@theglitchking/persistent-planning 3.4.2 → 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.
- package/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/.documentation/INDEX.md +5 -4
- package/.documentation/REGISTRY.md +2 -2
- package/.documentation/agents/INDEX.md +2 -2
- package/.documentation/agents/REGISTRY.md +2 -2
- package/.documentation/api/INDEX.md +2 -2
- package/.documentation/api/REGISTRY.md +2 -2
- package/.documentation/architecture/INDEX.md +2 -2
- package/.documentation/architecture/REGISTRY.md +2 -2
- package/.documentation/architecture/lg-plan-artifact-lifecycle.md +4 -3
- package/.documentation/backups/INDEX.md +2 -2
- package/.documentation/backups/REGISTRY.md +2 -2
- package/.documentation/database/INDEX.md +2 -2
- package/.documentation/database/REGISTRY.md +2 -2
- package/.documentation/devops/INDEX.md +2 -2
- package/.documentation/devops/REGISTRY.md +2 -2
- package/.documentation/features/INDEX.md +2 -2
- package/.documentation/features/REGISTRY.md +2 -2
- package/.documentation/knowledge-base/facts/INDEX.md +57 -0
- package/.documentation/knowledge-base/facts/babel-fish-hook-adds-untracked-map.md +56 -0
- package/.documentation/knowledge-base/facts/claude-code-grep-v-exit-status.md +55 -0
- package/.documentation/knowledge-base/incidents/INDEX.md +17 -0
- package/.documentation/knowledge-base/symptoms/INDEX.md +17 -0
- package/.documentation/plans/INDEX.md +2 -2
- package/.documentation/plans/REGISTRY.md +2 -2
- package/.documentation/procedures/INDEX.md +2 -2
- package/.documentation/procedures/REGISTRY.md +2 -2
- package/.documentation/quickstart/INDEX.md +2 -2
- package/.documentation/quickstart/REGISTRY.md +2 -2
- package/.documentation/reference/INDEX.md +2 -2
- package/.documentation/reference/REGISTRY.md +2 -2
- package/.documentation/security/INDEX.md +2 -2
- package/.documentation/security/REGISTRY.md +2 -2
- package/.documentation/standards/INDEX.md +3 -3
- package/.documentation/standards/REGISTRY.md +3 -3
- package/.documentation/standards/mandatory-closing-phases.md +82 -27
- package/.documentation/testing/INDEX.md +2 -2
- package/.documentation/testing/REGISTRY.md +2 -2
- package/.documentation/testing/test-suite.md +3 -3
- package/.documentation/troubleshooting/INDEX.md +4 -3
- package/.documentation/troubleshooting/REGISTRY.md +6 -4
- package/.documentation/troubleshooting/docs-closer-missing-hewtd-steps.md +57 -0
- package/.documentation/troubleshooting/stale-skill-dir-drift.md +6 -3
- package/.documentation/workflows/INDEX.md +2 -2
- package/.documentation/workflows/REGISTRY.md +2 -2
- package/CHANGELOG.md +79 -0
- package/commands/start-planning.md +12 -0
- package/package.json +1 -1
- package/scripts/init-atom.sh +2 -0
- package/scripts/init-phase.sh +53 -10
- package/scripts/init-planning.sh +67 -5
- package/scripts/init-task.sh +2 -0
- package/scripts/lib/planning.sh +61 -0
- package/skills/persistent-planning/SKILL.md +24 -5
- package/templates/git-workflow-section.md +11 -0
- package/templates/lg/phase.md +21 -5
- package/templates/rules/persistent-planning.md +35 -0
package/scripts/init-phase.sh
CHANGED
|
@@ -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 \
|
|
@@ -125,7 +161,7 @@ planning_render_and_log \
|
|
|
125
161
|
"NOTES_SCOPE_PLACEHOLDER=${PHASE_SLUG}" \
|
|
126
162
|
"NOTES_DATE_PLACEHOLDER=${TODAY}"
|
|
127
163
|
|
|
128
|
-
# Scaffold the
|
|
164
|
+
# Scaffold the three mandatory closing tasks as real task directories.
|
|
129
165
|
#
|
|
130
166
|
# They used to exist only as two checkbox lines in phase.md, so the most important
|
|
131
167
|
# tasks in every plan were the only ones with no artifact for a subagent to read and
|
|
@@ -162,9 +198,21 @@ scaffold_closer() { # <slug> <title> <atom>...
|
|
|
162
198
|
done
|
|
163
199
|
}
|
|
164
200
|
|
|
201
|
+
# Cleanup comes first so validation proves every deletion safe.
|
|
202
|
+
scaffold_closer \
|
|
203
|
+
"cleanup-remove-junk-and-unused-code" \
|
|
204
|
+
"Cleanup — remove junk and unused code" \
|
|
205
|
+
"Scope it: diff against where this phase started — only what this phase created or changed is in scope" \
|
|
206
|
+
"Remove scratch/test scripts, debug files, temp output and backups this phase created" \
|
|
207
|
+
"Remove probe logging, one-off test functions and commented-out code" \
|
|
208
|
+
"Remove code, helpers, imports and dependencies left unused by abandoned approaches" \
|
|
209
|
+
"Never refactor code this phase did not touch; when unsure, record it in notes.md instead of deleting"
|
|
210
|
+
|
|
165
211
|
scaffold_closer \
|
|
166
212
|
"validate-success-through-comprehensive-testing" \
|
|
167
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" \
|
|
168
216
|
"Prove every claim this phase makes with a test that fails if it breaks" \
|
|
169
217
|
"Test the invariant after mutation, not the shape of a freshly rendered template" \
|
|
170
218
|
"Cover the failure mode that prompted the work, not just the happy path" \
|
|
@@ -172,17 +220,12 @@ scaffold_closer \
|
|
|
172
220
|
|
|
173
221
|
scaffold_closer \
|
|
174
222
|
"documentation-pass-create-update-deprecate-docs" \
|
|
175
|
-
"
|
|
176
|
-
"
|
|
177
|
-
"Add a troubleshooting entry for the symptom someone will actually search for" \
|
|
178
|
-
"Update every existing doc this phase made wrong — a stale doc is worse than a missing one" \
|
|
179
|
-
"Retire superseded docs with \`npx hewtd archive <file>\` — never by deleting" \
|
|
180
|
-
"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" \
|
|
181
|
-
"Run \`npx hewtd audit\` and resolve every error" \
|
|
182
|
-
"Never hand-edit INDEX.md or REGISTRY.md — they are generated"
|
|
223
|
+
"$DOCS_TITLE" \
|
|
224
|
+
"${DOCS_ATOMS[@]}"
|
|
183
225
|
|
|
184
226
|
# Only completed plans are local history — see planning_ensure_archive_gitignored.
|
|
185
227
|
planning_ensure_archive_gitignored "${ROOT}"
|
|
228
|
+
planning_seed_rules "${ROOT}"
|
|
186
229
|
|
|
187
230
|
echo ""
|
|
188
231
|
planning_ok "Phase '${PHASE_NAME}' ready at .planning/${PHASE_SLUG}/"
|
package/scripts/init-planning.sh
CHANGED
|
@@ -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.
|
|
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'
|
|
@@ -105,15 +114,31 @@ if [ ! -f "$TASK_PLAN_FILE" ]; then
|
|
|
105
114
|
- [ ] Phase 2: Research/gather information
|
|
106
115
|
- [ ] Phase 3: Execute/build
|
|
107
116
|
- [ ] Phase 4: Review and deliver
|
|
108
|
-
- [ ] Phase 5:
|
|
109
|
-
- [ ] Phase 6:
|
|
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)
|
|
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)
|
|
110
120
|
|
|
111
|
-
> Phases 5 and
|
|
121
|
+
> Phases 5, 6 and 7 are mandatory and MUST stay the last three phases of this plan.
|
|
112
122
|
> Insert new work above them; never after. Renumber them if you add phases.
|
|
113
123
|
>
|
|
114
|
-
> - **
|
|
124
|
+
> - **Cleanup**: remove what this work left behind -- scratch and test scripts, temp
|
|
125
|
+
> output, debug logging, one-off test functions, commented-out code, and code,
|
|
126
|
+
> imports or dependencies left unused by abandoned approaches. Only what this work
|
|
127
|
+
> changed; never refactor code it did not touch. When unsure, note it -- don't delete.
|
|
128
|
+
> Cleanup runs before validation so every deletion is proven safe by the tests.
|
|
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.
|
|
115
136
|
> - **Documentation pass**: create/update/deprecate every doc this change touches --
|
|
116
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.
|
|
117
142
|
> If hit-em-with-the-docs is installed, you MUST use it for this pass --
|
|
118
143
|
> `npx hewtd integrate <file> -a` to create, `npx hewtd archive <file>` to retire,
|
|
119
144
|
> `npx hewtd maintain --quick` to regenerate indexes. Never hand-edit INDEX.md or
|
|
@@ -155,6 +180,13 @@ EOF
|
|
|
155
180
|
|
|
156
181
|
sed -i "s/TASK_NAME_PLACEHOLDER/${TASK_NAME}/g" "$TASK_PLAN_FILE"
|
|
157
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"
|
|
158
190
|
echo -e "${GREEN}+${NC} Created task_plan.md"
|
|
159
191
|
else
|
|
160
192
|
echo -e "${YELLOW}*${NC} task_plan.md already exists (not overwritten)"
|
|
@@ -228,6 +260,36 @@ else
|
|
|
228
260
|
echo -e "${YELLOW}*${NC} No .gitignore found (not added)"
|
|
229
261
|
fi
|
|
230
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
|
+
|
|
231
293
|
# Step 6: List other active tasks
|
|
232
294
|
OTHER_TASKS=$(find "$PLANNING_DIR" -maxdepth 1 -type d -not -name ".planning" -not -path "$TASK_DIR" 2>/dev/null | wc -l)
|
|
233
295
|
if [ "$OTHER_TASKS" -gt 0 ]; then
|
package/scripts/init-task.sh
CHANGED
package/scripts/lib/planning.sh
CHANGED
|
@@ -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]
|
|
@@ -160,15 +163,31 @@ Create this file FIRST for any complex task:
|
|
|
160
163
|
- [ ] Phase 2: Research/gather information
|
|
161
164
|
- [ ] Phase 3: Execute/build
|
|
162
165
|
- [ ] Phase 4: Review and deliver
|
|
163
|
-
- [ ] Phase 5:
|
|
164
|
-
- [ ] Phase 6:
|
|
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)
|
|
167
|
+
- [ ] Phase 6: Validate success through comprehensive testing -- we need to validate success thoroughly through comprehensive testing of our changes (MANDATORY)
|
|
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)
|
|
165
169
|
|
|
166
|
-
> Phases 5 and
|
|
170
|
+
> Phases 5, 6 and 7 are mandatory and MUST stay the last three phases of this plan.
|
|
167
171
|
> Insert new work above them; never after. Renumber them if you add phases.
|
|
168
172
|
>
|
|
169
|
-
> - **
|
|
173
|
+
> - **Cleanup**: remove what this work left behind -- scratch and test scripts, temp
|
|
174
|
+
> output, debug logging, one-off test functions, commented-out code, and code,
|
|
175
|
+
> imports or dependencies left unused by abandoned approaches. Only what this work
|
|
176
|
+
> changed; never refactor code it did not touch. When unsure, note it -- don't delete.
|
|
177
|
+
> Cleanup runs before validation so every deletion is proven safe by the tests.
|
|
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.
|
|
170
185
|
> - **Documentation pass**: create/update/deprecate every doc this change touches --
|
|
171
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.
|
|
172
191
|
> If hit-em-with-the-docs is installed, you MUST use it for this pass --
|
|
173
192
|
> `npx hewtd integrate <file> -a` to create, `npx hewtd archive <file>` to retire,
|
|
174
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`.
|
package/templates/lg/phase.md
CHANGED
|
@@ -21,16 +21,32 @@ Tasks with no inter-dependencies can be marked `parallelizable: true` in their f
|
|
|
21
21
|
so subagent teams can pick them up concurrently.]
|
|
22
22
|
|
|
23
23
|
_(no tasks yet — run `/start-task "Task name" --parent PHASE_SLUG_PLACEHOLDER`)_
|
|
24
|
+
- [ ] **Cleanup — remove junk and unused code** (`cleanup-remove-junk-and-unused-code`) (MANDATORY — third-to-last)
|
|
24
25
|
- [ ] **Validate success through comprehensive testing** (`validate-success-through-comprehensive-testing`) (MANDATORY — second-to-last)
|
|
25
|
-
- [ ] **
|
|
26
|
+
- [ ] **DOCS_CLOSER_PLACEHOLDER** (`documentation-pass-create-update-deprecate-docs`) (MANDATORY — last)
|
|
26
27
|
|
|
27
|
-
> The
|
|
28
|
-
> Add new tasks above them; never after. A phase cannot be marked `done` until
|
|
29
|
-
> `done`, and
|
|
28
|
+
> The three mandatory closing tasks above MUST remain the last three tasks of this phase.
|
|
29
|
+
> Add new tasks above them; never after. A phase cannot be marked `done` until all three
|
|
30
|
+
> are `done`, and none may be `parallelizable` — they gate on everything before them.
|
|
30
31
|
>
|
|
31
|
-
> - **
|
|
32
|
+
> - **Cleanup**: remove what this phase left behind — scratch and test scripts, temp
|
|
33
|
+
> output, debug logging, one-off test functions, commented-out code, and code, imports
|
|
34
|
+
> or dependencies left unused by abandoned approaches. Only what this phase changed;
|
|
35
|
+
> never refactor code it did not touch. It runs before validation so the tests prove
|
|
36
|
+
> every deletion safe.
|
|
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.
|
|
32
44
|
> - **Documentation pass**: create/update/deprecate every doc this phase touches —
|
|
33
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.
|
|
34
50
|
> If hit-em-with-the-docs is installed, you MUST use it for this pass --
|
|
35
51
|
> `npx hewtd integrate <file> -a` to create, `npx hewtd archive <file>` to retire,
|
|
36
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.
|