pan-wizard 3.32.0 → 3.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. package/README.md +23 -20
  2. package/agents/pan-conductor.md +18 -17
  3. package/agents/pan-counterfactual.md +2 -2
  4. package/agents/pan-debugger.md +27 -8
  5. package/agents/pan-design-checker.md +1 -1
  6. package/agents/pan-designer.md +2 -2
  7. package/agents/pan-distiller.md +3 -3
  8. package/agents/pan-document_code.md +16 -16
  9. package/agents/pan-executor.md +15 -11
  10. package/agents/pan-experiment-runner.md +15 -17
  11. package/agents/pan-hardener.md +15 -15
  12. package/agents/pan-integration-checker.md +2 -2
  13. package/agents/pan-knowledge.md +2 -2
  14. package/agents/pan-meta-reviewer.md +5 -5
  15. package/agents/pan-optimizer.md +40 -44
  16. package/agents/pan-phase-researcher.md +10 -10
  17. package/agents/pan-plan-checker.md +36 -30
  18. package/agents/pan-planner.md +77 -53
  19. package/agents/pan-previewer.md +1 -1
  20. package/agents/pan-project-researcher.md +21 -78
  21. package/agents/pan-release.md +1 -1
  22. package/agents/pan-research-synthesizer.md +2 -2
  23. package/agents/pan-reviewer.md +24 -2
  24. package/agents/pan-roadmapper.md +20 -62
  25. package/agents/pan-verifier.md +53 -30
  26. package/bin/install-lib.cjs +228 -38
  27. package/bin/install.js +86 -15
  28. package/commands/pan/army.md +16 -12
  29. package/commands/pan/assumptions.md +2 -2
  30. package/commands/pan/audit-deployment.md +11 -12
  31. package/commands/pan/cost.md +8 -4
  32. package/commands/pan/debug.md +10 -7
  33. package/commands/pan/design-phase.md +3 -3
  34. package/commands/pan/discuss-phase.md +2 -0
  35. package/commands/pan/exec-phase.md +21 -37
  36. package/commands/pan/experiment.md +11 -10
  37. package/commands/pan/focus-auto.md +33 -27
  38. package/commands/pan/focus-design.md +9 -6
  39. package/commands/pan/focus-doc-audit.md +4 -3
  40. package/commands/pan/focus-drift-walking.md +4 -3
  41. package/commands/pan/focus-exec.md +7 -7
  42. package/commands/pan/focus-plan.md +12 -11
  43. package/commands/pan/focus-scan.md +7 -10
  44. package/commands/pan/focus-sync.md +3 -2
  45. package/commands/pan/git.md +8 -8
  46. package/commands/pan/health.md +2 -2
  47. package/commands/pan/hud.md +3 -2
  48. package/commands/pan/hygiene.md +14 -7
  49. package/commands/pan/knowledge.md +9 -9
  50. package/commands/pan/learn.md +10 -7
  51. package/commands/pan/links.md +4 -1
  52. package/commands/pan/map-codebase.md +5 -5
  53. package/commands/pan/mcp-bridge.md +18 -18
  54. package/commands/pan/milestone-done.md +7 -5
  55. package/commands/pan/milestone-new.md +1 -1
  56. package/commands/pan/new-project.md +10 -10
  57. package/commands/pan/optimize.md +16 -14
  58. package/commands/pan/patches.md +2 -6
  59. package/commands/pan/pause.md +1 -1
  60. package/commands/pan/phase-tests.md +4 -3
  61. package/commands/pan/plan-phase.md +9 -19
  62. package/commands/pan/preview.md +1 -1
  63. package/commands/pan/profile.md +4 -4
  64. package/commands/pan/quick.md +1 -1
  65. package/commands/pan/remove-phase.md +1 -1
  66. package/commands/pan/report.md +2 -2
  67. package/commands/pan/research-phase.md +14 -15
  68. package/commands/pan/resume.md +9 -11
  69. package/commands/pan/retro.md +5 -3
  70. package/commands/pan/review-deep.md +10 -10
  71. package/commands/pan/settings.md +1 -1
  72. package/commands/pan/todo-add.md +2 -2
  73. package/commands/pan/todo-check.md +2 -2
  74. package/commands/pan/verify-phase.md +0 -11
  75. package/commands/pan/what-if.md +2 -2
  76. package/hooks/dist/pan-context-monitor.js +343 -44
  77. package/hooks/dist/pan-cost-logger.js +30 -0
  78. package/hooks/dist/pan-state-reinject.js +140 -15
  79. package/hooks/dist/pan-statusline.js +68 -22
  80. package/hooks/dist/pan-stop-guard.js +7 -2
  81. package/package.json +1 -1
  82. package/pan-wizard-core/bin/lib/agents-md.cjs +48 -7
  83. package/pan-wizard-core/bin/lib/bridge.cjs +6 -5
  84. package/pan-wizard-core/bin/lib/campaign.cjs +4 -2
  85. package/pan-wizard-core/bin/lib/commands-learnings.cjs +19 -2
  86. package/pan-wizard-core/bin/lib/commands.cjs +126 -5
  87. package/pan-wizard-core/bin/lib/config.cjs +112 -1
  88. package/pan-wizard-core/bin/lib/constants.cjs +29 -15
  89. package/pan-wizard-core/bin/lib/context-budget.cjs +12 -9
  90. package/pan-wizard-core/bin/lib/core.cjs +77 -23
  91. package/pan-wizard-core/bin/lib/cost-rebuild.cjs +13 -1
  92. package/pan-wizard-core/bin/lib/cost.cjs +149 -10
  93. package/pan-wizard-core/bin/lib/distill.cjs +6 -3
  94. package/pan-wizard-core/bin/lib/doc-lint.cjs +30 -11
  95. package/pan-wizard-core/bin/lib/findings.cjs +15 -4
  96. package/pan-wizard-core/bin/lib/focus.cjs +13 -4
  97. package/pan-wizard-core/bin/lib/frontmatter.cjs +105 -26
  98. package/pan-wizard-core/bin/lib/hygiene.cjs +178 -17
  99. package/pan-wizard-core/bin/lib/init.cjs +12 -5
  100. package/pan-wizard-core/bin/lib/knowledge.cjs +17 -1
  101. package/pan-wizard-core/bin/lib/learn-index.cjs +111 -10
  102. package/pan-wizard-core/bin/lib/learn-lint.cjs +30 -3
  103. package/pan-wizard-core/bin/lib/memory-optimize.cjs +8 -4
  104. package/pan-wizard-core/bin/lib/memory.cjs +508 -54
  105. package/pan-wizard-core/bin/lib/milestone.cjs +8 -3
  106. package/pan-wizard-core/bin/lib/optimize.cjs +84 -16
  107. package/pan-wizard-core/bin/lib/phase-remove.cjs +85 -21
  108. package/pan-wizard-core/bin/lib/phase-report.cjs +8 -2
  109. package/pan-wizard-core/bin/lib/phase.cjs +67 -15
  110. package/pan-wizard-core/bin/lib/preview.cjs +3 -1
  111. package/pan-wizard-core/bin/lib/review-deep.cjs +2 -2
  112. package/pan-wizard-core/bin/lib/roadmap-compact.cjs +267 -0
  113. package/pan-wizard-core/bin/lib/roadmap.cjs +243 -9
  114. package/pan-wizard-core/bin/lib/runner.cjs +2 -1
  115. package/pan-wizard-core/bin/lib/state-compact.cjs +11 -6
  116. package/pan-wizard-core/bin/lib/state.cjs +47 -31
  117. package/pan-wizard-core/bin/lib/template.cjs +11 -4
  118. package/pan-wizard-core/bin/lib/verdict.cjs +54 -4
  119. package/pan-wizard-core/bin/lib/verify-drift.cjs +14 -5
  120. package/pan-wizard-core/bin/lib/verify-preflight.cjs +4 -13
  121. package/pan-wizard-core/bin/lib/verify-retro.cjs +5 -3
  122. package/pan-wizard-core/bin/lib/verify-scope.cjs +74 -4
  123. package/pan-wizard-core/bin/lib/verify.cjs +117 -35
  124. package/pan-wizard-core/bin/lib/whatif.cjs +5 -3
  125. package/pan-wizard-core/bin/pan-tools.cjs +111 -17
  126. package/pan-wizard-core/learnings/index.json +5 -5
  127. package/pan-wizard-core/mcp/server.cjs +18 -9
  128. package/pan-wizard-core/opencode/pan-wizard.js +111 -0
  129. package/pan-wizard-core/references/checkpoints.md +7 -5
  130. package/pan-wizard-core/references/continuation-format.md +3 -3
  131. package/pan-wizard-core/references/decimal-phase-calculation.md +2 -3
  132. package/pan-wizard-core/references/design-methodology.md +1 -1
  133. package/pan-wizard-core/references/git-integration.md +4 -6
  134. package/pan-wizard-core/references/git-planning-commit.md +2 -2
  135. package/pan-wizard-core/references/guardrails.md +2 -2
  136. package/pan-wizard-core/references/handoff-decisions.md +3 -3
  137. package/pan-wizard-core/references/model-profile-resolution.md +5 -5
  138. package/pan-wizard-core/references/model-profiles.md +14 -9
  139. package/pan-wizard-core/references/phase-argument-parsing.md +7 -7
  140. package/pan-wizard-core/references/planning-config.md +4 -4
  141. package/pan-wizard-core/references/tdd.md +10 -1
  142. package/pan-wizard-core/references/verdict-contract.md +2 -1
  143. package/pan-wizard-core/references/verification-patterns.md +5 -5
  144. package/pan-wizard-core/templates/codebase/architecture.md +2 -2
  145. package/pan-wizard-core/templates/codebase/best-practices.md +2 -2
  146. package/pan-wizard-core/templates/codebase/concerns.md +3 -3
  147. package/pan-wizard-core/templates/codebase/integrations.md +6 -6
  148. package/pan-wizard-core/templates/codebase/relationships.md +2 -2
  149. package/pan-wizard-core/templates/codebase/stack.md +2 -2
  150. package/pan-wizard-core/templates/codebase/structure.md +4 -4
  151. package/pan-wizard-core/templates/codebase/testing.md +4 -4
  152. package/pan-wizard-core/templates/continue-here.md +1 -1
  153. package/pan-wizard-core/templates/debug-subagent-prompt.md +3 -2
  154. package/pan-wizard-core/templates/debug.md +15 -1
  155. package/pan-wizard-core/templates/discovery.md +1 -1
  156. package/pan-wizard-core/templates/milestone-archive.md +6 -6
  157. package/pan-wizard-core/templates/milestone.md +1 -1
  158. package/pan-wizard-core/templates/phase-prompt.md +31 -18
  159. package/pan-wizard-core/templates/planner-subagent-prompt.md +3 -5
  160. package/pan-wizard-core/templates/research-project/architecture.md +3 -3
  161. package/pan-wizard-core/templates/research-project/features.md +1 -1
  162. package/pan-wizard-core/templates/research-project/pitfalls.md +1 -1
  163. package/pan-wizard-core/templates/research-project/stack.md +3 -3
  164. package/pan-wizard-core/templates/research.md +5 -5
  165. package/pan-wizard-core/templates/retrospective.md +1 -1
  166. package/pan-wizard-core/templates/roadmap.md +15 -15
  167. package/pan-wizard-core/templates/summary-complex.md +1 -0
  168. package/pan-wizard-core/templates/summary-minimal.md +1 -0
  169. package/pan-wizard-core/templates/summary-standard.md +2 -1
  170. package/pan-wizard-core/templates/summary.md +18 -2
  171. package/pan-wizard-core/templates/uat.md +3 -3
  172. package/pan-wizard-core/templates/user-setup.md +8 -8
  173. package/pan-wizard-core/templates/verification-report.md +54 -4
  174. package/pan-wizard-core/workflows/add-phase.md +1 -1
  175. package/pan-wizard-core/workflows/assumptions.md +1 -1
  176. package/pan-wizard-core/workflows/discuss-phase.md +9 -8
  177. package/pan-wizard-core/workflows/exec-phase.md +34 -60
  178. package/pan-wizard-core/workflows/execute-plan.md +8 -7
  179. package/pan-wizard-core/workflows/health.md +13 -11
  180. package/pan-wizard-core/workflows/help.md +8 -9
  181. package/pan-wizard-core/workflows/learn.md +13 -11
  182. package/pan-wizard-core/workflows/map-codebase.md +10 -10
  183. package/pan-wizard-core/workflows/milestone-audit.md +10 -10
  184. package/pan-wizard-core/workflows/milestone-gaps.md +17 -24
  185. package/pan-wizard-core/workflows/milestone-new.md +7 -6
  186. package/pan-wizard-core/workflows/new-project.md +10 -10
  187. package/pan-wizard-core/workflows/optimize.md +11 -9
  188. package/pan-wizard-core/workflows/pause.md +6 -1
  189. package/pan-wizard-core/workflows/phase-tests.md +4 -4
  190. package/pan-wizard-core/workflows/plan-phase.md +31 -34
  191. package/pan-wizard-core/workflows/profile.md +2 -2
  192. package/pan-wizard-core/workflows/progress.md +5 -7
  193. package/pan-wizard-core/workflows/quick.md +10 -8
  194. package/pan-wizard-core/workflows/remove-phase.md +1 -1
  195. package/pan-wizard-core/workflows/research-phase.md +9 -5
  196. package/pan-wizard-core/workflows/resume-project.md +4 -6
  197. package/pan-wizard-core/workflows/retro.md +3 -1
  198. package/pan-wizard-core/workflows/settings.md +16 -24
  199. package/pan-wizard-core/workflows/todo-check.md +1 -1
  200. package/pan-wizard-core/workflows/transition.md +12 -12
  201. package/pan-wizard-core/workflows/update.md +25 -17
  202. package/pan-wizard-core/workflows/verify-phase.md +24 -17
  203. package/pan-zcode/KNOWN-BETA-RISKS.md +2 -2
  204. package/pan-zcode/README.md +7 -7
  205. package/pan-zcode/bin/install-zcode.js +1 -1
  206. package/scripts/build-agent-plugin.js +19 -5
  207. package/scripts/build-plugin.js +3 -1
  208. package/scripts/generate-skills-docs.py +13 -4
  209. package/scripts/test-surface.cjs +4 -0
