@theglitchking/persistent-planning 3.5.0 → 3.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,13 +6,13 @@
6
6
  },
7
7
  "metadata": {
8
8
  "description": "Official marketplace for persistent-planning - Persistent markdown-based planning for Claude Code. Context engineering pattern with task directories, progress tracking, and working memory that persists across sessions.",
9
- "version": "3.5.0"
9
+ "version": "3.6.0"
10
10
  },
11
11
  "plugins": [
12
12
  {
13
13
  "name": "persistent-planning",
14
14
  "description": "Persistent markdown-based planning for Claude Code. Uses on-disk markdown files as working memory for planning, progress tracking, and knowledge storage. Plans persist across sessions and support multiple concurrent tasks.",
15
- "version": "3.5.0",
15
+ "version": "3.6.0",
16
16
  "author": {
17
17
  "name": "TheGlitchKing"
18
18
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "persistent-planning",
3
- "version": "3.5.0",
3
+ "version": "3.6.0",
4
4
  "description": "Persistent markdown-based planning with task directories, progress tracking, and context engineering for multi-step Claude Code workflows",
5
5
  "author": {
6
6
  "name": "TheGlitchKing"
@@ -3,7 +3,7 @@ title: Documentation Index
3
3
  tier: reference
4
4
  domains: [root]
5
5
  status: active
6
- last_updated: '2026-09-26'
6
+ last_updated: '2026-10-23'
7
7
  version: '1.0.0'
8
8
  purpose: Navigation hub for all documentation
9
9
  ---
@@ -29,7 +29,7 @@ purpose: Navigation hub for all documentation
29
29
  | [Security](#security) | 0 | Security, auth, Vault, Keycloak, RLS |
30
30
  | [Standards](#standards) | 2 | Coding standards (backend, frontend, database, devops, security) |
31
31
  | [Testing](#testing) | 1 | Test strategies, fixtures, patterns, integration/e2e |
32
- | [Troubleshooting](#troubleshooting) | 2 | Debug guides, common issues, solutions |
32
+ | [Troubleshooting](#troubleshooting) | 3 | Debug guides, common issues, solutions |
33
33
  | [Workflows](#workflows) | 0 | Process documentation, multi-step operations |
34
34
  | [Reference](#reference) | 3 | Schema, frontmatter, and CLI reference material for the planning artifacts |
35
35
 
@@ -164,7 +164,7 @@ purpose: Navigation hub for all documentation
164
164
  | Document | Tier | Status | Updated |
165
165
  |----------|------|--------|----------|
166
166
  | [Atom Granularity (anti-pattern guide)](standards/atom-granularity.md) | standard | active | 2026-05-07 |
167
- | [Mandatory Closing Phases](standards/mandatory-closing-phases.md) | standard | active | 2026-08-31 |
167
+ | [Mandatory Closing Phases](standards/mandatory-closing-phases.md) | standard | active | 2026-10-23 |
168
168
 
169
169
  ---
170
170
 
@@ -188,6 +188,7 @@ purpose: Navigation hub for all documentation
188
188
 
189
189
  | Document | Tier | Status | Updated |
190
190
  |----------|------|--------|----------|
191
+ | [A plan's docs step has no hit-em-with-the-docs steps](troubleshooting/docs-closer-missing-hewtd-steps.md) | guide | active | 2026-10-23 |
191
192
  | [A plan won't read COMPLETE](troubleshooting/plan-never-reads-complete.md) | guide | active | 2026-09-04 |
192
193
  | [Stale skill directory — commands run frozen code](troubleshooting/stale-skill-dir-drift.md) | guide | active | 2026-09-04 |
193
194
 
@@ -219,6 +220,6 @@ purpose: Navigation hub for all documentation
219
220
 
220
221
  ## Maintenance
221
222
 
222
- - **Last generated:** 2026-09-26
223
+ - **Last generated:** 2026-10-23
223
224
  - **Run maintenance:** `npx hit-em-with-the-docs maintain`
224
225
  - **Regenerate index:** `npx hit-em-with-the-docs index`
@@ -0,0 +1,57 @@
1
+ ---
2
+ title: Facts Index
3
+ tier: reference
4
+ domains:
5
+ - knowledge-base
6
+ status: active
7
+ last_updated: '0000-00-00'
8
+ version: '1.0.0'
9
+ purpose: Auto-generated index of all facts in the knowledge base, grouped by tag then confidence.
10
+ ---
11
+
12
+ # Facts Index
13
+
14
+ <!-- Auto-generated by `hewtd maintain`. Do not edit by hand — changes will be overwritten. -->
15
+
16
+ **Total facts:** 2
17
+
18
+ ## babel-fish
19
+
20
+ ### confidence: high
21
+
22
+ | ID | Title | Last verified | Citers |
23
+ |--------------------------------------|-----------------------------------------------------------------------------------------------|---------------|--------|
24
+ | `babel-fish-hook-adds-untracked-map` | babel-fish's pre-commit hook commits an untracked project map into the next qualifying commit | 2026-10-23 | 0 |
25
+
26
+ ## claude-code
27
+
28
+ ### confidence: high
29
+
30
+ | ID | Title | Last verified | Citers |
31
+ |----------------------------------|-------------------------------------------------------------------|---------------|--------|
32
+ | `claude-code-grep-v-exit-status` | In Claude Code's Bash tool, grep -v exits 1 when any line matches | 2026-10-23 | 0 |
33
+
34
+ ## git
35
+
36
+ ### confidence: high
37
+
38
+ | ID | Title | Last verified | Citers |
39
+ |--------------------------------------|-----------------------------------------------------------------------------------------------|---------------|--------|
40
+ | `babel-fish-hook-adds-untracked-map` | babel-fish's pre-commit hook commits an untracked project map into the next qualifying commit | 2026-10-23 | 0 |
41
+
42
+ ## gotcha
43
+
44
+ ### confidence: high
45
+
46
+ | ID | Title | Last verified | Citers |
47
+ |--------------------------------------|-----------------------------------------------------------------------------------------------|---------------|--------|
48
+ | `babel-fish-hook-adds-untracked-map` | babel-fish's pre-commit hook commits an untracked project map into the next qualifying commit | 2026-10-23 | 0 |
49
+ | `claude-code-grep-v-exit-status` | In Claude Code's Bash tool, grep -v exits 1 when any line matches | 2026-10-23 | 0 |
50
+
51
+ ## shell
52
+
53
+ ### confidence: high
54
+
55
+ | ID | Title | Last verified | Citers |
56
+ |----------------------------------|-------------------------------------------------------------------|---------------|--------|
57
+ | `claude-code-grep-v-exit-status` | In Claude Code's Bash tool, grep -v exits 1 when any line matches | 2026-10-23 | 0 |
@@ -0,0 +1,56 @@
1
+ ---
2
+ title: babel-fish's pre-commit hook commits an untracked project map into the next qualifying commit
3
+ tier: fact
4
+ domains:
5
+ - troubleshooting
6
+ status: active
7
+ last_updated: 2026-10-23
8
+ id: babel-fish-hook-adds-untracked-map
9
+ confidence: high
10
+ last_verified: 2026-10-23
11
+ verify_command: |
12
+ command grep -n "git add .claude/project-map" .githooks/pre-commit
13
+ provenance:
14
+ - .planning/hewtd-aware-documentation-closer/
15
+ sources:
16
+ - .githooks/pre-commit
17
+ tags:
18
+ - gotcha
19
+ - babel-fish
20
+ - git
21
+ invalidated_by:
22
+ - babel-fish's hook stops running git add on the map, or only re-adds files that are already tracked
23
+ ---
24
+
25
+ # babel-fish's pre-commit hook commits an untracked project map into the next qualifying commit
26
+
27
+ ## Claim
28
+
29
+ Once the babel-fish installer has run (`core.hooksPath=.githooks`), any commit that stages a
30
+ `.py`, `.ts`, `.js`, `.go`, `.java`, `.yaml`/`.yml`, `package.json`, `Cargo.toml`, `go.mod` or
31
+ docker-compose file runs the codebase mapper. The mapper then runs
32
+ `git add .claude/project-map/...`. If the map has never been committed, this stages the whole
33
+ map (about 25 files) into that commit. Nothing reports it beyond the generator's progress lines.
34
+
35
+ It happened on the 3.6.0 release commit: bumping `package.json` brought in the entire map,
36
+ and it was pushed before anyone noticed.
37
+
38
+ ## How to verify
39
+
40
+ `.githooks/pre-commit` contains `git add .claude/project-map/PROJECT_MAP.md ...` inside the
41
+ "Codebase Mapper" block. After a commit touching one of those file types, run
42
+ `git show --stat HEAD`, which lists `.claude/project-map/` files you didn't stage.
43
+
44
+ ## Instead
45
+
46
+ Right after installing babel-fish, commit its output on its own: `.claude/project-map/`,
47
+ `.claude/rules/`, `.claude/CLAUDE.md`, `.githooks/` and the generated developer skill.
48
+ After that the hook only stages real map changes. To keep the map out of git, gitignore
49
+ `.claude/project-map/`, which turns the hook's `git add` into a no-op. Removing the map from a commit the hook
50
+ already touched means re-committing, and the hook re-adds it. So commit the map first and
51
+ rebuild the branch on top, rather than amending past the hook with `--no-verify`.
52
+
53
+ ## Consequences
54
+
55
+ Release and feature commits pick up unrelated generated files. Check
56
+ `git show --stat HEAD` after the first commit in a repo where babel-fish was just installed.
@@ -0,0 +1,55 @@
1
+ ---
2
+ title: In Claude Code's Bash tool, grep -v exits 1 when any line matches
3
+ tier: fact
4
+ domains:
5
+ - troubleshooting
6
+ status: active
7
+ last_updated: 2026-10-23
8
+ id: claude-code-grep-v-exit-status
9
+ confidence: high
10
+ last_verified: 2026-10-23
11
+ verify_command: |
12
+ printf 'abc\nxyz\n' | command grep -v xyz >/dev/null; echo "GNU grep: $? (expect 0)"; type -t grep
13
+ provenance:
14
+ - .planning/hewtd-aware-documentation-closer/
15
+ tags:
16
+ - gotcha
17
+ - claude-code
18
+ - shell
19
+ invalidated_by:
20
+ - Claude Code stops wrapping grep in a shell function, or its ugrep matches GNU grep's -v exit status
21
+ ---
22
+
23
+ # In Claude Code's Bash tool, grep -v exits 1 when any line matches
24
+
25
+ ## Claim
26
+
27
+ In Claude Code's Bash tool, `grep` is a shell function that runs Claude Code's bundled ugrep.
28
+ With `-v`, it prints the right (non-matching) lines but **exits 1 whenever any input line
29
+ matches the pattern**. GNU grep exits 0 as long as some line was selected. So
30
+ `if … | grep -vq PATTERN` reads "nothing selected" when lines were selected. That includes
31
+ `-vqE`, `-v -q -E` and `-vE`.
32
+
33
+ Observed while filtering date-only `hewtd index` churn: a loop meant to keep index files
34
+ with real changes (`grep -vqE "last_updated|Last updated"`) reverted every file, including
35
+ the new doc's index entry.
36
+
37
+ ## How to verify
38
+
39
+ In the Claude Code Bash tool: `type -t grep` prints `function`. Then
40
+ `printf 'abc\nxyz\n' | grep -v xyz >/dev/null; echo $?` prints `1`. The same line with
41
+ `command grep` prints `0`. The `verify_command` above checks the GNU side. The ugrep
42
+ side only reproduces inside Claude Code's Bash tool.
43
+
44
+ ## Instead
45
+
46
+ Use `command grep` whenever the **exit status** of `grep -v` matters (`if`, `&&`, `||`, `-q`).
47
+ Scripts run as child processes (`bash script.sh`, `npm test`) are unaffected, because the
48
+ function isn't exported, so `tests/run.sh` and the init scripts use GNU grep. Only commands
49
+ typed straight into the tool are affected.
50
+
51
+ ## Consequences
52
+
53
+ A silent wrong branch, not an error. Here it discarded generated index changes that should
54
+ have been committed. Anywhere `grep -v` is used as a test, the "some lines selected" case is
55
+ read as "none selected".
@@ -0,0 +1,17 @@
1
+ ---
2
+ title: Incidents Index
3
+ tier: reference
4
+ domains:
5
+ - knowledge-base
6
+ - incidents
7
+ status: active
8
+ last_updated: '0000-00-00'
9
+ version: '1.0.0'
10
+ purpose: Auto-generated chronological index of all incidents in the knowledge base.
11
+ ---
12
+
13
+ # Incidents Index
14
+
15
+ <!-- Auto-generated by `hewtd maintain`. Do not edit by hand — changes will be overwritten. -->
16
+
17
+ _No incidents yet. Create one with the `templates/knowledge-base/incident-narrative.template.md` template._
@@ -0,0 +1,17 @@
1
+ ---
2
+ title: Symptoms Index
3
+ tier: reference
4
+ domains:
5
+ - knowledge-base
6
+ - operations
7
+ status: active
8
+ last_updated: '0000-00-00'
9
+ version: '1.0.0'
10
+ purpose: Auto-generated mapping of symptom keys (alert names, user phrases, error patterns) to playbook anchors and their fact citations.
11
+ ---
12
+
13
+ # Symptoms Index
14
+
15
+ <!-- Auto-generated by `hewtd maintain`. Do not edit by hand — changes will be overwritten. -->
16
+
17
+ _No symptoms blocks found in scanned playbooks. Add a `symptoms:` block to any playbook frontmatter to populate this index._
@@ -3,7 +3,7 @@ title: Standards Documentation Index
3
3
  tier: reference
4
4
  domains: [standards]
5
5
  status: active
6
- last_updated: '2026-09-26'
6
+ last_updated: '2026-10-23'
7
7
  version: '1.0.0'
8
8
  purpose: Complete listing of standards documentation
9
9
  ---
@@ -26,7 +26,7 @@ purpose: Complete listing of standards documentation
26
26
  | Document | Status | Updated | Words |
27
27
  |----------|--------|---------|-------|
28
28
  | [Atom Granularity (anti-pattern guide)](atom-granularity.md) | active | 2026-05-07 | 556 |
29
- | [Mandatory Closing Phases](mandatory-closing-phases.md) | active | 2026-08-31 | 770 |
29
+ | [Mandatory Closing Phases](mandatory-closing-phases.md) | active | 2026-10-23 | 770 |
30
30
 
31
31
  ## Keywords
32
32
 
@@ -40,4 +40,4 @@ This domain covers: standard, standards, convention, conventions, pattern, patte
40
40
 
41
41
  ---
42
42
 
43
- *Last updated: 2026-09-26*
43
+ *Last updated: 2026-10-23*
@@ -3,7 +3,7 @@ title: Standards Registry
3
3
  tier: reference
4
4
  domains: [standards]
5
5
  status: active
6
- last_updated: '2026-09-26'
6
+ last_updated: '2026-10-23'
7
7
  version: '1.0.0'
8
8
  purpose: Quick reference for standards documentation
9
9
  ---
@@ -27,7 +27,7 @@ purpose: Quick reference for standards documentation
27
27
 
28
28
  ## Recently Updated
29
29
 
30
- - [Mandatory Closing Phases](mandatory-closing-phases.md) - 2026-08-31
30
+ - [Mandatory Closing Phases](mandatory-closing-phases.md) - 2026-10-23
31
31
  - [Atom Granularity (anti-pattern guide)](atom-granularity.md) - 2026-05-07
32
32
 
33
33
  ## By Status
@@ -50,4 +50,4 @@ purpose: Quick reference for standards documentation
50
50
 
51
51
  ---
52
52
 
53
- *Last updated: 2026-09-26*
53
+ *Last updated: 2026-10-23*
@@ -8,7 +8,7 @@ audience:
8
8
  tags:
9
9
  - testing
10
10
  status: active
11
- last_updated: '2026-08-31'
11
+ last_updated: '2026-10-23'
12
12
  version: 1.0.0
13
13
  purpose: The three phases every persistent-planning plan must end with — cleanup,
14
14
  then validate success through comprehensive testing, then a documentation pass —
@@ -105,13 +105,54 @@ change validates nothing. For this repository that means adding assertions to
105
105
  command is. Mutation-check the assertion at least once: break the thing on
106
106
  purpose, confirm the test goes red, put it back.
107
107
 
108
+ The templates carry the sentence "we need to validate success thoroughly through
109
+ comprehensive testing of our changes" plus an instruction to write the concrete
110
+ checks into the plan *when the plan is written*. sm: under Phase 6. lg: as atoms of
111
+ the validation task. Without that, a plan got a one-line testing phase and the
112
+ user had to say the sentence afterwards to get real tests planned. The
113
+ `persistent-planning.md` rule repeats it so it is in context every session.
114
+
108
115
  **Documentation pass.** Create, update, or deprecate every doc the change
109
116
  touches, answering: what it is, where it lives, how to fix it, how to operate it,
110
117
  and why it matters. Deprecation counts — a doc made wrong by the change is worse
111
118
  than a missing one. If [hit-em-with-the-docs](https://github.com/TheGlitchKing/hit-em-with-the-docs)
112
119
  is installed, this pass **must** go through it (`hewtd integrate`, `hewtd
113
120
  archive`, `hewtd maintain`) rather than hand-managed markdown, so the doc lands
114
- in a domain and the indexes stay honest.
121
+ in a domain and the indexes stay honest. Every variant also says to capture new
122
+ procedures, tools, troubleshooting steps, gotchas and KB articles, and **never**
123
+ to include secrets or passwords.
124
+
125
+ Like validation, the docs step asks to be filled in when the plan is written,
126
+ naming each doc, by file, that the work creates, changes or makes stale. sm: in the
127
+ note under the phase list. lg: the docs closer's first atom and the `phase.md`
128
+ note. A behaviour test showed why: without that instruction, a planner filled
129
+ the validation closer with specific checks and left the docs closer generic. It
130
+ missed the project's own feature doc, which the change made wrong.
131
+
132
+ When the project uses hit-em-with-the-docs, the init scripts word this step for
133
+ it rather than leaving "if installed" for Claude to work out. A project counts if
134
+ it has a `.documentation/` tree or `.claude/hit-em-with-the-docs.json`
135
+ (`planning_uses_hewtd`; sm has its own copy). hewtd being installed for the whole
136
+ machine does not count.
137
+
138
+ - **sm:** Phase 7 reads "Documentation pass -- a full hit-em-with-the-docs pass to
139
+ create/update/deprecate as many docs as needed to capture all our changes: new
140
+ procedures, tools, troubleshooting steps, gotchas, KB articles, etc. Never
141
+ include secrets or passwords".
142
+ - **lg:** the docs closer's list line in `phase.md` says the same thing (the
143
+ `DOCS_CLOSER_PLACEHOLDER` slot). Its task is titled "Documentation pass — full
144
+ hit-em-with-the-docs pass", and its atoms cover `hewtd integrate`/`archive`,
145
+ procedures and tools, troubleshooting, gotchas as knowledge-base facts tagged
146
+ `gotcha`, KB articles, never secrets, and `hewtd maintain --quick` + `hewtd
147
+ audit`.
148
+
149
+ Elsewhere the wording is unchanged, and lg plans no longer get the
150
+ `npx hewtd archive`/`npx hewtd audit` atoms they used to receive unconditionally.
151
+ The slug `documentation-pass-create-update-deprecate-docs` is the same in both
152
+ variants, because the completion gate and existing plans key on it. The choice is
153
+ made once, when the plan is written. A project that adopts hewtd later keeps its
154
+ existing plans' wording; new plans pick it up. See
155
+ [docs step has no hewtd steps](../troubleshooting/docs-closer-missing-hewtd-steps.md).
115
156
 
116
157
  ## How to operate it
117
158
 
@@ -3,7 +3,7 @@ title: Troubleshooting Documentation Index
3
3
  tier: reference
4
4
  domains: [troubleshooting]
5
5
  status: active
6
- last_updated: '2026-09-26'
6
+ last_updated: '2026-10-23'
7
7
  version: '1.0.0'
8
8
  purpose: Complete listing of troubleshooting documentation
9
9
  ---
@@ -14,7 +14,7 @@ purpose: Complete listing of troubleshooting documentation
14
14
 
15
15
  ## Overview
16
16
 
17
- - **Total Documents:** 2
17
+ - **Total Documents:** 3
18
18
  - **Domain:** `troubleshooting/`
19
19
  - **Category:** advanced
20
20
  - **Load Priority:** 6/10
@@ -25,6 +25,7 @@ purpose: Complete listing of troubleshooting documentation
25
25
 
26
26
  | Document | Status | Updated | Words |
27
27
  |----------|--------|---------|-------|
28
+ | [A plan's docs step has no hit-em-with-the-docs steps](docs-closer-missing-hewtd-steps.md) | active | 2026-10-23 | 224 |
28
29
  | [A plan won't read COMPLETE](plan-never-reads-complete.md) | active | 2026-09-04 | 264 |
29
30
  | [Stale skill directory — commands run frozen code](stale-skill-dir-drift.md) | active | 2026-09-04 | 403 |
30
31
 
@@ -40,4 +41,4 @@ This domain covers: troubleshooting, troubleshoot, debug, debugging, issue, issu
40
41
 
41
42
  ---
42
43
 
43
- *Last updated: 2026-09-26*
44
+ *Last updated: 2026-10-23*
@@ -3,7 +3,7 @@ title: Troubleshooting Registry
3
3
  tier: reference
4
4
  domains: [troubleshooting]
5
5
  status: active
6
- last_updated: '2026-09-26'
6
+ last_updated: '2026-10-23'
7
7
  version: '1.0.0'
8
8
  purpose: Quick reference for troubleshooting documentation
9
9
  ---
@@ -16,17 +16,19 @@ purpose: Quick reference for troubleshooting documentation
16
16
 
17
17
  | Metric | Value |
18
18
  |--------|-------|
19
- | Documents | 2 |
19
+ | Documents | 3 |
20
20
  | Category | advanced |
21
21
  | Load Priority | 6/10 |
22
22
 
23
23
  ## Active Documents
24
24
 
25
+ - [A plan's docs step has no hit-em-with-the-docs steps](docs-closer-missing-hewtd-steps.md)
25
26
  - [A plan won't read COMPLETE](plan-never-reads-complete.md)
26
27
  - [Stale skill directory — commands run frozen code](stale-skill-dir-drift.md)
27
28
 
28
29
  ## Recently Updated
29
30
 
31
+ - [A plan's docs step has no hit-em-with-the-docs steps](docs-closer-missing-hewtd-steps.md) - 2026-10-23
30
32
  - [A plan won't read COMPLETE](plan-never-reads-complete.md) - 2026-09-04
31
33
  - [Stale skill directory — commands run frozen code](stale-skill-dir-drift.md) - 2026-09-04
32
34
 
@@ -34,7 +36,7 @@ purpose: Quick reference for troubleshooting documentation
34
36
 
35
37
  | Status | Count |
36
38
  |--------|-------|
37
- | active | 2 |
39
+ | active | 3 |
38
40
  | draft | 0 |
39
41
  | deprecated | 0 |
40
42
  | archived | 0 |
@@ -50,4 +52,4 @@ purpose: Quick reference for troubleshooting documentation
50
52
 
51
53
  ---
52
54
 
53
- *Last updated: 2026-09-26*
55
+ *Last updated: 2026-10-23*
@@ -0,0 +1,57 @@
1
+ ---
2
+ title: A plan's docs step has no hit-em-with-the-docs steps
3
+ tier: guide
4
+ domains:
5
+ - troubleshooting
6
+ audience:
7
+ - developers
8
+ tags: []
9
+ status: active
10
+ last_updated: '2026-10-23'
11
+ version: 1.0.0
12
+ purpose: Why a new plan in a hit-em-with-the-docs project got the generic docs step, and how to fix it.
13
+ estimated_read_time: 2 minutes
14
+ word_count: 224
15
+ last_validated: '2026-10-23'
16
+ backlinks: []
17
+ ---
18
+
19
+ # A plan's docs step has no hit-em-with-the-docs steps
20
+
21
+ ## Symptom
22
+
23
+ The project uses hit-em-with-the-docs, but a new plan's last step is the generic
24
+ one. sm: `Phase 7: Documentation pass -- create/update/deprecate as many docs as
25
+ needed to capture what was done…`. lg: the docs closer has no `hewtd audit`,
26
+ gotcha or KB-article atoms. The full hit-em-with-the-docs pass wording is missing.
27
+
28
+ ## Cause
29
+
30
+ The init scripts choose the wording once, when the plan is written. They use the
31
+ hewtd variant only when the **project** has a `.documentation/` tree or
32
+ `.claude/hit-em-with-the-docs.json`. Common reasons it wasn't chosen:
33
+
34
+ - **hewtd is only installed for the machine** (e.g. a marketplace install).
35
+ That's deliberate: otherwise every repo you plan in would get hewtd steps.
36
+ - **The plan predates the docs tree.** The project adopted hewtd after the plan
37
+ was written. Existing plans are never rewritten.
38
+ - **`CLAUDE_PROJECT_DIR` points somewhere else.** The scripts look in
39
+ `CLAUDE_PROJECT_DIR`, falling back to the current directory, not the git root.
40
+
41
+ ## Fix
42
+
43
+ 1. Check what the scripts see:
44
+ ```bash
45
+ ls -d "${CLAUDE_PROJECT_DIR:-$PWD}/.documentation" \
46
+ "${CLAUDE_PROJECT_DIR:-$PWD}/.claude/hit-em-with-the-docs.json"
47
+ ```
48
+ 2. If neither exists, set the project up with hit-em-with-the-docs (that creates
49
+ `.documentation/`), then start the plan again.
50
+ 3. For a plan that already exists, edit its last step by hand. sm: the Phase 7
51
+ line. lg: the docs closer's line in `phase.md` and its atoms. Or re-create it with
52
+ `PLANNING_FORCE=1` if nothing in it is worth keeping. Keep the lg slug
53
+ `documentation-pass-create-update-deprecate-docs`, because the completion gate
54
+ depends on it.
55
+
56
+ See [mandatory closing phases](../standards/mandatory-closing-phases.md) for the
57
+ two variants.
@@ -33,11 +33,13 @@ A generated `task_plan.md` ends at Phase 4. A correct one ends:
33
33
 
34
34
  ```
35
35
  - [ ] Phase 5: Cleanup -- remove junk and unused code this work created: scratch/test scripts, debug files, probe logging, one-off test functions, commented-out code, dead code from abandoned approaches (MANDATORY)
36
- - [ ] Phase 6: Validate success through comprehensive testing (MANDATORY)
36
+ - [ ] Phase 6: Validate success through comprehensive testing -- we need to validate success thoroughly through comprehensive testing of our changes (MANDATORY)
37
37
  - [ ] Phase 7: Documentation pass -- create/update/deprecate as many docs as needed to capture what was done, where it lives, how to troubleshoot it, etc. etc.. etc.. (MANDATORY)
38
38
  ```
39
39
 
40
- and carries an `## On Completion` section naming `/plan-status` and `/archive-plan`.
40
+ (In a project that uses hit-em-with-the-docs, Phase 7 reads as a full hit-em-with-the-docs pass instead —
41
+ see [mandatory closing phases](../standards/mandatory-closing-phases.md).) It also
42
+ carries an `## On Completion` section naming `/plan-status` and `/archive-plan`.
41
43
 
42
44
  ## Cause
43
45
 
package/CHANGELOG.md CHANGED
@@ -2,6 +2,56 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [3.6.0] - 2026-10-23
6
+
7
+ ### Added — a full hit-em-with-the-docs pass as the last step, when the project uses it
8
+
9
+ When the project has `.documentation/` or `.claude/hit-em-with-the-docs.json`, the
10
+ plan's last step reads "Documentation pass -- a full hit-em-with-the-docs pass to
11
+ create/update/deprecate as many docs as needed to capture all our changes: new
12
+ procedures, tools, troubleshooting steps, gotchas, KB articles, etc. Never include
13
+ secrets or passwords". lg's docs closer also gets hewtd atoms: integrate/archive,
14
+ gotchas as KB facts, KB articles, never secrets, `maintain --quick` + `audit`.
15
+ A machine-wide hewtd install does not count.
16
+
17
+ - **Fixed:** lg plans in projects without hewtd no longer get the unconditional
18
+ `npx hewtd archive` / `npx hewtd audit` atoms.
19
+ - Every variant's note now says to capture procedures, tools, troubleshooting,
20
+ gotchas and KB articles, and never secrets or passwords.
21
+ - The docs step asks to be filled in when the plan is written, naming each doc
22
+ the work creates, changes or makes stale (lg: the closer's first atom). In a
23
+ behaviour test, the docs closer was otherwise left generic.
24
+ - Projects without hewtd: the sm Phase 7 line and the lg closer line are
25
+ byte-identical to before. The slug is unchanged.
26
+
27
+ ### Changed — the validation closer asks for the tests when the plan is written
28
+
29
+ The validate step now reads "we need to validate success thoroughly through
30
+ comprehensive testing of our changes". It also tells Claude to write the
31
+ concrete checks into the plan up front, without being asked: unit,
32
+ integration/end-to-end, regression, edge cases and failure paths, and the full
33
+ suite. sm: Phase 6 line and note. lg: `phase.md` note plus two new leading atoms
34
+ on the validation task. The `persistent-planning.md` rule and SKILL.md carry it
35
+ too. Titles and slugs are unchanged, so existing plans and the completion gate
36
+ are unaffected.
37
+
38
+ ### Added — init scripts seed `.claude/rules/`
39
+
40
+ Every init script (`init-planning.sh`, `init-phase.sh`, `init-task.sh`,
41
+ `init-atom.sh`) copies each `templates/rules/*.md` into the project's
42
+ `.claude/rules/` when that file is absent, so Claude Code loads the planning
43
+ workflow every session instead of only when the skill triggers. Ships one rule,
44
+ `persistent-planning.md`. A rule is written once and never overwritten — not even
45
+ under `PLANNING_FORCE` — so a repo's edits stick; delete it and the next init
46
+ restores it. Adding a rule is adding a file to `templates/rules/`.
47
+
48
+ The same step adds a **Persistent plans** section of hard git requirements — sync
49
+ `main`, cut a branch, implement through to completion, commit at the end of each
50
+ phase, finish with a single PR. It is appended to the repo's existing git workflow
51
+ rule (any `.claude/rules/` file named like `git-workflow.md` or `gitflow.md`,
52
+ including babel-fish's) or, if there is none, creates `git-workflow.md`. A marker
53
+ comment keeps it to one copy.
54
+
5
55
  ## [3.5.0] - 2026-09-26
6
56
 
7
57
  ### Added — a mandatory cleanup closer at the end of every phase (#20)
@@ -100,6 +100,18 @@ bash ~/.claude/skills/persistent-planning/scripts/init-planning.sh "<name>"
100
100
 
101
101
  Add tasks under a phase with `/start-task "<name>" --parent <phase-slug>`.
102
102
 
103
+ ### Both modes
104
+ In a project that uses hit-em-with-the-docs (it has `.documentation/`), the last step
105
+ is worded as a full hit-em-with-the-docs pass: capture all changes, including procedures,
106
+ tools, troubleshooting, gotchas and KB articles, and never secrets.
107
+
108
+ `.claude/rules/persistent-planning.md` is added if the project does not already have
109
+ it. It is never overwritten, so edit it freely.
110
+
111
+ A "Persistent plans" git section (sync main, branch, commit per phase, one PR) is
112
+ appended once to the project's existing git workflow rule, or `.claude/rules/git-workflow.md`
113
+ is created to hold it.
114
+
103
115
  ## Slug conversion
104
116
 
105
117
  Names are converted to URL-friendly slugs:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theglitchking/persistent-planning",
3
- "version": "3.5.0",
3
+ "version": "3.6.0",
4
4
  "description": "Persistent markdown-based planning with task directories, progress tracking, and context engineering for multi-step Claude Code workflows",
5
5
  "type": "module",
6
6
  "bin": {
@@ -137,6 +137,8 @@ planning_insert_list_item \
137
137
  "## Atoms" \
138
138
  "- [ ] **${ATOM_NAME}** (\`atoms/${ATOM_SLUG}.md\`, sequence: ${NEXT_SEQUENCE})"
139
139
 
140
+ planning_seed_rules "${ROOT}"
141
+
140
142
  echo ""
141
143
  planning_ok "Atom '${ATOM_NAME}' ready"
142
144
  echo ""
@@ -107,6 +107,41 @@ fi
107
107
  # Create phase directory
108
108
  mkdir -p "$PHASE_DIR"
109
109
 
110
+ # The docs closer's wording depends on whether this project uses hit-em-with-the-docs.
111
+ # Its slug never changes: the completion gate and existing plans key on it.
112
+ # Both variants open by asking the planner to name the docs — the generic atoms alone
113
+ # left the closer unfilled while the validation closer, which asks, got filled.
114
+ DOCS_PLAN_ATOM="As this phase's tasks are written, add an atom here for each doc they create, change or make stale, naming the file — check the existing docs for ones this work makes wrong"
115
+ if planning_uses_hewtd "$ROOT"; then
116
+ DOCS_CLOSER="Documentation pass — a full hit-em-with-the-docs pass to create/update/deprecate as many docs as needed to capture all our changes: new procedures, tools, troubleshooting steps, gotchas, KB articles, etc. Never include secrets or passwords"
117
+ DOCS_TITLE="Documentation pass — full hit-em-with-the-docs pass"
118
+ DOCS_ATOMS=(
119
+ "$DOCS_PLAN_ATOM"
120
+ "Full hit-em-with-the-docs pass: create/update/deprecate as many docs as needed to capture all our changes"
121
+ "Create docs with \`npx hewtd integrate <file> -a\`; retire superseded ones with \`npx hewtd archive <file>\` — never by deleting"
122
+ "Capture every new procedure and tool: what it is, where it lives, how to run it"
123
+ "Add a troubleshooting entry for the symptom someone will actually search for"
124
+ "Record each gotcha (a non-obvious failure with an observed fix) as a knowledge-base fact tagged \`gotcha\`, with an \`## Instead\` section"
125
+ "Write KB articles for anything operational under \`.documentation/knowledge-base/\`"
126
+ "Update every existing doc this phase made wrong — a stale doc is worse than a missing one"
127
+ "Never include secrets, passwords, tokens or keys in any doc"
128
+ "Run \`npx hewtd maintain --quick\` and \`npx hewtd audit\`; resolve every error"
129
+ "Never hand-edit INDEX.md or REGISTRY.md — they are generated"
130
+ )
131
+ else
132
+ DOCS_CLOSER="Documentation pass — create/update/deprecate as many docs as needed to capture what was done, where it lives, how to troubleshoot it, etc. etc.. etc.."
133
+ DOCS_TITLE="Documentation pass — create/update/deprecate docs"
134
+ DOCS_ATOMS=(
135
+ "$DOCS_PLAN_ATOM"
136
+ "Create docs for what was built: what it is, where it lives, how it works"
137
+ "Capture new procedures, tools, troubleshooting steps and gotchas — add a troubleshooting entry for the symptom someone will actually search for"
138
+ "Update every existing doc this phase made wrong — a stale doc is worse than a missing one"
139
+ "Retire superseded docs rather than leaving them wrong"
140
+ "Never include secrets, passwords, tokens or keys in any doc"
141
+ "If hit-em-with-the-docs is installed you MUST use it: \`npx hewtd integrate <file> -a\` to create, \`npx hewtd archive <file>\` to retire, \`npx hewtd maintain --quick\` to regenerate indexes"
142
+ )
143
+ fi
144
+
110
145
  # Render phase.md
111
146
  planning_render_and_log \
112
147
  "${TEMPLATE_DIR}/phase.md" \
@@ -114,7 +149,8 @@ planning_render_and_log \
114
149
  "phase.md at ${PHASE_DIR}/phase.md" \
115
150
  "PHASE_TITLE_PLACEHOLDER=${PHASE_NAME}" \
116
151
  "PHASE_SLUG_PLACEHOLDER=${PHASE_SLUG}" \
117
- "PHASE_DATE_PLACEHOLDER=${TODAY}"
152
+ "PHASE_DATE_PLACEHOLDER=${TODAY}" \
153
+ "DOCS_CLOSER_PLACEHOLDER=${DOCS_CLOSER}"
118
154
 
119
155
  # Render notes.md (scoped to the phase)
120
156
  planning_render_and_log \
@@ -175,6 +211,8 @@ scaffold_closer \
175
211
  scaffold_closer \
176
212
  "validate-success-through-comprehensive-testing" \
177
213
  "Validate success through comprehensive testing" \
214
+ "We need to validate success thoroughly through comprehensive testing of our changes: as this phase's tasks are written, add an atom here for each check they need" \
215
+ "Cover every kind that applies: unit tests for new and changed logic, integration and end-to-end runs through the real entry points, edge cases and failure paths" \
178
216
  "Prove every claim this phase makes with a test that fails if it breaks" \
179
217
  "Test the invariant after mutation, not the shape of a freshly rendered template" \
180
218
  "Cover the failure mode that prompted the work, not just the happy path" \
@@ -182,17 +220,12 @@ scaffold_closer \
182
220
 
183
221
  scaffold_closer \
184
222
  "documentation-pass-create-update-deprecate-docs" \
185
- "Documentation pass — create/update/deprecate docs" \
186
- "Create docs for what was built: what it is, where it lives, how it works" \
187
- "Add a troubleshooting entry for the symptom someone will actually search for" \
188
- "Update every existing doc this phase made wrong — a stale doc is worse than a missing one" \
189
- "Retire superseded docs with \`npx hewtd archive <file>\` — never by deleting" \
190
- "If hit-em-with-the-docs is installed you MUST use it: \`npx hewtd integrate <file> -a\` to create, \`npx hewtd maintain --quick\` to regenerate indexes" \
191
- "Run \`npx hewtd audit\` and resolve every error" \
192
- "Never hand-edit INDEX.md or REGISTRY.md — they are generated"
223
+ "$DOCS_TITLE" \
224
+ "${DOCS_ATOMS[@]}"
193
225
 
194
226
  # Only completed plans are local history — see planning_ensure_archive_gitignored.
195
227
  planning_ensure_archive_gitignored "${ROOT}"
228
+ planning_seed_rules "${ROOT}"
196
229
 
197
230
  echo ""
198
231
  planning_ok "Phase '${PHASE_NAME}' ready at .planning/${PHASE_SLUG}/"
@@ -15,7 +15,8 @@
15
15
  # 2. Creates task_plan.md with templates
16
16
  # 3. Creates notes.md with templates
17
17
  # 4. Adds .planning/ to .gitignore (optional)
18
- # 5. Confirms creation and provides next steps
18
+ # 5. Copies templates/rules/*.md into .claude/rules/ (only files not already there)
19
+ # 6. Confirms creation and provides next steps
19
20
  #
20
21
  # Multiple tasks example:
21
22
  # /start-planning "Refactor auth" -> .planning/refactor-auth/
@@ -65,6 +66,14 @@ PROJECT_ROOT="${CLAUDE_PROJECT_DIR:-$(pwd)}"
65
66
  PLANNING_DIR="${PROJECT_ROOT}/.planning"
66
67
  TASK_DIR="${PLANNING_DIR}/${TASK_SLUG}"
67
68
 
69
+ # Does this project use hit-em-with-the-docs? Self-contained copy of
70
+ # planning_uses_hewtd in scripts/lib/planning.sh: a .documentation/ tree or hewtd's
71
+ # project config. A machine-wide install does not count.
72
+ USES_HEWTD=0
73
+ if [ -d "${PROJECT_ROOT}/.documentation" ] || [ -f "${PROJECT_ROOT}/.claude/hit-em-with-the-docs.json" ]; then
74
+ USES_HEWTD=1
75
+ fi
76
+
68
77
  # Color codes
69
78
  GREEN='\033[0;32m'
70
79
  BLUE='\033[0;34m'
@@ -106,8 +115,8 @@ if [ ! -f "$TASK_PLAN_FILE" ]; then
106
115
  - [ ] Phase 3: Execute/build
107
116
  - [ ] Phase 4: Review and deliver
108
117
  - [ ] Phase 5: Cleanup -- remove junk and unused code this work created: scratch/test scripts, debug files, probe logging, one-off test functions, commented-out code, dead code from abandoned approaches (MANDATORY)
109
- - [ ] Phase 6: Validate success through comprehensive testing (MANDATORY)
110
- - [ ] Phase 7: Documentation pass -- create/update/deprecate as many docs as needed to capture what was done, where it lives, how to troubleshoot it, etc. etc.. etc.. (MANDATORY)
118
+ - [ ] Phase 6: Validate success through comprehensive testing -- we need to validate success thoroughly through comprehensive testing of our changes (MANDATORY)
119
+ - [ ] Phase 7: DOCS_PHASE_PLACEHOLDER (MANDATORY)
111
120
 
112
121
  > Phases 5, 6 and 7 are mandatory and MUST stay the last three phases of this plan.
113
122
  > Insert new work above them; never after. Renumber them if you add phases.
@@ -117,9 +126,19 @@ if [ ! -f "$TASK_PLAN_FILE" ]; then
117
126
  > imports or dependencies left unused by abandoned approaches. Only what this work
118
127
  > changed; never refactor code it did not touch. When unsure, note it -- don't delete.
119
128
  > Cleanup runs before validation so every deletion is proven safe by the tests.
120
- > - **Validate success**: prove the work with tests that fail if the change breaks.
129
+ > - **Validate success**: we need to validate success thoroughly through comprehensive
130
+ > testing of our changes. Write the tests into this plan when you write the plan --
131
+ > don't wait to be asked. List each check under Phase 6, every kind that applies:
132
+ > unit tests for new and changed logic, integration and end-to-end runs through the
133
+ > real entry points, a regression test for the problem that prompted the work, edge
134
+ > cases and failure paths, and the full existing suite. Each must fail if the change
135
+ > breaks.
121
136
  > - **Documentation pass**: create/update/deprecate every doc this change touches --
122
137
  > what it is, where it lives, how to fix it, how to operate it, why it matters.
138
+ > Capture new procedures, tools, troubleshooting steps, gotchas and KB articles too.
139
+ > Never include secrets or passwords. Write the docs work into this plan when you
140
+ > write the plan -- don't wait to be asked. List each doc under Phase 7 by file:
141
+ > every doc this work creates, changes or makes stale.
123
142
  > If hit-em-with-the-docs is installed, you MUST use it for this pass --
124
143
  > `npx hewtd integrate <file> -a` to create, `npx hewtd archive <file>` to retire,
125
144
  > `npx hewtd maintain --quick` to regenerate indexes. Never hand-edit INDEX.md or
@@ -161,6 +180,13 @@ EOF
161
180
 
162
181
  sed -i "s/TASK_NAME_PLACEHOLDER/${TASK_NAME}/g" "$TASK_PLAN_FILE"
163
182
  sed -i "s/TASK_SLUG_PLACEHOLDER/${TASK_SLUG}/g" "$TASK_PLAN_FILE"
183
+ # Both texts contain '/', hence the '|' delimiter; neither may contain '|' or '&'.
184
+ if [ "$USES_HEWTD" = "1" ]; then
185
+ DOCS_PHASE="Documentation pass -- a full hit-em-with-the-docs pass to create/update/deprecate as many docs as needed to capture all our changes: new procedures, tools, troubleshooting steps, gotchas, KB articles, etc. Never include secrets or passwords"
186
+ else
187
+ DOCS_PHASE="Documentation pass -- create/update/deprecate as many docs as needed to capture what was done, where it lives, how to troubleshoot it, etc. etc.. etc.."
188
+ fi
189
+ sed -i "s|DOCS_PHASE_PLACEHOLDER|${DOCS_PHASE}|g" "$TASK_PLAN_FILE"
164
190
  echo -e "${GREEN}+${NC} Created task_plan.md"
165
191
  else
166
192
  echo -e "${YELLOW}*${NC} task_plan.md already exists (not overwritten)"
@@ -234,6 +260,36 @@ else
234
260
  echo -e "${YELLOW}*${NC} No .gitignore found (not added)"
235
261
  fi
236
262
 
263
+ # Step 5b: Seed .claude/rules/
264
+ #
265
+ # Each templates/rules/*.md is copied once, when absent; after that the repo owns it.
266
+ # The git-workflow section is appended once (by marker) to an existing git workflow
267
+ # rule, or creates git-workflow.md. Self-contained copy of planning_seed_rules in
268
+ # scripts/lib/planning.sh. A legacy install with no templates/ beside scripts/ just
269
+ # gets no rules.
270
+ TEMPLATES_SRC="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/../templates"
271
+ RULES_DIR="${PROJECT_ROOT}/.claude/rules"
272
+ for src in "$TEMPLATES_SRC"/rules/*.md; do
273
+ [ -f "$src" ] || continue
274
+ dest="${RULES_DIR}/$(basename "$src")"
275
+ [ -e "$dest" ] && continue
276
+ if mkdir -p "$RULES_DIR" && cp "$src" "$dest"; then
277
+ echo -e "${GREEN}+${NC} Added .claude/rules/$(basename "$src")"
278
+ fi
279
+ done
280
+ GIT_SECTION="${TEMPLATES_SRC}/git-workflow-section.md"
281
+ if [ -f "$GIT_SECTION" ]; then
282
+ GIT_RULE=$(ls "$RULES_DIR" 2>/dev/null | grep -iE 'git.?(work)?flow.*\.md$' | head -1)
283
+ if [ -n "$GIT_RULE" ]; then
284
+ if ! grep -qF "$(head -1 "$GIT_SECTION")" "${RULES_DIR}/${GIT_RULE}"; then
285
+ { printf '\n'; cat "$GIT_SECTION"; } >> "${RULES_DIR}/${GIT_RULE}"
286
+ echo -e "${GREEN}+${NC} Added persistent-plan requirements to .claude/rules/${GIT_RULE}"
287
+ fi
288
+ elif mkdir -p "$RULES_DIR" && { printf '# Git Workflow\n\n'; cat "$GIT_SECTION"; } > "${RULES_DIR}/git-workflow.md"; then
289
+ echo -e "${GREEN}+${NC} Added .claude/rules/git-workflow.md"
290
+ fi
291
+ fi
292
+
237
293
  # Step 6: List other active tasks
238
294
  OTHER_TASKS=$(find "$PLANNING_DIR" -maxdepth 1 -type d -not -name ".planning" -not -path "$TASK_DIR" 2>/dev/null | wc -l)
239
295
  if [ "$OTHER_TASKS" -gt 0 ]; then
@@ -116,6 +116,8 @@ planning_insert_list_item \
116
116
  "## Tasks" \
117
117
  "- [ ] **${TASK_NAME}** (\`${TASK_SLUG}\`)"
118
118
 
119
+ planning_seed_rules "${ROOT}"
120
+
119
121
  echo ""
120
122
  planning_ok "Task '${TASK_NAME}' ready at .planning/${PARENT_PHASE}/${TASK_SLUG}/"
121
123
  echo ""
@@ -23,6 +23,10 @@
23
23
  # - planning_render_template "<src>" "<dest>" "PLACEHOLDER1=value1" "PLACEHOLDER2=value2" ...
24
24
  # Renders a template file by sed-substituting PLACEHOLDER tokens.
25
25
  # Refuses to overwrite existing dest unless PLANNING_FORCE=1 in env.
26
+ # - planning_uses_hewtd "<root>" → exit 0 when the project uses hit-em-with-the-docs
27
+ # - planning_seed_rules "<root>" → copies templates/rules/*.md into <root>/.claude/rules/
28
+ # when absent; never overwrites. Appends templates/git-workflow-section.md once to
29
+ # the repo's git workflow rule, or creates git-workflow.md
26
30
  # - planning_color_<name> → ANSI color codes (green, blue, yellow, cyan, red, reset)
27
31
  # (only set when stdout is a tty; empty otherwise)
28
32
  # - Color-coded log helpers: planning_log, planning_ok, planning_warn, planning_err
@@ -281,3 +285,60 @@ planning_ensure_archive_gitignored() {
281
285
  printf '\n# Completed plans retired by scripts/archive-plan.sh (local history)\n.planning/.archive/\n' >> "$gitignore"
282
286
  planning_ok "Added .planning/.archive/ to .gitignore (active plans stay shareable)"
283
287
  }
288
+
289
+ # planning_uses_hewtd <repo-root>
290
+ #
291
+ # True when this project uses hit-em-with-the-docs: it has a .documentation/ tree or
292
+ # hewtd's project config. A machine-wide hewtd install does not count — it would put
293
+ # hewtd steps into plans for repos that have no docs tree. init-planning.sh (sm) keeps
294
+ # a self-contained copy of this check.
295
+ planning_uses_hewtd() {
296
+ [[ -d "${1}/.documentation" || -f "${1}/.claude/hit-em-with-the-docs.json" ]]
297
+ }
298
+
299
+ # planning_seed_rules <repo-root>
300
+ #
301
+ # Copies each templates/rules/*.md into <root>/.claude/rules/ when that file is absent.
302
+ # Written once: after that the rule is the repo's, so an existing file is never
303
+ # overwritten — not even under PLANNING_FORCE, which is for plan artifacts.
304
+ #
305
+ # The git-workflow section is the exception: it is appended to the repo's existing git
306
+ # workflow rule (babel-fish writes git-workflow.md) or creates one. Its first line is a
307
+ # marker, so it is added once and a repo's edits to it stick.
308
+ #
309
+ # Reads only the plugin's own templates, never <root>/templates: that name is generic
310
+ # enough that a project could have one, and its files are not ours to load.
311
+ # init-planning.sh (sm) keeps a self-contained copy of this function.
312
+ planning_seed_rules() {
313
+ local root="$1" src dest target
314
+ local tpl_dir rules="${1}/.claude/rules"
315
+ tpl_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/../../templates"
316
+ for src in "$tpl_dir"/rules/*.md; do
317
+ [[ -f "$src" ]] || continue
318
+ dest="${rules}/$(basename "$src")"
319
+ [[ -e "$dest" ]] && continue
320
+ if mkdir -p "$rules" && cp "$src" "$dest"; then
321
+ planning_ok "Added .claude/rules/$(basename "$src")"
322
+ else
323
+ planning_warn "Could not write ${dest} (skipped)"
324
+ fi
325
+ done
326
+
327
+ local section="${tpl_dir}/git-workflow-section.md"
328
+ [[ -f "$section" ]] || return 0
329
+ target=$(ls "$rules" 2>/dev/null | grep -iE 'git.?(work)?flow.*\.md$' | head -1)
330
+ if [[ -n "$target" ]]; then
331
+ target="${rules}/${target}"
332
+ grep -qF "$(head -1 "$section")" "$target" && return 0
333
+ if { printf '\n'; cat "$section"; } >> "$target"; then
334
+ planning_ok "Added persistent-plan requirements to .claude/rules/$(basename "$target")"
335
+ else
336
+ planning_warn "Could not update ${target} (skipped)"
337
+ fi
338
+ elif mkdir -p "$rules" && { printf '# Git Workflow\n\n'; cat "$section"; } > "${rules}/git-workflow.md"; then
339
+ planning_ok "Added .claude/rules/git-workflow.md"
340
+ else
341
+ planning_warn "Could not write ${rules}/git-workflow.md (skipped)"
342
+ fi
343
+ return 0
344
+ }
@@ -147,7 +147,10 @@ Both tasks coexist independently. Switch between them as needed.
147
147
 
148
148
  ## task_plan.md Template
149
149
 
150
- Create this file FIRST for any complex task:
150
+ Create this file FIRST for any complex task. In a project that uses hit-em-with-the-docs
151
+ (it has `.documentation/`), the init scripts word the last phase as a full
152
+ hit-em-with-the-docs pass capturing all changes (procedures, tools, troubleshooting,
153
+ gotchas, KB articles), never secrets; lg's docs closer gets matching atoms.
151
154
 
152
155
  ```markdown
153
156
  # Task Plan: [Brief Description]
@@ -161,7 +164,7 @@ Create this file FIRST for any complex task:
161
164
  - [ ] Phase 3: Execute/build
162
165
  - [ ] Phase 4: Review and deliver
163
166
  - [ ] Phase 5: Cleanup -- remove junk and unused code this work created: scratch/test scripts, debug files, probe logging, one-off test functions, commented-out code, dead code from abandoned approaches (MANDATORY)
164
- - [ ] Phase 6: Validate success through comprehensive testing (MANDATORY)
167
+ - [ ] Phase 6: Validate success through comprehensive testing -- we need to validate success thoroughly through comprehensive testing of our changes (MANDATORY)
165
168
  - [ ] Phase 7: Documentation pass -- create/update/deprecate as many docs as needed to capture what was done, where it lives, how to troubleshoot it, etc. etc.. etc.. (MANDATORY)
166
169
 
167
170
  > Phases 5, 6 and 7 are mandatory and MUST stay the last three phases of this plan.
@@ -172,9 +175,19 @@ Create this file FIRST for any complex task:
172
175
  > imports or dependencies left unused by abandoned approaches. Only what this work
173
176
  > changed; never refactor code it did not touch. When unsure, note it -- don't delete.
174
177
  > Cleanup runs before validation so every deletion is proven safe by the tests.
175
- > - **Validate success**: prove the work with tests that fail if the change breaks.
178
+ > - **Validate success**: we need to validate success thoroughly through comprehensive
179
+ > testing of our changes. Write the tests into this plan when you write the plan --
180
+ > don't wait to be asked. List each check under Phase 6, every kind that applies:
181
+ > unit tests for new and changed logic, integration and end-to-end runs through the
182
+ > real entry points, a regression test for the problem that prompted the work, edge
183
+ > cases and failure paths, and the full existing suite. Each must fail if the change
184
+ > breaks.
176
185
  > - **Documentation pass**: create/update/deprecate every doc this change touches --
177
186
  > what it is, where it lives, how to fix it, how to operate it, why it matters.
187
+ > Capture new procedures, tools, troubleshooting steps, gotchas and KB articles too.
188
+ > Never include secrets or passwords. Write the docs work into this plan when you
189
+ > write the plan -- don't wait to be asked. List each doc under Phase 7 by file:
190
+ > every doc this work creates, changes or makes stale.
178
191
  > If hit-em-with-the-docs is installed, you MUST use it for this pass --
179
192
  > `npx hewtd integrate <file> -a` to create, `npx hewtd archive <file>` to retire,
180
193
  > `npx hewtd maintain --quick` to regenerate indexes. Never hand-edit INDEX.md or
@@ -0,0 +1,11 @@
1
+ <!-- persistent-planning:git-workflow -->
2
+ ## Persistent plans
3
+
4
+ These are hard requirements on every plan under `.planning/`:
5
+
6
+ 1. **Sync `main` first.** `git checkout main && git fetch origin main && git merge --ff-only origin/main`.
7
+ 2. **Cut a new branch** for the plan before changing anything: `git checkout -b <type>/<plan-slug>`.
8
+ 3. **Implement the plan through to completion**: every phase, including the mandatory cleanup,
9
+ validation and documentation steps, until `/plan-status` reads COMPLETE.
10
+ 4. **Commit at the end of each phase** (sm: each item under `## Phases`; lg: each task).
11
+ 5. **Finish with a single PR** for the whole plan, against `main`.
@@ -23,7 +23,7 @@ so subagent teams can pick them up concurrently.]
23
23
  _(no tasks yet — run `/start-task "Task name" --parent PHASE_SLUG_PLACEHOLDER`)_
24
24
  - [ ] **Cleanup — remove junk and unused code** (`cleanup-remove-junk-and-unused-code`) (MANDATORY — third-to-last)
25
25
  - [ ] **Validate success through comprehensive testing** (`validate-success-through-comprehensive-testing`) (MANDATORY — second-to-last)
26
- - [ ] **Documentation pass — create/update/deprecate as many docs as needed to capture what was done, where it lives, how to troubleshoot it, etc. etc.. etc..** (`documentation-pass-create-update-deprecate-docs`) (MANDATORY — last)
26
+ - [ ] **DOCS_CLOSER_PLACEHOLDER** (`documentation-pass-create-update-deprecate-docs`) (MANDATORY — last)
27
27
 
28
28
  > The three mandatory closing tasks above MUST remain the last three tasks of this phase.
29
29
  > Add new tasks above them; never after. A phase cannot be marked `done` until all three
@@ -34,9 +34,19 @@ _(no tasks yet — run `/start-task "Task name" --parent PHASE_SLUG_PLACEHOLDER`
34
34
  > or dependencies left unused by abandoned approaches. Only what this phase changed;
35
35
  > never refactor code it did not touch. It runs before validation so the tests prove
36
36
  > every deletion safe.
37
- > - **Validate success**: prove the phase's work with tests that fail if it breaks.
37
+ > - **Validate success**: we need to validate success thoroughly through comprehensive
38
+ > testing of our changes. Write the tests into this phase as you write its tasks --
39
+ > don't wait to be asked. Add each check as an atom of the validation task, every kind
40
+ > that applies: unit tests for new and changed logic, integration and end-to-end runs
41
+ > through the real entry points, a regression test for the problem that prompted the
42
+ > work, edge cases and failure paths, and the full existing suite. Each must fail if
43
+ > the change breaks.
38
44
  > - **Documentation pass**: create/update/deprecate every doc this phase touches —
39
45
  > what it is, where it lives, how to fix it, how to operate it, why it matters.
46
+ > Capture new procedures, tools, troubleshooting steps, gotchas and KB articles too.
47
+ > Never include secrets or passwords. Write the docs work into this phase as you write
48
+ > its tasks -- don't wait to be asked. Add an atom to the documentation task for each
49
+ > doc they create, change or make stale, naming the file.
40
50
  > If hit-em-with-the-docs is installed, you MUST use it for this pass --
41
51
  > `npx hewtd integrate <file> -a` to create, `npx hewtd archive <file>` to retire,
42
52
  > `npx hewtd maintain --quick` to regenerate indexes. Never hand-edit INDEX.md or
@@ -0,0 +1,35 @@
1
+ # Persistent Planning
2
+
3
+ > Auto-loaded every session. Written once by persistent-planning's init scripts and never
4
+ > overwritten: edit it to fit this repo.
5
+
6
+ Plans live in `.planning/`, on disk, so they survive context resets and can be handed to
7
+ teammates and subagents. The files are the working memory: read them, keep them current.
8
+
9
+ ## Working a plan
10
+
11
+ - **Before starting work**, run `/plan-status` and read the active plan. Re-read it before any
12
+ major decision.
13
+ - **Create plans with the commands**, never by hand: `/start-planning`, then (team mode)
14
+ `/start-task --parent <phase>` and `/start-atom --parent <task>`. They keep each parent's list
15
+ in order and the closing steps last.
16
+ - **Write the testing into the plan when you write the plan**: we need to validate success
17
+ thoroughly through comprehensive testing of our changes. Fill the validation step with the
18
+ specific checks this work needs (unit, integration, end-to-end, regression, edge cases and
19
+ failure paths, the full suite) before starting work, without being asked.
20
+ - **Write the docs work into the plan too**: under the documentation step, name each doc this
21
+ work creates, changes or makes stale, by file.
22
+ - **Update as you go**: tick each box when it is done, record decisions and errors as they
23
+ happen, and put research in `notes.md` instead of the conversation.
24
+ - The layers are **phase → task → atom**, plus **notes** for context at phase or task level.
25
+ Use those words. Do work in dependency order first; mark work `parallelizable: true` only
26
+ when nothing it depends on is unfinished.
27
+
28
+ ## Finishing a plan
29
+
30
+ - Every plan ends with three **mandatory** steps, always last, in this order: cleanup of junk
31
+ and unused code, validation by testing, a documentation pass. Add new work above them, never
32
+ after, and never skip them.
33
+ - **A plan is done when `/plan-status` says COMPLETE.** Don't mark it done any other way.
34
+ - Retire a finished plan with `/archive-plan <slug>`. Never delete a plan.
35
+ - Active plans are committed to git; only `.planning/.archive/` is ignored.