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
@@ -119,7 +119,7 @@ The Focus workflow is a **scan → plan → exec → sync** pipeline. Each step
119
119
 
120
120
  **Reality Score:** Every P3-P6 item gets scored: `RS = (User Value + Time Criticality + Risk Reduction) / Job Size`. Items below RS 3.0 get deferred, below 1.5 get dropped.
121
121
 
122
- **Output:** `.planning/superplan_<date>.md` — the prioritized work list that `/pan:focus-plan` reads.
122
+ **Output:** the prioritized work list, returned by `pan-tools focus scan` as JSON (`/pan:focus-plan` collects the items again itself).
123
123
 
124
124
  **Flags:**
125
125
  - `--quick` — skip strategic analysis and validation phases
@@ -136,10 +136,10 @@ The Focus workflow is a **scan → plan → exec → sync** pipeline. Each step
136
136
  **Modes:**
137
137
  | Mode | Budget | Strategy |
138
138
  |------|--------|----------|
139
- | `bugfix` | 40 pts | P0→P1→smallest-first, no features |
139
+ | `bugfix` | 40 pts | One pass over P0→P4 in priority order, smallest first within a priority (P5–P6 excluded; no item-type filter) |
140
140
  | `balanced` | 50 pts | 60% stability / 40% features (default) |
141
141
  | `features` | 50 pts | 80% features, P0 crashes still mandatory |
142
- | `full` | 60 pts | All priorities equally weighted |
142
+ | `full` | 60 pts | One pass over every priority in priority order (P0 first, smallest first within a priority) |
143
143
 
144
144
  **Point system:** XS=1, S=2, M=4, L=10, XL=20 points.
145
145
 
@@ -183,8 +183,8 @@ The Focus workflow is a **scan → plan → exec → sync** pipeline. Each step
183
183
 
184
184
  **Flags:**
185
185
  - `--readme` — check README only
186
- - `--commands` — verify command files match implementations
187
- - `--agents` — verify agent files
186
+ - `--docs` — verify documentation matches implementations
187
+ - `--arch` — verify architecture docs match actual structure
188
188
  - `--all` — full sync + auto-fix
189
189
 
190
190
  ### Standalone: `/pan:focus-design <description>`
@@ -336,7 +336,7 @@ The Focus workflow is a **scan → plan → exec → sync** pipeline. Each step
336
336
 
337
337
  **`/pan:new-project`** — One command: deep questioning → optional domain research (4 parallel agents) → requirements → roadmap. Creates `.planning/` with project.md, roadmap.md, state.md, config.json, requirements.md.
338
338
 
339
- **`/pan:map-codebase`** — Analyze existing codebase before `/pan:new-project`. Creates `.planning/codebase/` with 7 documents (stack, architecture, structure, conventions, testing, integrations, concerns).
339
+ **`/pan:map-codebase`** — Analyze existing codebase before `/pan:new-project`. Creates `.planning/codebase/` with its codebase documents (stack, architecture, structure, conventions, testing, integrations, concerns, relationships, best-practices).
340
340
 
341
341
  **`/pan:discuss-phase <N>`** — Capture your vision for a phase before planning. Creates context.md.
342
342
 
@@ -394,7 +394,7 @@ The Focus workflow is a **scan → plan → exec → sync** pipeline. Each step
394
394
 
395
395
  **Planning config** (`.planning/config.json`):
396
396
  - `commit_docs: true` — commit planning artifacts to git (set `false` + add `.planning/` to `.gitignore` for private planning)
397
- - `search_gitignored: false` — add `--no-ignore` to ripgrep when `.planning/` is gitignored
397
+ - `search_gitignored: false` — reserved: read by `loadConfig` and reported by `init map-codebase`, but no workflow or agent acts on it (to search a gitignored `.planning/`, add `--no-ignore` to `rg` yourself)
398
398
 
399
399
  ---
400
400
 
@@ -409,10 +409,9 @@ The Focus workflow is a **scan → plan → exec → sync** pipeline. Each step
409
409
  ├── config.json # Workflow & gate configuration
410
410
  ├── focus/ # Focus batch files
411
411
  │ └── batch-YYYY-MM-DD.json
412
- ├── superplan_*.md # Focus scan output
413
412
  ├── todos/
414
413
  │ ├── pending/ # Todos waiting
415
- │ └── done/ # Completed todos
414
+ │ └── completed/ # Completed todos
416
415
  ├── debug/ # Active debug sessions
417
416
  │ └── resolved/ # Archived resolved issues
418
417
  ├── milestones/ # Archived milestones
@@ -27,11 +27,13 @@ Use the most recent session unless `--session <id>` was specified.
27
27
 
28
28
  If `--session <id>` was specified, use that session ID.
29
29
 
30
+ If `--experiment <slug>` was specified, set `EXP` to the harvest folder (the `harvest_path` `/pan:experiment harvest <slug>` printed, `<source-repo>/experiments/<slug>/` by default), add `--cwd "$EXP"` to every `pan-tools` call in this workflow, and read and write every `.planning/optimization/` path below under `$EXP/`.
31
+
30
32
  ## Step 2 — Generate local analysis
31
33
 
32
34
  Run:
33
35
  ```
34
- node ~/.claude/pan-wizard-core/bin/pan-tools.cjs optimize learn [--session <id> | --sessions <n>]
36
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs optimize learn [--session <id> | --sessions <n>] # with no active session, pass --session <id> for the session Step 1 chose: a bare call errors "No trace session active"
35
37
  ```
36
38
 
37
39
  This produces `.planning/optimization/reports/{session}-analysis.json`. With `--sessions <n>` it pools the last n sessions into `pooled-<n>-{session}-analysis.json`: a recommendation should explain failures that recur across runs, not one run's accident.
@@ -39,18 +41,18 @@ This produces `.planning/optimization/reports/{session}-analysis.json`. With `--
39
41
  Read the output and note:
40
42
  - `summary.errors` — how many error events
41
43
  - `summary.gaps` — how many gap events
42
- - `summary.memory_misses` — how many memory miss events
44
+ - `summary.memory_misses` — how many times an agent logged missing knowledge (`memory_miss` events)
43
45
  - `summary.wasted_tokens` — tokens wasted on redundancies
44
46
  - `top_error_patterns` — most frequent error categories
45
47
  - `top_tool_error_patterns` — failed tool calls captured from the subagents' own transcripts, ranked by how many spawns hit them
46
48
  - `verdict_stats` — each judge's pass/fail counts, retries, and the retries that resolved a failure
47
- - `top_memory_misses` — most frequent memory miss topics
49
+ - `top_memory_misses` — the topics most often logged as missing
48
50
 
49
51
  ## Step 3 — Invoke pan-optimizer agent
50
52
 
51
53
  Spawn the `pan-optimizer` agent with this instruction:
52
54
 
53
- > Read the analysis at `.planning/optimization/reports/{session}-analysis.json` and the raw trace at `.planning/optimization/traces/{session}/trace.jsonl`. Also read any existing memory at `.planning/memory/*.md` to understand what's already known. Produce a full optimization report at `.planning/optimization/reports/{session}-opt-report.md` following the format in your agent definition.
55
+ > Read the analysis at `{analysis_path}` (the path `optimize learn` printed: `{session}-analysis.json`, or `pooled-<n>-{session}-analysis.json` with `--sessions`) and the raw trace at `.planning/optimization/traces/{session}/trace.jsonl`. Produce a full optimization report at `.planning/optimization/reports/{session}-opt-report.md` following the format in your agent definition.
54
56
 
55
57
  Wait for the agent to complete. It will write the report to `.planning/optimization/reports/`.
56
58
 
@@ -61,9 +63,9 @@ Read `.planning/optimization/reports/{session}-opt-report.md`.
61
63
  Present to the user:
62
64
  1. **Score** — the circular optimization score (0–100)
63
65
  2. **Top 3 findings** — the most impactful recommendations
64
- 3. **Auto-applicable count** — how many items `/pan:optimize apply` can handle automatically
65
- 4. **Review required count** — how many prompt/workflow suggestions need human review
66
- 5. **Next step** — suggest running `/pan:optimize apply` to apply safe optimizations
66
+ 3. **Lessons** — how many, and where each belongs: the project's instructions (CLAUDE.md or AGENTS.md, outside PAN's section), a test, or a comment at the cited code
67
+ 4. **Prompt and workflow changes** — how many, for human review
68
+ 5. **Next step** — `/pan:optimize apply` records the suggestions in `.planning/optimization/suggestions.md`; a person makes the changes, because nothing in the report reaches an agent until it is written where the agents read
67
69
 
68
70
  ## Step 5 — Auto-apply (if --apply flag)
69
71
 
@@ -72,14 +74,14 @@ If the `--apply` flag was passed, immediately run:
72
74
  node ~/.claude/pan-wizard-core/bin/pan-tools.cjs optimize apply
73
75
  ```
74
76
 
75
- Show what was applied and what still needs review.
77
+ Show what was recorded and where each suggestion belongs.
76
78
 
77
79
  ## Step 6 — Update the circular score baseline
78
80
 
79
81
  After applying, tell the user what to watch in the next run:
80
- - Which memory gaps were filled (will reduce `memory_miss` events)
81
- - Which error patterns were documented (will reduce repeat errors if agent reads memory)
82
- - Prompt/workflow changes to consider applying manually
82
+ - Which lessons they wrote into the project's instructions, tests or code (the next trace should show fewer of those gaps and `memory_miss` events)
83
+ - Which error patterns a prompt or workflow change addressed
84
+ - Prompt/workflow changes still to consider
83
85
 
84
86
  ## Edge cases
85
87
 
@@ -3,7 +3,7 @@ Orchestrate parallel codebase mapper agents to analyze codebase and produce stru
3
3
 
4
4
  Each agent has fresh context, explores a specific focus area, and **writes documents directly**. The orchestrator only receives confirmation + line counts, then writes a summary.
5
5
 
6
- Output: .planning/codebase/ folder with 9 structured documents about the codebase state.
6
+ Output: .planning/codebase/ folder with structured documents about the codebase state.
7
7
  </purpose>
8
8
 
9
9
  <philosophy>
@@ -109,7 +109,7 @@ Use Task tool with `subagent_type="pan-document_code"`, `model="{mapper_model}"`
109
109
  **CRITICAL:** Use the dedicated `pan-document_code` agent, NOT `Explore`. The mapper agent writes documents directly.
110
110
 
111
111
  **CRITICAL: Project Scope Boundary — include this line in EVERY agent prompt:**
112
- > SCOPE: Only analyze project source code. EXCLUDE these PAN infrastructure directories: .claude/, .github/copilot-instructions.md, .opencode/, .gemini/, .codex/, .planning/
112
+ > SCOPE: Only analyze project source code. EXCLUDE these PAN infrastructure paths: .claude/, .opencode/, .gemini/, .codex/, .agents/, .planning/, and the Copilot runtime paths PAN installs into under .github/ (agents/, skills/, hooks/, copilot/, pan-wizard-core/, pan-local-patches/, mcp.json, package.json, pan-file-manifest.json)
113
113
 
114
114
  **Agent 1: Tech Focus**
115
115
 
@@ -120,7 +120,7 @@ Task(
120
120
  run_in_background=true,
121
121
  description="Map codebase tech stack",
122
122
  prompt="Focus: tech
123
- SCOPE: Only analyze project source code. EXCLUDE these PAN infrastructure directories: .claude/, .github/copilot-instructions.md, .opencode/, .gemini/, .codex/, .planning/
123
+ SCOPE: Only analyze project source code. EXCLUDE these PAN infrastructure paths: .claude/, .opencode/, .gemini/, .codex/, .agents/, .planning/, and the Copilot runtime paths PAN installs into under .github/ (agents/, skills/, hooks/, copilot/, pan-wizard-core/, pan-local-patches/, mcp.json, package.json, pan-file-manifest.json)
124
124
 
125
125
  Analyze this codebase for technology stack and external integrations.
126
126
 
@@ -142,7 +142,7 @@ Task(
142
142
  run_in_background=true,
143
143
  description="Map codebase architecture",
144
144
  prompt="Focus: arch
145
- SCOPE: Only analyze project source code. EXCLUDE these PAN infrastructure directories: .claude/, .github/copilot-instructions.md, .opencode/, .gemini/, .codex/, .planning/
145
+ SCOPE: Only analyze project source code. EXCLUDE these PAN infrastructure paths: .claude/, .opencode/, .gemini/, .codex/, .agents/, .planning/, and the Copilot runtime paths PAN installs into under .github/ (agents/, skills/, hooks/, copilot/, pan-wizard-core/, pan-local-patches/, mcp.json, package.json, pan-file-manifest.json)
146
146
 
147
147
  Analyze this codebase architecture and directory structure.
148
148
 
@@ -164,7 +164,7 @@ Task(
164
164
  run_in_background=true,
165
165
  description="Map codebase conventions",
166
166
  prompt="Focus: quality
167
- SCOPE: Only analyze project source code. EXCLUDE these PAN infrastructure directories: .claude/, .github/copilot-instructions.md, .opencode/, .gemini/, .codex/, .planning/
167
+ SCOPE: Only analyze project source code. EXCLUDE these PAN infrastructure paths: .claude/, .opencode/, .gemini/, .codex/, .agents/, .planning/, and the Copilot runtime paths PAN installs into under .github/ (agents/, skills/, hooks/, copilot/, pan-wizard-core/, pan-local-patches/, mcp.json, package.json, pan-file-manifest.json)
168
168
 
169
169
  Analyze this codebase for coding conventions and testing patterns.
170
170
 
@@ -185,7 +185,7 @@ Task(
185
185
  run_in_background=true,
186
186
  description="Map codebase concerns",
187
187
  prompt="Focus: concerns
188
- SCOPE: Only analyze project source code. EXCLUDE these PAN infrastructure directories: .claude/, .github/copilot-instructions.md, .opencode/, .gemini/, .codex/, .planning/
188
+ SCOPE: Only analyze project source code. EXCLUDE these PAN infrastructure paths: .claude/, .opencode/, .gemini/, .codex/, .agents/, .planning/, and the Copilot runtime paths PAN installs into under .github/ (agents/, skills/, hooks/, copilot/, pan-wizard-core/, pan-local-patches/, mcp.json, package.json, pan-file-manifest.json)
189
189
 
190
190
  Analyze this codebase for technical debt, known issues, and areas of concern.
191
191
 
@@ -206,7 +206,7 @@ Task(
206
206
  run_in_background=true,
207
207
  description="Map module relationships",
208
208
  prompt="Focus: relationships
209
- SCOPE: Only analyze project source code. EXCLUDE these PAN infrastructure directories: .claude/, .github/copilot-instructions.md, .opencode/, .gemini/, .codex/, .planning/
209
+ SCOPE: Only analyze project source code. EXCLUDE these PAN infrastructure paths: .claude/, .opencode/, .gemini/, .codex/, .agents/, .planning/, and the Copilot runtime paths PAN installs into under .github/ (agents/, skills/, hooks/, copilot/, pan-wizard-core/, pan-local-patches/, mcp.json, package.json, pan-file-manifest.json)
210
210
 
211
211
  Analyze module dependencies using pre-computed import analysis.
212
212
 
@@ -230,7 +230,7 @@ Task(
230
230
  run_in_background=true,
231
231
  description="Map best practices",
232
232
  prompt="Focus: practices
233
- SCOPE: Only analyze project source code. EXCLUDE these PAN infrastructure directories: .claude/, .github/copilot-instructions.md, .opencode/, .gemini/, .codex/, .planning/
233
+ SCOPE: Only analyze project source code. EXCLUDE these PAN infrastructure paths: .claude/, .opencode/, .gemini/, .codex/, .agents/, .planning/, and the Copilot runtime paths PAN installs into under .github/ (agents/, skills/, hooks/, copilot/, pan-wizard-core/, pan-local-patches/, mcp.json, package.json, pan-file-manifest.json)
234
234
 
235
235
  Assess codebase best practices using pre-computed analysis.
236
236
 
@@ -284,7 +284,7 @@ wc -l .planning/codebase/*.md
284
284
  ```
285
285
 
286
286
  **Verification checklist:**
287
- - All 9 documents exist (lowercase filenames)
287
+ - All codebase documents the mapper prompts list exist (lowercase filenames)
288
288
  - No empty documents (each should have >20 lines)
289
289
 
290
290
  If any documents missing or empty, note which agents may have failed.
@@ -395,7 +395,7 @@ End workflow.
395
395
  - Relationships agent receives pre-computed import/dependency data
396
396
  - Practices agent receives pre-computed language and best-practices data
397
397
  - Read agent output files to collect confirmations
398
- - All 9 codebase documents exist (lowercase filenames)
398
+ - All codebase documents the mapper prompts list exist (lowercase filenames)
399
399
  - Clear completion summary with line counts
400
400
  - User offered clear next steps in PAN style
401
401
  </success_criteria>
@@ -14,7 +14,7 @@ Read all files referenced by the invoking prompt's execution_context before star
14
14
  INIT=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs init milestone-op)
15
15
  ```
16
16
 
17
- Extract from init JSON: `milestone_version`, `milestone_name`, `phase_count`, `completed_phases`, `commit_docs`.
17
+ Extract from init JSON: `milestone_version`, `milestone_name`, `phase_count`, `completed_phases`, `commit_docs`. `{version}` below is the version without its leading `v` (the argument, else `milestone_version` with the `v` removed: `v1.0` → `1.0`), so `v{version}-milestone-audit.md` names the `v1.0-milestone-audit.md` that `/pan:milestone-done` looks for.
18
18
 
19
19
  **Also extract `planning_root` and `track`, and use `$PLANNING_ROOT` for every planning path in this workflow** — the project may hold several planning trees, and auditing the wrong one produces a confident, plausible, wrong report:
20
20
 
@@ -26,7 +26,7 @@ PLANNING_ROOT=$(printf '%s' "$INIT" | node -e "let s='';process.stdin.on('data',
26
26
 
27
27
  **Always state the resolved `planning_root` at the top of the audit report.** If `planning_root_exists` is `false`, STOP — that is a mistyped `--track`, not an empty milestone.
28
28
 
29
- To audit a specific tree, pass `--track <name>`. To see every tree's milestone state before choosing:
29
+ To audit a specific tree, add `--track <name>` to every `pan-tools` call in this workflow (each call resolves its own planning root). To see every tree's milestone state before choosing:
30
30
 
31
31
  ```bash
32
32
  node ~/.claude/pan-wizard-core/bin/pan-tools.cjs init milestone-op --all-tracks
@@ -38,12 +38,12 @@ That returns `{track_count, ambiguous_tracks, tracks[]}`, one entry per planning
38
38
 
39
39
  The init payload carries how the milestone was decided:
40
40
 
41
- - `milestone_basis` — `marked-current` (a `(current)` / 🚧 marker), `first-unshipped`, `last-shipped`, or `default`
41
+ - `milestone_basis` — `marked-current` (a `(current)` / 🚧 marker), `first-unshipped`, `last-shipped`, `state` (state.md's `milestone:`), `no-milestone-heading`, or `default` (no roadmap.md)
42
42
  - `milestone_ambiguous` — **`true` means the roadmap marks more than one milestone current**
43
43
 
44
44
  **If `milestone_ambiguous` is `true`, STOP and report the planning-state error.** Do not audit. Two milestones marked current is a roadmap defect the owner must resolve; picking one silently is how an audit ends up describing a milestone that does not exist.
45
45
 
46
- If `milestone_basis` is `default`, there is no milestone heading in the roadmap at all — say so rather than auditing `v1.0 milestone`.
46
+ If `milestone_basis` is `no-milestone-heading` (no milestone heading, none recorded in state.md) or `default` (no roadmap.md), say so rather than auditing `v1.0 milestone`; `state` means the version came from state.md's `milestone:`.
47
47
 
48
48
  Resolve integration checker model:
49
49
  ```bash
@@ -67,9 +67,9 @@ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs phases list
67
67
  For each phase directory, read the verification.md:
68
68
 
69
69
  ```bash
70
- # For each phase, use find-phase to resolve the directory (handles archived phases)
71
- PHASE_INFO=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs find-phase 01 --raw)
72
- # Extract directory from JSON, then read verification.md from that directory
70
+ # For each phase, find-phase resolves its directory under phases/ (zero-padding handled; archived milestones are not searched)
71
+ PHASE_DIR=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs find-phase 01 --raw)
72
+ # --raw prints the directory itself (empty when not found); read verification.md from it
73
73
  # Repeat for each phase number from roadmap.md
74
74
  ```
75
75
 
@@ -87,7 +87,7 @@ If a phase is missing verification.md, flag it as "unverified phase" — this is
87
87
  What the judges found in this milestone, and what was decided about each finding, is on record. Read it rather than reconstructing it from prose:
88
88
 
89
89
  ```bash
90
- node ~/.claude/pan-wizard-core/bin/pan-tools.cjs findings debt --milestone "{version}"
90
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs findings debt --milestone "{version}" # with or without the leading v
91
91
  ```
92
92
 
93
93
  - **`deferred`** findings were continued past on purpose, and each carries the reason recorded at the time. They are the milestone's tech debt: put every one in `tech_debt`, with its id and reason.
@@ -115,7 +115,7 @@ MUST map each integration finding to affected requirement IDs where applicable.
115
115
 
116
116
  Verify cross-phase wiring and E2E user flows.",
117
117
  subagent_type="pan-integration-checker",
118
- model="{integration_checker_model}"
118
+ model="{CHECKER_MODEL}"
119
119
  )
120
120
  ```
121
121
 
@@ -145,7 +145,7 @@ For each phase's verification.md, extract the expanded requirements table:
145
145
  For each phase's summary.md, extract `requirements-completed` from YAML frontmatter:
146
146
  ```bash
147
147
  for summary in "$PLANNING_ROOT"/phases/*-*/*-summary.md; do