@@ -2,7 +2,7 @@
2
2
  name: pan:mcp-bridge
3
3
  group: External tools
4
4
  description: Discover available MCP tools and recommend which ones apply to a phase. Discovery-only; auto-invocation deferred.
5
- argument-hint: "list | recommend <phase> | cache [--servers <json>] [--runtime <name>]"
5
+ argument-hint: "list | recommend <phase> [--max N] [--min-score N] | cache [--servers <json>] [--runtime <name>]"
6
6
  allowed-tools:
7
7
  - Read
8
8
  - Bash
@@ -12,7 +12,7 @@ allowed-tools:
12
12
  <objective>
13
13
  Surface Model Context Protocol (MCP) tools visible to the host runtime and recommend which ones might apply to a specific phase plan.
14
14
 
15
- Reduced scope from Spec B v1's X-7: **discovery and recommendation only**. Auto-injection of MCP tools into planner context and auto-invocation from executor agents are deliberately deferred (likely Wave 5+ or v3.5). This keeps v3.3 narrow and avoids coupling PAN to Claude Code's MCP schema stability.
15
+ Reduced scope from Spec B v1's X-7: **discovery and recommendation only**. Auto-injection of MCP tools into planner context and auto-invocation from executor agents are deliberately deferred and still unscheduled (the v3.5 target passed without them). This kept v3.3 narrow and avoids coupling PAN to Claude Code's MCP schema stability.
16
16
  </objective>
17
17
 
18
18
  <execution_context>
@@ -44,7 +44,7 @@ Show cached MCP tools with server grouping and schemas.
44
44
  }
45
45
  ```
46
46
 
47
- When `source: "empty"`, either no MCP servers are configured or the host runtime hasn't populated the cache yet. See the `cache` subcommand for manual seeding.
47
+ When `source: "empty"`, nothing has seeded the cache yet: no hook or host writes it, only `cache --servers` (or an external script). See the `cache` subcommand for manual seeding.
48
48
 
49
49
  ### `recommend <phase>`
50
50
 
@@ -85,20 +85,20 @@ Scoring is naive keyword frequency with word boundaries — not semantic embeddi
85
85
  Write or inspect the MCP tools cache at `.planning/bridge/available-tools.json`.
86
86
 
87
87
  ```
88
- # Inspect current cache (same as `list` but raw)
88
+ # Inspect current cache (prints the same JSON as `list`)
89
89
  /pan:mcp-bridge cache
90
90
 
91
91
  # Seed cache from scripted discovery (for testing or external pipeline)
92
92
  /pan:mcp-bridge cache --runtime claude --servers '[{"name":"linear","tools":[{"name":"linear.updateTicket","description":"Update ticket"}]}]'
93
93
  ```
94
94
 
95
- Normally the host runtime writes this file. The CLI path exists for test fixtures and external-script integration.
95
+ Nothing else writes this file: no hook or installer step populates it, so `list` and `recommend` see only what this command (or an external script) has recorded.
96
96
 
97
97
  </subcommands>
98
98
 
99
99
  <workflow>
100
100
 
101
- **New to a project with MCP tools?** Run `/pan:mcp-bridge list` to see what's available. If empty, check the host runtime's MCP config — each runtime keeps it somewhere different: Claude Code in `settings.json` under its config dir, OpenCode in `opencode.json`, Copilot in `.github/mcp.json`, Codex in its own config, Gemini in its settings file.
101
+ **New to a project with MCP tools?** Run `/pan:mcp-bridge list` to see what's available. If empty, nothing has seeded the cache: record each server with its tools, `/pan:mcp-bridge cache --servers '[{"name":"<server>","tools":[{"name":"<tool>","description":"…"}]}]'`, taking the tool names and descriptions from the MCP tools your session has loaded. A server recorded without `tools` adds no tool to `list` (only `server_count` counts it, and `source` then reads `cache`) and nothing to `recommend`, and the host runtime's MCP config names only the servers and how to start them. Each runtime keeps that config somewhere different: Claude Code in `.mcp.json` at the project root (project scope) or `~/.claude.json` (user and local scopes), OpenCode in `opencode.json`, Copilot in `.github/mcp.json`, Codex in its own config, Gemini in its settings file.
102
102
 
103
103
  **Planning a phase that might touch external systems?** Run `/pan:mcp-bridge recommend <phase>` to get a ranked shortlist. Copy relevant tool names into the phase plan's "External tools" section so the executor knows to invoke them.
104
104
 
@@ -108,11 +108,11 @@ Normally the host runtime writes this file. The CLI path exists for test fixture
108
108
 
109
109
  <caveats>
110
110
 
111
- **Discovery is a cache, not a live probe.** The host runtime owns populating `.planning/bridge/available-tools.json`. PAN does not query MCP servers directly — that would require runtime-specific HTTP or IPC integration this command deliberately avoids.
111
+ **Discovery is a cache, not a live probe.** Only `cache --servers` (or an external script) populates `.planning/bridge/available-tools.json`; no hook or host writes it. PAN does not query MCP servers directly — that would require runtime-specific HTTP or IPC integration this command deliberately avoids.
112
112
 
113
113
  **Keyword scoring is crude.** "Postgres" and "PostgreSQL" are different tokens; `postgresql` in a plan won't match a `postgres.query` tool unless the plan also says "postgres." Tune your plan language or expand tool descriptions to improve matches.
114
114
 
115
- **Claude Code is the primary target.** MCP is a Claude-first protocol. Other runtimes may have their own tool-discovery mechanisms; the cache schema is intentionally generic so a future Codex/Gemini equivalent could populate the same file.
115
+ **No runtime is special.** Each runtime PAN installs into reads MCP servers from its own config (see the workflow section above); the cache schema is generic, so whatever lists a runtime's servers can populate the same file.
116
116
 
117
117
  **No automatic invocation.** This command never calls MCP tools. It tells you what's available and what might apply. The actual invocation happens via the host runtime's normal tool-use flow (Claude Code's tool calls, etc.) when the executor agent decides to use a recommended tool.
118
118
 
@@ -122,23 +122,23 @@ Normally the host runtime writes this file. The CLI path exists for test fixture
122
122
 
123
123
  | Runtime | list | recommend | cache |
124
124
  |---------|------|-----------|-------|
125
- | Claude Code | Full | Full | Full (host-populated) |
126
- | OpenCode | Stub (empty cache returns gracefully) | Stub | CLI write works |
127
- | Gemini CLI | Stub | Stub | CLI write works |
128
- | Codex CLI | Stub | Stub | CLI write works |
129
- | Copilot CLI | Stub | Stub | CLI write works |
125
+ | Claude Code | Full once seeded | Full once seeded | Full |
126
+ | OpenCode | Full once seeded | Full once seeded | Full |
127
+ | Gemini CLI | Full once seeded | Full once seeded | Full |
128
+ | Codex CLI | Full once seeded | Full once seeded | Full |
129
+ | Copilot CLI | Full once seeded | Full once seeded | Full |
130
130
 
131
- On non-Claude runtimes, the aggregator and recommendation logic still work — they just report zero tools until something populates the cache.
131
+ On every runtime, `list` reports zero tools (`source: "empty"`) and `recommend` an empty `recommendations` list with a `reason` until `cache --servers` (or an external script) populates the cache; no host or hook writes it.
132
132
 
133
133
  </runtime_compatibility>
134
134
 
135
135
  <future_scope>
136
136
 
137
- Explicitly deferred from v3.3 (documented in ADR-0023 / Spec B v2 notes):
137
+ Explicitly deferred from v3.3 (documented in ADR-0024 / Spec B v2 notes):
138
138
 
139
- 1. **Auto-inject recommended tools into planner context** — requires a stable MCP schema contract and a plan-template extension. Candidate for v3.5.
140
- 2. **Auto-invoke MCP tools from executor agent** — requires permission-gating and per-tool safety review. Candidate for v3.5+.
141
- 3. **Cross-runtime tool discovery** — generic MCP-like protocol for non-Claude runtimes. No timeline; needs ecosystem signal.
139
+ 1. **Auto-inject recommended tools into planner context** — requires a stable MCP schema contract and a plan-template extension. Unscheduled.
140
+ 2. **Auto-invoke MCP tools from executor agent** — requires permission-gating and per-tool safety review. Unscheduled.
141
+ 3. **Cross-runtime tool discovery** — filling the cache automatically from each runtime's own MCP config and servers. No timeline; needs ecosystem signal.
142
142
 
143
143
  Until those land, this command is the minimum viable integration: you see what's there, you get suggestions, you decide manually.
144
144
 
@@ -34,7 +34,7 @@ The full milestone-done workflow is inlined in <process> below — there is no s
34
34
 
35
35
  **User input:**
36
36
 
37
- - Version: {{version}} (e.g., "1.0", "1.1", "2.0")
37
+ - Version: $ARGUMENTS (e.g., "1.0", "1.1", "2.0"); `{{version}}` below stands for this value
38
38
  </context>
39
39
 
40
40
  <process>
@@ -46,6 +46,7 @@ The full milestone-done workflow is inlined in <process> below — there is no s
46
46
  - Look for `.planning/v{{version}}-milestone-audit.md`
47
47
  - If missing or stale: recommend `/pan:milestone-audit` first
48
48
  - If audit status is `gaps_found`: recommend `/pan:milestone-gaps` first
49
+ - If audit status is `tech_debt`: present the debt; proceed on the user's say-so (it becomes accepted debt), or recommend `/pan:milestone-gaps` for a cleanup phase
49
50
  - If audit status is `passed`: proceed to step 1
50
51
 
51
52
  ```markdown
@@ -87,6 +88,7 @@ The full milestone-done workflow is inlined in <process> below — there is no s
87
88
  - Create `.planning/milestones/v{{version}}-roadmap.md`
88
89
  - Extract full phase details from roadmap.md
89
90
  - Fill milestone-archive.md template
91
+ - Add this milestone's entry to `.planning/milestones.md` from @~/.claude/pan-wizard-core/templates/milestone.md (create the file with that template's header if it does not exist)
90
92
  - Update roadmap.md to one-line summary with link
91
93
 
92
94
  5. **Archive requirements:**
@@ -104,7 +106,7 @@ The full milestone-done workflow is inlined in <process> below — there is no s
104
106
 
105
107
  7. **Commit and tag:**
106
108
 
107
- - Stage: milestones.md, project.md, roadmap.md, state.md, archive files
109
+ - Stage: milestones.md, project.md, roadmap.md, state.md, archive files, and the deleted requirements.md, and commit with `--force` (the user confirmed the milestone in step 1): `pan-tools commit` refuses any pending deletion, staged or not (`deleted_files_detected`), unless git pairs it with the archive as a rename
108
110
  - Commit: `chore: archive v{{version}} milestone`
109
111
  - Tag: `git tag -a v{{version}} -m "[milestone summary]"`
110
112
  - Ask about pushing tag
@@ -116,10 +118,11 @@ The full milestone-done workflow is inlined in <process> below — there is no s
116
118
 
117
119
  ```bash
118
120
  node ~/.claude/pan-wizard-core/bin/pan-tools.cjs optimize trace end 2>/dev/null || true
119
- node ~/.claude/pan-wizard-core/bin/pan-tools.cjs optimize learn 2>/dev/null || true
121
+ # trace end cleared the active-session pointer, so pool the recent sessions
122
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs optimize learn --sessions 5 2>/dev/null || true
120
123
  ```
121
124
 
122
- Present the optimization summary to the user and suggest `/pan:optimize apply` to write memory entries.
125
+ Present the optimization summary to the user and suggest `/pan:optimize apply` to record its suggestions, each naming where a person should make the change.
123
126
 
124
127
  </process>
125
128
 
@@ -137,7 +140,6 @@ The full milestone-done workflow is inlined in <process> below — there is no s
137
140
 
138
141
  <critical_rules>
139
142
 
140
- - **Load workflow first:** Read milestone-done.md before executing
141
143
  - **Verify completion:** All phases must have summary.md files
142
144
  - **User confirmation:** Wait for approval at verification gates
143
145
  - **Archive before deleting:** Always create archive files before updating/deleting originals
@@ -22,7 +22,7 @@ Brownfield equivalent of new-project. Project exists, project.md has history. Ga
22
22
  - `.planning/roadmap.md` — phase structure (continues numbering)
23
23
  - `.planning/state.md` — reset for new milestone
24
24
 
25
- **After:** `/pan:design-phase [N]` → `/pan:plan-phase [N]` to design then plan the first phase.
25
+ **After:** `/pan:discuss-phase [N]` (then, optionally, `/pan:design-phase [N]`) → `/pan:plan-phase [N]` for the first phase.
26
26
 
27
27
  **Design altitude (ADR-0042):** product/strategic design — demand validation, competitive intelligence, market positioning — belongs HERE at milestone creation (via the requirements/research cycle, or `/pan:focus-design` for a strategic feature), done ONCE. Per-phase architecture/ADR/threat design is `/pan:design-phase`, run per phase. Do not defer product questions to per-phase design, and do not re-open them there.
28
28
  </objective>
@@ -12,7 +12,7 @@ allowed-tools:
12
12
  ---
13
13
  <context>
14
14
  **Flags:**
15
- - `--auto` — Automatic mode. After config questions, runs research → requirements → roadmap without further interaction. Expects idea document via @ reference.
15
+ - `--auto` — Automatic mode. Asks no questions: applies the auto-mode defaults (idea.md frontmatter can override them), then runs research → requirements → roadmap without interaction. Needs an idea document — an @ reference, or the idea pasted after the flag.
16
16
  </context>
17
17
 
18
18
  <objective>
@@ -26,7 +26,7 @@ Initialize a new project through unified flow: questioning → research (optiona
26
26
  - `.planning/roadmap.md` — phase structure
27
27
  - `.planning/state.md` — project memory
28
28
 
29
- **After this command:** Run `/pan:plan-phase 1` to start execution.
29
+ **After this command:** Run `/pan:discuss-phase 1` to gather context, or `/pan:plan-phase 1` to plan directly. With `--auto` the workflow continues into `/pan:discuss-phase 1 --auto` itself.
30
30
  </objective>
31
31
 
32
32
  <execution_context>
@@ -68,23 +68,23 @@ Use this decision tree to select the correct path. Evaluate conditions top-to-bo
68
68
 
69
69
  ```
70
70
  IF .planning/ already exists AND contains project.md:
71
- → WARN: "Project already initialized. Use /pan:resume to continue."
71
+ → WARN: "Project already initialized. Use /pan:progress to continue."
72
72
  → STOP (do not overwrite existing project)
73
73
 
74
- ELSE IF --auto flag AND @ reference document provided:
75
- → ASK config questions only (commit_docs, model_profile)
76
- → SKIP interactive questioning (use the @ document as project context)
74
+ ELSE IF --auto flag AND an idea document provided (@ reference or pasted text):
75
+ → ASK nothing: apply the auto-mode defaults (workflow step 2a; idea.md frontmatter can override them)
76
+ → SKIP interactive questioning (use the document as project context)
77
77
  → RUN research automatically
78
- → GENERATE requirements from research + @ document
78
+ → GENERATE requirements from research + the document
79
79
  → GENERATE roadmap from requirements
80
80
  → No further interaction until complete
81
81
 
82
- ELSE IF --auto flag WITHOUT @ reference:
83
- → ERROR: "--auto requires an @ referenced idea document"
82
+ ELSE IF --auto flag WITHOUT an idea document:
83
+ → ERROR: "--auto requires an idea document" (an @ reference, or the idea pasted after the flag)
84
84
  → STOP
85
85
 
86
86
  ELSE (interactive mode — default):
87
- → RUN questioning flow (5-area deep questioning)
87
+ → RUN questioning flow (freeform deep questioning — references/questioning.md)
88
88
  → ASK: "Should I research the domain ecosystem?" (Y/N)
89
89
  → IF Y: spawn researchers → synthesize → continue
90
90
  → IF N: skip research → continue
@@ -1,7 +1,8 @@
1
1
  ---
2
2
  name: pan:optimize
3
3
  group: Self-Improvement
4
- description: Manage the circular optimization loop — apply recommendations, view stats, list reports, manage trace sessions
4
+ description: Manage the circular optimization loop — record a report's suggestions, undo them, view stats, list reports, manage trace sessions
5
+ argument-hint: "apply [--report <file>] | revert <apply_id> | revert --last | list | stats | trace init|end|current|list"
5
6
  allowed-tools:
6
7
  - Read
7
8
  - Write
@@ -13,7 +14,7 @@ allowed-tools:
13
14
 
14
15
  # /pan:optimize
15
16
 
16
- Manage the circular optimization loop: apply recommendations, view stats, list reports.
17
+ Manage the circular optimization loop: record a report's suggestions, view stats, list reports.
17
18
 
18
19
  **Usage:**
19
20
  ```
@@ -32,14 +33,15 @@ Manage the circular optimization loop: apply recommendations, view stats, list r
32
33
  **Subcommands:**
33
34
 
34
35
  ### apply
35
- Apply safe optimizations from the most recent (or specified) optimization report.
36
+ Record the suggestions from the most recent (or specified) optimization report.
36
37
 
37
- Auto-applied automatically:
38
- - New memory entries (`.planning/memory/*.md`) — skipped if file already exists
39
- - Suggestions appended to `.planning/optimization/suggestions.md`
38
+ Recorded automatically:
39
+ - Suggestions appended to `.planning/optimization/suggestions.md`: lessons, prompt changes and workflow changes, each naming where it belongs
40
40
  - Config notes appended to `.planning/optimization/config-suggestions.md`
41
+ - An older report's memory actions (`memory_entry`, `memory`, `memory_append`) still write to `.planning/memory/`, a `memory_entry` only if it passes the checks of the `memory record` command. The result warns that PAN's workflows do not load that folder into agents
41
42
 
42
- Requires human review (never auto-applied):
43
+ A person makes every change the suggestions describe (never auto-applied):
44
+ - Lessons, written into the project's instructions (CLAUDE.md or AGENTS.md, outside PAN's section), a test, or a comment at the cited code
43
45
  - Agent prompt changes
44
46
  - Workflow step additions
45
47
  - Structural changes to commands
@@ -47,7 +49,7 @@ Requires human review (never auto-applied):
47
49
  After applying, the report lists what was applied and what still needs review, plus the `apply_id` that undoes it. Every apply is recorded action by action in `.planning/optimization/applied.jsonl`: the path, whether the file was created or appended to, the exact text, and a hash of the file after the write. Applying the same report a second time writes nothing: each action names the apply that already wrote it.
48
50
 
49
51
  ### revert
50
- Undo one apply exactly: delete the memory files it created and cut the text it appended (`revert --last` for the newest).
52
+ Undo one apply exactly: delete the files it created and cut the text it appended (`revert --last` for the newest).
51
53
 
52
54
  Revert never destroys work someone did since:
53
55
  - It refuses a file whose content changed after the apply. The comparison ignores line endings, so a CRLF checkout still matches.
@@ -63,12 +65,12 @@ List all optimization reports in `.planning/optimization/reports/`, most recent
63
65
  Show cumulative optimization statistics:
64
66
  - Total trace sessions run
65
67
  - Total events traced
66
- - Total errors/gaps/redundancies seen
68
+ - Total errors seen (`total_errors_traced`; gaps and redundancies are not totalled)
67
69
  - Total optimizations applied across all runs, the apply runs, the reverted runs, and the last `apply_id`
68
70
  - Current active trace session (if any)
69
71
 
70
72
  ### trace init
71
- Start a new trace session before running a build. The hook fires automatically on SubagentStop, but calling `trace init` first lets you attach a description to the session.
73
+ Start a trace session before running a build — or join the active one: `trace init` reuses an unended session started within the last hour (`reused: true`, keeping that session's description) instead of opening a new one. The hook fires automatically on SubagentStop, but calling `trace init` first lets you attach a description to a new session.
72
74
 
73
75
  ```
74
76
  /pan:optimize trace init --description "building express web server"
@@ -80,7 +82,7 @@ Start a new trace session before running a build. The hook fires automatically o
80
82
  Finalize the current trace session (writes summary stats to session.json).
81
83
 
82
84
  ### trace current
83
- Show the active trace session ID and event count.
85
+ Show the active trace session ID (`optimize trace current` returns only `session_id` and `active`; `trace list` carries each session's event count).
84
86
 
85
87
  ### trace list
86
88
  List all trace sessions, most recent first.
@@ -98,14 +100,14 @@ List all trace sessions, most recent first.
98
100
  │ ↓ │
99
101
  │ /pan:learn ← analyze + report │
100
102
  │ ↓ │
101
- │ /pan:optimize apply ← write memory entries │
103
+ │ /pan:optimize apply ← record suggestions │
102
104
  │ ↓ │
103
- │ Next run is smarter ← memory populated │
105
+ │ You make the changes ← instructions, tests, code │
104
106
  │ ↑ │
105
107
  │ └──────────────────────────────────────────┘
106
108
  └─────────────────────────────────────────────────────┘
107
109
  ```
108
110
 
109
- Each iteration improves the model's context: fewer memory misses, fewer repeated errors, better decisions.
111
+ Each iteration puts what the last run lacked where the next run's agents read it: fewer repeated errors and gaps.
110
112
 
111
113
  **See also:** `/pan:learn`, `/pan:exec-phase`
@@ -23,12 +23,8 @@ After a PAN update wipes and reinstalls files, this command merges user's previo
23
23
  Check for local patches directory:
24
24
 
25
25
  ```bash
26
- # Global install (path templated at install time)
26
+ # This install's own dir — the installer templates ~/.claude/ to it, local or global
27
27
  PATCHES_DIR=~/.claude/pan-local-patches
28
- # Local install fallback
29
- if [ ! -d "$PATCHES_DIR" ]; then
30
- PATCHES_DIR=~/.claude/pan-local-patches
31
- fi
32
28
  ```
33
29
 
34
30
  Read `backup-meta.json` from the patches directory.
@@ -61,7 +57,7 @@ Exit.
61
57
 
62
58
  For each file in `backup-meta.json`:
63
59
 
64
- 1. **Read the backed-up version** (user's modified copy from `pan-local-patches/`)
60
+ 1. **Read the backed-up version** (user's modified copy from `pan-local-patches/<file>`; a file listed in `backup-meta.json`'s `external_files` — a Codex skill under `../.agents/skills/` — is at `pan-local-patches/` + the path that map gives)
65
61
  2. **Read the newly installed version** (current file after update)
66
62
  3. **Compare and merge:**
67
63
 
@@ -74,7 +74,7 @@ context:
74
74
  The workflow handles all logic including:
75
75
  1. Phase directory detection
76
76
  2. State gathering with user clarifications
77
- 3. Handoff file writing with timestamp — **using the schema from `<handoff_schema>`**
77
+ 3. Handoff file writing with timestamp — **using the schema from `<handoff_schema>`, in place of the format in the workflow's write step and `templates/continue-here.md`** (`/pan:resume` parses this schema's fields)
78
78
  4. Git commit
79
79
  5. Confirmation with resume instructions
80
80
  </process>
@@ -19,7 +19,7 @@ Generate unit and E2E tests for a completed phase, using its summary.md, context
19
19
 
20
20
  Analyzes implementation files, classifies them into TDD (unit), E2E (browser), or Skip categories, presents a test plan for user approval, then generates tests following RED-GREEN conventions.
21
21
 
22
- Output: Test files committed with message `test(phase-{N}): add unit and E2E tests from add-tests command`
22
+ Output: Test files committed with message `test(phase-{N}): add unit and E2E tests from phase-tests command`
23
23
  </objective>
24
24
 
25
25
  <execution_context>
@@ -30,10 +30,11 @@ Output: Test files committed with message `test(phase-{N}): add unit and E2E tes
30
30
  Phase: $ARGUMENTS
31
31
 
32
32
  @.planning/state.md
33
- @.planning/roadmap.md
33
+
34
+ This phase's goal and requirements, if the workflow needs them: `node ~/.claude/pan-wizard-core/bin/pan-tools.cjs roadmap slice <phase> --raw`, with only the phase number from $ARGUMENTS, since the instructions after it are free text that can break a shell line (the whole roadmap.md only for something it leaves out).
34
35
  </context>
35
36
 
36
37
  <process>
37
- Execute the add-tests workflow from @~/.claude/pan-wizard-core/workflows/phase-tests.md end-to-end.
38
+ Execute the phase-tests workflow from @~/.claude/pan-wizard-core/workflows/phase-tests.md end-to-end.
38
39
  Preserve all workflow gates (classification approval, test plan approval, RED-GREEN verification, gap reporting).
39
40
  </process>
@@ -19,7 +19,7 @@ Create executable phase prompts (plan.md files) for a roadmap phase with integra
19
19
 
20
20
  **Default flow:** Research (if needed) → Plan → Verify → Done
21
21
 
22
- **Design input (ADR-0042):** if `{phase}-design.md` exists (from `/pan:design-phase`, verified by `pan-design-checker`), it is an authoritative upstream input — `pan-planner` implements its approved architecture/decisions and `pan-plan-checker` verifies conformance (Design Conformance dimension). It is optional: a phase without a design.md plans exactly as before.
22
+ **Design input (ADR-0042):** if `{phase}-design.md` exists (from `/pan:design-phase`, verified by `pan-design-checker`), it is an authoritative upstream input — `pan-planner` implements its approved architecture/decisions and `pan-plan-checker` verifies conformance (Design Conformance dimension). It is optional: a phase without a design.md plans exactly as before. The plan-phase workflow does not list it in the planner's or checker's `<files_to_read>`, so they use it only when they find it in the phase directory themselves.
23
23
 
24
24
  **Orchestrator role:** Parse arguments, validate phase, research domain (unless skipped), spawn pan-planner, verify with pan-plan-checker, iterate until pass or max iterations, present results.
25
25
  </objective>
@@ -38,6 +38,7 @@ Phase number: $ARGUMENTS (optional — auto-detects next unplanned phase if omit
38
38
  - `--gaps` — Gap closure mode (reads verification.md, skips research)
39
39
  - `--skip-verify` — Skip verification loop
40
40
  - `--prd <file>` — Use a PRD/acceptance criteria file instead of discuss-phase. Parses requirements into context.md automatically. Skips discuss-phase entirely.
41
+ - `--auto` — Autonomous mode: sets `workflow.auto_advance` and asks nothing (with no context.md it plans from the project-level research, requirements and idea.md); after planning it runs `/pan:exec-phase N --auto --no-transition` and, once the phase completes, prints `Next: /pan:discuss-phase <next phase> --auto` and stops.
41
42
 
42
43
  Normalize phase input in step 2 before any directory lookups.
43
44
  </context>
@@ -48,7 +49,7 @@ During the plan-checker verification iteration:
48
49
  2. For each identified gap: verify it is a genuine gap by re-reading the relevant requirement
49
50
  3. Do not blindly accept all critiques — some may be false positives from missing context
50
51
  4. Revise the plan to address genuine gaps only
51
- 5. Maximum 2 revision iterations (plan → check → revise → check → final)
52
+ 5. At most 2 revisions: the workflow checks up to three times (plan → check → revise → check → revise → check); after the third check the user chooses force proceed, guidance or abandon
52
53
  This prevents over-revision while ensuring real gaps are closed.
53
54
  </reflexion_loop>
54
55
 
@@ -57,7 +58,7 @@ Planning is complete when ALL conditions are met:
57
58
  1. At least one plan.md file created in the phase directory
58
59
  2. Plan-checker passed (or max 2 revision iterations exhausted with final approval)
59
60
  3. Each plan contains: objective, task breakdown with estimates, dependency ordering, and key file links
60
- 4. Research.md exists (unless --skip-research was used)
61
+ 4. Research.md exists, unless research was skipped (`--skip-research`, `--gaps`, `workflow.research: false`, or the single-plan lightweight-phase bypass)
61
62
  5. User presented with results and next-step options
62
63
 
63
64
  Planning FAILS if: phase not found in roadmap, or planner agent returns empty/malformed output after retries.
@@ -67,7 +68,7 @@ Planning FAILS if: phase not found in roadmap, or planner agent returns empty/ma
67
68
  Avoid these planning anti-patterns:
68
69
  ```
69
70
  BAD: Plan has 25 tasks for a single phase → too granular, executor loses context
70
- GOOD: 5-8 tasks per plan, each with clear scope and testable outcome
71
+ GOOD: 2-3 tasks per plan, each with clear scope and testable outcome (more work means more plans)
71
72
 
72
73
  BAD: Task says "Implement the feature" with no file links or acceptance criteria
73
74
  → Executor guesses at scope, misses edge cases
@@ -92,7 +93,7 @@ IF --gaps flag is set:
92
93
  ELSE IF --prd <file> flag is set:
93
94
  → SKIP discuss-phase entirely
94
95
  → PARSE PRD file into context.md
95
- → SKIP research (PRD provides requirements)
96
+ → RUN research as usual (step 3.5 writes context.md from the PRD, then continues to step 5)
96
97
  → PLAN from parsed requirements
97
98
  → VERIFY (unless --skip-verify)
98
99
 
@@ -120,23 +121,12 @@ IF --skip-verify:
120
121
  ELSE:
121
122
  → Spawn pan-plan-checker
122
123
  → IF checker PASSES: done
123
- → IF checker finds gaps (iteration 1): revise plan, re-check
124
- → IF checker finds gaps (iteration 2): final revision, present with caveats
125
- → Max 2 revision iterations
124
+ → IF checker finds gaps (check 1 or 2): revise plan, re-check
125
+ → IF checker finds gaps (check 3): stop revising; the user chooses force proceed (open issues recorded as deferred), guidance and retry, or abandon
126
+ → Max 2 revisions, so at most 3 checks
126
127
  ```
127
128
  </routing_decision_tree>
128
129
 
129
- <cache_priming>
130
- **Before spawning research + planner agents, prime the prompt cache.** All sub-agents spawned within the next 5 minutes hit cached context instead of re-reading project.md / requirements.md / roadmap.md / state.md / standards.md.
131
-
132
- Run once per invocation:
133
- ```
134
- pan-tools cache prime --summary
135
- ```
136
-
137
- Returns `{blocks: [{path, bytes, cache}], total_bytes, sha}`. On a host runtime that supports prompt caching (Claude Code does), the host translates these block references into `cache_control: ephemeral`. Where prompt caching is unavailable this is a no-op — nothing breaks.
138
- </cache_priming>
139
-
140
130
  <process>
141
131
  Execute the plan-phase workflow from @~/.claude/pan-wizard-core/workflows/plan-phase.md end-to-end.
142
132
  Preserve all workflow gates (validation, research, planning, verification loop, routing).
@@ -60,7 +60,7 @@ Consolidates Spec B v1's architect + simulate + predict-milestone into one entry
60
60
  ```
61
61
 
62
62
  **What it does:**
63
- 1. `pan-tools preview milestone` returns `{phases_total, completed, remaining, avg_phase_duration_days, eta_date, confidence_pct, bottleneck, sample_size}`.
63
+ 1. `pan-tools preview milestone` returns `{current_milestone, phases_total, phases_completed, phases_remaining, avg_phase_duration_days, velocity_phases_per_week, eta_date, confidence_pct, bottleneck, sample_size}`.
64
64
  2. Spawn `pan-previewer` with `mode: milestone`.
65
65
  3. Agent writes `.planning/milestones/preview-<today>.md` with ETA + confidence + bottleneck + caveats + bottom line.
66
66
 
@@ -10,9 +10,9 @@ allowed-tools:
10
10
  ---
11
11
 
12
12
  <objective>
13
- Switch the model profile used by PAN agents. Controls which Claude model each agent uses, balancing quality vs token spend.
13
+ Switch the model profile used by PAN agents. Sets the model tier PAN's workflows pass when they spawn an agent (mapped to the detected provider's models), balancing quality vs token spend. `/pan:army` and `pan-conductor` spawn with no model, so the agents they run use their own `model:` pin, else the session model, under every profile.
14
14
 
15
- Routes to the set-profile workflow which handles:
15
+ Routes to the profile workflow which handles:
16
16
  - Argument validation (quality/balanced/budget)
17
17
  - Downgrade confirmation (quality → balanced → budget requires 'yes')
18
18
  - Config file creation if missing
@@ -25,7 +25,7 @@ Routes to the set-profile workflow which handles:
25
25
  </execution_context>
26
26
 
27
27
  <process>
28
- **Follow the set-profile workflow** from `@~/.claude/pan-wizard-core/workflows/profile.md`.
28
+ **Follow the profile workflow** from `@~/.claude/pan-wizard-core/workflows/profile.md`.
29
29
 
30
30
  The workflow handles all logic including:
31
31
  1. Profile argument validation
@@ -37,7 +37,7 @@ The workflow handles all logic including:
37
37
  </process>
38
38
 
39
39
  <tier_decision_tree>
40
- **Capability-aware routing** (shipped v2.10.0 — E-7). Even within a single profile, PAN picks a tier per-call based on three hints: context estimate, whether the task needs extended thinking, and whether prompt cache is warm.
40
+ **Capability-aware routing** (shipped v2.10.0 — E-7). `resolveModel` can adjust the profile's tier per call from three hints — context estimate, whether the task needs extended thinking, and whether prompt cache is warm — but only when the caller passes them (`resolve-model <agent> --metadata '{…}'`). No shipped workflow, command or agent passes them, so the tree and the quick guide below describe what a caller's hints would do.
41
41
 
42
42
  The decision order `resolveModel` applies after the baseline profile pick:
43
43
 
@@ -2,7 +2,7 @@
2
2
  name: pan:quick
3
3
  group: Session & Progress
4
4
  description: Execute a quick task with PAN guarantees (atomic commits, state tracking) but skip optional agents
5
- argument-hint: "[--full]"
5
+ argument-hint: "[--full] [description]"
6
6
  allowed-tools:
7
7
  - Read
8
8
  - Write
@@ -28,5 +28,5 @@ Roadmap and state are resolved in-workflow via `init phase-op` and targeted read
28
28
 
29
29
  <process>
30
30
  Execute the remove-phase workflow from @~/.claude/pan-wizard-core/workflows/remove-phase.md end-to-end.
31
- Preserve all validation gates (future phase check, work check), renumbering logic, and commit.
31
+ Preserve all validation gates (future phase check, work check), renumbering logic, and commit. The removal deletes tracked files, so commit with `--force` once the user has confirmed it: without it `pan-tools commit` refuses any pending deletion (`deleted_files_detected`).
32
32
  </process>
@@ -2,7 +2,7 @@
2
2
  name: pan:report
3
3
  group: Observability
4
4
  description: Generate a self-contained HTML report for one phase, or a project-level timeline index linking every phase report
5
- argument-hint: "phase <N> | index [--bundle] | all [--out <file>] [--open] [--stdout]"
5
+ argument-hint: "phase <N> [--out <file>] [--open] [--stdout] | index [--out <file>] [--open] [--stdout] [--bundle] | all [--open]"
6
6
  allowed-tools:
7
7
  - Read
8
8
  - Bash
@@ -48,7 +48,7 @@ pan-tools report all [--open]
48
48
  {
49
49
  "action": "phase",
50
50
  "phase": "03",
51
- "path": ".planning/phases/03-auth-sessions/03-report.html",
51
+ "path": "/abs/path/to/project/.planning/phases/03-auth-sessions/03-report.html",
52
52
  "bytes": 16183,
53
53
  "status": "complete",
54
54
  "written": true,
@@ -2,7 +2,7 @@
2
2
  name: pan:research-phase
3
3
  group: Phase Lifecycle
4
4
  description: Research how to implement a phase (standalone - usually use /pan:plan-phase instead)
5
- argument-hint: "[phase]"
5
+ argument-hint: "<phase>"
6
6
  allowed-tools:
7
7
  - Read
8
8
  - Bash
@@ -38,7 +38,7 @@ Normalize phase input in step 1 before any directory lookups.
38
38
  INIT=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs init phase-op "$ARGUMENTS")
39
39
  ```
40
40
 
41
- Extract from init JSON: `phase_dir`, `phase_number`, `phase_name`, `phase_found`, `commit_docs`, `has_research`, `state_path`, `requirements_path`, `context_path`, `research_path`.
41
+ Extract from init JSON: `phase_dir`, `padded_phase`, `phase_slug`, `phase_number`, `phase_name`, `phase_found`, `commit_docs`, `has_research`, `state_path`, `requirements_path`, `context_path`, `research_path`. `phase_dir` is null when the phase is in the roadmap but has no directory yet: create it (`mkdir -p ".planning/phases/${padded_phase}-${phase_slug}"`) and use that path as `phase_dir`, as discuss-phase does.
42
42
 
43
43
  Resolve researcher model:
44
44
  ```bash
@@ -55,18 +55,19 @@ PHASE_INFO=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs roadmap get-phase
55
55
 
56
56
  ## 2. Check Existing Research
57
57
 
58
- ```bash
59
- ls .planning/phases/${PHASE}-*/research.md 2>/dev/null
60
- ```
58
+ Use `has_research` and `research_path` from INIT.
61
59
 
62
- **If exists:** Offer: 1) Update research, 2) View existing, 3) Skip. Wait for response.
60
+ **If exists:** Offer: 1) Update research, 2) View existing (`research_path`), 3) Skip. Wait for response.
63
61
 
64
62
  **If doesn't exist:** Continue.
65
63
 
66
64
  ## 3. Gather Phase Context
67
65
 
68
- Use paths from INIT (do not inline file contents in orchestrator context):
69
- - `requirements_path`
66
+ Write this phase's roadmap slice (its section, its dependencies' goals and its requirement lines), then use paths from INIT (do not inline file contents in orchestrator context):
67
+ ```bash
68
+ SLICE_PATH=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs roadmap slice "${phase_number}" --write --raw)
69
+ ```
70
+ - `slice_path` (from the command above; `requirements_path` if it is empty)
70
71
  - `context_path`
71
72
  - `state_path`
72
73
 
@@ -74,7 +75,7 @@ Present summary with phase description and what files the researcher will load.
74
75
 
75
76
  ## 4. Spawn pan-phase-researcher Agent
76
77
 
77
- Research modes: ecosystem (default), feasibility, implementation, comparison.
78
+ Research mode: the prompt below names `ecosystem`; pan-phase-researcher defines no modes, so treat it as context, not a switch.
78
79
 
79
80
  ```markdown
80
81
  <research_type>
@@ -100,7 +101,7 @@ Mode: ecosystem
100
101
  </objective>
101
102
 
102
103
  <files_to_read>
103
- - {requirements_path} (Requirements)
104
+ - {slice_path} (This phase's roadmap and requirements)
104
105
  - {context_path} (Phase context from discuss-phase, if exists)
105
106
  - {state_path} (Prior project decisions and blockers)
106
107
  </files_to_read>
@@ -130,7 +131,7 @@ Before declaring complete, verify:
130
131
  </quality_gate>
131
132
 
132
133
  <output>
133
- Write to: .planning/phases/${PHASE}-{slug}/${PHASE}-research.md
134
+ Write to: {phase_dir}/{padded_phase}-research.md
134
135
  </output>
135
136
  ```
136
137
 
@@ -147,9 +148,7 @@ Task(
147
148
 
148
149
  **`## RESEARCH COMPLETE`:** Display summary, offer: Plan phase, Dig deeper, Review full, Done.
149
150
 
150
- **`## CHECKPOINT REACHED`:** Present to user, get response, spawn continuation.
151
-
152
- **`## RESEARCH INCONCLUSIVE`:** Show what was attempted, offer: Add context, Try different mode, Manual.
151
+ **`## RESEARCH BLOCKED`:** Show the blocker and what was attempted, offer: Provide context (then spawn a continuation, step 6), Skip research, Abort.
153
152
 
154
153
  ## 6. Spawn Continuation Agent
155
154
 
@@ -160,7 +159,7 @@ Continue research for Phase {phase_number}: {phase_name}
160
159
 
161
160
  <prior_state>
162
161
  <files_to_read>
163
- - .planning/phases/${PHASE}-{slug}/${PHASE}-research.md (Existing research)
162
+ - {phase_dir}/{padded_phase}-research.md (Existing research)
164
163
  </files_to_read>
165
164
  </prior_state>
166
165