pan-wizard 3.33.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 (197) hide show
  1. package/README.md +23 -20
  2. package/agents/pan-conductor.md +17 -16
  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 +14 -14
  9. package/agents/pan-executor.md +12 -8
  10. package/agents/pan-experiment-runner.md +8 -7
  11. package/agents/pan-integration-checker.md +2 -2
  12. package/agents/pan-knowledge.md +1 -1
  13. package/agents/pan-meta-reviewer.md +3 -3
  14. package/agents/pan-optimizer.md +39 -43
  15. package/agents/pan-phase-researcher.md +8 -8
  16. package/agents/pan-plan-checker.md +30 -28
  17. package/agents/pan-planner.md +54 -43
  18. package/agents/pan-previewer.md +1 -1
  19. package/agents/pan-project-researcher.md +11 -11
  20. package/agents/pan-release.md +1 -1
  21. package/agents/pan-research-synthesizer.md +2 -2
  22. package/agents/pan-reviewer.md +24 -2
  23. package/agents/pan-roadmapper.md +15 -14
  24. package/agents/pan-verifier.md +32 -24
  25. package/bin/install-lib.cjs +58 -23
  26. package/bin/install.js +47 -1
  27. package/commands/pan/army.md +15 -11
  28. package/commands/pan/assumptions.md +2 -2
  29. package/commands/pan/audit-deployment.md +11 -12
  30. package/commands/pan/cost.md +8 -4
  31. package/commands/pan/debug.md +10 -7
  32. package/commands/pan/design-phase.md +3 -3
  33. package/commands/pan/discuss-phase.md +2 -0
  34. package/commands/pan/exec-phase.md +21 -37
  35. package/commands/pan/experiment.md +9 -8
  36. package/commands/pan/focus-auto.md +22 -20
  37. package/commands/pan/focus-design.md +7 -6
  38. package/commands/pan/focus-doc-audit.md +4 -3
  39. package/commands/pan/focus-drift-walking.md +4 -3
  40. package/commands/pan/focus-exec.md +6 -6
  41. package/commands/pan/focus-plan.md +12 -11
  42. package/commands/pan/focus-scan.md +5 -3
  43. package/commands/pan/focus-sync.md +3 -2
  44. package/commands/pan/git.md +8 -8
  45. package/commands/pan/health.md +2 -2
  46. package/commands/pan/hud.md +3 -2
  47. package/commands/pan/hygiene.md +14 -7
  48. package/commands/pan/knowledge.md +9 -9
  49. package/commands/pan/learn.md +10 -7
  50. package/commands/pan/links.md +4 -1
  51. package/commands/pan/map-codebase.md +1 -1
  52. package/commands/pan/mcp-bridge.md +18 -18
  53. package/commands/pan/milestone-done.md +6 -3
  54. package/commands/pan/milestone-new.md +1 -1
  55. package/commands/pan/new-project.md +10 -10
  56. package/commands/pan/optimize.md +16 -14
  57. package/commands/pan/patches.md +2 -6
  58. package/commands/pan/pause.md +1 -1
  59. package/commands/pan/phase-tests.md +2 -1
  60. package/commands/pan/plan-phase.md +9 -19
  61. package/commands/pan/preview.md +1 -1
  62. package/commands/pan/profile.md +2 -2
  63. package/commands/pan/quick.md +1 -1
  64. package/commands/pan/remove-phase.md +1 -1
  65. package/commands/pan/report.md +2 -2
  66. package/commands/pan/research-phase.md +12 -11
  67. package/commands/pan/resume.md +9 -11
  68. package/commands/pan/retro.md +5 -3
  69. package/commands/pan/review-deep.md +7 -7
  70. package/commands/pan/settings.md +1 -1
  71. package/commands/pan/verify-phase.md +0 -11
  72. package/commands/pan/what-if.md +2 -2
  73. package/hooks/dist/pan-context-monitor.js +343 -44
  74. package/hooks/dist/pan-cost-logger.js +30 -0
  75. package/hooks/dist/pan-statusline.js +68 -22
  76. package/hooks/dist/pan-stop-guard.js +7 -2
  77. package/package.json +1 -1
  78. package/pan-wizard-core/bin/lib/agents-md.cjs +44 -6
  79. package/pan-wizard-core/bin/lib/bridge.cjs +6 -5
  80. package/pan-wizard-core/bin/lib/campaign.cjs +4 -2
  81. package/pan-wizard-core/bin/lib/commands-learnings.cjs +19 -2
  82. package/pan-wizard-core/bin/lib/commands.cjs +33 -4
  83. package/pan-wizard-core/bin/lib/config.cjs +2 -1
  84. package/pan-wizard-core/bin/lib/constants.cjs +18 -6
  85. package/pan-wizard-core/bin/lib/context-budget.cjs +12 -9
  86. package/pan-wizard-core/bin/lib/core.cjs +53 -19
  87. package/pan-wizard-core/bin/lib/cost-rebuild.cjs +13 -1
  88. package/pan-wizard-core/bin/lib/cost.cjs +142 -13
  89. package/pan-wizard-core/bin/lib/distill.cjs +6 -3
  90. package/pan-wizard-core/bin/lib/doc-lint.cjs +30 -11
  91. package/pan-wizard-core/bin/lib/findings.cjs +9 -2
  92. package/pan-wizard-core/bin/lib/focus.cjs +13 -4
  93. package/pan-wizard-core/bin/lib/frontmatter.cjs +105 -26
  94. package/pan-wizard-core/bin/lib/hygiene.cjs +178 -17
  95. package/pan-wizard-core/bin/lib/init.cjs +7 -4
  96. package/pan-wizard-core/bin/lib/knowledge.cjs +17 -1
  97. package/pan-wizard-core/bin/lib/learn-index.cjs +111 -10
  98. package/pan-wizard-core/bin/lib/learn-lint.cjs +30 -3
  99. package/pan-wizard-core/bin/lib/memory-optimize.cjs +8 -4
  100. package/pan-wizard-core/bin/lib/memory.cjs +508 -54
  101. package/pan-wizard-core/bin/lib/milestone.cjs +8 -3
  102. package/pan-wizard-core/bin/lib/optimize.cjs +84 -16
  103. package/pan-wizard-core/bin/lib/phase-remove.cjs +85 -21
  104. package/pan-wizard-core/bin/lib/phase-report.cjs +8 -2
  105. package/pan-wizard-core/bin/lib/phase.cjs +15 -13
  106. package/pan-wizard-core/bin/lib/preview.cjs +3 -1
  107. package/pan-wizard-core/bin/lib/roadmap-compact.cjs +267 -0
  108. package/pan-wizard-core/bin/lib/roadmap.cjs +243 -9
  109. package/pan-wizard-core/bin/lib/runner.cjs +2 -1
  110. package/pan-wizard-core/bin/lib/state-compact.cjs +11 -6
  111. package/pan-wizard-core/bin/lib/state.cjs +43 -28
  112. package/pan-wizard-core/bin/lib/template.cjs +11 -4
  113. package/pan-wizard-core/bin/lib/verify-preflight.cjs +4 -13
  114. package/pan-wizard-core/bin/lib/verify-retro.cjs +5 -3
  115. package/pan-wizard-core/bin/lib/verify-scope.cjs +5 -2
  116. package/pan-wizard-core/bin/lib/verify.cjs +30 -28
  117. package/pan-wizard-core/bin/lib/whatif.cjs +5 -3
  118. package/pan-wizard-core/bin/pan-tools.cjs +101 -15
  119. package/pan-wizard-core/learnings/index.json +5 -5
  120. package/pan-wizard-core/opencode/pan-wizard.js +111 -0
  121. package/pan-wizard-core/references/checkpoints.md +3 -3
  122. package/pan-wizard-core/references/continuation-format.md +3 -3
  123. package/pan-wizard-core/references/decimal-phase-calculation.md +2 -3
  124. package/pan-wizard-core/references/design-methodology.md +1 -1
  125. package/pan-wizard-core/references/git-integration.md +4 -6
  126. package/pan-wizard-core/references/git-planning-commit.md +2 -2
  127. package/pan-wizard-core/references/guardrails.md +2 -2
  128. package/pan-wizard-core/references/handoff-decisions.md +3 -3
  129. package/pan-wizard-core/references/model-profile-resolution.md +5 -5
  130. package/pan-wizard-core/references/model-profiles.md +14 -9
  131. package/pan-wizard-core/references/phase-argument-parsing.md +7 -7
  132. package/pan-wizard-core/references/planning-config.md +4 -4
  133. package/pan-wizard-core/references/tdd.md +10 -1
  134. package/pan-wizard-core/references/verification-patterns.md +5 -5
  135. package/pan-wizard-core/templates/codebase/architecture.md +2 -2
  136. package/pan-wizard-core/templates/codebase/best-practices.md +2 -2
  137. package/pan-wizard-core/templates/codebase/concerns.md +3 -3
  138. package/pan-wizard-core/templates/codebase/integrations.md +6 -6
  139. package/pan-wizard-core/templates/codebase/relationships.md +2 -2
  140. package/pan-wizard-core/templates/codebase/stack.md +2 -2
  141. package/pan-wizard-core/templates/codebase/structure.md +4 -4
  142. package/pan-wizard-core/templates/codebase/testing.md +4 -4
  143. package/pan-wizard-core/templates/continue-here.md +1 -1
  144. package/pan-wizard-core/templates/debug-subagent-prompt.md +3 -2
  145. package/pan-wizard-core/templates/debug.md +15 -1
  146. package/pan-wizard-core/templates/milestone-archive.md +6 -6
  147. package/pan-wizard-core/templates/milestone.md +1 -1
  148. package/pan-wizard-core/templates/phase-prompt.md +29 -17
  149. package/pan-wizard-core/templates/planner-subagent-prompt.md +3 -5
  150. package/pan-wizard-core/templates/research-project/architecture.md +3 -3
  151. package/pan-wizard-core/templates/research-project/features.md +1 -1
  152. package/pan-wizard-core/templates/research-project/pitfalls.md +1 -1
  153. package/pan-wizard-core/templates/research-project/stack.md +3 -3
  154. package/pan-wizard-core/templates/research.md +5 -5
  155. package/pan-wizard-core/templates/retrospective.md +1 -1
  156. package/pan-wizard-core/templates/roadmap.md +15 -15
  157. package/pan-wizard-core/templates/summary-complex.md +1 -0
  158. package/pan-wizard-core/templates/summary-minimal.md +1 -0
  159. package/pan-wizard-core/templates/summary-standard.md +2 -1
  160. package/pan-wizard-core/templates/summary.md +18 -2
  161. package/pan-wizard-core/templates/uat.md +3 -3
  162. package/pan-wizard-core/templates/user-setup.md +8 -8
  163. package/pan-wizard-core/templates/verification-report.md +53 -8
  164. package/pan-wizard-core/workflows/add-phase.md +1 -1
  165. package/pan-wizard-core/workflows/assumptions.md +1 -1
  166. package/pan-wizard-core/workflows/discuss-phase.md +9 -8
  167. package/pan-wizard-core/workflows/exec-phase.md +26 -57
  168. package/pan-wizard-core/workflows/execute-plan.md +8 -7
  169. package/pan-wizard-core/workflows/health.md +13 -12
  170. package/pan-wizard-core/workflows/help.md +8 -9
  171. package/pan-wizard-core/workflows/learn.md +13 -11
  172. package/pan-wizard-core/workflows/map-codebase.md +10 -10
  173. package/pan-wizard-core/workflows/milestone-audit.md +10 -10
  174. package/pan-wizard-core/workflows/milestone-gaps.md +17 -24
  175. package/pan-wizard-core/workflows/milestone-new.md +7 -6
  176. package/pan-wizard-core/workflows/new-project.md +9 -9
  177. package/pan-wizard-core/workflows/optimize.md +11 -9
  178. package/pan-wizard-core/workflows/pause.md +6 -1
  179. package/pan-wizard-core/workflows/phase-tests.md +4 -4
  180. package/pan-wizard-core/workflows/plan-phase.md +31 -34
  181. package/pan-wizard-core/workflows/profile.md +2 -2
  182. package/pan-wizard-core/workflows/progress.md +5 -7
  183. package/pan-wizard-core/workflows/quick.md +5 -3
  184. package/pan-wizard-core/workflows/remove-phase.md +1 -1
  185. package/pan-wizard-core/workflows/research-phase.md +9 -5
  186. package/pan-wizard-core/workflows/resume-project.md +4 -6
  187. package/pan-wizard-core/workflows/retro.md +3 -1
  188. package/pan-wizard-core/workflows/settings.md +16 -24
  189. package/pan-wizard-core/workflows/todo-check.md +1 -1
  190. package/pan-wizard-core/workflows/transition.md +12 -12
  191. package/pan-wizard-core/workflows/update.md +25 -17
  192. package/pan-wizard-core/workflows/verify-phase.md +17 -15
  193. package/pan-zcode/KNOWN-BETA-RISKS.md +2 -2
  194. package/pan-zcode/README.md +7 -7
  195. package/pan-zcode/bin/install-zcode.js +1 -1
  196. package/scripts/build-plugin.js +3 -1
  197. package/scripts/generate-skills-docs.py +13 -4
