pan-wizard 3.34.0 → 3.36.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 (110) hide show
  1. package/README.md +16 -10
  2. package/agents/pan-conductor.md +2 -2
  3. package/agents/pan-debugger.md +3 -1
  4. package/agents/pan-design-checker.md +1 -0
  5. package/agents/pan-designer.md +1 -1
  6. package/agents/pan-executor.md +43 -1
  7. package/agents/pan-experiment-runner.md +1 -1
  8. package/agents/pan-hardener.md +3 -1
  9. package/agents/pan-meta-reviewer.md +1 -1
  10. package/agents/pan-phase-researcher.md +16 -2
  11. package/agents/pan-plan-checker.md +37 -9
  12. package/agents/pan-planner.md +14 -2
  13. package/agents/pan-previewer.md +2 -0
  14. package/agents/pan-project-researcher.md +9 -1
  15. package/agents/pan-research-synthesizer.md +1 -1
  16. package/agents/pan-reviewer.md +8 -2
  17. package/agents/pan-verifier.md +3 -3
  18. package/bin/install-lib.cjs +119 -16
  19. package/bin/install.js +34 -62
  20. package/commands/pan/cost.md +21 -5
  21. package/commands/pan/dashboard.md +0 -3
  22. package/commands/pan/design-phase.md +2 -2
  23. package/commands/pan/hud.md +1 -5
  24. package/commands/pan/knowledge.md +0 -1
  25. package/commands/pan/mcp-bridge.md +1 -3
  26. package/commands/pan/optimize.md +2 -0
  27. package/commands/pan/phase-tests.md +1 -1
  28. package/commands/pan/preview.md +2 -3
  29. package/commands/pan/report.md +1 -5
  30. package/commands/pan/research-phase.md +4 -4
  31. package/commands/pan/review-deep.md +0 -2
  32. package/commands/pan/what-if.md +1 -2
  33. package/hooks/dist/pan-context-monitor.js +12 -3
  34. package/hooks/dist/pan-guard.js +244 -0
  35. package/hooks/dist/pan-statusline.js +5 -2
  36. package/package.json +1 -1
  37. package/pan-wizard-core/bin/lib/commands.cjs +24 -2
  38. package/pan-wizard-core/bin/lib/config.cjs +13 -1
  39. package/pan-wizard-core/bin/lib/core.cjs +9 -4
  40. package/pan-wizard-core/bin/lib/cost.cjs +146 -0
  41. package/pan-wizard-core/bin/lib/doc-lint.cjs +5 -3
  42. package/pan-wizard-core/bin/lib/findings.cjs +239 -23
  43. package/pan-wizard-core/bin/lib/git.cjs +1 -1
  44. package/pan-wizard-core/bin/lib/hygiene.cjs +11 -5
  45. package/pan-wizard-core/bin/lib/init.cjs +6 -0
  46. package/pan-wizard-core/bin/lib/mutate.cjs +257 -0
  47. package/pan-wizard-core/bin/lib/optimize.cjs +13 -1
  48. package/pan-wizard-core/bin/lib/phase-gate.cjs +180 -0
  49. package/pan-wizard-core/bin/lib/phase-remove.cjs +91 -11
  50. package/pan-wizard-core/bin/lib/phase.cjs +61 -9
  51. package/pan-wizard-core/bin/lib/plan-lint.cjs +161 -0
  52. package/pan-wizard-core/bin/lib/preview.cjs +35 -31
  53. package/pan-wizard-core/bin/lib/research-lint.cjs +121 -0
  54. package/pan-wizard-core/bin/lib/roadmap.cjs +1 -0
  55. package/pan-wizard-core/bin/lib/test-gate.cjs +433 -0
  56. package/pan-wizard-core/bin/lib/usage.cjs +104 -0
  57. package/pan-wizard-core/bin/lib/verdict.cjs +140 -10
  58. package/pan-wizard-core/bin/lib/verify-integrity.cjs +181 -0
  59. package/pan-wizard-core/bin/lib/verify-plan-set.cjs +230 -0
  60. package/pan-wizard-core/bin/lib/verify-red.cjs +138 -0
  61. package/pan-wizard-core/bin/lib/verify-scope.cjs +148 -6
  62. package/pan-wizard-core/bin/lib/verify.cjs +27 -27
  63. package/pan-wizard-core/bin/lib/whatif.cjs +48 -6
  64. package/pan-wizard-core/bin/pan-tools.cjs +106 -9
  65. package/pan-wizard-core/mcp/merge-gate.cjs +14 -3
  66. package/pan-wizard-core/mcp/native-tools.cjs +3 -3
  67. package/pan-wizard-core/mcp/orchestrator.cjs +4 -1
  68. package/pan-wizard-core/opencode/pan-wizard.js +36 -8
  69. package/pan-wizard-core/references/design-methodology.md +1 -1
  70. package/pan-wizard-core/references/handoff-decisions.md +1 -1
  71. package/pan-wizard-core/references/model-profiles.md +1 -1
  72. package/pan-wizard-core/references/planning-config.md +3 -3
  73. package/pan-wizard-core/references/verdict-contract.md +6 -1
  74. package/pan-wizard-core/templates/config.json +6 -6
  75. package/pan-wizard-core/templates/debug-subagent-prompt.md +2 -1
  76. package/pan-wizard-core/templates/design.md +5 -4
  77. package/pan-wizard-core/templates/phase-prompt.md +9 -0
  78. package/pan-wizard-core/templates/planner-subagent-prompt.md +2 -0
  79. package/pan-wizard-core/templates/preview-report.md +1 -1
  80. package/pan-wizard-core/templates/research-project/architecture.md +6 -0
  81. package/pan-wizard-core/templates/research-project/features.md +6 -0
  82. package/pan-wizard-core/templates/research-project/pitfalls.md +6 -0
  83. package/pan-wizard-core/templates/research-project/stack.md +6 -0
  84. package/pan-wizard-core/templates/research.md +10 -0
  85. package/pan-wizard-core/templates/state.md +4 -4
  86. package/pan-wizard-core/templates/summary-complex.md +5 -1
  87. package/pan-wizard-core/templates/summary-minimal.md +4 -0
  88. package/pan-wizard-core/templates/summary-standard.md +5 -1
  89. package/pan-wizard-core/templates/summary.md +8 -1
  90. package/pan-wizard-core/workflows/diagnose-issues.md +4 -4
  91. package/pan-wizard-core/workflows/discuss-phase.md +2 -1
  92. package/pan-wizard-core/workflows/exec-phase.md +92 -45
  93. package/pan-wizard-core/workflows/execute-plan.md +3 -1
  94. package/pan-wizard-core/workflows/help.md +103 -44
  95. package/pan-wizard-core/workflows/milestone-gaps.md +2 -2
  96. package/pan-wizard-core/workflows/new-project.md +8 -16
  97. package/pan-wizard-core/workflows/plan-phase.md +40 -8
  98. package/pan-wizard-core/workflows/progress.md +1 -1
  99. package/pan-wizard-core/workflows/quick.md +2 -2
  100. package/pan-wizard-core/workflows/remove-phase.md +11 -1
  101. package/pan-wizard-core/workflows/settings.md +17 -0
  102. package/pan-wizard-core/workflows/todo-check.md +3 -2
  103. package/pan-wizard-core/workflows/transition.md +4 -0
  104. package/pan-wizard-core/workflows/verify-phase.md +40 -47
  105. package/scripts/build-help.cjs +106 -0
  106. package/scripts/build-hooks.js +1 -0
  107. package/scripts/generate-skills-docs.py +2 -2
  108. package/scripts/mutation-probe.cjs +7 -80
  109. package/scripts/prompt-lint.cjs +167 -0
  110. package/scripts/test-surface.cjs +169 -6
