pan-wizard 3.35.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 (60) hide show
  1. package/README.md +11 -5
  2. package/agents/pan-designer.md +1 -1
  3. package/agents/pan-executor.md +25 -0
  4. package/agents/pan-hardener.md +2 -0
  5. package/agents/pan-phase-researcher.md +14 -0
  6. package/agents/pan-plan-checker.md +28 -1
  7. package/agents/pan-planner.md +11 -1
  8. package/agents/pan-previewer.md +2 -0
  9. package/agents/pan-project-researcher.md +8 -0
  10. package/agents/pan-reviewer.md +5 -0
  11. package/agents/pan-verifier.md +2 -2
  12. package/commands/pan/cost.md +21 -1
  13. package/commands/pan/preview.md +1 -1
  14. package/package.json +1 -1
  15. package/pan-wizard-core/bin/lib/config.cjs +10 -3
  16. package/pan-wizard-core/bin/lib/core.cjs +9 -4
  17. package/pan-wizard-core/bin/lib/cost.cjs +146 -0
  18. package/pan-wizard-core/bin/lib/doc-lint.cjs +5 -3
  19. package/pan-wizard-core/bin/lib/findings.cjs +115 -6
  20. package/pan-wizard-core/bin/lib/git.cjs +1 -1
  21. package/pan-wizard-core/bin/lib/mutate.cjs +257 -0
  22. package/pan-wizard-core/bin/lib/phase-gate.cjs +15 -9
  23. package/pan-wizard-core/bin/lib/phase-remove.cjs +91 -11
  24. package/pan-wizard-core/bin/lib/phase.cjs +37 -9
  25. package/pan-wizard-core/bin/lib/plan-lint.cjs +161 -0
  26. package/pan-wizard-core/bin/lib/preview.cjs +3 -0
  27. package/pan-wizard-core/bin/lib/research-lint.cjs +121 -0
  28. package/pan-wizard-core/bin/lib/roadmap.cjs +1 -0
  29. package/pan-wizard-core/bin/lib/test-gate.cjs +433 -0
  30. package/pan-wizard-core/bin/lib/usage.cjs +104 -0
  31. package/pan-wizard-core/bin/lib/verify-plan-set.cjs +1 -1
  32. package/pan-wizard-core/bin/lib/verify-red.cjs +138 -0
  33. package/pan-wizard-core/bin/lib/verify-scope.cjs +143 -2
  34. package/pan-wizard-core/bin/lib/verify.cjs +27 -27
  35. package/pan-wizard-core/bin/pan-tools.cjs +94 -6
  36. package/pan-wizard-core/mcp/orchestrator.cjs +4 -1
  37. package/pan-wizard-core/references/design-methodology.md +1 -1
  38. package/pan-wizard-core/references/handoff-decisions.md +1 -1
  39. package/pan-wizard-core/templates/config.json +5 -1
  40. package/pan-wizard-core/templates/design.md +5 -4
  41. package/pan-wizard-core/templates/phase-prompt.md +7 -0
  42. package/pan-wizard-core/templates/research-project/architecture.md +6 -0
  43. package/pan-wizard-core/templates/research-project/features.md +6 -0
  44. package/pan-wizard-core/templates/research-project/pitfalls.md +6 -0
  45. package/pan-wizard-core/templates/research-project/stack.md +6 -0
  46. package/pan-wizard-core/templates/research.md +10 -0
  47. package/pan-wizard-core/templates/summary-complex.md +5 -1
  48. package/pan-wizard-core/templates/summary-minimal.md +4 -0
  49. package/pan-wizard-core/templates/summary-standard.md +5 -1
  50. package/pan-wizard-core/templates/summary.md +8 -1
  51. package/pan-wizard-core/workflows/exec-phase.md +43 -7
  52. package/pan-wizard-core/workflows/execute-plan.md +3 -1
  53. package/pan-wizard-core/workflows/help.md +103 -44
  54. package/pan-wizard-core/workflows/plan-phase.md +20 -2
  55. package/pan-wizard-core/workflows/remove-phase.md +11 -1
  56. package/pan-wizard-core/workflows/settings.md +17 -0
  57. package/pan-wizard-core/workflows/verify-phase.md +39 -46
  58. package/scripts/build-help.cjs +106 -0
  59. package/scripts/mutation-probe.cjs +7 -80
  60. package/scripts/test-surface.cjs +168 -6
@@ -151,6 +151,12 @@ How roadmap phases should address these pitfalls.
151
151
  | [pitfall] | Phase [X] | [how to verify prevention worked] |
152
152
  | [pitfall] | Phase [X] | [how to verify prevention worked] |
153
153
 
154
+ ## Claims
155
+
156
+ | Claim | Type | Source | Checked |
157
+ |-------|------|--------|---------|
158
+ | [what is true] | [version / api / pricing / security / practice / general] | [URL, doc section or Context7 id] | [YYYY-MM-DD] |
159
+
154
160
  ## Sources
155
161
 
156
162
  - [Post-mortems referenced]
@@ -79,6 +79,12 @@ npm install -D [packages]
79
79
  |-----------|-----------------|-------|
80
80
  | [package@version] | [package@version] | [compatibility notes] |
81
81
 
82
+ ## Claims
83
+
84
+ | Claim | Type | Source | Checked |
85
+ |-------|------|--------|---------|
86
+ | [what is true] | [version / api / pricing / security / practice / general] | [URL, doc section or Context7 id] | [YYYY-MM-DD] |
87
+
82
88
  ## Sources
83
89
 
84
90
  - [Context7 library ID] — [topics fetched]
@@ -204,6 +204,16 @@ Things that couldn't be fully resolved:
204
204
  - Recommendation: [how to handle]
205
205
  </open_questions>
206
206
 
207
+ <claims>
208
+ ## Claims
209
+
210
+ Every claim a plan will rest on: a version, an API's behaviour, a price, a security advisory, a practice. One row each, with where it came from and the day it was checked (YYYY-MM-DD). `pan-tools research lint` refuses a claim with no source or no date, and lists as stale a claim older than its type's window (version, pricing, security: 30 days; api: 90; general: 180; practice: 365).
211
+
212
+ | Claim | Type | Source | Checked |
213
+ |-------|------|--------|---------|
214
+ | [what is true] | [version / api / pricing / security / practice / general] | [URL, doc section or Context7 id] | [YYYY-MM-DD] |
215
+ </claims>
216
+
207
217
  <sources>
208
218
  ## Sources
209
219
 
@@ -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
@@ -117,6 +117,14 @@ Report:
117
117
  | 1 | 01-01, 01-02 | {from plan objectives, 3-8 words} |
118
118
  | 2 | 01-03 | ... |
119
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.
120
128
  </step>
121
129
 
122
130
  <step name="execute_waves">
@@ -202,6 +210,8 @@ Execute each wave in sequence. Within a wave: parallel if `PARALLELIZATION=true`
202
210
 
203
211
  If ANY spot-check fails: report which plan failed, route to failure handler — ask "Retry plan?" or "Continue with remaining waves?"
204
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
+
205
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`.
206
216
 
207
217
  If pass:
@@ -211,7 +221,8 @@ Execute each wave in sequence. Within a wave: parallel if `PARALLELIZATION=true`
211
221
 
212
222
  **{Plan ID}: {Plan Name}**
213
223
  {What was built — from summary.md}
214
- {Notable deviations, if any}
224
+ {Notable deviations, if any, with their cost if wrong}
225
+ {Concerns, if it returned DONE_WITH_CONCERNS}
215
226
 
216
227
  {If more waves: what this enables for next wave}
217
228
  ---
@@ -229,6 +240,12 @@ Execute each wave in sequence. Within a wave: parallel if `PARALLELIZATION=true`
229
240
  2>/dev/null || true
230
241
  ```
231
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
+
232
249
  - Bad: "Wave 2 complete. Proceeding to Wave 3."
233
250
  - Good: "Terrain system complete — 3 biome types, height-based texturing, physics collision meshes. Vehicle physics (Wave 3) can now reference ground surfaces."
234
251
 
@@ -323,7 +340,14 @@ After all waves:
323
340
 
324
341
  ### Issues Encountered
325
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"]
326
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.
327
351
  </step>
328
352
 
329
353
  <step name="generate_tests">
@@ -378,13 +402,12 @@ TEST_AFTER=$(npm test 2>&1 | grep -E "^(ℹ|#) tests" | awk '{print $NF}')
378
402
 
379
403
  **Skip if** `--skip-review` or `--fast` flag is present in $ARGUMENTS.
380
404
 
381
- 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:
382
406
  ```bash
383
- # Read each summary.md and extract key-files.created + key-files.modified
384
- for summary in "$PHASE_DIR"/*-summary.md; do
385
- node ~/.claude/pan-wizard-core/bin/pan-tools.cjs summary-extract "$summary" --fields key_files | node -e "let s='';process.stdin.on('data',d=>s+=d).on('end',()=>{const k=JSON.parse(s).key_files||{};for(const f of [...(k.created||[]),...(k.modified||[])])console.log(f)})"
386
- 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)
387
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.
388
411
 
389
412
  2. Collect the reviewer's earlier open findings on this phase (empty on a first review), then spawn pan-reviewer:
390
413
  ```bash
@@ -412,6 +435,19 @@ Task(
412
435
  Phase directory: ${phase_dir}
413
436
  </context>
414
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
+
415
451
  <open_findings>
416
452
  ${OPEN_REVIEW_FINDINGS}
417
453
  </open_findings>
@@ -633,7 +669,7 @@ COMPLETION_EXIT=$?
633
669
  | Result | Action |
634
670
  |---|---|
635
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) |
636
- | exit 0, `gate.ok` false (`warn`, the default) | 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`) |
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`) |
637
673
  | exit 0, `gate.ok` true | Continue |
638
674
 
639
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:
@@ -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
 
@@ -392,7 +392,7 @@ Task(
392
392
 
393
393
  ## 9. Handle Planner Return
394
394
 
395
- - **`## PLANNING COMPLETE`:** Display plan count. If `--skip-verify` or `plan_checker_enabled` is false (from init): still run the code checks at the start of step 10 (`verify plan-set`; they cost no model call), send any errors back to the planner (step 12), then skip to step 13. Otherwise: step 10.
395
+ - **`## PLANNING COMPLETE`:** Display plan count. If `--skip-verify` or `plan_checker_enabled` is false (from init): still run the code checks at the start of step 10 (`verify plan-set`, `verify review-focus`, `verify decisions`; they cost no model call), send any errors back to the planner (step 12), then skip to step 13. Otherwise: step 10.
396
396
  - **`## GAP CLOSURE PLANS CREATED`:** (`--gaps` mode) Handle as `## PLANNING COMPLETE`.
397
397
  - **`## CHECKPOINT REACHED`:** Present to user, get response, spawn a fresh planner (step 8's Task) with the response added to its prompt
398
398
 
@@ -403,9 +403,14 @@ Task(
403
403
  ```bash
404
404
  PLAN_SET=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs verify plan-set "${PHASE_NUMBER}")
405
405
  PLAN_SET_EXIT=$?
406
+ REVIEW_FOCUS=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs verify review-focus "${PHASE_NUMBER}")
407
+ REVIEW_FOCUS_EXIT=$?
408
+ DECISIONS=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs verify decisions "${PHASE_NUMBER}")
409
+ DECISIONS_EXIT=$?
410
+ RESEARCH_LINT=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs research lint "${PHASE_NUMBER}" 2>/dev/null)
406
411
  ```
407
412
 
408
- Exit 1 means the plan set is broken in a way no review can wave through: a roadmap requirement no plan lists, two plans in one wave modifying the same file, a `depends_on` that names no plan or a plan in the same or a later wave, or a cycle. Send `PLAN_SET`'s `errors` to the planner as the revision context (step 12; it counts as an iteration) and do not spawn the checker for this set. Exit 0: continue, and pass any `warnings` to the checker.
413
+ Exit 1 from `verify plan-set` means the plan set is broken in a way no review can wave through: a roadmap requirement no plan lists, two plans in one wave modifying the same file, a `depends_on` that names no plan or a plan in the same or a later wave, or a cycle. Exit 1 from `verify review-focus` means a plan has no `## Review Focus` section, more than five items, or an item that names no owning task or no test. Exit 1 from `verify decisions` means a plan cites a `DD-N` decision the design does not record, or a recorded decision no plan cites (it exits 0 when there is no design, or a design without ids). On any exit 1, send the `errors` of each failing check to the planner as the revision context (step 12; it counts as an iteration) and do not spawn the checker for this set. All exit 0: continue, and pass any `warnings` to the checker. `RESEARCH_LINT` never blocks planning: it goes to the checker as `<research_claims>` (claims with no source or date, and `stale` ones older than their type's window), and is `{"error":"no_research"}` when the phase was not researched.
409
414
 
410
415
  Display banner:
411
416
  ```
@@ -436,6 +441,10 @@ Checker prompt:
436
441
  **Project skills:** Check .agents/skills/ directory (if exists) — verify plans account for project skill rules
437
442
  </verification_context>
438
443
 
444
+ <research_claims>
445
+ {RESEARCH_LINT}
446
+ </research_claims>
447
+
439
448
  <open_findings>
440
449
  {output of `pan-tools findings list --phase {phase_number} --agent pan-plan-checker --status open`: empty on the first check; on a re-check, answer each in `resolutions`}
441
450
  </open_findings>
@@ -537,6 +546,15 @@ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs state update "Last Activity" "$
537
546
  node ~/.claude/pan-wizard-core/bin/pan-tools.cjs state update "Last Activity Description" "Phase ${PHASE_NUMBER} planned — ${PLAN_COUNT} plans created"
538
547
  ```
539
548
 
549
+ **Spend so far and what execution may cost** (`cost.phase_budget_usd`, default $20; it only warns):
550
+
551
+ ```bash
552
+ BUDGET=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs cost budget --phase "${PHASE_NUMBER}" 2>/dev/null)
553
+ FORECAST=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs preview phase "${PHASE_NUMBER}" 2>/dev/null)
554
+ ```
555
+
556
+ In the final status, when the budget's `status` is not `off`, add: "Budget: ${spent_usd} of ${budget_usd} spent so far". When `FORECAST`'s `cost_forecast.phase.status` is `ok`, add its p50 and p10–p90, and say so when the p50 alone is above what is left of the budget. When the forecast is `insufficient`, say nothing about it. Never stop or ask on either.
557
+
540
558
  Route to `<offer_next>` OR `auto_advance` depending on flags/config.
541
559
 
542
560
  **Circular optimization — log plan creation:**
@@ -72,6 +72,8 @@ This will:
72
72
  Proceed? (y/n)
73
73
  ```
74
74
 
75
+ If an integer target has decimal phases inserted after it (`### Phase {target}.1:` and so on in roadmap.md, or `{target}.N-*` directories), name them in the summary and ask whether to remove them too. pan-tools refuses to remove the integer phase while they exist, because they would be left behind under a different phase's number.
76
+
75
77
  Wait for confirmation.
76
78
  </step>
77
79
 
@@ -88,6 +90,14 @@ If the phase has executed plans (summary.md files), pan-tools will error. Use `-
88
90
  RESULT=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs phase remove "${target}" --force)
89
91
  ```
90
92
 
93
+ If the phase has decimal phases, pan-tools errors and names them. Add `--with-decimals` only if the user confirmed removing them as well (each is checked for executed plans the same way, so `--force` still applies to them):
94
+
95
+ ```bash
96
+ RESULT=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs phase remove "${target}" --with-decimals)
97
+ ```
98
+
99
+ Otherwise stop and report the decimals; the user can remove them one by one first.
100
+
91
101
  The CLI handles:
92
102
  - Deleting the phase directory
93
103
  - Renumbering all subsequent directories (in reverse order to avoid conflicts)
@@ -95,7 +105,7 @@ The CLI handles:
95
105
  - Updating roadmap.md (removing section, renumbering all phase references, updating dependencies)
96
106
  - Updating state.md (decrementing phase count)
97
107
 
98
- Extract from result: `removed`, `directory_deleted`, `renamed_directories`, `renamed_files`, `roadmap_updated`, `state_updated`.
108
+ Extract from result: `removed`, `directory_deleted`, `renamed_directories`, `renamed_files`, `roadmap_updated`, `state_updated`, and `removed_decimals` when `--with-decimals` removed any.
99
109
  </step>
100
110
 
101
111
  <step name="commit">
@@ -31,6 +31,7 @@ Parse current values (when a key is absent, use PAN's default: `true` for resear
31
31
  - `workflow.nyquist_validation` — validation architecture research during plan-phase
32
32
  - `model_profile` — which model each agent uses (default: `balanced`)
33
33
  - `routing.strategy` — how model tiers are adjusted at runtime (default: `static`)
34
+ - `cost.phase_budget_usd` — spend per phase PAN warns about, in API-equivalent dollars (default: `20`; `0` = off). It never stops a run
34
35
  - `branching_strategy` — branching approach (default: `"none"`; a top-level key — a nested `git.branching_strategy` is ignored when the top-level key exists, as it does in every config `config-ensure-section` creates — write the top-level key)
35
36
  </step>
36
37
 
@@ -112,9 +113,23 @@ AskUserQuestion([
112
113
  { label: "Static (Recommended)", description: "Profile assigns fixed tiers to each agent. Predictable and simple." },
113
114
  { label: "Complexity", description: "Adjust tiers by task complexity, only where a model is resolved with the task passed (resolve-model --metadata); the *_model values workflows pass are not, so it changes nothing there" }
114
115
  ]
116
+ },
117
+ {
118
+ question: "Warn when a phase's spend passes how much? (API-equivalent dollars; warns only, never stops)",
119
+ header: "Phase budget",
120
+ multiSelect: false,
121
+ options: [
122
+ { label: "$20 per phase (Recommended)", description: "Warn at $16 (80%) and again once a phase passes $20" },
123
+ { label: "$50 per phase", description: "For larger phases or the quality profile" },
124
+ { label: "$10 per phase", description: "For small phases or the budget profile" },
125
+ { label: "Off", description: "No spend warnings; /pan:cost still reports spend" }
126
+ ]
115
127
  }
116
128
  ])
117
129
  ```
130
+
131
+ A dollar amount typed under Other is used as given.
132
+ ```
118
133
  </step>
119
134
 
120
135
  <step name="update_config">
@@ -129,6 +144,7 @@ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs config-set workflow.auto_advanc
129
144
  node ~/.claude/pan-wizard-core/bin/pan-tools.cjs config-set workflow.nyquist_validation <true|false>
130
145
  node ~/.claude/pan-wizard-core/bin/pan-tools.cjs config-set branching_strategy <none|phase|milestone>
131
146
  node ~/.claude/pan-wizard-core/bin/pan-tools.cjs config-set routing.strategy <static|complexity>
147
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs config-set cost.phase_budget_usd <20|50|10|0|amount>
132
148
  ```
133
149
  </step>
134
150
 
@@ -194,6 +210,7 @@ Display:
194
210
  | Nyquist Validation | {On/Off} |
195
211
  | Git Branching | {None/Per Phase/Per Milestone} |
196
212
  | Routing Strategy | {Static/Complexity} |
213
+ | Phase Budget | {$N per phase (warn only)/Off} |
197
214
  | Saved as Defaults | {Yes/No} |
198
215
 
199
216
  These settings apply to future /pan:plan-phase and /pan:exec-phase runs.