@@ -1,5 +1,5 @@
1
1
  <purpose>
2
- Create executable phase prompts (plan.md files) for a roadmap phase with integrated research and verification. Default flow: Research (if needed) -> Plan -> Verify -> Done. Orchestrates pan-phase-researcher, pan-planner, and pan-plan-checker agents with a revision loop (max 3 iterations).
2
+ Create executable phase prompts (plan.md files) for a roadmap phase with integrated research and verification. Default flow: Research (if needed) -> Plan -> Verify -> Done. Orchestrates pan-phase-researcher, pan-planner, and pan-plan-checker agents with a revision loop (at most 2 revisions, up to 3 checks).
3
3
  </purpose>
4
4
 
5
5
  <required_reading>
@@ -8,7 +8,7 @@ Read all files referenced by the invoking prompt's execution_context before star
8
8
  @~/.claude/pan-wizard-core/references/ui-brand.md
9
9
  @~/.claude/pan-wizard-core/references/guardrails.md
10
10
 
11
- > **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 planner --token-budget 5000 --raw` to load only the topics tagged relevant for planning at the configured budget. Per P-RES-002 (distractor-density research), reading every topic degrades reasoning even at modest token counts.
11
+ > **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 planner --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 planning. Per P-RES-002 (distractor-density research), reading every topic degrades reasoning even at modest token counts.
12
12
  </required_reading>
13
13
 
14
14
  ## Phase 0 — Clarify Phase Scope (recommended)
@@ -19,7 +19,7 @@ Before drafting the phase plan, confirm:
19
19
  2. **What's deliberately out of scope?**
20
20
  3. **Any constraints or dependencies on other phases?**
21
21
 
22
- If the answers aren't already in `.planning/requirements.md` or the phase context file, ask the user. A 2-minute clarification prevents 30-minute rework downstream.
22
+ If the answers aren't already in the phase's roadmap section and requirement lines (`pan-tools roadmap slice <phase> --raw` prints them) or the phase context file, ask the user — except with `--auto` or `workflow.auto_advance: true`, where you proceed with what the files hold (as step 4 does). A 2-minute clarification prevents 30-minute rework downstream.
23
23
 
24
24
  ## Re-Read Checkpoints
25
25
 
@@ -44,7 +44,7 @@ INIT=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs init plan-phase "$PHASE"
44
44
 
45
45
  Parse JSON for: `researcher_model`, `planner_model`, `checker_model`, `research_enabled`, `plan_checker_enabled`, `nyquist_validation_enabled`, `commit_docs`, `phase_found`, `phase_dir`, `phase_number`, `phase_name`, `phase_slug`, `padded_phase`, `has_research`, `has_context`, `has_plans`, `plan_count`, `planning_exists`, `roadmap_exists`, `phase_req_ids`.
46
46
 
47
- **File paths (for <files_to_read> blocks):** `state_path`, `roadmap_path`, `requirements_path`, `context_path`, `research_path`, `verification_path`, `uat_path`. These are null if files don't exist.
47
+ **File paths (for <files_to_read> blocks):** `state_path`, `roadmap_path`, `requirements_path`, `context_path`, `research_path`, `verification_path`, `uat_path`. The first three are always set, even when the file is missing; the other four are absent (treat as null) when their file does not exist.
48
48
 
49
49
  **If `planning_exists` is false:** Error — run `/pan:new-project` first.
50
50
 
@@ -63,9 +63,9 @@ Extract `--prd <filepath>` from $ARGUMENTS. If present, set PRD_FILE to the file
63
63
 
64
64
  **If no phase number:** Detect next unplanned phase from roadmap.
65
65
 
66
- **If `phase_found` is false:** Validate phase exists in roadmap.md. If valid, create the directory using `phase_slug` and `padded_phase` from init:
66
+ **If `phase_found` is false:** Validate phase exists in roadmap.md. If valid, create the directory (scaffold pads the number and honours the planning root) and use the path it prints as `phase_dir`:
67
67
  ```bash
68
- mkdir -p ".planning/phases/${padded_phase}-${phase_slug}"
68
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs scaffold phase-dir --phase "${PHASE}" --name "{phase_name}" --raw
69
69
  ```
70
70
 
71
71
  **Existing artifacts from init:** `has_research`, `has_plans`, `plan_count`.
@@ -78,6 +78,14 @@ PHASE_INFO=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs roadmap get-phase
78
78
 
79
79
  **If `found` is false:** Error with available phases. **If `found` is true:** Extract `phase_number`, `phase_name`, `goal` from JSON.
80
80
 
81
+ ## 3.1. Write the Phase's Roadmap Slice
82
+
83
+ ```bash
84
+ SLICE_PATH=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs roadmap slice "${PHASE}" --write --raw)
85
+ ```
86
+
87
+ `SLICE_PATH` (`{slice_path}` below) is what this phase needs from roadmap.md and requirements.md: a line for every phase, this phase's section, the goals of the phases it depends on, and its requirement lines. The researcher, planner and checker read it instead of the whole files, which a long project re-read on every turn of every spawn. Plans name it in their `<context>` too, so executors read it rather than the whole roadmap. **If `SLICE_PATH` is empty** (no roadmap section, or no phase directory yet), list `{roadmap_path}` and `{requirements_path}` wherever `{slice_path}` appears below.
88
+
81
89
  ## 3.5. Handle PRD Express Path
82
90
 
83
91
  **Skip if:** No `--prd` flag in arguments.
@@ -214,15 +222,15 @@ If "Run discuss-phase first": Display `/pan:discuss-phase {X}` and exit workflow
214
222
 
215
223
  **P-1401 lightweight-phase bypass (v3.7.3+):** Also skip per-phase research when ALL three are true:
216
224
 
217
- 1. The phase has only **1 plan** (read `plan_count` from init JSON)
218
- 2. The plan's `change_class` is in `[chore, docs, feat-trivial]` (i.e., scaffolding, config, single-file feat with ≤3 tasks)
225
+ 1. The phase's roadmap section expects no more than one plan (`**Plans:** 1 plan`, or the `TBD` / `0 plans` the roadmapper and `phase add`/`insert` write before any planning); init's `plan_count` counts plans already written, which is 0 before the first planning run
226
+ 2. The phase is scaffolding, config, docs or a single-file feature with ≤3 tasks (judge from its goal; no plan field records this)
219
227
  3. Project-level `research/architecture.md`, `features.md`, `stack.md` already exist (so the planner has broad context to draw from)
220
228
 
221
229
  In that case, log a `decision` trace event (`type: "decision", category: "skip-research-trivial"`) and proceed directly to step 6 (planning). Saves ~3 commits and ~5 minutes per trivial phase. Surfaced by panloop run: Phase 1 (project setup, scaffolding only) over-ceremonialized.
222
230
 
223
231
  This is a workflow-level optimization — the planner still produces a plan, just without per-phase research.md. Phase 2+ phases with substantive build work still go through full research.
224
232
 
225
- **P-1602 phase_record_compact (v3.7.5+):** When `workflow.phase_record_compact: true` AND the lightweight-phase bypass above triggers, also skip per-phase context.md creation (step 4) and emit a single combined `${PHASE_NUM}-record.md` after planning containing: goal, locked decisions (from project-level context), plan summary, must_haves. Reduces the planning output (context, research, plan) to a record and a plan for trivial phases; execution still writes the plan's summary. Off by default — opt-in via `pan-tools config-set workflow.phase_record_compact true`. Substantive phases (>1 plan or non-trivial change_class) still produce full per-phase artifacts regardless of this flag.
233
+ **P-1602 phase_record_compact (v3.7.5+):** When `workflow.phase_record_compact: true` AND the lightweight-phase bypass above triggers, also skip per-phase context.md creation (step 4) and emit a single combined `${padded_phase}-record.md` after planning containing: goal, locked decisions (from project-level context), plan summary, must_haves. Reduces the planning output (context, research, plan) to a record and a plan for trivial phases; execution still writes the plan's summary. Off by default — opt-in via `pan-tools config-set workflow.phase_record_compact true`. Substantive phases (more than one plan, or more than scaffolding, config, docs or a single-file feature) still produce full per-phase artifacts regardless of this flag.
226
234
 
227
235
  **If `has_research` is true (from init) AND no `--research` flag:** Use existing, skip to step 6.
228
236
 
@@ -240,7 +248,7 @@ Display banner:
240
248
  ### Spawn pan-phase-researcher
241
249
 
242
250
  ```bash
243
- PHASE_DESC=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs roadmap get-phase "${PHASE}" | jq -r '.section')
251
+ PHASE_DESC=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs roadmap get-phase "${PHASE}" --raw) # --raw prints the phase's section
244
252
  ```
245
253
 
246
254
  Research prompt:
@@ -253,7 +261,7 @@ Answer: "What do I need to know to PLAN this phase well?"
253
261
 
254
262
  <files_to_read>
255
263
  - {context_path} (USER DECISIONS from /pan:discuss-phase)
256
- - {requirements_path} (Project requirements)
264
+ - {slice_path} (This phase's roadmap and requirements)
257
265
  - {state_path} (Project decisions and history)
258
266
  </files_to_read>
259
267
 
@@ -266,7 +274,7 @@ Answer: "What do I need to know to PLAN this phase well?"
266
274
  </additional_context>
267
275
 
268
276
  <output>
269
- Write to: {phase_dir}/{phase_num}-research.md
277
+ Write to: {phase_dir}/{padded_phase}-research.md
270
278
  </output>
271
279
  ```
272
280
 
@@ -306,7 +314,7 @@ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs commit "docs(phase-${PHASE}): a
306
314
  **If not found (and nyquist enabled):** Display warning:
307
315
  ```
308
316
  ⚠ Nyquist validation enabled but researcher did not produce a Validation Architecture section.
309
- Continuing without validation strategy. Plans may fail Dimension 8 check.
317
+ Continuing without validation strategy. The plan checker skips Nyquist Compliance (Dimension 9).
310
318
  ```
311
319
 
312
320
  ## 6. Check Existing Plans
@@ -319,17 +327,7 @@ ls "${PHASE_DIR}"/*-plan.md 2>/dev/null
319
327
 
320
328
  ## 7. Use Context Paths from INIT
321
329
 
322
- Extract from INIT JSON:
323
-
324
- ```bash
325
- STATE_PATH=$(echo "$INIT" | jq -r '.state_path // empty')
326
- ROADMAP_PATH=$(echo "$INIT" | jq -r '.roadmap_path // empty')
327
- REQUIREMENTS_PATH=$(echo "$INIT" | jq -r '.requirements_path // empty')
328
- RESEARCH_PATH=$(echo "$INIT" | jq -r '.research_path // empty')
329
- VERIFICATION_PATH=$(echo "$INIT" | jq -r '.verification_path // empty')
330
- UAT_PATH=$(echo "$INIT" | jq -r '.uat_path // empty')
331
- CONTEXT_PATH=$(echo "$INIT" | jq -r '.context_path // empty')
332
- ```
330
+ `state_path`, `roadmap_path`, `requirements_path`, `research_path`, `verification_path`, `uat_path` and `context_path` come straight from the INIT JSON; fill the `{…_path}` placeholders below with them. `state_path`, `roadmap_path` and `requirements_path` are always set, even when the file is missing; the other four are absent from the JSON when their file does not exist.
333
331
 
334
332
  ## 8. Spawn pan-planner Agent
335
333
 
@@ -351,8 +349,7 @@ Planner prompt:
351
349
 
352
350
  <files_to_read>
353
351
  - {state_path} (Project State)
354
- - {roadmap_path} (Roadmap)
355
- - {requirements_path} (Requirements)
352
+ - {slice_path} (This phase's roadmap and requirements — read the whole roadmap.md or requirements.md only for something it leaves out)
356
353
  - {context_path} (USER DECISIONS from /pan:discuss-phase)
357
354
  - {research_path} (Technical Research)
358
355
  - {verification_path} (Verification Gaps - if --gaps)
@@ -396,8 +393,8 @@ Task(
396
393
  ## 9. Handle Planner Return
397
394
 
398
395
  - **`## PLANNING COMPLETE`:** Display plan count. If `--skip-verify` or `plan_checker_enabled` is false (from init): skip to step 13. Otherwise: step 10.
399
- - **`## CHECKPOINT REACHED`:** Present to user, get response, spawn continuation (step 12)
400
- - **`## PLANNING INCONCLUSIVE`:** Show attempts, offer: Add context / Retry / Manual
396
+ - **`## GAP CLOSURE PLANS CREATED`:** (`--gaps` mode) Handle as `## PLANNING COMPLETE`.
397
+ - **`## CHECKPOINT REACHED`:** Present to user, get response, spawn a fresh planner (step 8's Task) with the response added to its prompt
401
398
 
402
399
  ## 10. Spawn pan-plan-checker Agent
403
400
 
@@ -419,8 +416,7 @@ Checker prompt:
419
416
 
420
417
  <files_to_read>
421
418
  - {PHASE_DIR}/*-plan.md (Plans to verify)
422
- - {roadmap_path} (Roadmap)
423
- - {requirements_path} (Requirements)
419
+ - {slice_path} (This phase's roadmap and requirements — read the whole roadmap.md or requirements.md only for something it leaves out)
424
420
  - {context_path} (USER DECISIONS from /pan:discuss-phase)
425
421
  - {research_path} (Technical Research — includes Validation Architecture)
426
422
  </files_to_read>
@@ -463,7 +459,7 @@ The fallback reads the heading when the report carries no valid `pan-verdict` bl
463
459
 
464
460
  Each re-check in the revision loop overwrites the same file and is recorded again as the next attempt. The issues a revision resolved are closed by that record.
465
461
 
466
- ## 12. Revision Loop (Max 3 Iterations)
462
+ ## 12. Revision Loop (At Most 2 Revisions, 3 Checks)
467
463
 
468
464
  Track `iteration_count` (starts at 1 after initial plan + check).
469
465
 
@@ -512,7 +508,7 @@ Offer: 1) Force proceed, 2) Provide guidance and retry, 3) Abandon
512
508
 
513
509
  **On "Force proceed":** record that planning continues past the remaining issues. Execution and the milestone audit will see them as deferred, with this reason:
514
510
  ```bash
515
- node ~/.claude/pan-wizard-core/bin/pan-tools.cjs findings dispose --phase "${PHASE_NUMBER}" --agent pan-plan-checker --open --as deferred --reason "force proceed after 3 plan revision iterations"
511
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs findings dispose --phase "${PHASE_NUMBER}" --agent pan-plan-checker --open --as deferred --reason "force proceed after 3 plan checks"
516
512
  ```
517
513
 
518
514
  ## 13. Present Final Status
@@ -585,7 +581,7 @@ Task(
585
581
 
586
582
  <instructions>
587
583
  1. Read exec-phase.md from execution_context for your complete workflow
588
- 2. Follow ALL steps: initialize, handle_branching, validate_phase, discover_and_group_plans, execute_waves, aggregate_results, close_parent_artifacts, verify_phase_goal, update_roadmap
584
+ 2. Follow ALL steps: initialize, handle_branching, validate_phase, discover_and_group_plans, execute_waves, checkpoint_handling, aggregate_results, generate_tests, code_review, close_parent_artifacts, verify_phase_goal, update_roadmap, offer_next
589
585
  3. The --no-transition flag means: after verification + roadmap update, STOP and return status. Do NOT run transition.md.
590
586
  4. When spawning executor agents, use subagent_type='pan-executor' with the existing @file pattern from the workflow
591
587
  5. When spawning verifier agents, use subagent_type='pan-verifier'
@@ -614,7 +610,8 @@ Task(
614
610
  Auto-advance stopped: Execution needs review.
615
611
 
616
612
  Review the output above and continue manually:
617
- /pan:exec-phase ${PHASE}
613
+ /pan:plan-phase ${PHASE} --gaps (verification found gaps)
614
+ /pan:exec-phase ${PHASE} (execution did not finish)
618
615
  ```
619
616
 
620
617
  **If neither `--auto` nor config enabled:**
@@ -34,7 +34,7 @@ This creates `.planning/config.json` with defaults if missing and loads current
34
34
  Detect if this is a downgrade and confirm with user:
35
35
 
36
36
  ```
37
- TIER_MAP = { "quality": 3, "balanced": 2, "budget": 1 }
37
+ TIER_MAP = { "quality": 2, "balanced": 2, "budget": 1 } # quality and balanced resolve every agent to the same tier and effort
38
38
  current_profile = config.model_profile OR "balanced"
39
39
  new_profile = $ARGUMENTS.profile
40
40
 
@@ -86,7 +86,7 @@ Display confirmation with model table and cost estimate for selected profile:
86
86
 
87
87
  Agents will now use:
88
88
 
89
- [Show table from MODEL_PROFILES in pan-tools.cjs for selected profile]
89
+ [Show table from MODEL_PROFILES in ~/.claude/pan-wizard-core/bin/lib/core.cjs for selected profile]
90
90
 
91
91
  Example (`budget` — the only profile that steps agents below the reasoning
92
92
  tier; `quality` and `balanced` put every agent on `reasoning`):
@@ -29,9 +29,9 @@ Exit.
29
29
 
30
30
  If missing state.md: suggest `/pan:new-project`.
31
31
 
32
- **If roadmap.md missing but project.md exists:**
32
+ **If `.planning/requirements.md` is missing but roadmap.md and project.md exist:**
33
33
 
34
- This means a milestone was completed and archived. Go to **Route F** (between milestones).
34
+ This means a milestone was completed and archived (`/pan:milestone-done` deletes requirements.md and keeps roadmap.md with the milestone collapsed). Go to **Route F** (between milestones).
35
35
 
36
36
  If missing both roadmap.md and project.md: suggest `/pan:new-project`.
37
37
  </step>
@@ -109,12 +109,10 @@ Plan [M] of [phase-total]: [status]
109
109
  CONTEXT: [✓ if has_context | - if not]
110
110
 
111
111
  ## Key Decisions Made
112
- - [extract from $STATE.decisions[]]
113
- - [e.g. jq -r '.decisions[].decision' from state-snapshot]
112
+ - [extract from $STATE.decisions[]: each entry's summary]
114
113
 
115
114
  ## Blockers/Concerns
116
115
  - [extract from $STATE.blockers[]]
117
- - [e.g. jq -r '.blockers[].text' from state-snapshot]
118
116
 
119
117
  ## Pending Todos
120
118
  - [count] pending — /pan:todo-check to review
@@ -280,7 +278,7 @@ State: "Current phase is {X}. Milestone has {N} phases (highest: {Y})."
280
278
 
281
279
  **Route C: Phase complete, more phases remain**
282
280
 
283
- Read roadmap.md to get the next phase's name and goal.
281
+ Take the next phase's name and goal from `$ROADMAP` (`roadmap analyze` lists every phase's `name` and `goal`).
284
282
 
285
283
  ```
286
284
  ---
@@ -333,7 +331,7 @@ All {N} phases finished!
333
331
 
334
332
  ---
335
333
 
336
- **Route F: Between milestones (roadmap.md missing, project.md exists)**
334
+ **Route F: Between milestones (requirements.md missing, roadmap.md and project.md exist)**
337
335
 
338
336
  A milestone was completed and archived. Ready to start the next milestone cycle.
339
337
 
@@ -267,6 +267,7 @@ Execute quick task ${next_num}.
267
267
  - Commit each task atomically
268
268
  - Create summary at: ${QUICK_DIR}/${next_num}-summary.md
269
269
  - Do NOT update roadmap.md (quick tasks are separate from planned phases)
270
+ - This is not a phase: skip `init execute-phase` and the state updates (advance-plan, update-progress, record-metric, record-session, roadmap update-plan-progress, requirements mark-complete); Step 7 of this workflow records the task in state.md
270
271
  </constraints>
271
272
  ",
272
273
  subagent_type="pan-executor",
@@ -381,7 +382,8 @@ Use `date` and `description_cell` from init. Write `description_cell` exactly as
381
382
 
382
383
  Use `date` and `description_cell` from init (one line, whatever the description held):
383
384
  ```
384
- Last activity: ${date} - Completed quick task ${next_num}: ${description_cell}
385
+ **Last Activity:** ${date}
386
+ **Last Activity Description:** Completed quick task ${next_num}: ${description_cell}
385
387
  ```
386
388
 
387
389
  Use Edit tool to make these changes atomically
@@ -449,8 +451,8 @@ Ready for next task: /pan:quick
449
451
  - [ ] User provides task description
450
452
  - [ ] `--full` flag parsed from arguments when present
451
453
  - [ ] Slug generated (lowercase, hyphens, max 40 chars)
452
- - [ ] Next number calculated (001, 002, 003...)
453
- - [ ] Directory created at `.planning/quick/NNN-slug/`
454
+ - [ ] Next number taken from init (`next_num`: 1, 2, 3...)
455
+ - [ ] Directory created at init's `task_dir` (`.planning/quick/{next_num}-{slug}/`)
454
456
  - [ ] `${next_num}-plan.md` created by planner
455
457
  - [ ] (--full) Plan checker validates plan, revision loop capped at 2
456
458
  - [ ] `${next_num}-summary.md` created by executor
@@ -102,7 +102,7 @@ Extract from result: `removed`, `directory_deleted`, `renamed_directories`, `ren
102
102
  Stage and commit the removal:
103
103
 
104
104
  ```bash
105
- node ~/.claude/pan-wizard-core/bin/pan-tools.cjs commit "chore: remove phase {target} ({original-phase-name})" --files .planning/
105
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs commit "chore: remove phase {target} ({original-phase-name})" --files .planning/ --force
106
106
  ```
107
107
 
108
108
  The commit message preserves the historical record of what was removed.
@@ -35,7 +35,12 @@ If exists: Offer update/view/skip options.
35
35
 
36
36
  ```bash
37
37
  INIT=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs init phase-op "${PHASE}")
38
- # Extract: phase_dir, padded_phase, phase_number, state_path, requirements_path, context_path
38
+ # Extract: phase_dir, padded_phase, phase_slug, phase_number, state_path, requirements_path, context_path
39
+ # phase_dir is null when the phase has no directory yet: create it (scaffold pads the number and honours the planning root) and use the printed path as phase_dir
40
+ case "{phase_dir}" in ""|null) node ~/.claude/pan-wizard-core/bin/pan-tools.cjs scaffold phase-dir --phase "${PHASE}" --name "{phase_name}" --raw ;; esac
41
+
42
+ # This phase's roadmap and requirements, written into the phase directory
43
+ SLICE_PATH=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs roadmap slice "${PHASE}" --write --raw)
39
44
  ```
40
45
 
41
46
  ## Step 4: Spawn Researcher
@@ -48,7 +53,7 @@ Research implementation approach for Phase {phase}: {name}
48
53
 
49
54
  <files_to_read>
50
55
  - {context_path} (USER DECISIONS from /pan:discuss-phase)
51
- - {requirements_path} (Project requirements)
56
+ - {slice_path} (This phase's roadmap and requirements; if SLICE_PATH is empty, {requirements_path} instead)
52
57
  - {state_path} (Project decisions and history)
53
58
  </files_to_read>
54
59
 
@@ -57,7 +62,7 @@ Phase description: {description}
57
62
  </additional_context>
58
63
 
59
64
  <output>
60
- Write to: .planning/phases/${PHASE}-{slug}/${PHASE}-research.md
65
+ Write to: {phase_dir}/{padded_phase}-research.md
61
66
  </output>",
62
67
  subagent_type="pan-phase-researcher",
63
68
  model="{researcher_model}"
@@ -67,7 +72,6 @@ Write to: .planning/phases/${PHASE}-{slug}/${PHASE}-research.md
67
72
  ## Step 5: Handle Return
68
73
 
69
74
  - `## RESEARCH COMPLETE` — Display summary, offer: Plan/Dig deeper/Review/Done
70
- - `## CHECKPOINT REACHED` — Present to user, spawn continuation
71
- - `## RESEARCH INCONCLUSIVE` — Show attempts, offer: Add context/Try different mode/Manual
75
+ - `## RESEARCH BLOCKED` — Display the blocker, offer: Provide context / Skip research / Abort
72
76
 
73
77
  </process>
@@ -252,12 +252,10 @@ Before proceeding to routed workflow, update session continuity:
252
252
 
253
253
  Update state.md:
254
254
 
255
- ```markdown
256
- ## Session Continuity
257
-
258
- Last session: [now]
259
- Stopped at: Session resumed, proceeding to [action]
260
- Resume file: [updated if applicable]
255
+ ```bash
256
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs state record-session \
257
+ --stopped-at "Session resumed, proceeding to [action]" \
258
+ --resume-file "[updated if applicable, else None]"
261
259
  ```
262
260
 
263
261
  This ensures if session ends unexpectedly, next resume knows the state.
@@ -22,6 +22,8 @@ Call pan-tools retro to gather all metrics:
22
22
  RETRO=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs retro)
23
23
  ```
24
24
 
25
+ If the user passed `--write-memory` (and `--max N`), pass them on: `pan-tools retro --write-memory [--max N]`. It is the one flag that writes, appending recurring-pattern entries to the agent logs in `.planning/memory/`, and the JSON then carries `memory.wrote`. Never add it on your own.
26
+
25
27
  Parse JSON for: `phases_planned`, `phases_completed`, `phases_decimal`, `estimation_accuracy_pct`, `verifications_total`, `verifications_passed_first_try`, `verifications_gaps_found`, `verifications_human_needed`, `first_try_rate_pct`, `common_gap_patterns`.
26
28
 
27
29
  **If error:** Report "No roadmap found — run /pan:new-project first."
@@ -114,7 +116,7 @@ For each top pattern, suggest a preventive action:
114
116
  </process>
115
117
 
116
118
  <constraints>
117
- - Read-only: this workflow does not modify any files
119
+ - Read-only: this workflow does not modify any files, unless the user passed `--write-memory` (then `pan-tools retro` appends to the agent logs in `.planning/memory/` and nothing else changes)
118
120
  - Data-driven: all assessments backed by quantitative metrics
119
121
  - Actionable: every finding includes a concrete recommendation
120
122
  - Non-judgmental: focus on systemic patterns, not individual decisions
@@ -24,7 +24,7 @@ Creates `.planning/config.json` with defaults if missing and loads current confi
24
24
  cat .planning/config.json
25
25
  ```
26
26
 
27
- Parse current values (default to `true` if not present):
27
+ Parse current values (when a key is absent, use PAN's default: `true` for research, plan_check and verifier; `false` for nyquist_validation):
28
28
  - `workflow.research` — spawn researcher during plan-phase
29
29
  - `workflow.plan_check` — spawn plan checker during plan-phase
30
30
  - `workflow.verifier` — spawn verifier during execute-phase
@@ -110,7 +110,7 @@ AskUserQuestion([
110
110
  multiSelect: false,
111
111
  options: [
112
112
  { label: "Static (Recommended)", description: "Profile assigns fixed tiers to each agent. Predictable and simple." },
113
- { label: "Complexity", description: "Adjust tiers up/down based on task complexity (file count, requirements, architecture). Saves tokens on simple phases." }
113
+ { 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
114
  ]
115
115
  }
116
116
  ])
@@ -118,27 +118,18 @@ AskUserQuestion([
118
118
  </step>
119
119
 
120
120
  <step name="update_config">
121
- Merge new settings into existing config.json:
121
+ Write each answer with `config-set`, which keeps every other key in the `workflow` and `routing` objects:
122
122
 
123
- ```json
124
- {
125
- ...existing_config,
126
- "model_profile": "quality" | "balanced" | "budget",
127
- "workflow": {
128
- "research": true/false,
129
- "plan_check": true/false,
130
- "verifier": true/false,
131
- "auto_advance": true/false,
132
- "nyquist_validation": true/false
133
- },
134
- "branching_strategy": "none" | "phase" | "milestone",
135
- "routing": {
136
- "strategy": "static" | "complexity"
137
- }
138
- }
123
+ ```bash
124
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs config-set model_profile <quality|balanced|budget>
125
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs config-set workflow.research <true|false>
126
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs config-set workflow.plan_check <true|false>
127
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs config-set workflow.verifier <true|false>
128
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs config-set workflow.auto_advance <true|false>
129
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs config-set workflow.nyquist_validation <true|false>
130
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs config-set branching_strategy <none|phase|milestone>
131
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs config-set routing.strategy <static|complexity>
139
132
  ```
140
-
141
- Write updated config to `.planning/config.json`.
142
133
  </step>
143
134
 
144
135
  <step name="save_as_defaults">
@@ -179,7 +170,8 @@ Write `~/.pan-wizard/defaults.json` with:
179
170
  "verifier": <current>,
180
171
  "auto_advance": <current>,
181
172
  "nyquist_validation": <current>
182
- }
173
+ },
174
+ "routing": { "strategy": <current> }
183
175
  }
184
176
  ```
185
177
  </step>
@@ -218,8 +210,8 @@ Quick commands:
218
210
 
219
211
  <success_criteria>
220
212
  - [ ] Current config read
221
- - [ ] User presented with 7 settings (profile + 5 workflow toggles + git branching)
222
- - [ ] Config updated with model_profile, workflow, and git sections
213
+ - [ ] User presented with the settings above (model profile, workflow toggles, git branching, routing strategy)
214
+ - [ ] Config updated with model_profile, workflow, branching_strategy and routing
223
215
  - [ ] User offered to save as global defaults (~/.pan-wizard/defaults.json)
224
216
  - [ ] Changes confirmed to user
225
217
  </success_criteria>
@@ -127,7 +127,7 @@ Use AskUserQuestion:
127
127
  ```bash
128
128
  node ~/.claude/pan-wizard-core/bin/pan-tools.cjs todo complete "[filename]"
129
129
  ```
130
- This moves it to `.planning/todos/completed/` with a `completed:` date — the directory `init todos` and `/pan:progress` count.
130
+ This moves it out of `.planning/todos/pending/` (the directory `init todos` and `/pan:progress` count) into `.planning/todos/completed/` with a `completed:` date.
131
131
  Update state.md todo count. Present problem/solution context. Begin work or ask how to proceed.
132
132
 
133
133
  **Add to phase plan:**
@@ -4,7 +4,7 @@
4
4
 
5
5
  1. `.planning/state.md`
6
6
  2. `.planning/project.md`
7
- 3. `.planning/roadmap.md`
7
+ 3. The current phase's roadmap slice (`.planning/phases/XX-current/XX-roadmap-slice.md`) — not the whole roadmap.md (Route A takes the next phase from `phase complete` and `roadmap get-phase`)
8
8
  4. Current phase's plan files (`*-plan.md`)
9
9
  5. Current phase's summary files (`*-summary.md`)
10
10
 
@@ -152,7 +152,7 @@ If found, delete them — phase is complete, handoffs are stale.
152
152
  **Delegate roadmap.md and state.md updates to pan-tools:**
153
153
 
154
154
  ```bash
155
- TRANSITION=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs phase complete "${current_phase}")
155
+ TRANSITION=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs phase complete "${current_phase}") # skip when exec-phase invoked this workflow: its `phase complete` already ran — reuse that result
156
156
  ```
157
157
 
158
158
  The CLI handles:
@@ -358,9 +358,9 @@ Then Edit state.md (still under the P-1604 batched-write policy — fold this Ed
358
358
  **Format:**
359
359
 
360
360
  ```markdown
361
- Last session: [today]
362
- Stopped at: Phase [X] complete, ready to plan Phase [X+1]
363
- Resume file: None
361
+ **Last session:** [today]
362
+ **Stopped At:** Phase [X] complete, ready to plan Phase [X+1]
363
+ **Resume File:** None
364
364
  ```
365
365
 
366
366
  **Step complete when:**
@@ -396,12 +396,12 @@ This returns all phases with goals, disk status, and completion info.
396
396
 
397
397
  **Route A: More phases remain in milestone**
398
398
 
399
- Read roadmap.md to get the next phase's name and goal.
399
+ Take the name from `next_phase_name` (the `phase complete` result) and the goal from `roadmap get-phase "${next_phase}"`, not the whole roadmap.md.
400
400
 
401
401
  **Check if next phase has context.md:**
402
402
 
403
403
  ```bash
404
- ls .planning/phases/*[X+1]*/*-context.md 2>/dev/null
404
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs init phase-op "${next_phase}" # has_context is true when the next phase has a context.md
405
405
  ```
406
406
 
407
407
  **If next phase exists:**
@@ -448,8 +448,8 @@ Task(
448
448
  <instructions>
449
449
  1. Read plan-phase.md from execution_context for your complete workflow.
450
450
  2. Follow ALL steps: initialize, validate_phase, load context.md, handle research (P-1401 bypass if applicable), spawn pan-planner, optionally spawn pan-plan-checker, then auto-advance to exec-phase via Task (per plan-phase.md step 14).
451
- 3. After exec-phase completes and verification passes, exec-phase will return to its own auto-advance handler which spawns transition.md — that transition will spawn Phase ${NEXT_PHASE}+1 via this same pattern, recursing until milestone-done.
452
- 4. Do NOT use the Skill tool or /pan: commands. Do NOT exit early — let the recursion run.
451
+ 3. plan-phase step 14 spawns exec-phase with --no-transition, so exec-phase returns without running transition.md and the chain ends there: on PHASE COMPLETE plan-phase prints `/pan:discuss-phase {next} --auto` as the next step; on GAPS FOUND it stops and reports the gaps.
452
+ 4. Do NOT use the Skill tool or /pan: commands. Do NOT exit early — wait for the exec-phase Task to return.
453
453
  </instructions>
454
454
  ",
455
455
  subagent_type="general-purpose",
@@ -500,7 +500,7 @@ Task(
500
500
  ```
501
501
 
502
502
  **Handle next-phase Task return:**
503
- - **PHASE COMPLETE** (the spawned chain reached verification + roadmap update for ${NEXT_PHASE} and beyond, and either hit milestone-done or recursed further) → Done. Workflow chain finished.
503
+ - **PHASE COMPLETE** (the spawned chain reached verification + roadmap update for ${NEXT_PHASE} and stopped at that phase's boundary; plan-phase printed `/pan:discuss-phase {next} --auto`) → Done. Workflow chain finished.
504
504
  - **GAPS FOUND / FAILED / TIMEOUT** → Display the failure, stop the recursion, return status to user. Do NOT attempt to skip ahead.
505
505
 
506
506
  </if>
@@ -574,10 +574,10 @@ Phase {X} marked complete.
574
574
 
575
575
  🎉 Milestone {version} is 100% complete — all {N} phases finished!
576
576
 
577
- ⚡ Auto-continuing: Complete milestone and archive
577
+ Auto-advance stops at the milestone boundary. Next: /pan:milestone-done {version}
578
578
  ```
579
579
 
580
- Exit skill and invoke SlashCommand("/pan:milestone-done {version}")
580
+ Stop here and show `/pan:milestone-done {version}` as the next step: the milestone boundary ends the auto chain (auto-advance was cleared above).
581
581
 
582
582
  </if>
583
583
 
@@ -24,19 +24,32 @@ case "$VERSION_FILE" in
24
24
  ./*) SCOPE="LOCAL" ;;
25
25
  *) SCOPE="GLOBAL" ;;
26
26
  esac
27
+ # The same templated path names the runtime: the installer rewrites ~/.claude/ to
28
+ # this runtime's own directory. With no runtime flag the installer installs Claude
29
+ # Code only, so the flag must be passed.
30
+ case "$VERSION_FILE" in
31
+ *.codex/*) RUNTIME="--codex" ;;
32
+ *.gemini/*) RUNTIME="--gemini" ;;
33
+ *opencode/*) RUNTIME="--opencode" ;;
34
+ *.github/*|*.copilot/*) RUNTIME="--copilot" ;;
35
+ *) RUNTIME="--claude" ;;
36
+ esac
27
37
 
28
38
  if [ -f "$VERSION_FILE" ] && [ -f "$MARKER_FILE" ] && grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+' "$VERSION_FILE"; then
29
39
  cat "$VERSION_FILE"
40
+ echo "$RUNTIME"
30
41
  echo "$SCOPE"
31
42
  else
32
43
  echo "UNKNOWN"
44
+ echo "$RUNTIME"
45
+ echo "$SCOPE"
33
46
  fi
34
47
  ```
35
48
 
36
- Parse output (there is ONE install; scope is derived from the shape of the single templated prefix):
37
- - If last line is "LOCAL": this install is local-scoped (templated prefix is `./`-relative); installed version is first line; use `--local`
38
- - If last line is "GLOBAL": this install is global-scoped (templated prefix is an absolute path); installed version is first line; use `--global`
39
- - If "UNKNOWN": the VERSION/marker files are missing or invalid; proceed to install step (treat as version 0.0.0)
49
+ Parse output (there is ONE install; scope and runtime are derived from the single templated prefix). The output is three lines: the installed version (or `UNKNOWN`), the runtime flag (`--claude`, `--codex`, `--gemini`, `--opencode` or `--copilot`) and the scope. Remember the runtime flag: the install step writes it into its command.
50
+ - If last line is "LOCAL": this install is local-scoped (templated prefix is `./`-relative); use `--local`
51
+ - If last line is "GLOBAL": this install is global-scoped (templated prefix is an absolute path); use `--global`
52
+ - If the first line is "UNKNOWN": the VERSION/marker files are missing or invalid; proceed to install step (treat as version 0.0.0) — the runtime and scope lines still apply
40
53
 
41
54
  **If VERSION file missing:**
42
55
  ```
@@ -63,7 +76,7 @@ npm view pan-wizard version 2>/dev/null
63
76
  ```
64
77
  Couldn't check for updates (offline or npm unavailable).
65
78
 
66
- To update manually: `npx pan-wizard --global`
79
+ To update manually: `npx -y pan-wizard@latest {runtime_flag} --global` (`--local` for a local install), with the runtime flag and scope step 1 printed
67
80
  ```
68
81
 
69
82
  Exit.
@@ -155,28 +168,23 @@ Run the update using the install type detected in step 1:
155
168
 
156
169
  **If LOCAL install:**
157
170
  ```bash
158
- npx -y pan-wizard@latest --local
171
+ npx -y pan-wizard@latest {runtime_flag} --local
159
172
  ```
160
173
 
161
- **If GLOBAL install (or unknown):**
174
+ **If GLOBAL install:**
162
175
  ```bash
163
- npx -y pan-wizard@latest --global
176
+ npx -y pan-wizard@latest {runtime_flag} --global
164
177
  ```
165
178
 
166
- Capture output. If install fails, show error and exit.
179
+ `{runtime_flag}` is the runtime line step 1 printed: write the flag itself into the command. A variable set in step 1's shell call is gone in this one (each Bash call starts a new shell), and an empty `""` argument in its place installs Claude Code only. A `--config-dir` or `--unified-skills` install is not recognised from its path: for those, re-run the installer with your original flags instead.
167
180
 
168
- Clear the update cache so statusline indicator disappears:
181
+ Capture output. If install fails, show error and exit.
169
182
 
170
- **If LOCAL install:**
171
- ```bash
172
- rm -f ~/.claude/cache/pan-update-check.json
173
- ```
183
+ Clear the update cache so the statusline indicator disappears. The update-check hook keeps it under your home directory for every install, local or global, in the runtime's own config directory: `.claude` (Claude Code), `.codex` (Codex), `.gemini` (Gemini CLI) or `.copilot` (Copilot CLI); OpenCode runs no update-check hook, so there is nothing to clear there:
174
184
 
175
- **If GLOBAL install:**
176
185
  ```bash
177
- rm -f ~/.claude/cache/pan-update-check.json
186
+ rm -f "$HOME/<config dir from the list above>/cache/pan-update-check.json"
178
187
  ```
179
- (Paths are templated at install time for runtime compatibility)
180
188
  </step>
181
189
 
182
190
  <step name="display_result">