@@ -53,7 +53,7 @@ completed: YYYY-MM-DD
53
53
  - DT-1: Chose [option] for O-N. Reason: [rationale].
54
54
 
55
55
  ### Deviations (from plan; must explain)
56
- - DV-1: Plan said [X]; I did [Y]. Reason: [rationale]. Verification: [how I confirmed Y is acceptable].
56
+ - DV-1: Plan said [X]; I did [Y]. Reason: [rationale]. Verification: [how I confirmed Y is acceptable]. Cost if wrong: [low | medium | high] — [what breaks].
57
57
 
58
58
  ### Open questions for verifier
59
59
  - Q-1: [question]. Why it matters: [stake].
@@ -64,6 +64,10 @@ completed: YYYY-MM-DD
64
64
  [Problems during planned work and resolutions — distinct from Deviations above:
65
65
  Issues = bugs/blockers fixed; Deviations = intentional departures from plan]
66
66
 
67
+ ## Concerns
68
+ [What was finished but is not certain, or "None"]
69
+ - C-1: [concern]. Why: [what makes it uncertain]. Cost if wrong: [low | medium | high] — [what breaks].
70
+
67
71
  ## Next Phase Readiness
68
72
  [What's ready for next phase]
69
73
  [Blockers or concerns]
@@ -44,5 +44,9 @@ completed: YYYY-MM-DD
44
44
  [One line each, or this single line if none:
45
45
  "No deviations or open questions — implementation followed plan exactly."]
46
46
 
47
+ ## Concerns
48
+ [What was finished but is not certain, or "None"]
49
+ - C-1: [concern]. Why: [what makes it uncertain]. Cost if wrong: [low | medium | high] — [what breaks].
50
+
47
51
  ## Next Phase Readiness
48
52
  [Ready for next phase]
@@ -49,7 +49,7 @@ completed: YYYY-MM-DD
49
49
  - DT-1: Chose [option] for O-N. Reason: [rationale].
50
50
 
51
51
  ### Deviations (from plan; must explain)
52
- - DV-1: Plan said [X]; I did [Y]. Reason: [rationale]. Verification: [how I confirmed Y is acceptable].
52
+ - DV-1: Plan said [X]; I did [Y]. Reason: [rationale]. Verification: [how I confirmed Y is acceptable]. Cost if wrong: [low | medium | high] — [what breaks].
53
53
 
54
54
  ### Open questions for verifier
55
55
  - Q-1: [question]. Why it matters: [stake].
@@ -57,5 +57,9 @@ completed: YYYY-MM-DD
57
57
  <!-- If none: replace ALL three buckets with:
58
58
  "No deviations or open questions — implementation followed plan exactly." -->
59
59
 
60
+ ## Concerns
61
+ [What was finished but is not certain, or "None"]
62
+ - C-1: [concern]. Why: [what makes it uncertain]. Cost if wrong: [low | medium | high] — [what breaks].
63
+
60
64
  ## Next Phase Readiness
61
65
  [What's ready for next phase]
@@ -88,7 +88,7 @@ _Note: TDD tasks may have multiple commits (test → feat → refactor)_
88
88
  - DT-1: Chose [option] for O-N. Reason: [rationale].
89
89
 
90
90
  ### Deviations (from plan; must explain)
91
- - DV-1: Plan said [X]; I did [Y]. Reason: [rationale]. Verification: [how I confirmed Y is acceptable].
91
+ - DV-1: Plan said [X]; I did [Y]. Reason: [rationale]. Verification: [how I confirmed Y is acceptable]. Cost if wrong: [low | medium | high] — [what breaks].
92
92
 
93
93
  ### Open questions for verifier
94
94
  - Q-1: [question]. Why it matters: [stake].
@@ -112,6 +112,7 @@ _Note: TDD tasks may have multiple commits (test → feat → refactor)_
112
112
  - **Fix:** [What was done]
113
113
  - **Files modified:** [file paths]
114
114
  - **Verification:** [How it was verified]
115
+ - **Cost if wrong:** [low | medium | high] — [what breaks, and for whom, if this call was wrong]
115
116
  - **Committed in:** [hash] (part of task commit)
116
117
 
117
118
  [... repeat for each auto-fix ...]
@@ -124,6 +125,12 @@ _Note: TDD tasks may have multiple commits (test → feat → refactor)_
124
125
  ## Issues Encountered
125
126
  [Problems and how they were resolved, or "None"]
126
127
 
128
+ ## Concerns
129
+
130
+ [What was finished but is not certain, or "None". Any entry here means the executor returned DONE_WITH_CONCERNS.]
131
+
132
+ - C-1: [concern]. Why: [what makes it uncertain]. Cost if wrong: [low | medium | high] — [what breaks].
133
+
127
134
  [Note: "Deviations from Plan" documents unplanned work that was handled automatically via deviation rules. "Issues Encountered" documents problems during planned work that required problem-solving.]
128
135
 
129
136
  ## User Setup Required
@@ -81,6 +81,7 @@ For each gap, fill the debug-subagent-prompt template and spawn:
81
81
  Task(
82
82
  prompt=filled_debug_subagent_prompt + "\n\n<files_to_read>\n- {phase_dir}/{phase_num}-uat.md\n- .planning/state.md\n</files_to_read>",
83
83
  subagent_type="pan-debugger",
84
+ model="{debugger_model}", # node ~/.claude/pan-wizard-core/bin/pan-tools.cjs resolve-model pan-debugger --raw
84
85
  description="Debug: {issue_summary_short}"
85
86
  )
86
87
  ```
@@ -181,11 +182,10 @@ Display:
181
182
 
182
183
  Debug sessions: ${DEBUG_DIR}/
183
184
 
184
- Proceeding to plan fixes...
185
+ Next: /pan:plan-phase {phase_num} --gaps
185
186
  ```
186
187
 
187
- Return to verify-phase orchestrator for automatic planning.
188
- Do NOT offer manual next steps - verify-phase handles the rest.
188
+ No command runs this workflow as a sub-step, so end by giving the user the next step: `/pan:plan-phase {phase_num} --gaps` (it reads the diagnosed uat.md).
189
189
  </step>
190
190
 
191
191
  </process>
@@ -217,5 +217,5 @@ Agents only diagnose—plan-phase --gaps handles fixes (no fix application).
217
217
  - [ ] Root causes collected from all agents
218
218
  - [ ] uat.md gaps updated with artifacts and missing
219
219
  - [ ] Debug sessions saved to ${DEBUG_DIR}/
220
- - [ ] Hand off to verify-phase for automatic planning
220
+ - [ ] Next step shown: /pan:plan-phase {phase_num} --gaps
221
221
  </success_criteria>
@@ -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 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.
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 42 cents of 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
 
@@ -599,6 +599,7 @@ Task(
599
599
  </instructions>
600
600
  ",
601
601
  subagent_type="general-purpose",
602
+ model="$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs resolve-model pan-conductor --raw)",
602
603
  description="Plan Phase ${PHASE}"
603
604
  )
604
605
  ```
@@ -34,12 +34,24 @@ 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`, `verifier_enabled`.
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`, `plan_check`, `plan_drift`. In the shell steps below, `$PHASE_DIR` (and `$phase_dir`) is `phase_dir` and `$PHASE_NUMBER` is `phase_number`.
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.
41
41
  **If `state_exists` is false but `.planning/` exists:** Offer reconstruct or continue.
42
42
 
43
+ **The plans must be the plans that passed the plan check** (`plan_check.status`):
44
+
45
+ | Status | Action |
46
+ |---|---|
47
+ | `ok`, `disabled` | Continue |
48
+ | `legacy` | Continue, and say: "the plan check predates plan hashing, so it cannot show these plans are unchanged" |
49
+ | `stale` | Stop: "The plans changed after they passed the plan check. Re-plan with `/pan:plan-phase {N} --skip-research`, which checks the new plans." Continue only if the user gives a reason, and record it: `pan-tools optimize trace log --type decision --category plan_check_overridden --description "<reason>"` |
50
+ | `failed` | Stop: "The last plan check found issues." Same override |
51
+ | `missing` | Stop: "No plan check is recorded for this phase." This includes plans made with `/pan:plan-phase --skip-verify` or with `workflow.plan_check` off after the fact. Same override |
52
+
53
+ **Drift.** For each `plan_drift` entry, tell the executor of that plan, in its prompt, which of its `files_modified` changed since it was planned (`files`), so it re-reads them before editing. An entry with `error` means its `planned_commit` is unknown: say so and continue.
54
+
43
55
  When `parallelization` is false, plans within a wave execute sequentially.
44
56
 
45
57
  **Circular optimization — start trace session for this exec:**
@@ -105,6 +117,14 @@ Report:
105
117
  | 1 | 01-01, 01-02 | {from plan objectives, 3-8 words} |
106
118
  | 2 | 01-03 | ... |
107
119
  ```
120
+
121
+ **Test baseline.** Before the first wave, record what the test suite does now, so the verifier can tell a failure this phase caused from one it inherited:
122
+
123
+ ```bash
124
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs test run --phase "${PHASE_NUMBER}" --baseline > /dev/null
125
+ ```
126
+
127
+ A phase that already has a baseline keeps it (a resumed run or a `--gaps-only` round compares against the phase's start, not its half-built state); the command says `kept_existing: true` and runs nothing. A failing or empty baseline is not a reason to stop: it is what the phase starts from.
108
128
  </step>
109
129
 
110
130
  <step name="execute_waves">
@@ -190,6 +210,10 @@ Execute each wave in sequence. Within a wave: parallel if `PARALLELIZATION=true`
190
210
 
191
211
  If ANY spot-check fails: report which plan failed, route to failure handler — ask "Retry plan?" or "Continue with remaining waves?"
192
212
 
213
+ **An executor that returned `## DONE_WITH_CONCERNS`** finished its plan: run the same spot-checks and treat it as complete. Keep its concerns (each with why and cost if wrong, also under `## Concerns` in its summary) for the wave report and the phase report. Do not stop the wave for them; a high-cost concern is something the review and the verifier should look at, and the phase report puts it in front of the user.
214
+
215
+ **An executor that returned `## BLOCKED_SPEC_CONFLICT`** found a test it cannot satisfy without weakening it. It is not a failure to retry: show the user its Test, Requirement and Options and ask for a ruling. "Change the test" means a revised plan that declares the test file in `files_modified` (`/pan:plan-phase {N} --gaps` or an edit to the plan), then re-run that plan; "change the requirement" means updating the requirement and the plan. Never re-run the same plan unchanged: it would meet the same test. Declaring the file permits rewriting its expectations; deleting the test, skipping it or dropping assertions still fails `verify test-integrity`, so a ruling to do that also needs `phase complete --force --reason`.
216
+
193
217
  If pass:
194
218
  ```
195
219
  ---
@@ -197,7 +221,8 @@ Execute each wave in sequence. Within a wave: parallel if `PARALLELIZATION=true`
197
221
 
198
222
  **{Plan ID}: {Plan Name}**
199
223
  {What was built — from summary.md}
200
- {Notable deviations, if any}
224
+ {Notable deviations, if any, with their cost if wrong}
225
+ {Concerns, if it returned DONE_WITH_CONCERNS}
201
226
 
202
227
  {If more waves: what this enables for next wave}
203
228
  ---
@@ -215,6 +240,12 @@ Execute each wave in sequence. Within a wave: parallel if `PARALLELIZATION=true`
215
240
  2>/dev/null || true
216
241
  ```
217
242
 
243
+ Check the phase's spend against its budget (`cost.phase_budget_usd`, default $20; it only warns):
244
+ ```bash
245
+ BUDGET=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs cost budget --phase "${PHASE_NUMBER}" 2>/dev/null)
246
+ ```
247
+ When its `status` is `near` or `over`, add one line to the wave report: "Spend: ${spent_usd} of the ${budget_usd} phase budget (${pct}%)", and for `over`, "over budget: the phase keeps running; change the budget with /pan:settings". Do not stop, pause or ask: the budget warns, it never blocks. `ok` and `off` add nothing.
248
+
218
249
  - Bad: "Wave 2 complete. Proceeding to Wave 3."
219
250
  - Good: "Terrain system complete — 3 biome types, height-based texturing, physics collision meshes. Vehicle physics (Wave 3) can now reference ground surfaces."
220
251
 
@@ -309,7 +340,14 @@ After all waves:
309
340
 
310
341
  ### Issues Encountered
311
342
  [Aggregate from SUMMARYs, or "None"]
343
+
344
+ ### Concerns
345
+ [Every concern from the plans that returned DONE_WITH_CONCERNS (and any `## Concerns` entry in a summary), high cost if wrong first:]
346
+ - **03-02** C-1: [concern]. Why: [...]. Cost if wrong: high — [what breaks]
347
+ [Or "None"]
312
348
  ```
349
+
350
+ Concerns go into the review too: the code_review step passes them to the reviewer as `${EXECUTOR_CONCERNS}`, so a high-cost concern is checked rather than only reported.
313
351
  </step>
314
352
 
315
353
  <step name="generate_tests">
@@ -319,7 +357,7 @@ After all waves:
319
357
 
320
358
  1. Record baseline test count:
321
359
  ```bash
322
- TEST_BASELINE=$(npm test 2>&1 | grep -E "^ℹ tests" | awk '{print $NF}')
360
+ TEST_BASELINE=$(npm test 2>&1 | grep -E "^(ℹ|#) tests" | awk '{print $NF}')
323
361
  ```
324
362
 
325
363
  2. Invoke phase-tests workflow for the completed phase:
@@ -331,7 +369,8 @@ Read each summary.md to understand what was built.
331
369
  Generate unit and integration tests for the new code.
332
370
  Discover the project's existing test patterns, directories, frameworks, and helpers before writing tests.
333
371
  Follow whatever conventions the project already uses.",
334
- subagent_type="general-purpose"
372
+ subagent_type="general-purpose",
373
+ model="{executor_model}",
335
374
  )
336
375
  ```
337
376
 
@@ -342,7 +381,7 @@ Alternatively, if the user's AI tool supports it, invoke the command directly:
342
381
 
343
382
  3. Record new test count:
344
383
  ```bash
345
- TEST_AFTER=$(npm test 2>&1 | grep -E "^ℹ tests" | awk '{print $NF}')
384
+ TEST_AFTER=$(npm test 2>&1 | grep -E "^(ℹ|#) tests" | awk '{print $NF}')
346
385
  ```
347
386
 
348
387
  4. Report:
@@ -353,6 +392,8 @@ TEST_AFTER=$(npm test 2>&1 | grep -E "^ℹ tests" | awk '{print $NF}')
353
392
  - New tests: +$((TEST_AFTER - TEST_BASELINE))
354
393
  ```
355
394
 
395
+ `ℹ tests N` (spec reporter) and `# tests N` (TAP, Node's default for piped output before Node 23) are the summary lines of Node's built-in test runner, and both greps above match either. With any other runner both counts come back empty, so report the runner's own summary line instead of `+0`.
396
+
356
397
  **If tests fail after generation:** Report failures but continue to next step. Test issues are caught by the verify-phase test gate.
357
398
  </step>
358
399
 
@@ -361,15 +402,17 @@ TEST_AFTER=$(npm test 2>&1 | grep -E "^ℹ tests" | awk '{print $NF}')
361
402
 
362
403
  **Skip if** `--skip-review` or `--fast` flag is present in $ARGUMENTS.
363
404
 
364
- 1. Collect changed files from executor summaries:
405
+ 1. Collect the review scope: the files the phase's commits changed plus any uncommitted or untracked work, whether or not a summary lists them, and the intent to judge them against:
365
406
  ```bash
366
- # Read each summary.md and extract key-files.created + key-files.modified
367
- for summary in "$PHASE_DIR"/*-summary.md; do
368
- grep -A 50 "key-files" "$summary" | grep -E "^\s*-" | sed 's/^\s*- //'
369
- done | sort -u > /tmp/review-files.txt
407
+ REVIEW_SCOPE=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs review scope "${PHASE_NUMBER}")
408
+ CHANGED_FILES_LIST=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs review scope "${PHASE_NUMBER}" --raw)
370
409
  ```
410
+ `REVIEW_SCOPE` is JSON. Its `unlisted` array holds the changed files no summary's key-files names. Review them like the others: an executor that changed a file without listing it is exactly what a review must not miss. Its `intent` holds each plan's objective, `must_haves` and Review Focus, and the text of the requirements the plans claim.
371
411
 
372
- 2. Spawn pan-reviewer:
412
+ 2. Collect the reviewer's earlier open findings on this phase (empty on a first review), then spawn pan-reviewer:
413
+ ```bash
414
+ OPEN_REVIEW_FINDINGS=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs findings list --phase "${PHASE_NUMBER}" --agent pan-reviewer --status open 2>/dev/null)
415
+ ```
373
416
  ```
374
417
  Task(
375
418
  subagent_type="pan-reviewer",
@@ -391,6 +434,23 @@ Task(
391
434
  Phase: ${PHASE_NUMBER} - ${PHASE_NAME}
392
435
  Phase directory: ${phase_dir}
393
436
  </context>
437
+
438
+ <intent>
439
+ The plans' objectives, must_haves and Review Focus, the requirements they claim,
440
+ and the changed files no summary listed (review scope JSON):
441
+ ${REVIEW_SCOPE}
442
+ </intent>
443
+
444
+ <executor_concerns>
445
+ What the executors finished but were not sure of, each with why and its cost if
446
+ wrong (from DONE_WITH_CONCERNS returns and the summaries' ## Concerns). Check the
447
+ high-cost ones first. Empty when there were none:
448
+ ${EXECUTOR_CONCERNS}
449
+ </executor_concerns>
450
+
451
+ <open_findings>
452
+ ${OPEN_REVIEW_FINDINGS}
453
+ </open_findings>
394
454
  "
395
455
  )
396
456
  ```
@@ -426,7 +486,7 @@ The fallback reads the word under `### Verdict` when the report carries no valid
426
486
  node ~/.claude/pan-wizard-core/bin/pan-tools.cjs findings dispose --phase "${PHASE_NUMBER}" --agent pan-reviewer --open --as deferred --reason "accepted at review: PASS_WITH_WARNINGS"
427
487
  ```
428
488
  - **The user chooses "Continue anyway"** at `NEEDS_FIXES`: the same command with `--reason "continued past NEEDS_FIXES at the user's choice"`, then proceed to verification.
429
- - **The user chooses "Fix before verification"**: apply the fixes, then run the review once more (steps 2–4). The new record closes the findings it no longer reports.
489
+ - **The user chooses "Fix before verification"**: apply the fixes, then run the review once more (steps 2–4). The re-review answers each earlier finding in its `resolutions`; the record closes the ones it answers `resolved` with evidence, and one it neither reports nor answers stays open.
430
490
 
431
491
  5. **No separate trace logging.** The record logs `verdict_passed` or `verdict_failed` for the reviewer on every runtime. The `reviewer_correction` and `reviewer_warnings` trace calls that used to sit here read the error count from a shell variable nothing ever set.
432
492
 
@@ -553,7 +613,7 @@ VERIF_FILE=$(ls "$PHASE_DIR"/*-verification.md 2>/dev/null | head -1)
553
613
  VERIF_STATUS=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs findings record --phase "${PHASE_NUMBER}" --file "$VERIF_FILE" --raw 2>/dev/null) \
554
614
  || VERIF_STATUS=$(grep "^status:" "$VERIF_FILE" | cut -d: -f2 | tr -d ' ')
555
615
  ```
556
- `findings record` reads the verdict from the verification frontmatter (`status`, `gaps`, `human_verification`, `unrequested`) and adds its findings to the ledger. A re-verification after a fix round is the next attempt: the gaps it no longer reports are closed, and the retry is logged. Recording the same file twice is a no-op, so verify-phase recording it too is safe. The grep fallback keeps the old reading when the record cannot parse the file.
616
+ `findings record` reads the verdict from the verification frontmatter (`status`, `gaps`, `human_verification`, `unrequested`) and adds its findings to the ledger. A re-verification after a fix round is the next attempt: the gaps it lists under `re_verification.gaps_closed` are closed, a gap it neither reports nor answers stays open (listed in `unaddressed`), and the retry is logged. Recording the same file twice is a no-op, so verify-phase recording it too is safe. The grep fallback keeps the old reading when the record cannot parse the file.
557
617
 
558
618
  **Trace logging happens in the record.** The record above logs the verification outcome (`verdict_passed`, `verdict_failed` or `verdict_needs_human`) here, after the verifier returns. That covers inline verification too, which is the reason P-1806 moved the trace call here (v3.7.8). No separate `optimize trace log` call is needed.
559
619
 
@@ -599,12 +659,26 @@ Gap closure cycle: `/pan:plan-phase {X} --gaps` reads verification.md → create
599
659
  </step>
600
660
 
601
661
  <step name="update_roadmap">
602
- **Mark phase complete and update all tracking files:**
662
+ **Mark phase complete and update all tracking files.** `phase complete` runs the phase gate first, on every path (this step runs before `offer_next`, with or without `--no-transition`). The gate checks in code what this workflow used to ask for in prose: every plan has a summary, the verification passes (a failed test gate lowers it to gaps), human items have a recorded approval, the verification is fresh, reconcile finds no contradiction, no critical or high finding is left open, no stub was committed, and no test was weakened.
603
663
 
604
664
  ```bash
605
665
  COMPLETION=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs phase complete "${PHASE_NUMBER}")
666
+ COMPLETION_EXIT=$?
667
+ ```
668
+
669
+ | Result | Action |
670
+ |---|---|
671
+ | exit 1, `error: phase_gate_refused` (`workflow.phase_gate: enforce`) | The phase was NOT marked complete. Show each `gate.reasons` entry (`code`: `detail`) with its fix, and stop: no commit, no auto-advance. The user may complete anyway with a reason (below) |
672
+ | exit 0, `gate.ok` false (`workflow.phase_gate: warn`) | The phase was marked complete. Show the reasons as warnings, run the rest of this step, and do NOT auto-advance (`offer_next` reads `GATE_OK`) |
673
+ | exit 0, `gate.ok` true | Continue |
674
+
675
+ **Completing past a refusal** is the user's decision, never yours, and needs their reason. It records a `decision` for every open finding the gate counted:
676
+ ```bash
677
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs phase complete "${PHASE_NUMBER}" --force --reason "<the user's reason>"
606
678
  ```
607
679
 
680
+ Set `GATE_OK` to `gate.ok` from `COMPLETION` (`false` when the gate refused).
681
+
608
682
  The CLI handles:
609
683
  - Marking phase checkbox `[x]` with completion date
610
684
  - Updating Progress table (Status → Complete, date)
@@ -659,7 +733,7 @@ Parse `--no-transition` flag from $ARGUMENTS.
659
733
  **If `--no-transition` flag present:**
660
734
 
661
735
  Execute-phase was spawned by plan-phase's auto-advance. Do NOT run transition.md.
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:
736
+ If verification found gaps, or `GATE_OK` is false, return `## GAPS FOUND` with the phase, score and the gap summaries or the gate's reasons (plan-phase and discuss-phase stop the chain on it). After the gate passes, return completion status to parent:
663
737
 
664
738
  ```
665
739
  ## PHASE COMPLETE
@@ -675,37 +749,10 @@ STOP. Do not proceed to auto-advance or transition.
675
749
 
676
750
  **If `--no-transition` flag is NOT present:**
677
751
 
678
- **Verification gate check (before auto-advance):**
679
-
680
- If `workflow.verifier` is true in config, confirm the current phase has a passing verification:
681
-
682
- ```bash
683
- VERIF=$(ls "$phase_dir"/*-verification.md 2>/dev/null | head -1)
684
- VERIF_STATUS=""
685
- if [ -n "$VERIF" ]; then
686
- VERIF_STATUS=$(grep "^status:" "$VERIF" | awk '{print $2}')
687
- fi
688
- ```
689
-
690
- **Cross-check the written verdict against the mechanical signals (anti-rubber-stamp, ADR-0036).** The `status:` string above is authored by the verifier agent; `reconcile` re-derives the artifact/key-link checks from disk and exits non-zero when a claimed pass contradicts them:
691
- ```bash
692
- node ~/.claude/pan-wizard-core/bin/pan-tools.cjs verify reconcile "${PHASE_NUMBER}" --raw
693
- RECONCILE_EXIT=$?
694
- ```
695
- If `RECONCILE_EXIT` is non-zero:
696
- ```
697
- ⚠ Reconcile gate: Phase ${PHASE_NUMBER} verification says "passed" but the mechanical
698
- checks disagree — artifacts fail substance checks or key-links are unwired.
699
- This is a rubber-stamped verification. Do NOT auto-advance.
700
- Re-run /pan:verify-phase and fix the failing artifacts/key-links.
701
- ```
702
- STOP — do not auto-advance. Return to user.
703
-
704
- If `VERIF_STATUS` is not `passed`:
752
+ **Gate check (before auto-advance).** The phase gate already ran inside `phase complete` (`update_roadmap`), and it covers the verification status, reconcile (anti-rubber-stamp, ADR-0036), freshness, open findings, stubs and test integrity. If `GATE_OK` is false:
705
753
  ```
706
- ⚠ Verification gate: Phase ${PHASE_NUMBER} verification status is "${VERIF_STATUS:-missing}"
707
- Cannot auto-advance without passing verification.
708
- Run /pan:verify-phase to verify this phase first.
754
+ ⚠ Phase gate: Phase ${PHASE_NUMBER} may not advance — {each gate reason: code and detail}.
755
+ Fix the reasons (or close the gaps with /pan:plan-phase ${PHASE_NUMBER} --gaps), then re-run.
709
756
  ```
710
757
  STOP — do not auto-advance. Return to user.
711
758
 
@@ -218,10 +218,12 @@ Proceed with proposed change? (yes / different approach / defer)
218
218
 
219
219
  Summary MUST include deviations section. None? → `## Deviations from Plan\n\nNone - plan executed exactly as written.`
220
220
 
221
- Per deviation: **[Rule N - Category] Title** — Found during: Task X | Issue | Fix | Files modified | Verification | Commit hash
221
+ Per deviation: **[Rule N - Category] Title** — Found during: Task X | Issue | Fix | Files modified | Verification | Cost if wrong (low, medium or high, and what breaks) | Commit hash
222
222
 
223
223
  End with: **Total deviations:** N auto-fixed (breakdown). **Impact:** assessment.
224
224
 
225
+ Then `## Concerns`: what was finished but is not certain, each as `- C-1: <concern>. Why: <…>. Cost if wrong: <…>.`, or "None". A plan with concerns returns `## DONE_WITH_CONCERNS` (see the executor's completion format).
226
+
225
227
  </deviation_documentation>
226
228
 
227
229
  <tdd_plan_execution>
@@ -209,81 +209,140 @@ The Focus workflow is a **scan → plan → exec → sync** pipeline. Each step
209
209
 
210
210
  ## All Commands
211
211
 
212
- > This table is a **curated subset** of the most-used commands, not an exhaustive list. For the full, always-current command set, browse the `commands/pan/*.md` files in your install (each `.md` is one `/pan:<name>` command).
212
+ Every shipped command, by group. This list is generated from each command's own description, so it is complete.
213
213
 
214
+ <!-- generated:command-index:start (scripts/build-help.cjs --write) -->
214
215
  ### Getting Started
215
216
  | Command | Description |
216
217
  |---------|-------------|
217
- | `/pan:new-project` | Initialize new project — research, requirements, roadmap |
218
- | `/pan:map-codebase` | Analyze existing codebase with parallel agents |
218
+ | `/pan:map-codebase` | Analyze codebase with parallel mapper agents to produce .planning/codebase/ documents |
219
+ | `/pan:new-project` | Initialize a new project with deep context gathering and project.md |
219
220
 
220
221
  ### Phase Lifecycle
221
222
  | Command | Description |
222
223
  |---------|-------------|
223
- | `/pan:discuss-phase <N>` | Shape implementation through targeted questions |
224
- | `/pan:plan-phase <N>` | Research + plan a phase with verification |
225
- | `/pan:exec-phase <N>` | Execute plans with wave-based parallelization |
226
- | `/pan:research-phase <N>` | Deep ecosystem research for specialized domains |
227
- | `/pan:verify-phase <N>` | Re-run goal-backward verification with a test-suite gate |
224
+ | `/pan:design-phase` | Design a roadmap phase before planning — architecture, ADR, threat-lite, machine-checkable criteria — verified by an independent checker |
225
+ | `/pan:discuss-phase` | Gather phase context through adaptive questioning before planning |
226
+ | `/pan:exec-phase` | Execute all plans in a phase with wave-based parallelization |
227
+ | `/pan:plan-phase` | Create detailed phase plan (plan.md) with verification loop |
228
+ | `/pan:research-phase` | Research how to implement a phase (standalone - usually use /pan:plan-phase instead) |
229
+ | `/pan:verify-phase` | Re-run goal-backward verification of a phase with a test-suite gate and list its gaps |
228
230
 
229
231
  ### Phase Management
230
232
  | Command | Description |
231
233
  |---------|-------------|
232
- | `/pan:add-phase <desc>` | Append new phase to roadmap |
233
- | `/pan:insert-phase <N> <desc>` | Insert urgent work between phases |
234
- | `/pan:remove-phase <N>` | Remove phase and renumber |
235
- | `/pan:assumptions <N>` | Surface approach assumptions before planning |
236
- | `/pan:phase-tests <N>` | Generate tests for completed phase |
237
- | `/pan:phase-budget` | Estimate context utilization for current phase |
234
+ | `/pan:add-phase` | Add phase to end of current milestone in roadmap |
235
+ | `/pan:assumptions` | Surface Claude's assumptions about a phase approach before planning |
236
+ | `/pan:insert-phase` | Insert urgent work as decimal phase (e.g., 72.1) between existing phases |
237
+ | `/pan:phase-budget` | Estimate context utilization and quality for the current phase |
238
+ | `/pan:phase-tests` | Generate tests for a completed phase from its summaries, context decisions, verification report and implementation |
239
+ | `/pan:remove-phase` | Remove a future phase from roadmap and renumber subsequent phases |
238
240
 
239
241
  ### Session & Progress
240
242
  | Command | Description |
241
243
  |---------|-------------|
242
- | `/pan:progress` | Check status and route to next action |
243
- | `/pan:quick <desc>` | Fast-path execution (skip optional agents) |
244
- | `/pan:pause` | Save context for later resumption |
245
- | `/pan:resume` | Restore previous session context |
246
- | `/pan:profile <name>` | Switch model profile (quality/balanced/budget) |
244
+ | `/pan:pause` | Create context handoff when pausing work mid-phase |
245
+ | `/pan:profile` | Switch model profile for PAN agents (quality/balanced/budget) |
246
+ | `/pan:progress` | Check project progress, show context, and route to next action (execute or plan) |
247
+ | `/pan:quick` | Execute a quick task with PAN guarantees (atomic commits, state tracking) but skip optional agents |
248
+ | `/pan:resume` | Resume work from previous session with full context restoration |
247
249
 
248
250
  ### Milestone
249
251
  | Command | Description |
250
252
  |---------|-------------|
251
- | `/pan:milestone-new` | Start a new milestone cycle |
252
- | `/pan:milestone-done <v>` | Archive completed milestone |
253
- | `/pan:milestone-audit` | Audit completion against intent |
254
- | `/pan:milestone-gaps` | Create phases to close audit gaps |
255
- | `/pan:milestone-cleanup` | Archive accumulated phase directories |
256
- | `/pan:retro` | Milestone retrospective — estimation & verification analysis |
257
-
258
- ### Focus (Strategic Project Management)
253
+ | `/pan:milestone-audit` | Audit milestone completion against original intent before archiving |
254
+ | `/pan:milestone-cleanup` | Archive accumulated phase directories from completed milestones |
255
+ | `/pan:milestone-done` | Archive completed milestone and prepare for next version |
256
+ | `/pan:milestone-gaps` | Create phases to close all gaps identified by milestone audit |
257
+ | `/pan:milestone-new` | Start a new milestone cycle — update project.md and route to requirements |
258
+
259
+ ### Milestone Lifecycle
260
+ | Command | Description |
261
+ |---------|-------------|
262
+ | `/pan:retro` | Milestone retrospective — analyze estimation accuracy, verification patterns, and common gaps |
263
+
264
+ ### Focus
265
+ | Command | Description |
266
+ |---------|-------------|
267
+ | `/pan:focus-auto` | Continuous scan-plan-exec loop with purpose-driven categories and a layered safety harness |
268
+ | `/pan:focus-design` | Strategic 10-phase feature investigation, design, and specification pipeline |
269
+ | `/pan:focus-doc-audit` | Multi-dimensional document audit — accuracy, freshness, links, cross-consistency, and structural quality |
270
+ | `/pan:focus-drift-walking` | Deep documentation-code drift detection, CLAUDE.md alignment, and auto-repair across all project directories |
271
+ | `/pan:focus-exec` | Automated batch execution pipeline with 6 stages, behavioral rules, 3 execution tiers |
272
+ | `/pan:focus-plan` | Create capacity-budgeted work batch with spec coverage verification and 4 execution modes |
273
+ | `/pan:focus-scan` | Deep-dive strategic work scan with prioritized items and Reality Score filtering |
274
+ | `/pan:focus-sync` | Synchronize documentation after changes — check staleness and update counts |
275
+
276
+ ### Foresight
277
+ | Command | Description |
278
+ |---------|-------------|
279
+ | `/pan:preview` | Preview what will happen — phase blast radius, phase dependency graph, or milestone ETA |
280
+ | `/pan:what-if` | Explore a phase's alternative approach in an isolated git worktree. Replays the scenario, compares to the original plan, writes a report. |
281
+
282
+ ### Review
283
+ | Command | Description |
284
+ |---------|-------------|
285
+ | `/pan:review-deep` | Security audit + cross-reviewer check. OWASP/STRIDE pass by pan-hardener, then pan-meta-reviewer catches what the first pass missed. Writes consolidated deep-review.md. |
286
+
287
+ ### Validation
288
+ | Command | Description |
289
+ |---------|-------------|
290
+ | `/pan:links` | Validate the doc-code link graph — inline wiki-style refs, source-comment anchors, and require-code-mention contracts (ADR-0027, v3.8.0+) |
291
+
292
+ ### Observability
293
+ | Command | Description |
294
+ |---------|-------------|
295
+ | `/pan:cost` | Show token usage and estimated cost across PAN commands and agents |
296
+ | `/pan:dashboard` | Alias for /pan:hud — generate the single-page HTML dashboard of the bot army and project |
297
+ | `/pan:hud` | Generate a single-page, self-contained HTML dashboard of the bot army and the project's current state |
298
+ | `/pan:report` | Generate a self-contained HTML report for one phase, or a project-level timeline index linking every phase report |
299
+
300
+ ### Knowledge
301
+ | Command | Description |
302
+ |---------|-------------|
303
+ | `/pan:knowledge` | Grounded Q&A, multi-turn design discussion, and playbook generation. Three modes in one command. |
304
+
305
+ ### Self-Improvement
306
+ | Command | Description |
307
+ |---------|-------------|
308
+ | `/pan:experiment` | Manage external experiments — scaffold, run, harvest, promote findings back to PAN |
309
+ | `/pan:learn` | Analyze trace sessions or harvested experiments via pan-optimizer; generate ranked optimization reports |
310
+ | `/pan:optimize` | Manage the circular optimization loop — record a report's suggestions, undo them, view stats, list reports, manage trace sessions |
311
+
312
+ ### Git Workflow
313
+ | Command | Description |
314
+ |---------|-------------|
315
+ | `/pan:git` | Safe, phase-aware git workflow commands — commit, branch, push, status, log, stash, diff, rollback, tag, sync |
316
+
317
+ ### Army
318
+ | Command | Description |
319
+ |---------|-------------|
320
+ | `/pan:army` | Bot-army campaign — Mission Control (the reasoning-tier conductor) delegates a whole-project goal to squads (architecture / build / quality / release), each squad working branch-per-agent worktrees under a hard safety harness, gated by CI + a human merge, looping plan→delegate→execute→review→integrate→learn until the goal ships or a stop condition fires. |
321
+
322
+ ### External tools
259
323
  | Command | Description |
260
324
  |---------|-------------|
261
- | `/pan:focus-scan` | Step 1: Find and prioritize all work items |
262
- | `/pan:focus-plan` | Step 2: Budget items into an execution batch |
263
- | `/pan:focus-exec` | Step 3: Implement, test, verify, commit |
264
- | `/pan:focus-sync` | Step 4: Synchronize documentation after changes |
265
- | `/pan:focus-auto` | Continuous scan→plan→exec loop with safety harness |
266
- | `/pan:focus-design <desc>` | Standalone: Deep feature investigation and spec |
267
- | `/pan:focus-drift-walking` | Walk project tree, detect doc-code drift, auto-repair |
268
- | `/pan:focus-doc-audit` | Deep document audit with quality scoring |
325
+ | `/pan:mcp-bridge` | Discover available MCP tools and recommend which ones apply to a phase. Discovery-only; auto-invocation deferred. |
269
326
 
270
327
  ### System
271
328
  | Command | Description |
272
329
  |---------|-------------|
273
- | `/pan:help` | Show this reference |
274
- | `/pan:health` | Diagnose planning directory integrity |
275
- | `/pan:settings` | Configure workflow toggles |
276
- | `/pan:update` | Update PAN to latest version |
277
- | `/pan:debug` | Systematic debugging with persistent state |
278
- | `/pan:todo-add` | Capture idea as todo |
279
- | `/pan:todo-check` | List and select pending todos |
280
- | `/pan:audit-deployment <dir>` | Audit a PAN installation for integrity and health |
330
+ | `/pan:audit-deployment` | Audit a PAN Wizard deployment — verify installation integrity, project health, and draft enhancement specs |
331
+ | `/pan:debug` | Systematic debugging with persistent state across context resets |
332
+ | `/pan:health` | Diagnose planning directory health and optionally repair issues |
333
+ | `/pan:help` | Show available PAN commands and usage guide |
334
+ | `/pan:hygiene` | Scan the project for PAN version drift and stale artifacts (legacy filenames, memory bloat and stale entries, poisoned ledgers, trace debris, oversized planning files) and apply safe cleanups |
335
+ | `/pan:patches` | Reapply local modifications after a PAN update |
336
+ | `/pan:settings` | Configure PAN workflow toggles and model profile |
337
+ | `/pan:todo-add` | Capture idea or task as todo from current conversation context |
338
+ | `/pan:todo-check` | List pending todos and select one to work on |
339
+ | `/pan:update` | Update PAN to latest version with changelog display |
281
340
 
282
341
  ### Community
283
342
  | Command | Description |
284
343
  |---------|-------------|
285
344
  | `/pan:discord` | Join the PAN Discord community |
286
- | `/pan:patches` | Reapply local modifications after update |
345
+ <!-- generated:command-index:end -->
287
346
 
288
347
  ---
289
348
 
@@ -64,8 +64,8 @@ Gap: Flow "View dashboard" broken at data fetch
64
64
 
65
65
  Find highest existing phase:
66
66
  ```bash
67
- # Get sorted phase list, extract last one
68
- HIGHEST=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs phases list --raw | tail -1)
67
+ # Highest phase number in roadmap.md — the same source `phase add` numbers from
68
+ HIGHEST=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs roadmap analyze | node -e "let s='';process.stdin.on('data',d=>s+=d).on('end',()=>{const n=JSON.parse(s).phases.map(p=>parseInt(p.number,10)).filter(Number.isFinite);console.log(n.length?Math.max(...n):0)})")
69
69
  ```
70
70
 
71
71
  New phases continue from there: