pan-wizard 3.32.0 → 3.34.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.
Files changed (209) hide show
  1. package/README.md +23 -20
  2. package/agents/pan-conductor.md +18 -17
  3. package/agents/pan-counterfactual.md +2 -2
  4. package/agents/pan-debugger.md +27 -8
  5. package/agents/pan-design-checker.md +1 -1
  6. package/agents/pan-designer.md +2 -2
  7. package/agents/pan-distiller.md +3 -3
  8. package/agents/pan-document_code.md +16 -16
  9. package/agents/pan-executor.md +15 -11
  10. package/agents/pan-experiment-runner.md +15 -17
  11. package/agents/pan-hardener.md +15 -15
  12. package/agents/pan-integration-checker.md +2 -2
  13. package/agents/pan-knowledge.md +2 -2
  14. package/agents/pan-meta-reviewer.md +5 -5
  15. package/agents/pan-optimizer.md +40 -44
  16. package/agents/pan-phase-researcher.md +10 -10
  17. package/agents/pan-plan-checker.md +36 -30
  18. package/agents/pan-planner.md +77 -53
  19. package/agents/pan-previewer.md +1 -1
  20. package/agents/pan-project-researcher.md +21 -78
  21. package/agents/pan-release.md +1 -1
  22. package/agents/pan-research-synthesizer.md +2 -2
  23. package/agents/pan-reviewer.md +24 -2
  24. package/agents/pan-roadmapper.md +20 -62
  25. package/agents/pan-verifier.md +53 -30
  26. package/bin/install-lib.cjs +228 -38
  27. package/bin/install.js +86 -15
  28. package/commands/pan/army.md +16 -12
  29. package/commands/pan/assumptions.md +2 -2
  30. package/commands/pan/audit-deployment.md +11 -12
  31. package/commands/pan/cost.md +8 -4
  32. package/commands/pan/debug.md +10 -7
  33. package/commands/pan/design-phase.md +3 -3
  34. package/commands/pan/discuss-phase.md +2 -0
  35. package/commands/pan/exec-phase.md +21 -37
  36. package/commands/pan/experiment.md +11 -10
  37. package/commands/pan/focus-auto.md +33 -27
  38. package/commands/pan/focus-design.md +9 -6
  39. package/commands/pan/focus-doc-audit.md +4 -3
  40. package/commands/pan/focus-drift-walking.md +4 -3
  41. package/commands/pan/focus-exec.md +7 -7
  42. package/commands/pan/focus-plan.md +12 -11
  43. package/commands/pan/focus-scan.md +7 -10
  44. package/commands/pan/focus-sync.md +3 -2
  45. package/commands/pan/git.md +8 -8
  46. package/commands/pan/health.md +2 -2
  47. package/commands/pan/hud.md +3 -2
  48. package/commands/pan/hygiene.md +14 -7
  49. package/commands/pan/knowledge.md +9 -9
  50. package/commands/pan/learn.md +10 -7
  51. package/commands/pan/links.md +4 -1
  52. package/commands/pan/map-codebase.md +5 -5
  53. package/commands/pan/mcp-bridge.md +18 -18
  54. package/commands/pan/milestone-done.md +7 -5
  55. package/commands/pan/milestone-new.md +1 -1
  56. package/commands/pan/new-project.md +10 -10
  57. package/commands/pan/optimize.md +16 -14
  58. package/commands/pan/patches.md +2 -6
  59. package/commands/pan/pause.md +1 -1
  60. package/commands/pan/phase-tests.md +4 -3
  61. package/commands/pan/plan-phase.md +9 -19
  62. package/commands/pan/preview.md +1 -1
  63. package/commands/pan/profile.md +4 -4
  64. package/commands/pan/quick.md +1 -1
  65. package/commands/pan/remove-phase.md +1 -1
  66. package/commands/pan/report.md +2 -2
  67. package/commands/pan/research-phase.md +14 -15
  68. package/commands/pan/resume.md +9 -11
  69. package/commands/pan/retro.md +5 -3
  70. package/commands/pan/review-deep.md +10 -10
  71. package/commands/pan/settings.md +1 -1
  72. package/commands/pan/todo-add.md +2 -2
  73. package/commands/pan/todo-check.md +2 -2
  74. package/commands/pan/verify-phase.md +0 -11
  75. package/commands/pan/what-if.md +2 -2
  76. package/hooks/dist/pan-context-monitor.js +343 -44
  77. package/hooks/dist/pan-cost-logger.js +30 -0
  78. package/hooks/dist/pan-state-reinject.js +140 -15
  79. package/hooks/dist/pan-statusline.js +68 -22
  80. package/hooks/dist/pan-stop-guard.js +7 -2
  81. package/package.json +1 -1
  82. package/pan-wizard-core/bin/lib/agents-md.cjs +48 -7
  83. package/pan-wizard-core/bin/lib/bridge.cjs +6 -5
  84. package/pan-wizard-core/bin/lib/campaign.cjs +4 -2
  85. package/pan-wizard-core/bin/lib/commands-learnings.cjs +19 -2
  86. package/pan-wizard-core/bin/lib/commands.cjs +126 -5
  87. package/pan-wizard-core/bin/lib/config.cjs +112 -1
  88. package/pan-wizard-core/bin/lib/constants.cjs +29 -15
  89. package/pan-wizard-core/bin/lib/context-budget.cjs +12 -9
  90. package/pan-wizard-core/bin/lib/core.cjs +77 -23
  91. package/pan-wizard-core/bin/lib/cost-rebuild.cjs +13 -1
  92. package/pan-wizard-core/bin/lib/cost.cjs +149 -10
  93. package/pan-wizard-core/bin/lib/distill.cjs +6 -3
  94. package/pan-wizard-core/bin/lib/doc-lint.cjs +30 -11
  95. package/pan-wizard-core/bin/lib/findings.cjs +15 -4
  96. package/pan-wizard-core/bin/lib/focus.cjs +13 -4
  97. package/pan-wizard-core/bin/lib/frontmatter.cjs +105 -26
  98. package/pan-wizard-core/bin/lib/hygiene.cjs +178 -17
  99. package/pan-wizard-core/bin/lib/init.cjs +12 -5
  100. package/pan-wizard-core/bin/lib/knowledge.cjs +17 -1
  101. package/pan-wizard-core/bin/lib/learn-index.cjs +111 -10
  102. package/pan-wizard-core/bin/lib/learn-lint.cjs +30 -3
  103. package/pan-wizard-core/bin/lib/memory-optimize.cjs +8 -4
  104. package/pan-wizard-core/bin/lib/memory.cjs +508 -54
  105. package/pan-wizard-core/bin/lib/milestone.cjs +8 -3
  106. package/pan-wizard-core/bin/lib/optimize.cjs +84 -16
  107. package/pan-wizard-core/bin/lib/phase-remove.cjs +85 -21
  108. package/pan-wizard-core/bin/lib/phase-report.cjs +8 -2
  109. package/pan-wizard-core/bin/lib/phase.cjs +67 -15
  110. package/pan-wizard-core/bin/lib/preview.cjs +3 -1
  111. package/pan-wizard-core/bin/lib/review-deep.cjs +2 -2
  112. package/pan-wizard-core/bin/lib/roadmap-compact.cjs +267 -0
  113. package/pan-wizard-core/bin/lib/roadmap.cjs +243 -9
  114. package/pan-wizard-core/bin/lib/runner.cjs +2 -1
  115. package/pan-wizard-core/bin/lib/state-compact.cjs +11 -6
  116. package/pan-wizard-core/bin/lib/state.cjs +47 -31
  117. package/pan-wizard-core/bin/lib/template.cjs +11 -4
  118. package/pan-wizard-core/bin/lib/verdict.cjs +54 -4
  119. package/pan-wizard-core/bin/lib/verify-drift.cjs +14 -5
  120. package/pan-wizard-core/bin/lib/verify-preflight.cjs +4 -13
  121. package/pan-wizard-core/bin/lib/verify-retro.cjs +5 -3
  122. package/pan-wizard-core/bin/lib/verify-scope.cjs +74 -4
  123. package/pan-wizard-core/bin/lib/verify.cjs +117 -35
  124. package/pan-wizard-core/bin/lib/whatif.cjs +5 -3
  125. package/pan-wizard-core/bin/pan-tools.cjs +111 -17
  126. package/pan-wizard-core/learnings/index.json +5 -5
  127. package/pan-wizard-core/mcp/server.cjs +18 -9
  128. package/pan-wizard-core/opencode/pan-wizard.js +111 -0
  129. package/pan-wizard-core/references/checkpoints.md +7 -5
  130. package/pan-wizard-core/references/continuation-format.md +3 -3
  131. package/pan-wizard-core/references/decimal-phase-calculation.md +2 -3
  132. package/pan-wizard-core/references/design-methodology.md +1 -1
  133. package/pan-wizard-core/references/git-integration.md +4 -6
  134. package/pan-wizard-core/references/git-planning-commit.md +2 -2
  135. package/pan-wizard-core/references/guardrails.md +2 -2
  136. package/pan-wizard-core/references/handoff-decisions.md +3 -3
  137. package/pan-wizard-core/references/model-profile-resolution.md +5 -5
  138. package/pan-wizard-core/references/model-profiles.md +14 -9
  139. package/pan-wizard-core/references/phase-argument-parsing.md +7 -7
  140. package/pan-wizard-core/references/planning-config.md +4 -4
  141. package/pan-wizard-core/references/tdd.md +10 -1
  142. package/pan-wizard-core/references/verdict-contract.md +2 -1
  143. package/pan-wizard-core/references/verification-patterns.md +5 -5
  144. package/pan-wizard-core/templates/codebase/architecture.md +2 -2
  145. package/pan-wizard-core/templates/codebase/best-practices.md +2 -2
  146. package/pan-wizard-core/templates/codebase/concerns.md +3 -3
  147. package/pan-wizard-core/templates/codebase/integrations.md +6 -6
  148. package/pan-wizard-core/templates/codebase/relationships.md +2 -2
  149. package/pan-wizard-core/templates/codebase/stack.md +2 -2
  150. package/pan-wizard-core/templates/codebase/structure.md +4 -4
  151. package/pan-wizard-core/templates/codebase/testing.md +4 -4
  152. package/pan-wizard-core/templates/continue-here.md +1 -1
  153. package/pan-wizard-core/templates/debug-subagent-prompt.md +3 -2
  154. package/pan-wizard-core/templates/debug.md +15 -1
  155. package/pan-wizard-core/templates/discovery.md +1 -1
  156. package/pan-wizard-core/templates/milestone-archive.md +6 -6
  157. package/pan-wizard-core/templates/milestone.md +1 -1
  158. package/pan-wizard-core/templates/phase-prompt.md +31 -18
  159. package/pan-wizard-core/templates/planner-subagent-prompt.md +3 -5
  160. package/pan-wizard-core/templates/research-project/architecture.md +3 -3
  161. package/pan-wizard-core/templates/research-project/features.md +1 -1
  162. package/pan-wizard-core/templates/research-project/pitfalls.md +1 -1
  163. package/pan-wizard-core/templates/research-project/stack.md +3 -3
  164. package/pan-wizard-core/templates/research.md +5 -5
  165. package/pan-wizard-core/templates/retrospective.md +1 -1
  166. package/pan-wizard-core/templates/roadmap.md +15 -15
  167. package/pan-wizard-core/templates/summary-complex.md +1 -0
  168. package/pan-wizard-core/templates/summary-minimal.md +1 -0
  169. package/pan-wizard-core/templates/summary-standard.md +2 -1
  170. package/pan-wizard-core/templates/summary.md +18 -2
  171. package/pan-wizard-core/templates/uat.md +3 -3
  172. package/pan-wizard-core/templates/user-setup.md +8 -8
  173. package/pan-wizard-core/templates/verification-report.md +54 -4
  174. package/pan-wizard-core/workflows/add-phase.md +1 -1
  175. package/pan-wizard-core/workflows/assumptions.md +1 -1
  176. package/pan-wizard-core/workflows/discuss-phase.md +9 -8
  177. package/pan-wizard-core/workflows/exec-phase.md +34 -60
  178. package/pan-wizard-core/workflows/execute-plan.md +8 -7
  179. package/pan-wizard-core/workflows/health.md +13 -11
  180. package/pan-wizard-core/workflows/help.md +8 -9
  181. package/pan-wizard-core/workflows/learn.md +13 -11
  182. package/pan-wizard-core/workflows/map-codebase.md +10 -10
  183. package/pan-wizard-core/workflows/milestone-audit.md +10 -10
  184. package/pan-wizard-core/workflows/milestone-gaps.md +17 -24
  185. package/pan-wizard-core/workflows/milestone-new.md +7 -6
  186. package/pan-wizard-core/workflows/new-project.md +10 -10
  187. package/pan-wizard-core/workflows/optimize.md +11 -9
  188. package/pan-wizard-core/workflows/pause.md +6 -1
  189. package/pan-wizard-core/workflows/phase-tests.md +4 -4
  190. package/pan-wizard-core/workflows/plan-phase.md +31 -34
  191. package/pan-wizard-core/workflows/profile.md +2 -2
  192. package/pan-wizard-core/workflows/progress.md +5 -7
  193. package/pan-wizard-core/workflows/quick.md +10 -8
  194. package/pan-wizard-core/workflows/remove-phase.md +1 -1
  195. package/pan-wizard-core/workflows/research-phase.md +9 -5
  196. package/pan-wizard-core/workflows/resume-project.md +4 -6
  197. package/pan-wizard-core/workflows/retro.md +3 -1
  198. package/pan-wizard-core/workflows/settings.md +16 -24
  199. package/pan-wizard-core/workflows/todo-check.md +1 -1
  200. package/pan-wizard-core/workflows/transition.md +12 -12
  201. package/pan-wizard-core/workflows/update.md +25 -17
  202. package/pan-wizard-core/workflows/verify-phase.md +24 -17
  203. package/pan-zcode/KNOWN-BETA-RISKS.md +2 -2
  204. package/pan-zcode/README.md +7 -7
  205. package/pan-zcode/bin/install-zcode.js +1 -1
  206. package/scripts/build-agent-plugin.js +19 -5
  207. package/scripts/build-plugin.js +3 -1
  208. package/scripts/generate-skills-docs.py +13 -4
  209. package/scripts/test-surface.cjs +4 -0
@@ -8,7 +8,7 @@ Template for `.planning/phases/XX-name/{phase_num}-uat.md` — persistent UAT se
8
8
 
9
9
  ```markdown
10
10
  ---
11
- status: testing | complete | diagnosed
11
+ status: testing | complete | diagnosed | resolved
12
12
  phase: XX-name
13
13
  source: [list of summary.md files tested]
14
14
  started: [ISO timestamp]
@@ -74,7 +74,7 @@ skipped: [N]
74
74
  <section_rules>
75
75
 
76
76
  **Frontmatter:**
77
- - `status`: OVERWRITE - "testing" or "complete"
77
+ - `status`: OVERWRITE - "testing", "complete", "diagnosed" (after diagnosis) or "resolved" (exec-phase closes the gaps)
78
78
  - `phase`: IMMUTABLE - set on creation
79
79
  - `source`: IMMUTABLE - SUMMARY files being tested
80
80
  - `started`: IMMUTABLE - set on creation
@@ -106,7 +106,7 @@ skipped: [N]
106
106
 
107
107
  **After testing complete (status: complete), if gaps exist:**
108
108
 
109
- 1. User runs diagnosis (from verify-phase offer or manually)
109
+ 1. User runs diagnosis (on Claude Code, the native `/pan-diagnose-issues <phase>`; no `/pan:` command or verify-phase step runs it)
110
110
  2. diagnose-issues workflow spawns parallel debug agents
111
111
  3. Each agent investigates one gap, returns root cause
112
112
  4. uat.md Gaps section updated with diagnosis:
@@ -8,7 +8,7 @@ Template for `.planning/phases/XX-name/{phase}-USER-SETUP.md` - human-required c
8
8
 
9
9
  ## File Template
10
10
 
11
- ```markdown
11
+ ~~~markdown
12
12
  # Phase {X}: User Setup Required