148
- node ~/.claude/pan-wizard-core/bin/pan-tools.cjs summary-extract "$summary" --fields requirements_completed | jq -r '.requirements_completed'
148
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs frontmatter get "$summary" --field requirements-completed --raw
149
149
  done
150
150
  ```
151
151
 
@@ -27,15 +27,15 @@ No audit gaps found. Run `/pan:milestone-audit` first.
27
27
 
28
28
  ## 2. Prioritize Gaps
29
29
 
30
- Group gaps by priority from requirements.md:
30
+ Group gaps by their audit status (requirements.md records no priority; each `gaps.requirements[]` entry carries `status`):
31
31
 
32
- | Priority | Action |
33
- |----------|--------|
34
- | `must` | Create phase, blocks milestone |
35
- | `should` | Create phase, recommended |
36
- | `nice` | Ask user: include or defer? |
32
+ | Status | Action |
33
+ |--------|--------|
34
+ | `unsatisfied` | Create phase, blocks milestone |
35
+ | `partial` | Create phase, recommended (the audit's FAIL gate forces `gaps_found` only for `unsatisfied` and `orphaned`) |
36
+ | `orphaned` | Create phase, blocks milestone (the audit treats an orphaned requirement as unsatisfied) |
37
37
 
38
- For integration/flow gaps, infer priority from affected requirements.
38
+ For integration/flow gaps, take the status of the requirements they affect.
39
39
 
40
40
  ## 3. Group Gaps into Phases
41
41
 
@@ -65,8 +65,7 @@ Gap: Flow "View dashboard" broken at data fetch
65
65
  Find highest existing phase:
66
66
  ```bash
67
67
  # Get sorted phase list, extract last one
68
- PHASES=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs phases list)
69
- HIGHEST=$(echo "$PHASES" | jq -r '.directories[-1]')
68
+ HIGHEST=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs phases list --raw | tail -1)
70
69
  ```
71
70
 
72
71
  New phases continue from there:
@@ -94,9 +93,9 @@ Closes:
94
93
  - Flow: {flow name}
95
94
  Tasks: {count}
96
95
 
97
- {If nice-to-have gaps exist:}
96
+ {If partial gaps exist:}
98
97
 
99
- ### Deferred (nice-to-have)
98
+ ### Recommended (partial — not one of the gaps that force the audit's `gaps_found`)
100
99
 
101
100
  These gaps are optional. Include them?
102
101
  - {gap description}
@@ -111,18 +110,14 @@ Wait for user confirmation.
111
110
 
112
111
  ## 6. Update roadmap.md
113
112
 
114
- Add new phases to current milestone:
113
+ Add each new phase with the CLI, which writes its checklist line (what `phase complete` ticks), its `### Phase N:` section and its directory:
115
114
 
116
- ```markdown
117
- ### Phase {N}: {Name}
118
- **Goal:** {derived from gaps being closed}
119
- **Requirements:** {REQ-IDs being satisfied}
120
- **Gap Closure:** Closes gaps from audit
121
-
122
- ### Phase {N+1}: {Name}
123
- ...
115
+ ```bash
116
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs phase add "{Name}"
124
117
  ```
125
118
 
119
+ Then edit the new section: set **Goal:** to {derived from gaps being closed}, **Requirements:** to {REQ-IDs being satisfied}, and add `**Gap Closure:** Closes gaps from audit`.
120
+
126
121
  ## 7. Update requirements.md Traceability Table (REQUIRED)
127
122
 
128
123
  For each REQ-ID assigned to a gap closure phase:
@@ -140,9 +135,7 @@ grep -c "Pending" .planning/requirements.md
140
135
 
141
136
  ## 8. Create Phase Directories
142
137
 
143
- ```bash
144
- mkdir -p ".planning/phases/{NN}-{name}"
145
- ```
138
+ `phase add` (step 6) already created each phase's directory.
146
139
 
147
140
  ## 9. Commit Roadmap and Requirements Update
148
141
 
@@ -261,7 +254,7 @@ becomes:
261
254
 
262
255
  <success_criteria>
263
256
  - [ ] milestone-audit.md loaded and gaps parsed
264
- - [ ] Gaps prioritized (must/should/nice)
257
+ - [ ] Gaps grouped by audit status (unsatisfied and orphaned block the milestone, partial is recommended)
265
258
  - [ ] Gaps grouped into logical phases
266
259
  - [ ] User confirmed phase plan
267
260
  - [ ] roadmap.md updated with new phases
@@ -58,20 +58,21 @@ Update Active requirements section and "Last updated" footer.
58
58
  ```markdown
59
59
  ## Current Position
60
60
 
61
- Phase: Not started (defining requirements)
62
- Plan: —
63
- Status: Defining requirements
64
- Last activity: [today] — Milestone v[X.Y] started
61
+ **Current Phase:** Not started (defining requirements)
62
+ **Current Plan:** —
63
+ **Status:** Defining requirements
64
+ **Last Activity:** [today]
65
+ **Last Activity Description:** Milestone v[X.Y] started
65
66
  ```
66
67
 
67
68
  Keep Accumulated Context section from previous milestone.
68
69
 
69
70
  ## 6. Cleanup and Commit
70
71
 
71
- Delete MILESTONE-context.md if exists (consumed).
72
+ Delete MILESTONE-context.md if exists (consumed). If git tracks it, add its path to `--files` so the deletion is committed (`--force` confirms it; a tracked deletion blocks the commit otherwise):
72
73
 
73
74
  ```bash
74
- node ~/.claude/pan-wizard-core/bin/pan-tools.cjs commit "docs: start milestone v[X.Y] [Name]" --files .planning/project.md .planning/state.md
75
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs commit "docs: start milestone v[X.Y] [Name]" --files .planning/project.md .planning/state.md [path of the deleted MILESTONE-context.md, if git tracked it] --force
75
76
  ```
76
77
 
77
78
  ## 7. Load Context and Resolve Models
@@ -34,7 +34,7 @@ Before scaffolding or coding anything, confirm with the user:
34
34
 
35
35
  **Do NOT proceed** until the user has answered. Do not assume, research, or fill in blanks yourself. The user's intent drives everything — skipping this step leads to wasted scaffolding and mis-aligned implementation.
36
36
 
37
- Save answers to `.planning/requirements.md` (or update if exists). Confirm with the user before scaffolding.
37
+ Ask these after Step 1's checks (Step 1 runs before any user interaction) and carry the answers into project.md (Step 4); requirements.md is written in Step 7 from its template. Confirm with the user before scaffolding.
38
38
 
39
39
  > **Auto mode exception:** If `--auto` is set with a provided idea document (see `<auto_mode>` below), the document IS the Phase 0 answer. Read it carefully and extract problem / success / scope / constraints from its contents.
40
40
 
@@ -46,7 +46,7 @@ Check if `--auto` flag is present in $ARGUMENTS.
46
46
  **If auto mode:**
47
47
  - Skip brownfield mapping offer (assume greenfield)
48
48
  - Skip deep questioning (extract context from provided document)
49
- - Config: YOLO mode is implicit (skip that question), but ask depth/git/agents FIRST (Step 2a)
49
+ - Config: YOLO mode is implicit; depth, git and agents take their defaults (or idea.md frontmatter overrides) silently in Step 2a — no questions
50
50
  - After config: run Steps 6-9 automatically with smart defaults:
51
51
  - Research: Always yes
52
52
  - Requirements: Include all table stakes + features from provided document
@@ -92,7 +92,7 @@ git init
92
92
 
93
93
  ## 2. Brownfield Offer
94
94
 
95
- **If auto mode:** Skip to Step 4 (assume greenfield, synthesize project.md from provided document).
95
+ **If auto mode:** Skip to Step 2a (assume greenfield); Step 2a applies the config defaults and continues at Step 4, which synthesizes project.md from the provided document.
96
96
 
97
97
  **If `needs_codebase_map` is true** (from init — existing code detected but no codebase map):
98
98
 
@@ -985,7 +985,7 @@ Use AskUserQuestion:
985
985
  - .planning/roadmap.md (Current roadmap to revise)
986
986
  </files_to_read>
987
987
 
988
- Update the roadmap based on feedback. Edit files in place.
988
+ Update the roadmap based on feedback: rewrite each changed file with one Write.
989
989
  Return ROADMAP REVISED with changes made.
990
990
  </revision>
991
991
  ", subagent_type="pan-roadmapper", model="{roadmapper_model}", description="Revise roadmap")
@@ -1016,7 +1016,7 @@ Parse JSON for `project_types` and `recommendations` arrays.
1016
1016
  **If auto mode (P-1601 v3.7.5):** Auto-select ONLY `priority: "high"` recommendations. These are recommendations from explicitly-detected non-general project types (e.g., a recognized `web` or `ai` project). For `general` fallback projects with no explicit type signal, **skip auto-selection entirely** — leave `standards.md` absent rather than impose unrelated standards.
1017
1017
 
1018
1018
  ```bash
1019
- HIGH_IDS=$(echo "$RECOMMEND" | jq -r '.recommendations[] | select(.priority=="high") | .id')
1019
+ HIGH_IDS=$(printf '%s' "$RECOMMEND" | node -e "let s='';process.stdin.on('data',d=>s+=d).on('end',()=>console.log((JSON.parse(s).recommendations||[]).filter(r=>r.priority==='high').map(r=>r.id).join('\n')))")
1020
1020
  if [ -n "$HIGH_IDS" ]; then
1021
1021
  for id in $HIGH_IDS; do
1022
1022
  node ~/.claude/pan-wizard-core/bin/pan-tools.cjs standards select "$id"
@@ -1036,10 +1036,10 @@ Present recommendations:
1036
1036
 
1037
1037
  Based on your project type ([types]), these standards are recommended:
1038
1038
 
1039
- | Standard | Category | Why |
1039
+ | Standard | Priority | Why |
1040
1040
  |----------|----------|-----|
1041
- | [name] | [category] | [description] |
1042
- | [name] | [category] | [description] |
1041
+ | [name] | [priority] | [reason] |
1042
+ | [name] | [priority] | [reason] |
1043
1043
  ```
1044
1044
 
1045
1045
  Use AskUserQuestion:
@@ -1047,7 +1047,7 @@ Use AskUserQuestion:
1047
1047
  - question: "Which standards would you like to apply? (advisory — guides agents, doesn't block)"
1048
1048
  - multiSelect: true
1049
1049
  - options: (from recommendations, max 4)
1050
- - "[standard name]" — [description]
1050
+ - "[standard name]" — [reason]
1051
1051
 
1052
1052
  For each selected standard:
1053
1053
  ```bash