13
13
 
14
14
  **Generated:** [YYYY-MM-DD]
@@ -55,7 +55,7 @@ Expected results:
55
55
  ---
56
56
 
57
57
  **Once all items complete:** Mark status as "Complete" at top of file.
58
- ```
58
+ ~~~
59
59
 
60
60
  ---
61
61
 
@@ -117,7 +117,7 @@ user_setup:
117
117
  ## Service-Specific Examples
118
118
 
119
119
  <stripe_example>
120
- ```markdown
120
+ ~~~markdown
121
121
  # Phase 10: User Setup Required
122
122
 
123
123
  **Generated:** 2025-01-14
@@ -188,11 +188,11 @@ Expected: Build passes, webhook returns 400 (signature validation working).
188
188
  ---
189
189
 
190
190
  **Once all items complete:** Mark status as "Complete" at top of file.
191
- ```
191
+ ~~~
192
192
  </stripe_example>
193
193
 
194
194
  <supabase_example>
195
- ```markdown
195
+ ~~~markdown
196
196
  # Phase 2: User Setup Required
197
197
 
198
198
  **Generated:** 2025-01-14
@@ -242,11 +242,11 @@ npx supabase status
242
242
  ---
243
243
 
244
244
  **Once all items complete:** Mark status as "Complete" at top of file.
245
- ```
245
+ ~~~
246
246
  </supabase_example>
247
247
 
248
248
  <sendgrid_example>
249
- ```markdown
249
+ ~~~markdown
250
250
  # Phase 5: User Setup Required
251
251
 
252
252
  **Generated:** 2025-01-14
@@ -297,7 +297,7 @@ curl -X POST http://localhost:3000/api/test-email \
297
297
  ---
298
298
 
299
299
  **Once all items complete:** Mark status as "Complete" at top of file.
300
- ```
300
+ ~~~
301
301
  </sendgrid_example>
302
302
 
303
303
  ---
@@ -10,11 +10,34 @@ Template for `.planning/phases/XX-name/{phase_num}-verification.md` — phase go
10
10
  ---
11
11
  phase: XX-name
12
12
  verified: YYYY-MM-DDTHH:MM:SSZ
13
+ # verified_commit: git rev-parse HEAD before writing this file; `pan-tools verify stale` compares against it
14
+ verified_commit: <sha>
13
15
  status: passed | gaps_found | human_needed
14
16
  score: N/M must-haves verified
15
- unrequested: # Only when the scope check (`pan-tools verify scope <phase>`) found work no plan asked for
16
- - path: "src/admin/panel.tsx"
17
- what: "An admin panel no plan or requirement asked for"
17
+ test_gate: passed | failed | skipped
18
+ # Only for checks that could not run, with why (a skipped test gate is one): write not_checked uncommented
19
+ # not_checked:
20
+ # - check: "tests"
21
+ # reason: "no test script in package.json"
22
+ # Only if status: gaps_found; read by `findings record` and /pan:plan-phase --gaps: write gaps uncommented
23
+ # gaps:
24
+ # - truth: "Observable truth that failed"
25
+ # status: failed
26
+ # reason: "Why it failed"
27
+ # artifacts:
28
+ # - path: "src/path/to/file.tsx"
29
+ # issue: "What's wrong"
30
+ # missing:
31
+ # - "Specific thing to add/fix"
32
+ # Only if status: human_needed: write human_verification uncommented
33
+ # human_verification:
34
+ # - test: "What to do"
35
+ # expected: "What should happen"
36
+ # why_human: "Why it cannot be verified programmatically"
37
+ # Only when the scope check (`pan-tools verify scope <phase>`) found work no plan asked for: write unrequested uncommented
38
+ # unrequested:
39
+ # - path: "src/admin/panel.tsx"
40
+ # what: "An admin panel no plan or requirement asked for"
18
41
  ---
19
42
 
20
43
  # Phase {X}: {Name} Verification Report
@@ -207,8 +230,35 @@ Unrequested work is recorded, not blocking: the status does not change because o
207
230
  ---
208
231
  phase: 03-chat
209
232
  verified: 2025-01-15T14:30:00Z
233
+ verified_commit: 4f2a9c1
210
234
  status: gaps_found
211
- score: 2/5 must-haves verified
235
+ score: 1/5 must-haves verified
236
+ test_gate: passed
237
+ gaps:
238
+ - truth: "User can see existing messages"
239
+ status: failed
240
+ reason: "Chat.tsx renders a placeholder, not message data"
241
+ artifacts:
242
+ - path: "src/components/Chat.tsx"
243
+ issue: "Returns a placeholder div and fetches nothing"
244
+ missing:
245
+ - "Fetch from /api/chat and render the messages"
246
+ - truth: "User can send a message"
247
+ status: failed
248
+ reason: "The onSubmit handler only logs"
249
+ artifacts:
250
+ - path: "src/components/ChatInput.tsx"
251
+ issue: "onSubmit calls console.log, no fetch"
252
+ missing:
253
+ - "POST to /api/chat on submit"
254
+ - truth: "Sent message appears in list"
255
+ status: failed
256
+ reason: "No state update after send, and the API routes return hardcoded values"
257
+ artifacts:
258
+ - path: "src/app/api/chat/route.ts"
259
+ issue: "GET returns [], POST returns { ok: true }, no database call"
260
+ missing:
261
+ - "prisma.message.findMany and create in the route handlers, and a list refresh after send"
212
262
  ---
213
263
 
214
264
  # Phase 3: Chat Interface Verification Report
@@ -52,7 +52,7 @@ The CLI handles:
52
52
  - Calculating next phase number (max + 1)
53
53
  - Generating slug from description
54
54
  - Creating the phase directory (`.planning/phases/{NN}-{slug}/`)
55
- - Inserting the phase entry into roadmap.md with Goal, Depends on, and Plans sections
55
+ - Inserting the phase into roadmap.md: its checklist line, and a section with Goal, Requirements, Depends on and Plans lines
56
56
 
57
57
  Extract from result: `phase_number`, `padded`, `name`, `slug`, `directory`.
58
58
  </step>
@@ -24,7 +24,7 @@ Exit workflow.
24
24
  Validate phase exists in roadmap:
25
25
 
26
26
  ```bash