@@ -1110,7 +1110,7 @@ Present completion summary:
1110
1110
  ╚══════════════════════════════════════════╝
1111
1111
  ```
1112
1112
 
1113
- Exit skill and invoke SlashCommand("/pan:discuss-phase 1 --auto")
1113
+ Spawn discuss-phase for Phase 1 as a Task subagent, exactly as transition.md Route A does for a phase with no context.md (discuss-phase.md as execution_context, `ARGUMENTS='1 --auto'`); do not call SlashCommand.
1114
1114
 
1115
1115
  **If interactive mode:**
1116
1116
 
@@ -6,8 +6,8 @@ Manage the circular optimization loop — apply reports, check stats, control tr
6
6
 
7
7
  | Subcommand | Action |
8
8
  |------------|--------|
9
- | `apply` | Apply safe recommendations from most recent report |
10
- | `apply --report <file>` | Apply from a specific report |
9
+ | `apply` | Record the suggestions from the most recent report |
10
+ | `apply --report <file>` | Record them from a specific report |
11
11
  | `revert <apply_id>` / `revert --last` | Undo one apply exactly |
12
12
  | `list` | List all reports |
13
13
  | `stats` | Show cumulative stats |
@@ -40,17 +40,17 @@ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs optimize apply [--report <path>
40
40
  ### Step 3 — Present results
41
41
 
42
42
  Show the user:
43
- - **Applied** — each item that was written (memory entries, notes)
43
+ - **Applied** — each item that was recorded (suggestions, config notes)
44
44
  - **Skipped** — items that already exist, that an earlier apply already wrote, or that had unknown types
45
- - **Still needs review** — prompt/workflow suggestions in `suggestions.md`
45
+ - **Still needs a person** — every suggestion in `suggestions.md`
46
46
  - **The `apply_id`**, and how to undo the apply: `/pan:optimize revert <apply_id>`
47
47
 
48
- If memory entries were written, tell the user:
49
- > Memory entries have been added to `.planning/memory/`. They will be loaded on the next agent run, reducing future memory misses for these topics.
48
+ If an applied item carries a `warning`, pass it on. An older report's memory actions write to `.planning/memory/`, which PAN's workflows do not load into agents.
50
49
 
51
50
  ### Step 4 — Point to manual review items
52
51
 
53
52
  If `.planning/optimization/suggestions.md` exists, tell the user to review it for:
53
+ - Lessons (apply by writing them into the project's CLAUDE.md or AGENTS.md outside PAN's section, a test, or a comment at the cited code)
54
54
  - Agent prompt improvements (apply by editing `agents/pan-*.md`)
55
55
  - Workflow step additions (apply by editing `pan-wizard-core/workflows/*.md`)
56
56
 
@@ -125,7 +125,7 @@ Active session: sess_... (or none)
125
125
  ```
126
126
 
127
127
  If `total_optimizations_applied` > 0, note:
128
- > {N} optimizations have been applied across {apply_runs} apply runs. Each applied memory entry reduces future knowledge gaps.
128
+ > {N} suggestions have been recorded across {apply_runs} apply runs. Each helps once a person has written it where the agents read.
129
129
 
130
130
  ---
131
131
 
@@ -142,11 +142,13 @@ Every agent spawn → hook logs completion event
142
142
  ↓
143
143
  .planning/optimization/reports/{session}-opt-report.md
144
144
  ↓
145
- /pan:optimize apply → writes memory entries
145
+ /pan:optimize apply → records suggestions
146
+ ↓
147
+ A person writes each one where the agents read it
146
148
  ↓
147
149
  Next build has better context → fewer errors/gaps
148
150
  ↓
149
151
  (repeat, improving each time)
150
152
  ```
151
153
 
152
- The key insight: each apply run populates `.planning/memory/` with cached knowledge. Future agent runs load this memory and skip the research/inference that caused gaps. The error rate trends down. The optimization score trends up.
154
+ The key insight: a lesson changes the next run only from a place the next run's agents read: the project's instructions (CLAUDE.md or AGENTS.md, outside PAN's section), a test that fails when it is broken, or the code itself. PAN's workflows do not load `.planning/memory/` into agents (ADR-0036, amended `2026-10-04`). In the harness, a lesson recorded there changed nothing that the project's state, summaries and code did not already carry. The report says where each suggestion belongs, and a person puts it there.
@@ -91,8 +91,13 @@ timestamp=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs current-timestamp f
91
91
  </step>
92
92
 
93
93
  <step name="commit">
94
+ Record the stopping point in state.md too: the context monitor's note sends agents here to make state.md say where they are, and after a compaction PAN re-injects state.md's Stopped At and Resume File, not the handoff file.
95
+
94
96
  ```bash
95
- node ~/.claude/pan-wizard-core/bin/pan-tools.cjs commit "wip: [phase-name] paused at task [X]/[Y]" --files .planning/phases/*/.continue-here.md
97
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs state record-session \
98
+ --stopped-at "Phase [XX] plan [P], task [X]/[Y] — next: [next_action]" \
99
+ --resume-file ".planning/phases/[XX-name]/.continue-here.md"
100
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs commit "wip: [phase-name] paused at task [X]/[Y]" --files .planning/phases/*/.continue-here.md .planning/state.md
96
101
  ```
97
102
  </step>
98
103
 
@@ -1,5 +1,5 @@
1
1
  <purpose>
2
- Generate unit and E2E tests for a completed phase based on its summary.md, context.md, and implementation. Classifies each changed file into TDD (unit), E2E (browser), or Skip categories, presents a test plan for user approval, then generates tests following RED-GREEN conventions.
2
+ Generate unit and E2E tests for a completed phase based on its summary.md, context.md, and implementation. Classifies each changed file into TDD (unit), Integration, E2E (browser), or Skip categories, presents a test plan for user approval, then generates tests following RED-GREEN conventions.
3
3
 
4
4
  Users currently hand-craft `/pan:quick` prompts for test generation after each phase. This workflow standardizes the process with proper classification, quality gates, and gap reporting.
5
5
  </purpose>
@@ -70,7 +70,7 @@ Extract the list of files modified by the phase from summary.md ("Files Changed"
70
70
 
71
71
  **CRITICAL: Project Scope Boundary**
72
72
  Skip any files inside PAN infrastructure directories — these are NOT project source code:
73
- - `.claude/`, `.github/copilot-instructions.md`, `.opencode/`, `.gemini/`, `.codex/`, `.planning/`
73
+ - `.claude/`, `.opencode/`, `.gemini/`, `.codex/`, `.agents/`, `.planning/`, and the Copilot runtime paths PAN installs into under `.github/` (`agents/`, `skills/`, `hooks/`, `copilot/`, `pan-wizard-core/`, `pan-local-patches/`, `mcp.json`, `package.json`, `pan-file-manifest.json`)
74
74
  If all changed files are inside these directories, report "No project source files to test" and exit.
75
75
 
76
76
  For each file, classify into one of four categories:
@@ -334,7 +334,7 @@ Create a test coverage report and present to user:
334
334
 
335
335
  Record test generation in project state:
336
336
  ```bash
337
- node ~/.claude/pan-wizard-core/bin/pan-tools.cjs state-snapshot
337
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs state update "Last Activity Description" "Phase ${phase_number} tests generated"
338
338
  ```
339
339
 
340
340
  If there are passing tests to commit:
@@ -374,7 +374,7 @@ Present next steps:
374
374
 
375
375
  <success_criteria>
376
376
  - [ ] Phase artifacts loaded (summary.md, context.md, optionally verification.md)
377
- - [ ] All changed files classified into TDD/E2E/Skip categories
377
+ - [ ] All changed files classified into TDD/Integration/E2E/Skip categories
378
378
  - [ ] Classification presented to user and approved
379
379
  - [ ] Project test structure discovered (directories, conventions, runners)
380
380
  - [ ] Test plan presented to user and approved