27
- cat .planning/roadmap.md | grep -i "Phase ${PHASE}"
27
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs roadmap get-phase "${PHASE}" # found, phase_name, goal, success_criteria, section
28
28
  ```
29
29
 
30
30
  **If phase not found:**
@@ -130,7 +130,7 @@ Exit workflow.
130
130
  </step>
131
131
 
132
132
  <step name="auto_mode_bypass">
133
- **P-1803 fix (v3.7.8):** When `--auto` is set or `workflow.auto_advance: true`, **skip the entire question-driven discussion** and synthesize a minimal `context.md` directly from upstream artifacts. The 6 unguarded `AskUserQuestion` calls in this workflow (lines ~140, 156, 208, 261, 264, 278) all stall headless `claude -p` sessions immediately. Surfaced by the wookie autonomous build (v3.7.7): retry attempts via `/pan:discuss-phase 3 --auto` exited in 75s with $0.42 cost and zero commits before plan-phase auto-mode was patched to bypass discuss-phase entirely. This step makes discuss-phase itself auto-mode-safe, so it can be re-introduced into the auto pipeline cleanly.
133
+ **P-1803 fix (v3.7.8):** When `--auto` is set or `workflow.auto_advance: true`, **skip the entire question-driven discussion** and synthesize a minimal `context.md` directly from upstream artifacts. The unguarded `AskUserQuestion` calls in `check_existing`, `present_gray_areas` and `discuss_areas` all stall headless `claude -p` sessions immediately. Surfaced by the wookie autonomous build (v3.7.7): retry attempts via `/pan:discuss-phase 3 --auto` exited in 75s with $0.42 cost and zero commits before plan-phase auto-mode was patched to bypass discuss-phase entirely. This step makes discuss-phase itself auto-mode-safe, so it can be re-introduced into the auto pipeline cleanly.
134
134
 
135
135
  Detect auto mode:
136
136
 
@@ -152,7 +152,7 @@ Skip the interactive flow. Generate `context.md` from the roadmap goal + idea.md
152
152
 
153
153
  2. Read inputs:
154
154
  ```bash
155
- ROADMAP_GOAL=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs roadmap get-phase "${PHASE}" --raw | sed -n '/^Goal:/,/^$/p')
155
+ PHASE_JSON=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs roadmap get-phase "${PHASE}") # JSON: goal, success_criteria, section
156
156
  IDEA_PATH=".planning/idea.md"
157
157
  PROJECT_PATH=".planning/project.md"
158
158
  REQ_PATH=".planning/requirements.md"
@@ -170,7 +170,7 @@ REQ_PATH=".planning/requirements.md"
170
170
  <domain>
171
171
  ## Phase Boundary
172
172
 
173
- [Goal extracted verbatim from roadmap.md]
173
+ [The `goal` from PHASE_JSON, verbatim]
174
174
 
175
175
  </domain>
176
176
 
@@ -181,7 +181,7 @@ REQ_PATH=".planning/requirements.md"
181
181
  [For each item in idea.md "Constraints" / "Scope" / "Notes for the planner" sections that mentions Phase ${PHASE} or its domain keywords (e.g., "image pipeline" for Phase 3) — extract as a locked decision, prefixed with the domain name]
182
182
 
183
183
  ### From requirements.md
184
- [For each requirement marked Active that maps to Phase ${PHASE} via `requirements.md`'s phase column — list as a locked decision]
184
+ [For each requirement the phase's slice lists under "Its requirements" (`pan-tools roadmap slice ${PHASE} --raw`) — list as a locked decision]
185
185
 
186
186
  ### Claude's Discretion
187
187
  - Implementation patterns within the constraints above (the planner decides specific libraries / file layouts / function shapes)
@@ -213,7 +213,8 @@ None — auto-mode synthesis honors the original idea.md scope.
213
213
 
214
214
  Write the file:
215
215
  ```bash
216
- mkdir -p "${phase_dir}"
216
+ # phase_dir is null when the phase has no directory yet: create it (the printed path is phase_dir)
217
+ case "{phase_dir}" in ""|null) node ~/.claude/pan-wizard-core/bin/pan-tools.cjs scaffold phase-dir --phase "${PHASE}" --name "{phase_name}" --raw ;; esac
217
218
  # Use Write tool (NOT heredoc) to create ${phase_dir}/${PADDED_PHASE}-context.md
218
219
  ```
219
220
 
@@ -278,7 +279,7 @@ If "Cancel": Exit workflow.
278
279
  <step name="analyze_phase">
279
280
  Analyze the phase to identify gray areas worth discussing.
280
281
 
281
- **Read the phase description from roadmap.md and determine:**
282
+ **Read the phase's section (`roadmap get-phase "${PHASE}"`: `goal`, `success_criteria`, `section`) and determine:**
282
283
 
283
284
  1. **Domain boundary** — What capability is this phase delivering? State it clearly.
284
285
 
@@ -416,9 +417,9 @@ Create context.md capturing decisions made.
416
417
 
417
418
  Use values from init: `phase_dir`, `phase_slug`, `padded_phase`.
418
419
 
419
- If `phase_dir` is null (phase exists in roadmap but no directory):
420
+ If `phase_dir` is null (phase exists in roadmap but no directory), create it and use the printed path as `phase_dir`:
420
421
  ```bash
421
- mkdir -p ".planning/phases/${padded_phase}-${phase_slug}"
422
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs scaffold phase-dir --phase "${PHASE}" --name "{phase_name}" --raw
422
423
  ```
423
424
 
424
425
  **File location:** `${phase_dir}/${padded_phase}-context.md`
@@ -11,7 +11,7 @@ Read state.md before any operation to load project context.
11
11
 
12
12
  @~/.claude/pan-wizard-core/references/guardrails.md
13
13
 
14
- > **Also see:** `~/.claude/pan-wizard-core/learnings/universal/` — AI-derived patterns from prior experiments. **Don't skim the whole folder.** Run `pan-tools learn topics-for --agent executor --token-budget 5000 --raw` to load only the topics tagged relevant for execution at the configured budget. Per P-RES-002 (distractor-density research), reading every topic degrades reasoning even at modest token counts. Files appear here over time as `pan-tools learn promote` adds findings.
14
+ > **Also see:** `~/.claude/pan-wizard-core/learnings/universal/` — AI-derived patterns from prior experiments. **Don't skim the whole folder.** Run `pan-tools learn topics-for --agent executor --cue "<phase goal; the files it touches>" --token-budget 5000 --raw` to load the topics that match this task, within the budget; if none matches, it falls back to the topics tagged relevant for execution. Per P-RES-002 (distractor-density research), reading every topic degrades reasoning even at modest token counts. Files appear here over time as `pan-tools learn promote` adds findings.
15
15
  </required_reading>
16
16
 
17
17
  ## Re-Read Checkpoints
@@ -20,7 +20,7 @@ Context compaction may have dropped earlier sections. Re-read the relevant secti
20
20
 
21
21
  | Before this step | Re-read | Why |
22
22
  |------------------|---------|-----|
23
- | Spawning a subagent | This workflow's `<step name="execute">` block | Wave/segment routing is easy to misremember after compaction |
23
+ | Spawning a subagent | This workflow's `<step name="execute_waves">` block | Wave/segment routing is easy to misremember after compaction |
24
24
  | Writing code in a plan | `references/tdd.md` + plan file | Conventions and the plan's tasks drift across long sessions |
25
25
  | Committing | `references/guardrails.md` | Pre-commit shortcuts (silent model swaps, scope creep) are tempting under pressure |
26
26
  | Marking phase complete | `workflows/verify-phase.md` | Completion criteria are easy to misremember |
@@ -34,7 +34,7 @@ Load all context in one call:
34
34
  INIT=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs init execute-phase "${PHASE_ARG}")
35
35
  ```
36
36
 
37
- Parse JSON for: `executor_model`, `verifier_model`, `reviewer_model`, `commit_docs`, `parallelization`, `branching_strategy`, `branch_name`, `phase_found`, `phase_dir`, `phase_number`, `phase_name`, `phase_slug`, `plans`, `incomplete_plans`, `plan_count`, `incomplete_count`, `state_exists`, `roadmap_exists`, `phase_req_ids`.
37
+ Parse JSON for: `executor_model`, `verifier_model`, `reviewer_model`, `commit_docs`, `parallelization`, `branching_strategy`, `branch_name`, `phase_found`, `phase_dir`, `phase_number`, `phase_name`, `phase_slug`, `plans`, `incomplete_plans`, `plan_count`, `incomplete_count`, `state_exists`, `roadmap_exists`, `phase_req_ids`, `verifier_enabled`.
38
38
 
39
39
  **If `phase_found` is false:** Error — phase directory not found.
40
40
  **If `plan_count` is 0:** Error — no plans found in phase.
@@ -49,6 +49,11 @@ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs optimize trace init \
49
49
  --command "exec-phase" \
50
50
  --phase "${PHASE_ARG}" 2>/dev/null || true
51
51
  ```
52
+
53
+ **The phase's roadmap slice** — what executing this phase needs from roadmap.md and requirements.md (a line per phase, this phase's section, its dependencies' goals, its requirement lines). Plans name it in their `<context>`; this writes it for plans made before it existed:
54
+ ```bash
55
+ SLICE_PATH=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs roadmap slice "${phase_number}" --write --raw)
56
+ ```
52
57
  </step>
53
58
 
54
59
  <step name="handle_branching">
@@ -70,42 +75,6 @@ From init JSON: `phase_dir`, `plan_count`, `incomplete_count`.
70
75
  Report: "Found {plan_count} plans in {phase_dir} ({incomplete_count} incomplete)"
71
76
  </step>
72
77
 
73
- <step name="load_phase_memory">
74
- **Load project memory before dispatching executors — prevents re-learning patterns already solved.**
75
-
76
- ```bash
77
- ls .planning/memory/*.md 2>/dev/null
78
- ```
79
-
80
- If `.planning/memory/` exists and contains `.md` files:
81
- 1. **Check the memory-load budget first** (ADR-0036 — keeps per-agent injection bounded as logs grow):
82
- ```bash
83
- node ~/.claude/pan-wizard-core/bin/pan-tools.cjs memory budget --raw
84
- ```
85
- 2. **Load, size-gated — whole-file is the default:**
86
- - If `status` is `ok`: **read every file whole** (Read tool) and condense each entry to its rule(s) — 1–3 lines per file. This preserves the "apply every rule" contract for normal-sized logs.
87
- - If `status` is `warning` or `critical` (a log has grown large): load a **cue-scoped** slice per agent instead of the whole log, using the phase objective + the files this phase touches as the cue:
88
- ```bash
89
- node ~/.claude/pan-wizard-core/bin/pan-tools.cjs memory select <agent> --cue "<phase objective; changed files>" --raw
90
- ```
91
- Run once per agent that has a memory file. The returned `selected` entries are already recency-floored and token-budgeted (the newest lessons are always included). If `selected` is empty for an agent, **fall back to reading that file whole** — never silently drop an agent's memory.
92
- 3. Store the condensed rules as a `MEMORY_RULES` block for injection into executor prompts in execute_waves.
93
- 4. **Log memory priming to trace:**
94
- ```bash
95
- MEMORY_COUNT=$(ls .planning/memory/*.md 2>/dev/null | wc -l | tr -d ' ')
96
- if [ "$MEMORY_COUNT" -gt "0" ]; then
97
- node ~/.claude/pan-wizard-core/bin/pan-tools.cjs optimize trace log \
98
- --type decision --category memory_primed \
99
- --description "Loaded ${MEMORY_COUNT} memory entries before Wave 1 dispatch" \
100
- --agent orchestrator --impact minor \
101
- --context "{\"memory_count\":${MEMORY_COUNT}}" \
102
- 2>/dev/null || true
103
- fi
104
- ```
105
-
106
- If no memory files exist: skip (no trace event needed).
107
- </step>
108
-
109
78
  <step name="discover_and_group_plans">
110
79
  Load plan inventory with wave grouping in one call:
111
80
 
@@ -115,7 +84,7 @@ PLAN_INDEX=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs phase-plan-index "
115
84
 
116
85
  Parse JSON for: `phase`, `plans[]` (each with `id`, `wave`, `autonomous`, `objective`, `files_modified`, `task_count`, `has_summary`), `waves` (map of wave number → plan IDs), `incomplete`, `has_checkpoints`.
117
86
 
118
- **Filtering:** Skip plans where `has_summary: true`. If `--gaps-only`: also skip non-gap_closure plans. If all filtered: "No matching incomplete plans" → exit.
87
+ **Filtering:** Skip plans where `has_summary: true`. If `--gaps-only`: also skip plans whose frontmatter lacks `gap_closure: true` (`phase-plan-index` does not report it; `frontmatter get <plan> --field gap_closure` exits 1 when it is absent). If all filtered: "No matching incomplete plans" → exit.
119
88
 
120
89
  **If `--gaps-only`:** this run is the fix round after a verification found gaps — a second attempt at work that failed once. Resolve the executor for that attempt and use it in place of `executor_model` for every spawn in this run:
121
90
 
@@ -197,10 +166,7 @@ Execute each wave in sequence. Within a wave: parallel if `PARALLELIZATION=true`
197
166
  - .agents/skills/ (Project skills, if exists — list skills, read SKILL.md for each, follow relevant rules during implementation)
198
167
  </files_to_read>
199
168
 
200
- <project_memory>
201
- {MEMORY_RULES — insert condensed content of all .planning/memory/*.md files read in load_phase_memory step. If no memory files exist, omit this block entirely.}
202
- Apply every rule in this block without exception. These are lessons from previous phases that the reviewer has already verified.
203
- </project_memory>
169
+ If the plan's `<context>` names `@.planning/roadmap.md`, read `{slice_path}` in its place: it carries this phase's section, its dependencies' goals and its requirements, and the whole roadmap is the largest file in `.planning/` on a long project. Open the whole file only for something the slice leaves out.
204
170
 
205
171
  <success_criteria>
206
172
  - [ ] All tasks executed
@@ -256,7 +222,11 @@ Execute each wave in sequence. Within a wave: parallel if `PARALLELIZATION=true`
256
222
 
257
223
  **Known Claude Code bug (classifyHandoffIfNeeded):** If an agent reports "failed" with error containing `classifyHandoffIfNeeded is not defined`, this is a Claude Code runtime bug — not a PAN or agent issue. The error fires in the completion handler AFTER all tool calls finish. In this case: run the same spot-checks as step 4 (summary.md exists, git commits present, no Self-Check: FAILED). If spot-checks PASS → treat as **successful**. If spot-checks FAIL → treat as real failure below.
258
224
 
259
- For real failures: report which plan failed → ask "Continue?" or "Stop?" → if continue, dependent plans may also fail. If stop, partial completion report.
225
+ For real failures: report which plan failed → ask "Continue?" or "Stop?". If stop, partial completion report. If continue, never run a plan that depends on a failed one; ask the engine which plans are blocked:
226
+ ```bash
227
+ BLOCKED=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs phase-plan-index "${PHASE_NUMBER}" --failed "${FAILED_PLAN_IDS}")
228
+ ```
229
+ `${FAILED_PLAN_IDS}` is the comma-separated ids of every plan that failed so far. `blocked` lists each unfinished plan whose `depends_on` reaches a failed plan, directly or through another blocked plan, with the failed plans behind it. Do not spawn those plans in this or any later wave. Name them in the wave report and the final summary ("Skipped 03-03 and 03-04: they depend on 03-01, which failed"), and run every other plan as planned. The same applies after "Continue with remaining waves?" in step 4.
260
230
 
261
231
  6. **Execute checkpoint plans between waves** — see `<checkpoint_handling>`.
262
232
 
@@ -275,7 +245,7 @@ AUTO_CFG=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs config-get workflow.
275
245
 
276
246
  When executor returns a checkpoint AND `AUTO_CFG` is `"true"`:
277
247
  - **human-verify** → Auto-spawn continuation agent with `{user_response}` = `"approved"`. Log `⚡ Auto-approved checkpoint`.
278
- - **decision** → Auto-spawn continuation agent with `{user_response}` = first option from checkpoint details. Log `⚡ Auto-selected: [option]`.
248
+ - **decision** → The executor already took the plan's `auto_select` option when the task had one, so a decision that comes back has none: present it to the user (standard flow below). If a returned decision's task does carry `auto_select` in the plan file, auto-spawn the continuation agent with `{user_response}` = that option id and log `⚡ Auto-selected: [option] (auto_select)`. Never answer with an option because it is listed first.
279
249
  - **human-action** → Present to user (existing behavior below). Auth gates cannot be automated.
280
250
 
281
251
  **Standard flow (not auto-mode, or human-action type):**
@@ -521,8 +491,8 @@ fi
521
491
 
522
492
  **2. Find parent UAT file:**
523
493
  ```bash
524
- PARENT_INFO=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs find-phase "${PARENT_PHASE}" --raw)
525
- # Extract directory from PARENT_INFO JSON, then find UAT file in that directory
494
+ PARENT_DIR=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs find-phase "${PARENT_PHASE}" --raw)
495
+ # --raw prints the phase directory itself (empty when not found); find the UAT file in it
526
496
  ```
527
497
 
528
498
  **If no parent UAT found:** Skip this step (gap-closure may have been triggered by verification.md instead).
@@ -552,21 +522,25 @@ mv .planning/debug/{slug}.md .planning/debug/resolved/
552
522
 
553
523
  **6. Commit updated artifacts:**
554
524
  ```bash
555
- node ~/.claude/pan-wizard-core/bin/pan-tools.cjs commit "docs(phase-${PARENT_PHASE}): resolve UAT gaps and debug sessions after ${PHASE_NUMBER} gap closure" --files .planning/phases/*${PARENT_PHASE}*/*-uat.md .planning/debug/resolved/*.md
525
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs commit "docs(phase-${PARENT_PHASE}): resolve UAT gaps and debug sessions after ${PHASE_NUMBER} gap closure" --files .planning/phases/*${PARENT_PHASE}*/*-uat.md .planning/debug/
556
526
  ```
557
527
  </step>
558
528
 
559
529
  <step name="verify_phase_goal">
560
530
  Verify phase achieved its GOAL, not just completed tasks.
561
531
 
532
+ **If `verifier_enabled` is false** (`workflow.verifier: false`, set by `/pan:settings` or at project setup): skip this step. Say "verification skipped (workflow.verifier is off)" when you report the phase, and go to update_roadmap. `/pan:verify-phase {X}` still verifies on demand.
533
+
562
534
  ```
563
535
  Task(
564
536
  prompt="Verify phase {phase_number} goal achievement.
565
537
  Phase directory: {phase_dir}
566
538
  Phase goal: {goal from roadmap.md}
567
539
  Phase requirement IDs: {phase_req_ids}
540
+ Roadmap slice: {slice_path} — this phase's section, its dependencies' goals and its requirement lines. Read it instead of roadmap.md and requirements.md.
568
541
  Check must_haves against actual codebase.
569
- Cross-reference requirement IDs from PLAN frontmatter against requirements.md — every ID MUST be accounted for.
542
+ Cross-reference requirement IDs from PLAN frontmatter against the slice's requirement lines — every ID MUST be accounted for.
543
+ Run the project's test suite as the test gate (the run_test_suite step of @~/.claude/pan-wizard-core/workflows/verify-phase.md) and record test_gate in the frontmatter.
570
544
  Create verification.md.",
571
545
  subagent_type="pan-verifier",
572
546
  model="{verifier_model}"
@@ -585,7 +559,7 @@ VERIF_STATUS=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs findings record
585
559
 
586
560
  | Status | Action |
587
561
  |--------|--------|
588
- | `passed` | → update_roadmap |
562
+ | `passed` | → update_roadmap. If the verification frontmatter has `test_gate: skipped` or a `not_checked` list, say so when you report the phase: "passed — not checked: tests (no test script)". A pass never hides what it did not check |
589
563
  | `human_needed` | Present items for human testing, get approval or feedback |
590
564
  | `gaps_found` | Present gap summary, offer `/pan:plan-phase {phase} --gaps` |
591
565
 
@@ -660,18 +634,18 @@ The report files are appended to the completion commit's `--files` list (`$REPOR
660
634
  node ~/.claude/pan-wizard-core/bin/pan-tools.cjs commit "docs(phase-{X}): complete phase execution" --files .planning/roadmap.md .planning/state.md .planning/requirements.md {phase_dir}/*-verification.md $REPORT_FILES
661
635
  ```
662
636
 
663
- **Circular optimization — finalize trace session:**
664
- ```bash
665
- node ~/.claude/pan-wizard-core/bin/pan-tools.cjs optimize trace end 2>/dev/null || true
666
- ```
667
-
668
- Log phase completion event:
637
+ Log phase completion event (before the session ends: `trace end` clears the active-session pointer, and a `trace log` after it lands in a separate day-scoped `sess_auto_*` session):
669
638
  ```bash
670
639
  node ~/.claude/pan-wizard-core/bin/pan-tools.cjs optimize trace log \
671
640
  --type decision --category phase_complete \
672
- --description "Phase ${PHASE_NUMBER} execution complete (${VERIFICATION_STATUS:-verified})" \
641
+ --description "Phase ${PHASE_NUMBER} execution complete (${VERIF_STATUS:-verified})" \
673
642
  --agent orchestrator --impact minor 2>/dev/null || true
674
643
  ```
644
+
645
+ **Circular optimization — finalize trace session:**
646
+ ```bash
647
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs optimize trace end 2>/dev/null || true
648
+ ```
675
649
  </step>
676
650
 
677
651
  <step name="offer_next">
@@ -685,14 +659,14 @@ Parse `--no-transition` flag from $ARGUMENTS.
685
659
  **If `--no-transition` flag present:**
686
660
 
687
661
  Execute-phase was spawned by plan-phase's auto-advance. Do NOT run transition.md.
688
- After verification passes and roadmap is updated, return completion status to parent:
662
+ If verification found gaps, return `## GAPS FOUND` with the phase, score and gap summaries (plan-phase and discuss-phase stop the chain on it). After verification passes and roadmap is updated, return completion status to parent:
689
663
 
690
664
  ```
691
665
  ## PHASE COMPLETE
692
666
 
693
667
  Phase: ${PHASE_NUMBER} - ${PHASE_NAME}
694
668
  Plans: ${completed_count}/${total_count}
695
- Verification: {Passed | Gaps Found}
669
+ Verification: {Passed | Skipped (workflow.verifier is off)}
696
670
 
697
671
  [Include aggregate_results output]
698
672
  ```
@@ -9,7 +9,7 @@ Read config.json for planning behavior settings.
9
9
  @~/.claude/pan-wizard-core/references/git-integration.md
10
10
  @~/.claude/pan-wizard-core/references/guardrails.md
11
11
 
12
- > **Also see:** `~/.claude/pan-wizard-core/learnings/universal/` — AI-derived patterns from prior experiments. **Don't skim the whole folder.** Run `pan-tools learn topics-for --agent executor --token-budget 5000 --raw` to load only the topics tagged relevant for execution at the configured budget. Per P-RES-002 (distractor-density research), reading every topic degrades reasoning even at modest token counts.
12
+ > **Also see:** `~/.claude/pan-wizard-core/learnings/universal/` — AI-derived patterns from prior experiments. **Don't skim the whole folder.** Run `pan-tools learn topics-for --agent executor --cue "<plan objective; the files it modifies>" --token-budget 5000 --raw` to load the topics that match this task, within the budget; if none matches, it falls back to the topics tagged relevant for execution. Per P-RES-002 (distractor-density research), reading every topic degrades reasoning even at modest token counts.
13
13
  </required_reading>
14
14
 
15
15
  ## Re-Read Checkpoints
@@ -47,7 +47,8 @@ ls .planning/phases/XX-name/*-summary.md 2>/dev/null | sort
47
47
  Find first PLAN without matching SUMMARY. Decimal phases supported (`01.1-hotfix/`):
48
48
 
49
49
  ```bash
50
- PHASE=$(echo "$PLAN_PATH" | grep -oE '[0-9]+(\.[0-9]+)?-[0-9]+')
50
+ PHASE=$(basename "$PLAN_PATH" | grep -oE '^[0-9]+(\.[0-9]+)?')
51
+ PLAN=$(basename "$PLAN_PATH" | grep -oE '^[0-9]+(\.[0-9]+)?-[0-9]+' | cut -d- -f2)
51
52
  # config settings can be fetched via pan-tools config-get if needed
52
53
  ```
53
54
 
@@ -137,8 +138,8 @@ This IS the execution instructions. Follow exactly. If plan references context.m
137
138
 
138
139
  <step name="previous_phase_check">
139
140
  ```bash
140
- node ~/.claude/pan-wizard-core/bin/pan-tools.cjs phases list --type summaries --raw
141
- # Extract the second-to-last summary from the JSON result
141
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs phases list --type summaries
142
+ # Extract the second-to-last summary from the JSON result's files[] (file names only, in phase order)
142
143
  ```
143
144
  If previous SUMMARY has unresolved "Issues Encountered" or "Next Phase Readiness" blockers: AskUserQuestion(header="Previous Issues", options: "Proceed anyway" | "Address first" | "Review previous").
144
145
  </step>
@@ -277,7 +278,7 @@ TASK_COMMITS+=("Task ${TASK_NUM}: ${TASK_COMMIT}")
277
278
  <step name="checkpoint_protocol">
278
279
  On `type="checkpoint:*"`: automate everything possible first. Checkpoints are for verification/decisions only.
279
280
 
280
- Display: `CHECKPOINT: [Type]` box → Progress {X}/{Y} → Task name → type-specific content → `YOUR ACTION: [signal]`
281
+ Display: `CHECKPOINT: [Type]` box → Progress {X}/{Y} → Task name → type-specific content → the action prompt line `→ [signal]`
281
282
 
282
283
  | Type | Content | Resume signal |
283
284
  |------|---------|---------------|
@@ -333,7 +334,7 @@ Create `{phase}-{plan}-summary.md` at `.planning/phases/XX-name/`. Use `~/.claud
333
334
 
334
335
  **Frontmatter:** phase, plan, subsystem, tags | requires/provides/affects | tech-stack.added/patterns | key-files.created/modified | key-decisions | requirements-completed (**MUST** copy `requirements` array from plan.md frontmatter verbatim) | duration ($DURATION), completed ($PLAN_END_TIME date).
335
336
 
336
- Title: `# Phase [X] Plan [Y]: [Name] Summary`
337
+ Title: `# Phase [X]: [Name] Summary` (the summary template's)
337
338
 
338
339
  One-liner SUBSTANTIVE: "JWT auth with refresh rotation using jose library" not "Authentication implemented"
339
340
 
@@ -382,7 +383,7 @@ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs state record-session \
382
383
  --resume-file "None"
383
384
  ```
384
385
 
385
- Keep state.md under 150 lines.
386
+ Keep state.md under 100 lines (the state template's size constraint).
386
387
  </step>
387
388
 
388
389
  <step name="issues_review_gate">
@@ -11,13 +11,13 @@ Read all files referenced by the invoking prompt's execution_context before star
11
11
  <step name="parse_args">
12
12
  **Parse arguments:**
13
13
 
14
- Check if `--repair` flag is present in the command arguments.
14
+ Check which of `--repair`, `--standards`, `--full`, `--drift` and `--links` are present in the command arguments; `validate health` reads all five.
15
15
 
16
16
  ```
17
- REPAIR_FLAG=""
18
- if arguments contain "--repair"; then
19
- REPAIR_FLAG="--repair"
20
- fi
17
+ HEALTH_FLAGS=""
18
+ for flag in --repair --standards --full --drift --links; do
19
+ if arguments contain "$flag"; then HEALTH_FLAGS="$HEALTH_FLAGS $flag"; fi
20
+ done
21
21
  ```
22
22
  </step>
23
23
 
@@ -25,7 +25,7 @@ fi
25
25
  **Run health validation:**
26
26
 
27
27
  ```bash
28
- node ~/.claude/pan-wizard-core/bin/pan-tools.cjs validate health $REPAIR_FLAG
28
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs validate health $HEALTH_FLAGS
29
29
  ```
30
30
 
31
31
  Parse JSON output:
@@ -84,7 +84,7 @@ Errors: N | Warnings: N | Info: N
84
84
  ```
85
85
  ## Errors
86
86
 
87
- - [E001] config.json: JSON parse error at line 5
87
+ - [E005] config.json: JSON parse error - <parser message>
88
88
  Fix: Run /pan:health --repair to reset to defaults
89
89
 
90
90
  - [E002] project.md not found
@@ -95,7 +95,7 @@ Errors: N | Warnings: N | Info: N
95
95
  ```
96
96
  ## Warnings
97
97
 
98
- - [W001] state.md references phase 5, but only phases 1-3 exist
98
+ - [W002] state.md references phase 5, but only phases 01, 02, 03 exist
99
99
  Fix: Run /pan:health --repair to regenerate
100
100
 
101
101
  - [W005] Phase directory "1-setup" doesn't follow NN-name format
@@ -165,7 +165,8 @@ Report final status.
165
165
  | I003 | info | Focus-model or campaign tree — the phase-model checks do not apply | No |
166
166
  | I004 | info | planning-with-files shares the tree — PAN leaves its files alone | No |
167
167
  | I005 | info | The planning tree is gitignored while commit_docs is true — planning commits commit nothing | No |
168
- | STATE_REQ_DRIFT | warning | state.md complete but REQUIREMENTS.md has unchecked boxes | Yes |
168
+ | I006 | info | config.json holds keys PAN's code does not read (usually a typo); the fix names the nearest known key. It also lists `gates` and `safety` from templates/config.json: the `custom`-mode conditions in transition.md and execute-plan.md read `gates`; nothing reads `safety` (transition.md asks before skipping plans in every mode) | No |
169
+ | STATE_REQ_DRIFT | warning | state.md complete but requirements.md has unchecked boxes | Yes |
169
170
  | STATE_ROADMAP_DRIFT | warning | state.md complete but roadmap.md has unchecked plan boxes | Yes |
170
171
  | VERIFICATION_GATE_MISSING | warning | Phase has completed plans but no verification record | No |
171
172
 
@@ -175,7 +176,6 @@ Flag-gated codes:
175
176
  |------|----------|------|-------------|------------|
176
177
  | TESTS_FAIL | error | --full | Test run exited non-zero | No |
177
178
  | BUILD_FAIL | error | --full | Build exited non-zero | No |
178
- | MEM_BUDGET | warning / info | --full | Memory injection over budget | No |
179
179
  | DRIFT_HIGH | warning | --drift | Drift verdict is high | No |
180
180
  | DRIFT_MEDIUM | info | --drift | Drift verdict is medium | No |
181
181
  | LINKS_ERR | warning | --links | Link graph has errors | No |
@@ -196,7 +196,9 @@ or behind the current position warns.
196
196
  |--------|--------|------|
197
197
  | createConfig | Create config.json with defaults | None |
198
198
  | resetConfig | Delete + recreate config.json | Loses custom settings |
199
- | regenerateState | Create state.md from ROADMAP structure | Loses session history |
199
+ | regenerateState | Back up state.md to `state.md.bak-<timestamp>`, then create state.md from ROADMAP structure | Session history only in the backup |
200
+ | syncRequirements | Tick requirements.md boxes when state.md says every plan is done (STATE_REQ_DRIFT) | Edits requirements.md checkboxes |
201
+ | syncRoadmap | Tick roadmap.md plan boxes when state.md says every plan is done (STATE_ROADMAP_DRIFT) | Edits roadmap.md checkboxes |
200
202
 
201
203
  **Not repairable (too risky):**
202
204
  - project.md, roadmap.md content