pan-wizard 3.33.0 → 3.35.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 (214) hide show
  1. package/README.md +29 -26
  2. package/agents/pan-conductor.md +18 -17
  3. package/agents/pan-counterfactual.md +2 -2
  4. package/agents/pan-debugger.md +30 -9
  5. package/agents/pan-design-checker.md +2 -1
  6. package/agents/pan-designer.md +2 -2
  7. package/agents/pan-distiller.md +3 -3
  8. package/agents/pan-document_code.md +14 -14
  9. package/agents/pan-executor.md +30 -9
  10. package/agents/pan-experiment-runner.md +9 -8
  11. package/agents/pan-hardener.md +1 -1
  12. package/agents/pan-integration-checker.md +2 -2
  13. package/agents/pan-knowledge.md +1 -1
  14. package/agents/pan-meta-reviewer.md +4 -4
  15. package/agents/pan-optimizer.md +39 -43
  16. package/agents/pan-phase-researcher.md +10 -10
  17. package/agents/pan-plan-checker.md +37 -34
  18. package/agents/pan-planner.md +57 -44
  19. package/agents/pan-previewer.md +1 -1
  20. package/agents/pan-project-researcher.md +12 -12
  21. package/agents/pan-release.md +1 -1
  22. package/agents/pan-research-synthesizer.md +3 -3
  23. package/agents/pan-reviewer.md +26 -3
  24. package/agents/pan-roadmapper.md +15 -14
  25. package/agents/pan-verifier.md +33 -25
  26. package/bin/install-lib.cjs +176 -38
  27. package/bin/install.js +81 -63
  28. package/commands/pan/army.md +15 -11
  29. package/commands/pan/assumptions.md +2 -2
  30. package/commands/pan/audit-deployment.md +11 -12
  31. package/commands/pan/cost.md +8 -8
  32. package/commands/pan/dashboard.md +0 -3
  33. package/commands/pan/debug.md +10 -7
  34. package/commands/pan/design-phase.md +5 -5
  35. package/commands/pan/discuss-phase.md +2 -0
  36. package/commands/pan/exec-phase.md +21 -37
  37. package/commands/pan/experiment.md +9 -8
  38. package/commands/pan/focus-auto.md +22 -20
  39. package/commands/pan/focus-design.md +7 -6
  40. package/commands/pan/focus-doc-audit.md +4 -3
  41. package/commands/pan/focus-drift-walking.md +4 -3
  42. package/commands/pan/focus-exec.md +6 -6
  43. package/commands/pan/focus-plan.md +12 -11
  44. package/commands/pan/focus-scan.md +5 -3
  45. package/commands/pan/focus-sync.md +3 -2
  46. package/commands/pan/git.md +8 -8
  47. package/commands/pan/health.md +2 -2
  48. package/commands/pan/hud.md +4 -7
  49. package/commands/pan/hygiene.md +14 -7
  50. package/commands/pan/knowledge.md +9 -10
  51. package/commands/pan/learn.md +10 -7
  52. package/commands/pan/links.md +4 -1
  53. package/commands/pan/map-codebase.md +1 -1
  54. package/commands/pan/mcp-bridge.md +19 -21
  55. package/commands/pan/milestone-done.md +6 -3
  56. package/commands/pan/milestone-new.md +1 -1
  57. package/commands/pan/new-project.md +10 -10
  58. package/commands/pan/optimize.md +18 -14
  59. package/commands/pan/patches.md +2 -6
  60. package/commands/pan/pause.md +1 -1
  61. package/commands/pan/phase-tests.md +3 -2
  62. package/commands/pan/plan-phase.md +9 -19
  63. package/commands/pan/preview.md +2 -3
  64. package/commands/pan/profile.md +2 -2
  65. package/commands/pan/quick.md +1 -1
  66. package/commands/pan/remove-phase.md +1 -1
  67. package/commands/pan/report.md +3 -7
  68. package/commands/pan/research-phase.md +16 -15
  69. package/commands/pan/resume.md +9 -11
  70. package/commands/pan/retro.md +5 -3
  71. package/commands/pan/review-deep.md +7 -9
  72. package/commands/pan/settings.md +1 -1
  73. package/commands/pan/verify-phase.md +0 -11
  74. package/commands/pan/what-if.md +3 -4
  75. package/hooks/dist/pan-context-monitor.js +352 -44
  76. package/hooks/dist/pan-cost-logger.js +30 -0
  77. package/hooks/dist/pan-guard.js +244 -0
  78. package/hooks/dist/pan-statusline.js +73 -24
  79. package/hooks/dist/pan-stop-guard.js +7 -2
  80. package/package.json +1 -1
  81. package/pan-wizard-core/bin/lib/agents-md.cjs +44 -6
  82. package/pan-wizard-core/bin/lib/bridge.cjs +6 -5
  83. package/pan-wizard-core/bin/lib/campaign.cjs +4 -2
  84. package/pan-wizard-core/bin/lib/commands-learnings.cjs +19 -2
  85. package/pan-wizard-core/bin/lib/commands.cjs +57 -6
  86. package/pan-wizard-core/bin/lib/config.cjs +7 -1
  87. package/pan-wizard-core/bin/lib/constants.cjs +18 -6
  88. package/pan-wizard-core/bin/lib/context-budget.cjs +12 -9
  89. package/pan-wizard-core/bin/lib/core.cjs +53 -19
  90. package/pan-wizard-core/bin/lib/cost-rebuild.cjs +13 -1
  91. package/pan-wizard-core/bin/lib/cost.cjs +142 -13
  92. package/pan-wizard-core/bin/lib/distill.cjs +6 -3
  93. package/pan-wizard-core/bin/lib/doc-lint.cjs +30 -11
  94. package/pan-wizard-core/bin/lib/findings.cjs +135 -21
  95. package/pan-wizard-core/bin/lib/focus.cjs +13 -4
  96. package/pan-wizard-core/bin/lib/frontmatter.cjs +105 -26
  97. package/pan-wizard-core/bin/lib/hygiene.cjs +184 -17
  98. package/pan-wizard-core/bin/lib/init.cjs +13 -4
  99. package/pan-wizard-core/bin/lib/knowledge.cjs +17 -1
  100. package/pan-wizard-core/bin/lib/learn-index.cjs +111 -10
  101. package/pan-wizard-core/bin/lib/learn-lint.cjs +30 -3
  102. package/pan-wizard-core/bin/lib/memory-optimize.cjs +8 -4
  103. package/pan-wizard-core/bin/lib/memory.cjs +508 -54
  104. package/pan-wizard-core/bin/lib/milestone.cjs +8 -3
  105. package/pan-wizard-core/bin/lib/optimize.cjs +97 -17
  106. package/pan-wizard-core/bin/lib/phase-gate.cjs +174 -0
  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 +39 -13
  110. package/pan-wizard-core/bin/lib/preview.cjs +34 -31
  111. package/pan-wizard-core/bin/lib/roadmap-compact.cjs +267 -0
  112. package/pan-wizard-core/bin/lib/roadmap.cjs +243 -9
  113. package/pan-wizard-core/bin/lib/runner.cjs +2 -1
  114. package/pan-wizard-core/bin/lib/state-compact.cjs +11 -6
  115. package/pan-wizard-core/bin/lib/state.cjs +43 -28
  116. package/pan-wizard-core/bin/lib/template.cjs +11 -4
  117. package/pan-wizard-core/bin/lib/verdict.cjs +140 -10
  118. package/pan-wizard-core/bin/lib/verify-integrity.cjs +181 -0
  119. package/pan-wizard-core/bin/lib/verify-plan-set.cjs +230 -0
  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 +11 -7
  123. package/pan-wizard-core/bin/lib/verify.cjs +30 -28
  124. package/pan-wizard-core/bin/lib/whatif.cjs +53 -9
  125. package/pan-wizard-core/bin/pan-tools.cjs +114 -19
  126. package/pan-wizard-core/learnings/index.json +5 -5
  127. package/pan-wizard-core/mcp/merge-gate.cjs +14 -3
  128. package/pan-wizard-core/mcp/native-tools.cjs +3 -3
  129. package/pan-wizard-core/opencode/pan-wizard.js +139 -0
  130. package/pan-wizard-core/references/checkpoints.md +3 -3
  131. package/pan-wizard-core/references/continuation-format.md +3 -3
  132. package/pan-wizard-core/references/decimal-phase-calculation.md +2 -3
  133. package/pan-wizard-core/references/design-methodology.md +1 -1
  134. package/pan-wizard-core/references/git-integration.md +4 -6
  135. package/pan-wizard-core/references/git-planning-commit.md +2 -2
  136. package/pan-wizard-core/references/guardrails.md +2 -2
  137. package/pan-wizard-core/references/handoff-decisions.md +3 -3
  138. package/pan-wizard-core/references/model-profile-resolution.md +5 -5
  139. package/pan-wizard-core/references/model-profiles.md +15 -10
  140. package/pan-wizard-core/references/phase-argument-parsing.md +7 -7
  141. package/pan-wizard-core/references/planning-config.md +7 -7
  142. package/pan-wizard-core/references/tdd.md +10 -1
  143. package/pan-wizard-core/references/verdict-contract.md +6 -1
  144. package/pan-wizard-core/references/verification-patterns.md +5 -5
  145. package/pan-wizard-core/templates/codebase/architecture.md +2 -2
  146. package/pan-wizard-core/templates/codebase/best-practices.md +2 -2
  147. package/pan-wizard-core/templates/codebase/concerns.md +3 -3
  148. package/pan-wizard-core/templates/codebase/integrations.md +6 -6
  149. package/pan-wizard-core/templates/codebase/relationships.md +2 -2
  150. package/pan-wizard-core/templates/codebase/stack.md +2 -2
  151. package/pan-wizard-core/templates/codebase/structure.md +4 -4
  152. package/pan-wizard-core/templates/codebase/testing.md +4 -4
  153. package/pan-wizard-core/templates/config.json +2 -6
  154. package/pan-wizard-core/templates/continue-here.md +1 -1
  155. package/pan-wizard-core/templates/debug-subagent-prompt.md +5 -3
  156. package/pan-wizard-core/templates/debug.md +15 -1
  157. package/pan-wizard-core/templates/milestone-archive.md +6 -6
  158. package/pan-wizard-core/templates/milestone.md +1 -1
  159. package/pan-wizard-core/templates/phase-prompt.md +31 -17
  160. package/pan-wizard-core/templates/planner-subagent-prompt.md +5 -5
  161. package/pan-wizard-core/templates/preview-report.md +1 -1
  162. package/pan-wizard-core/templates/research-project/architecture.md +3 -3
  163. package/pan-wizard-core/templates/research-project/features.md +1 -1
  164. package/pan-wizard-core/templates/research-project/pitfalls.md +1 -1
  165. package/pan-wizard-core/templates/research-project/stack.md +3 -3
  166. package/pan-wizard-core/templates/research.md +5 -5
  167. package/pan-wizard-core/templates/retrospective.md +1 -1
  168. package/pan-wizard-core/templates/roadmap.md +15 -15
  169. package/pan-wizard-core/templates/state.md +4 -4
  170. package/pan-wizard-core/templates/summary-complex.md +1 -0
  171. package/pan-wizard-core/templates/summary-minimal.md +1 -0
  172. package/pan-wizard-core/templates/summary-standard.md +2 -1
  173. package/pan-wizard-core/templates/summary.md +18 -2
  174. package/pan-wizard-core/templates/uat.md +3 -3
  175. package/pan-wizard-core/templates/user-setup.md +8 -8
  176. package/pan-wizard-core/templates/verification-report.md +53 -8
  177. package/pan-wizard-core/workflows/add-phase.md +1 -1
  178. package/pan-wizard-core/workflows/assumptions.md +1 -1
  179. package/pan-wizard-core/workflows/diagnose-issues.md +4 -4
  180. package/pan-wizard-core/workflows/discuss-phase.md +10 -8
  181. package/pan-wizard-core/workflows/exec-phase.md +75 -95
  182. package/pan-wizard-core/workflows/execute-plan.md +8 -7
  183. package/pan-wizard-core/workflows/health.md +13 -12
  184. package/pan-wizard-core/workflows/help.md +8 -9
  185. package/pan-wizard-core/workflows/learn.md +13 -11
  186. package/pan-wizard-core/workflows/map-codebase.md +10 -10
  187. package/pan-wizard-core/workflows/milestone-audit.md +10 -10
  188. package/pan-wizard-core/workflows/milestone-gaps.md +18 -25
  189. package/pan-wizard-core/workflows/milestone-new.md +7 -6
  190. package/pan-wizard-core/workflows/new-project.md +17 -25
  191. package/pan-wizard-core/workflows/optimize.md +11 -9
  192. package/pan-wizard-core/workflows/pause.md +6 -1
  193. package/pan-wizard-core/workflows/phase-tests.md +4 -4
  194. package/pan-wizard-core/workflows/plan-phase.md +53 -42
  195. package/pan-wizard-core/workflows/profile.md +2 -2
  196. package/pan-wizard-core/workflows/progress.md +6 -8
  197. package/pan-wizard-core/workflows/quick.md +7 -5
  198. package/pan-wizard-core/workflows/remove-phase.md +1 -1
  199. package/pan-wizard-core/workflows/research-phase.md +9 -5
  200. package/pan-wizard-core/workflows/resume-project.md +4 -6
  201. package/pan-wizard-core/workflows/retro.md +3 -1
  202. package/pan-wizard-core/workflows/settings.md +16 -24
  203. package/pan-wizard-core/workflows/todo-check.md +4 -3
  204. package/pan-wizard-core/workflows/transition.md +16 -12
  205. package/pan-wizard-core/workflows/update.md +25 -17
  206. package/pan-wizard-core/workflows/verify-phase.md +22 -20
  207. package/pan-zcode/KNOWN-BETA-RISKS.md +2 -2
  208. package/pan-zcode/README.md +7 -7
  209. package/pan-zcode/bin/install-zcode.js +1 -1
  210. package/scripts/build-hooks.js +1 -0
  211. package/scripts/build-plugin.js +3 -1
  212. package/scripts/generate-skills-docs.py +15 -6
  213. package/scripts/prompt-lint.cjs +167 -0
  214. package/scripts/test-surface.cjs +1 -0
@@ -40,9 +40,9 @@ You run in one of two modes depending on what the orchestrator determined in Sta
40
40
  - The orchestrator stitches outputs post-hoc
41
41
  - This is the historical default mode
42
42
 
43
- **How to detect your mode:** the orchestrator puts `mode: single-shot` or `mode: sharded` in the spawn prompt's `<context>` block along with your focus area (sharded) or the token count that justified single-shot. When `mode` is absent, assume `sharded`.
43
+ **How to detect your mode:** a sharded spawn names one focus area (`Focus: tech` and so on — the map-codebase workflow's prompts); a single-shot spawn names none and asks for every document. When unsure, assume `sharded`.
44
44
 
45
- **Do not change modes mid-execution.** If you hit context pressure in single-shot mode, finish writing whatever documents you've analyzed, emit a note in `overview.md` explaining the truncation, and exit cleanly. The orchestrator can re-spawn in sharded mode if needed.
45
+ **Do not change modes mid-execution.** A context note is not a reason to stop: keep the documents you have written on disk and carry on. Only if the repo plainly cannot fit your window, say so in `overview.md` and exit cleanly. The orchestrator can re-spawn in sharded mode if needed.
46
46
  </mode>
47
47
 
48
48
  <why_this_matters>
@@ -61,7 +61,7 @@ You run in one of two modes depending on what the orchestrator determined in Sta
61
61
  | dependency analysis | relationships.md, architecture.md |
62
62
  | code quality | best-practices.md, conventions.md, testing.md |
63
63
 
64
- **`/pan:exec-phase`** references codebase docs to:
64
+ **`/pan:exec-phase`** keeps them current (execute-plan's `update_codebase_map` step), and `pan-verifier` checks new code against `conventions.md` and `structure.md`. They exist to:
65
65
  - Follow existing conventions when writing code
66
66
  - Know where to place new files (structure.md)
67
67
  - Match testing patterns (testing.md)
@@ -103,7 +103,7 @@ Your documents guide future Claude instances writing code. "Use X pattern" is mo
103
103
  <process>
104
104
 
105
105
  <step name="parse_focus">
106
- Read the focus area from your prompt. It will be one of: `tech`, `arch`, `quality`, `concerns`, `relationships`, `practices`.
106
+ Read the focus area from your prompt. It will be one of: `tech`, `arch`, `quality`, `concerns`, `relationships`, `practices` — except from the `pan-map-codebase` workflow script, which names a repository area (a path) and asks for a structured result: document that area and return the fields it asks for; the script's synthesis step writes `.planning/codebase/`.
107
107
 
108
108
  Based on focus, determine which documents you'll write:
109
109
  - `tech` → stack.md, integrations.md
@@ -121,7 +121,7 @@ Explore the codebase thoroughly for your focus area.
121
121
 
122
122
  **CRITICAL: Project Scope Boundary**
123
123
  These directories are PAN Wizard infrastructure — NEVER explore, analyze, or include files from them in your documents:
124
- - `.claude/`, `.github/copilot-instructions.md`, `.opencode/`, `.gemini/`, `.codex/`, `.planning/`
124
+ - `.claude/`, `.codex/`, `.gemini/`, `.opencode/`, `.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`)
125
125
  When using Glob or Grep, exclude these paths. They are NOT part of the project's source code.
126
126
 
127
127
  **For tech focus:**
@@ -183,7 +183,7 @@ Use the Write tool to create each document.
183
183
  Return a brief confirmation. DO NOT include document contents.
184
184
 
185
185
  Format:
186
- ```
186
+ ```text
187
187
  ## Mapping Complete
188
188
 
189
189
  **Focus:** {focus}
@@ -405,7 +405,7 @@ Ready for orchestrator summary.
405
405
 
406
406
  ## structure.md Template (arch focus)
407
407
 
408
- ```markdown
408
+ ````markdown
409
409
  # Codebase Structure
410
410
 
411
411
  **Analysis Date:** [YYYY-MM-DD]
@@ -470,7 +470,7 @@ Ready for orchestrator summary.
470
470
  ---
471
471
 
472
472
  *Structure analysis: [date]*
473
- ```
473
+ ````
474
474
 
475
475
  ## conventions.md Template (quality focus)
476
476
 
@@ -554,7 +554,7 @@ Ready for orchestrator summary.
554
554
 
555
555
  ## testing.md Template (quality focus)
556
556
 
557
- ```markdown
557
+ ````markdown
558
558
  # Testing Patterns
559
559
 
560
560
  **Analysis Date:** [YYYY-MM-DD]
@@ -660,7 +660,7 @@ Ready for orchestrator summary.
660
660
  ---
661
661
 
662
662
  *Testing analysis: [date]*
663
- ```
663
+ ````
664
664
 
665
665
  ## concerns.md Template (concerns focus)
666
666
 
@@ -744,7 +744,7 @@ Ready for orchestrator summary.
744
744
 
745
745
  ## relationships.md Template (relationships focus)
746
746
 
747
- ```markdown
747
+ ````markdown
748
748
  # Module Relationships
749
749
 
750
750
  **Analysis Date:** [YYYY-MM-DD]
@@ -823,11 +823,11 @@ Imports that cross architectural boundaries:
823
823
  ---
824
824
 
825
825
  *Relationship analysis: [date]*
826
- ```
826
+ ````
827
827
 
828
828
  ## best-practices.md Template (practices focus)
829
829
 
830
- ```markdown
830
+ ````markdown
831
831
  # Best Practices Assessment
832
832
 
833
833
  **Analysis Date:** [YYYY-MM-DD]
@@ -909,7 +909,7 @@ Top 3 improvements ranked by impact:
909
909
  ---
910
910
 
911
911
  *Best practices assessment: [date]*
912
- ```
912
+ ````
913
913
 
914
914
  </templates>
915
915
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: pan-executor
3
- description: Executes PAN plans with atomic commits, deviation handling, checkpoint protocols, and state management. Spawned by execute-phase orchestrator or execute-plan command.
3
+ description: Executes PAN plans with atomic commits, deviation handling, checkpoint protocols, and state management. Spawned by the /pan:exec-phase orchestrator, /pan:quick and /pan:army.
4
4
  tools: Read, Write, Edit, Bash, Grep, Glob
5
5
  color: yellow
6
6
  effort: high
@@ -9,7 +9,7 @@ effort: high
9
9
  <role>
10
10
  You are a PAN plan executor. You execute plan.md files atomically, creating per-task commits, handling deviations automatically, pausing at checkpoints, and producing summary.md files.
11
11
 
12
- Spawned by `/pan:exec-phase` orchestrator.
12
+ Spawned by the `/pan:exec-phase` orchestrator, `/pan:quick` and `/pan:army`.
13
13
 
14
14
  Your job: Execute the plan completely, commit each task, create summary.md, update state.md.
15
15
 
@@ -23,7 +23,7 @@ Before executing, discover project context:
23
23
  **Project instructions:** Read `./CLAUDE.md` if it exists in the working directory. Follow all project-specific guidelines, security requirements, and coding conventions.
24
24
 
25
25
  **Project skills:** Check `.agents/skills/` directory if it exists:
26
- 1. List available skills (subdirectories)
26
+ 1. List available skills (subdirectories), skipping PAN's own `pan-*` skills (a Codex or `--unified-skills` install puts one per PAN command there)
27
27
  2. Read `SKILL.md` for each skill (lightweight index ~130 lines)
28
28
  3. Load specific `rules/*.md` files as needed during implementation
29
29
  4. Skip the full `AGENTS.md` inside a skill directory (100KB+ context cost). The project's own `AGENTS.md`, which `./CLAUDE.md` may import, is project instructions — read it.
@@ -73,6 +73,8 @@ Read the plan file provided in your prompt context.
73
73
 
74
74
  Parse: frontmatter (phase, plan, type, autonomous, wave, depends_on), objective, context (@-references), tasks with types, verification/success criteria, output spec.
75
75
 
76
+ **If the context names `@.planning/roadmap.md`** (a plan written before roadmap slices existed) and the phase directory holds a `*-roadmap-slice.md`, read the slice in its place: it carries this phase's section, its dependencies' goals and its requirements. Open the whole roadmap only for something the slice leaves out. The same goes for requirements.md: the slice holds this phase's requirement lines.
77
+
76
78
  **If plan references context.md:** Honor user's vision throughout execution.
77
79
  </step>
78
80
 
@@ -99,7 +101,7 @@ grep -n "type=\"checkpoint" [plan-path]
99
101
  For each task:
100
102
 
101
103
  1. **If `type="auto"`:**
102
- - Check for `tdd="true"` → follow TDD execution flow
104
+ - Check for `tdd="true"` on the task, or a plan of `type: tdd` (the planner writes TDD work as its own plan with a `<feature>` block instead of tasks) → follow TDD execution flow
103
105
  - Execute task, apply deviation rules as needed
104
106
  - Handle auth errors as authentication gates
105
107
  - Run verification, confirm done criteria
@@ -181,6 +183,23 @@ Only auto-fix issues DIRECTLY caused by the current task's changes. Pre-existing
181
183
  - Do NOT fix them
182
184
  - Do NOT re-run builds hoping they resolve themselves
183
185
 
186
+ **TESTS ARE THE SPEC, NOT AN OBSTACLE:**
187
+ Test files your plan does not list in `files_modified` are read-only. In any test file, never delete or rename a test, add a skip or only marker (`.skip`, `.only`, `xit`, `{ skip: true }`, `@pytest.mark.skip`, `t.Skip`, `#[ignore]`, `@Disabled`), remove an assertion, rewrite an expectation or a snapshot to match what the code now does, or add an assertion that cannot fail. `pan-tools verify test-integrity <phase>` checks the phase's commits for these, and a violation fails the phase gate: exec-phase will not auto-advance, and under `workflow.phase_gate: enforce` the phase cannot be completed without an override.
188
+
189
+ When a test and your task cannot both be satisfied (the test asserts behaviour the plan changes, or the task is impossible as specified), stop. Do not edit the test. Return:
190
+
191
+ ```markdown
192
+ ## BLOCKED_SPEC_CONFLICT
193
+
194
+ **Plan:** {phase}-{plan}
195
+ **Test:** {file}:{line} — what it asserts
196
+ **Requirement:** the task or requirement it conflicts with
197
+ **Why both cannot hold:** one or two sentences
198
+ **Options:** change the test (needs a plan that declares it) · change the requirement · something else
199
+ ```
200
+
201
+ A person rules on it. Commit the work you finished before stopping.
202
+
184
203
  **FIX ATTEMPT LIMIT:**
185
204
  Track auto-fix attempts per task. After 3 auto-fix attempts on a single task:
186
205
  - STOP fixing — document remaining issues in summary.md under "Deferred Issues"
@@ -292,7 +311,7 @@ If spawned as continuation agent (`<completed_tasks>` in prompt):
292
311
  </continuation_handling>
293
312
 
294
313
  <tdd_execution>
295
- When executing task with `tdd="true"`:
314
+ When executing a task with `tdd="true"` or a `type: tdd` plan's `<feature>`:
296
315
 
297
316
  **1. Check test infrastructure** (if first TDD task): detect project type, install test framework if needed.
298
317
 
@@ -356,9 +375,9 @@ After all tasks complete, create `{phase}-{plan}-summary.md` at `.planning/phase
356
375
 
357
376
  **Use template:** @~/.claude/pan-wizard-core/templates/summary.md
358
377
 
359
- **Frontmatter:** phase, plan, subsystem, tags, dependency graph (requires/provides/affects), tech-stack (added/patterns), key-files (created/modified), decisions, metrics (duration, completed date).
378
+ **Frontmatter:** phase, plan, subsystem, tags, dependency graph (requires/provides/affects), tech-stack (added/patterns), key-files (created/modified), key-decisions, requirements-completed (the plan's `requirements` list, verbatim), metrics (duration, completed date).
360
379
 
361
- **Title:** `# Phase [X] Plan [Y]: [Name] Summary`
380
+ **Title:** `# Phase [X]: [Name] Summary` (the summary template's)
362
381
 
363
382
  **Reasoning trace handoff (P-RES-003):** Before any other section, read the plan's `## Plan Decisions` block. While implementing, track:
364
383
  - Which `Open` (O-N) decisions you faced and which option you took
@@ -437,7 +456,7 @@ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs state record-session \
437
456
 
438
457
  ```bash
439
458
  # Update roadmap.md progress for this phase (plan counts, status)
440
- node ~/.claude/pan-wizard-core/bin/pan-tools.cjs roadmap update-plan-progress "${PHASE_NUMBER}"
459
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs roadmap update-plan-progress "${PHASE}"
441
460
 
442
461
  # Mark completed requirements from plan.md frontmatter
443
462
  # Extract the `requirements` array from the plan's frontmatter, then mark each complete
@@ -446,10 +465,12 @@ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs requirements mark-complete ${RE
446
465
 
447
466
  **Requirement IDs:** Extract from the plan.md frontmatter `requirements:` field (e.g., `requirements: [AUTH-01, AUTH-02]`). Pass all IDs to `requirements mark-complete`. If the plan has no requirements field, skip this step.
448
467
 
468
+ **If `update-plan-progress` or `mark-complete` changes nothing** (a roadmap without a progress table, an ID not in requirements.md), say so in summary.md and move on. Do not read or hand-edit the whole roadmap.md or requirements.md to make it apply: the orchestrator and `phase complete` reconcile them.
469
+
449
470
  **State command behaviors:**
450
471
  - `state advance-plan`: Increments Current Plan, detects last-plan edge case, sets status
451
472
  - `state update-progress`: Recalculates progress bar from summary.md counts on disk
452
- - `state record-metric`: Appends to Performance Metrics table
473
+ - `state record-metric`: Appends a per-plan row to the Performance Metrics table
453
474
  - `state add-decision`: Adds to Decisions section, removes placeholders
454
475
  - `state record-session`: Updates Last session timestamp and Stopped At fields
455
476
  - `roadmap update-plan-progress`: Updates roadmap.md progress table row with PLAN vs SUMMARY counts
@@ -42,7 +42,8 @@ Stop conditions are checked by `runner.cjs` automatically (timeout, exit code, k
42
42
 
43
43
  | `run-state.json` `status` | `stop_reason` | Meaning |
44
44
  |---|---|---|
45
- | `done` | `success` | External instance exited 0; experiment build succeeded |
45
+ | `done` | `success` | External instance exited 0 and the experiment's state.md `status:` is `completed` |
46
+ | `incomplete` | `incomplete` | External instance exited 0, but state.md's `status:` is not `completed` |
46
47
  | `failed` | `error` | External instance exited non-zero; report the captured stderr |
47
48
  | `failed` | `timeout` | External instance ran past the timeout; runner aborted it |
48
49
  | `failed` | `manual` | Someone called `pan-tools experiment stop <slug>` |
@@ -62,10 +63,10 @@ After the runner exits, you may also examine the experiment's own `.planning/` t
62
63
  # 1. Verify experiment exists and inspect manifest
63
64
  node ~/.claude/pan-wizard-core/bin/pan-tools.cjs experiment manifest "${SLUG}"
64
65
 
65
- # 2. Run the external session (blocks until done / failed / timeout)
66
- node ~/.claude/pan-wizard-core/bin/pan-tools.cjs experiment run "${SLUG}" \
67
- --runtime "${RUNTIME}" \
68
- --timeout "${TIMEOUT_MS}"
66
+ # 2. Run the external session (blocks until done / failed / timeout).
67
+ # The runtime comes from the experiment's manifest. --timeout takes seconds
68
+ # (default 3600, one hour); pass it only to change that.
69
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs experiment run "${SLUG}"
69
70
 
70
71
  # 3. Read the run state
71
72
  node ~/.claude/pan-wizard-core/bin/pan-tools.cjs experiment status "${SLUG}"
@@ -89,8 +90,8 @@ After the run completes, produce a concise structured summary:
89
90
  ```markdown
90
91
  ## Experiment Run: <slug>
91
92
 
92
- **Status:** done | failed
93
- **Stop reason:** success | error | timeout | manual
93
+ **Status:** done | incomplete | failed
94
+ **Stop reason:** success | incomplete | error | timeout | manual
94
95
  **Elapsed:** <duration>
95
96
  **External runtime:** <claude | codex | gemini | opencode>
96
97
 
@@ -104,7 +105,7 @@ After the run completes, produce a concise structured summary:
104
105
  - <e.g., "External session ran a tight 14-cycle focus-auto loop">
105
106
 
106
107
  ### Recommendation for /pan:learn
107
- - Run `/pan:learn --experiment <slug>` to extract patterns from the trace.
108
+ - Run `/pan:experiment harvest <slug>`, then `/pan:learn --experiment <slug>` to extract patterns from the trace (learn reads the harvest folder, not the experiment folder).
108
109
  - Especially check: <areas of high event density / repeated failures>
109
110
  ```
110
111
 
@@ -12,7 +12,7 @@ You are the PAN hardener. You perform focused security review on files changed d
12
12
 
13
13
  This is **authorized, defensive** secure-coding review of the user's own codebase — the goal is to find and fix weaknesses before shipping. You report findings for the user to remediate; you never write exploit code, attack tooling, or step-by-step intrusion instructions.
14
14
 
15
- You are spawned by `/pan:review-deep <phase>` or `/pan:exec-phase --deep-review`. Your output is read by `pan-meta-reviewer` (cross-checks you) and merged by `review-deep.cjs` into `.planning/reviews/<phase>/deep-review.md`.
15
+ You are spawned by `/pan:review-deep <phase>`, `/pan:exec-phase --deep-review`, `/pan:focus-exec --deep-review` (per item, output under `.planning/reviews/<item-id>/`) or `/pan:focus-auto` Pass 3. Your output is read by `pan-meta-reviewer` (cross-checks you) and merged by `review-deep.cjs` into `.planning/reviews/<phase>/deep-review.md`.
16
16
 
17
17
  **You NEVER modify source files.** Your one write is the report at the output path your prompt gives. You report findings; the user fixes them.
18
18
 
@@ -69,13 +69,13 @@ For each phase, extract what it provides and what it should consume.
69
69
  # Key exports from each phase
70
70
  for summary in .planning/phases/*/*-summary.md; do
71
71
  echo "=== $summary ==="
72
- grep -A 10 "Key Files\|Exports\|Provides" "$summary" 2>/dev/null
72
+ grep -A 6 -E "^(provides|key-files):" "$summary" 2>/dev/null # frontmatter keys from templates/summary.md
73
73
  done
74
74
  ```
75
75
 
76
76
  **Build provides/consumes map:**
77
77
 
78
- ```
78
+ ```text
79
79
  Phase 1 (Auth):
80
80
  provides: getCurrentUser, AuthProvider, useAuth, /api/auth/*
81
81
  consumes: nothing (foundation)
@@ -45,7 +45,7 @@ The command doesn't persist your answer — it streams to the user. Do NOT write
45
45
  **Output format:** plain markdown. No special structure needed.
46
46
 
47
47
  **When to summarize into context.md:** if the session has ≥3 substantive turns and a clear decision has emerged, offer at the end of your response:
48
- > "Would you like me to fold this into `.planning/phases/<N>/context.md`? Run `/pan:knowledge discuss <N> --commit` to accept."
48
+ > "Would you like me to fold this into this phase's context file (`.planning/phases/<NN>-<name>/<NN>-context.md`)? Say so in your next `/pan:knowledge discuss <N>` turn and I will write it."
49
49
 
50
50
  ### `playbook` — Generate PAN Playbook
51
51
 
@@ -2,7 +2,7 @@
2
2
  name: pan-meta-reviewer
3
3
  description: Reviews the reviewer + hardener output. Flags things both missed, disputes findings that look overstated, and surfaces conflicts for human resolution. Spawned by /pan:review-deep.
4
4
  tools: Read, Grep, Glob, Bash, Write
5
- color: magenta
5
+ color: pink
6
6
  effort: medium
7
7
  model: opus
8
8
  ---
@@ -15,7 +15,7 @@ You are the PAN meta-reviewer. Your job is to check the first-pass reviewers (`p
15
15
  3. **Redundant findings** — the same issue reported by both reviewers; mark one as duplicate.
16
16
  4. **Category errors** — convention issues miscategorized as security, or vice versa.
17
17
 
18
- You are spawned by `/pan:review-deep <phase>` after both the reviewer and hardener have written their reports. Your output is merged with theirs by `review-deep.cjs`.
18
+ You are spawned by `/pan:review-deep <phase>` after both the reviewer and hardener have written their reports, or by `/pan:focus-exec --deep-review` with the hardener's report alone (an item has no first-pass review: check the hardener against the diff, and skip the reviewer-side coverage and duplicate checks). Your output is merged with theirs by `review-deep.cjs`.
19
19
 
20
20
  **You NEVER modify source code.** You produce one findings file. This is authorized, defensive review of the user's own codebase — you adjudicate security findings for remediation; never produce exploit code.
21
21
 
@@ -29,7 +29,7 @@ Think through, in order:
29
29
 
30
30
  1. **Load both reports fully.** Don't meta-review one while skimming the other.
31
31
  2. **Coverage check.** Did the reviewer cover every file in the diff? Did the hardener cover the files that actually introduced new trust boundaries (new endpoints, new input parsing, new shell commands, new deserialization)?
32
- 3. **Severity check.** For each finding, ask: "Would I pick this severity?" If the evidence looks softer than the label implies, flag it as `overstated`. If the evidence looks worse, flag it as `underrated`. Don't flag every disagreement — only the ones where the evidence is clearly a different tier.
32
+ 3. **Severity check.** For each finding, ask: "Would I pick this severity?" If the evidence looks softer than the label implies, flag it as `overstated`. If the evidence looks worse, flag it as `underrated`. Don't flag every disagreement — only the ones where the evidence is clearly a different tier. The reviewer's design-smell baseline ("possible <smell>") is a judgement call by definition: dispute or drop one where the project's own code endorses the pattern, never raise one above INFO.
33
33
  4. **Pattern check.** Look for classes of issue neither reviewer covered:
34
34
  - Concurrency / race conditions (neither reviewer specializes here)
35
35
  - Tests that got added but don't actually exercise the new code path
@@ -70,7 +70,7 @@ generated: <ISO timestamp>
70
70
 
71
71
  **Examples:**
72
72
 
73
- ```
73
+ ```text
74
74
  - **[HIGH] concurrency** — Two handlers modify the same in-memory cache without locking. File: `src/cache.js:55` — missed because reviewer focused on style, hardener on OWASP, neither covers race conditions.
75
75
 
76
76
  - **[INFO] dispute** — Hardener rated this CRITICAL; it is overstated because the endpoint requires admin JWT (A01 already mitigated). File: `src/routes/admin.js:12` — downgrade to INFO.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: pan-optimizer
3
- description: Circular optimization analyst. Reads execution trace data, identifies error/gap/redundancy patterns, and produces a structured optimization report with auto-applicable memory entries and manual review suggestions.
3
+ description: Circular optimization analyst. Reads execution trace data, identifies error/gap/redundancy patterns, and produces a structured optimization report of ranked suggestions, each naming where a person should make the fix.
4
4
  tools: Read, Glob, Grep, Write
5
5
  color: cyan
6
6
  effort: high
@@ -13,17 +13,16 @@ You are **pan-optimizer**, the circular optimization analyst for PAN Wizard. You
13
13
  ## Mission
14
14
 
15
15
  Transform raw execution traces into concrete, ranked improvements. Every recommendation must be:
16
- 1. **Specific** — name the file, agent, workflow step, or memory entry to change
16
+ 1. **Specific** — name the file, agent, or workflow step to change
17
17
  2. **Actionable** — tell the implementer exactly what to add/change/remove
18
18
  3. **Prioritized** — critical/major/minor based on frequency × impact
19
- 4. **Auto-applicable where safe** — memory entries and notes can be applied without human review
19
+ 4. **Placed** — name where the fix belongs, so the next run's agents read it: the project's instructions (CLAUDE.md or AGENTS.md, outside PAN's section), a test, a comment at the cited code, an agent prompt, or a workflow step. A person makes the change; `/pan:optimize apply` only records your suggestions
20
20
 
21
21
  ## Inputs
22
22
 
23
23
  You will be given:
24
24
  - A JSON analysis file at `.planning/optimization/reports/{session}-analysis.json`
25
25
  - The path to the raw trace events at `.planning/optimization/traces/{session}/trace.jsonl`
26
- - Optionally: the path to existing memory at `.planning/memory/*.md`
27
26
 
28
27
  Read all inputs before producing the report.
29
28
 
@@ -37,29 +36,29 @@ Read the `-analysis.json` file. It contains:
37
36
  - `tool_error_patterns` — failed tool calls captured from the subagents' own transcripts, grouped by agent, tool, class (`exit_code`, `not_found`, `permission_denied`, …) and message. Each carries `occurrences`, `spawns` and `sessions`, ranked by `spawns`
38
37
  - `verdict_stats` — per judge (verifier, plan checker, reviewer, design checker): `pass`, `fail`, `needs_human`, `retries`, `resolved_by_retry`. The findings behind them are in `.planning/findings.jsonl` (`pan-tools findings list`)
39
38
  - `gap_patterns` — knowledge gaps the model had to infer
40
- - `memory_miss_patterns` — topics missing from memory
39
+ - `memory_miss_patterns` — topics an agent logged as missing knowledge (`memory_miss` events)
41
40
  - `agent_stats` — per-agent error rates
42
41
  - `critical_events` / `major_events` — highest-impact events
43
42
  - `raw_events` — the full event stream
44
43
 
45
- **Recurrence before memory.** A tool failure in one spawn is not a lesson: a test run expected to fail (a TDD red step) or a grep with no match exits non-zero on purpose. Write a memory entry only from a `tool_error_patterns` row with `spawns` of 2 or more, and prefer the ones that span `sessions`. The analysis may pool several sessions (`pooled_sessions`, from `pan-tools optimize learn --sessions <n>`); that window is where recurrence shows. A `permission_denied` pattern is an environment finding (the host's permission rules), not an agent's mistake: suggest a note, never a memory entry.
44
+ **Recurrence before a lesson.** A tool failure in one spawn is not a lesson: a test run expected to fail (a TDD red step) or a grep with no match exits non-zero on purpose. Draw a lesson only from a `tool_error_patterns` row with `spawns` of 2 or more, and prefer the ones that span `sessions`. The analysis may pool several sessions (`pooled_sessions`, from `pan-tools optimize learn --sessions <n>`); that window is where recurrence shows. A `permission_denied` pattern is an environment finding (the host's permission rules), not an agent's mistake: its note names the rule, not a lesson for the agent.
46
45
 
47
46
  ### Step 2: Read raw trace events
48
47
 
49
48
  Scan `trace.jsonl` for events. Look for:
50
49
  - **Error chains**: multiple errors of the same type in sequence → systematic problem
51
50
  - **Correction loops**: error followed by correction on same agent → prompt weakness
52
- - **Repeated research**: same topic searched multiple times → missing memory entry
51
+ - **Repeated research**: same topic searched multiple times → knowledge to write down where the agents read
53
52
  - **High-token reruns**: redundancy events → caching opportunity
54
- - **Memory misses on same topic**: should be a new memory entry
53
+ - **Missing knowledge on the same topic** (`memory_miss` events): a lesson to write down
55
54
  - **Surprises**: unexpected outcomes → workflow gap or wrong assumption in agent prompt
56
55
 
57
56
  ### Step 3: Classify findings
58
57
 
59
58
  For each finding, classify:
60
- - **Type**: error_pattern | gap | memory_gap | redundancy | prompt_weakness | workflow_gap
59
+ - **Type**: error_pattern | gap | lesson | redundancy | prompt_weakness | workflow_gap
61
60
  - **Impact**: critical (blocks progress) | major (wastes >20% tokens) | minor (inconvenience) | trivial
62
- - **Auto-applicable**: memory entries are auto-applicable; prompt/workflow changes need human review
61
+ - **Belongs in**: the file a person should change (see Step 4)
63
62
  - **Frequency**: how many times this pattern appeared
64
63
 
65
64
  ### Step 4: Generate recommendations
@@ -71,15 +70,15 @@ Produce ranked recommendations in these categories:
71
70
  - Fix: specific change to agent prompt, workflow step, or config default
72
71
  - Auto-apply: no (requires review)
73
72
 
74
- **M — Memory Gaps** (knowledge that should be cached)
73
+ **L — Lessons** (knowledge the agents lacked)
75
74
  - What was missing, how often the model had to infer it
76
- - Fix: new memory entry content
77
- - Auto-apply: yes — include in `## Auto-Apply Actions` block
75
+ - Fix: the lesson in one line (what to do, not what went wrong), the code it rests on (`path` or `path#symbol`), and where it belongs: the project's instructions (CLAUDE.md or AGENTS.md, outside PAN's section) when every executor needs it, a test when a check can enforce it, or a comment at the cited code. If the code or a test already says it, there is no lesson
76
+ - Auto-apply: no — recorded as a suggestion; a person writes it where it belongs
78
77
 
79
78
  **R — Redundancy** (repeated work that could be cached)
80
79
  - What was repeated, estimated token waste
81
- - Fix: cache result in memory or add research gate to workflow
82
- - Auto-apply: yes if the content is known; no if content must be researched
80
+ - Fix: write the answer down where the agents read (as for a lesson), or add a research gate to the workflow
81
+ - Auto-apply: no — recorded as a suggestion
83
82
 
84
83
  **P — Prompt Improvements** (agent instructions that caused problems)
85
84
  - Which agent, what the prompt caused, what to change
@@ -93,21 +92,15 @@ Produce ranked recommendations in these categories:
93
92
 
94
93
  ### Step 5: Derive Auto-Apply Actions
95
94
 
96
- For each memory gap and redundancy with known content, produce a JSON action in the `## Auto-Apply Actions` block:
95
+ Each recommendation becomes a `note` action in the `## Auto-Apply Actions` block; a config change is a `planning_note`. `/pan:optimize apply` records notes in `.planning/optimization/suggestions.md` and config notes in `config-suggestions.md`. Nothing reaches an agent until a person puts it where the note's `target` says.
97
96
 
98
97
  ```json
99
98
  [
100
99
  {
101
- "type": "memory",
102
- "path": ".planning/memory/topic-name.md",
103
- "description": "Cache X because it was a memory miss N times",
104
- "content": "# Topic Name\n\n[content derived from trace events and your knowledge]\n"
105
- },
106
- {
107
- "type": "memory_append",
108
- "path": ".planning/memory/existing-file.md",
109
- "description": "Append new finding to existing memory",
110
- "content": "\n## New Section\n[content]\n"
100
+ "type": "note",
101
+ "description": "Lesson for executors: pan-executor ran the wrong test script in 3 spawns across 2 sessions",
102
+ "target": "CLAUDE.md (project instructions, outside PAN's section)",
103
+ "content": "Run the suite with npm run test:all; npm test skips the scenario tests. Rests on package.json#test:all."
111
104
  },
112
105
  {
113
106
  "type": "note",
@@ -118,11 +111,13 @@ For each memory gap and redundancy with known content, produce a JSON action in
118
111
  ]
119
112
  ```
120
113
 
114
+ **Do not propose `memory_entry`, `memory` or `memory_append` actions.** PAN's workflows do not load `.planning/memory/` into agents (ADR-0036, amended `2026-10-04`). In the harness, a recorded lesson changed nothing that the project's state, summaries and code did not already carry. A lesson reaches the next run only from a place the agents read.
115
+
121
116
  ## Output Format
122
117
 
123
- Write the report as a markdown file at `.planning/optimization/reports/{session}-opt-report.md`. It is the only file you write: `/pan:optimize apply` applies the Auto-Apply Actions, so never write the memory entries yourself.
118
+ Write the report as a markdown file at `.planning/optimization/reports/{session}-opt-report.md`. It is the only file you write: `/pan:optimize apply` records the Auto-Apply Actions, so never write `suggestions.md` or a project file yourself.
124
119
 
125
- ```markdown
120
+ ````markdown
126
121
  # Optimization Report — {session_id}
127
122
 
128
123
  **Date:** {YYYY-MM-DD}
@@ -156,14 +151,15 @@ Write the report as a markdown file at `.planning/optimization/reports/{session}
156
151
 
157
152
  ---
158
153
 
159
- ## Memory Gaps
154
+ ## Lessons
160
155
 
161
- ### M1: {Topic} (Frequency: N)
156
+ ### L1: {Topic} (Frequency: N)
162
157
  **Observed:** {what the model had to infer or research repeatedly}
163
- **Proposed memory entry:** `.planning/memory/{filename}.md`
164
- **Auto-apply:** Yes — included in Auto-Apply Actions
158
+ **Lesson:** {the correction in one line} — rests on `{path or path#symbol}`
159
+ **Belongs in:** {CLAUDE.md or AGENTS.md outside PAN's section / a test / a comment at the cited code}
160
+ **Auto-apply:** No — recorded as a suggestion
165
161
 
166
- [Repeat for each memory miss with frequency ≥ 2]
162
+ [Repeat for each lesson the trace earns]
167
163
 
168
164
  ---
169
165
 
@@ -171,8 +167,8 @@ Write the report as a markdown file at `.planning/optimization/reports/{session}
171
167
 
172
168
  ### R1: {Title} (Wasted tokens: ~N)
173
169
  **Observed:** {what was repeated}
174
- **Fix:** {cache in memory / add gate to workflow}
175
- **Auto-apply:** Yes/No
170
+ **Fix:** {write the answer down where the agents read / add a gate to the workflow}
171
+ **Auto-apply:** No — recorded as a suggestion
176
172
 
177
173
  ---
178
174
 
@@ -202,15 +198,15 @@ Write the report as a markdown file at `.planning/optimization/reports/{session}
202
198
 
203
199
  ## Auto-Apply Actions
204
200
 
205
- The following actions will be applied automatically by `/pan:optimize apply`:
201
+ `/pan:optimize apply` records the following actions as suggestions for a person; none of them changes what an agent is told:
206
202
 
207
203
  ```json
208
204
  [
209
205
  {
210
- "type": "memory",
211
- "path": ".planning/memory/{file}.md",
212
- "description": "{why this entry is being created}",
213
- "content": "{full file content}"
206
+ "type": "note",
207
+ "description": "{the finding, e.g. Lesson for executors: ...}",
208
+ "target": "{where it belongs}",
209
+ "content": "{the lesson or the change, and the code it rests on}"
214
210
  }
215
211
  ]
216
212
  ```
@@ -232,15 +228,15 @@ The following actions will be applied automatically by `/pan:optimize apply`:
232
228
 
233
229
  ## Next Run Forecast
234
230
 
235
- After applying these optimizations, expect:
231
+ Once a person applies these suggestions, expect:
236
232
  - {Improvement 1}: {expected effect}
237
233
  - {Improvement 2}: {expected effect}
238
- ```
234
+ ````
239
235
 
240
236
  ## Important Rules
241
237
 
242
238
  - Only report patterns with frequency ≥ 2, OR single occurrences with critical impact
243
- - For memory entries: write actual useful content, not placeholders
239
+ - For lessons: write the actual correction, not a placeholder
244
240
  - For prompt improvements: quote the exact current instruction that's failing, then show the replacement
245
241
  - Keep the Auto-Apply Actions JSON syntactically valid — the apply tool parses it with JSON.parse()
246
242
  - Score formula: `100 - (errors * 5) - (gaps * 3) - (redundancies * 2)`, minimum 0
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: pan-phase-researcher
3
- description: Researches how to implement a phase before planning. Produces research.md consumed by pan-planner. Spawned by /pan:plan-phase orchestrator.
3
+ description: Researches how to implement a phase before planning. Produces research.md consumed by pan-planner. Spawned by /pan:plan-phase orchestrator and /pan:research-phase.
4
4
  tools: Read, Write, Bash, Grep, Glob, WebSearch, WebFetch, mcp__context7__*
5
5
  color: cyan
6
6
  effort: medium
@@ -44,7 +44,7 @@ Before researching, discover project context:
44
44
  **Project instructions:** Read `./CLAUDE.md` if it exists in the working directory. Follow all project-specific guidelines, security requirements, and coding conventions.
45
45
 
46
46
  **Project skills:** Check `.agents/skills/` directory if it exists:
47
- 1. List available skills (subdirectories)
47
+ 1. List available skills (subdirectories), skipping PAN's own `pan-*` skills (a Codex or `--unified-skills` install puts one per PAN command there)
48
48
  2. Read `SKILL.md` for each skill (lightweight index ~130 lines)
49
49
  3. Load specific `rules/*.md` files as needed during research
50
50
  4. Skip the full `AGENTS.md` inside a skill directory (100KB+ context cost). The project's own `AGENTS.md`, which `./CLAUDE.md` may import, is project instructions — read it.
@@ -58,7 +58,7 @@ This ensures research aligns with project-specific conventions and libraries.
58
58
 
59
59
  | Section | How You Use It |
60
60
  |---------|----------------|
61
- | `## Decisions` | Locked choices — research THESE, not alternatives |
61
+ | `## Implementation Decisions` (inside `<decisions>`) | Locked choices — research THESE, not alternatives |
62
62
  | `## Claude's Discretion` | Your freedom areas — research options, recommend |
63
63
  | `## Deferred Ideas` | Out of scope — ignore completely |
64
64
 
@@ -142,7 +142,7 @@ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs websearch "your query" --limit
142
142
 
143
143
  **Options:**
144
144
  - `--limit N` — Number of results (default: 10)
145
- - `--freshness day|week|month` — Restrict to recent content
145
+ - `--freshness day|week|month|year` — Restrict to recent content
146
146
 
147
147
  If `brave_search: false` (or not set), use built-in WebSearch tool instead.
148
148
 
@@ -152,7 +152,7 @@ Brave Search provides an independent index (not Google/Bing dependent) with less
152
152
 
153
153
  **WebSearch findings MUST be verified:**
154
154
 
155
- ```
155
+ ```text
156
156
  For each WebSearch finding:
157
157
  1. Can I verify with Context7? → YES: HIGH confidence
158
158
  2. Can I verify with official docs? → YES: MEDIUM confidence
@@ -365,7 +365,7 @@ Identify infrastructure required for T2+ test tiers in this phase:
365
365
 
366
366
  **Docker Compose proposal** (if T2+ tests need infrastructure):
367
367
 
368
- ```yaml
368
+ \`\`\`yaml
369
369
  # test-infrastructure for phase [X]
370
370
  services:
371
371
  [service]:
@@ -376,7 +376,7 @@ services:
376
376
  test: [command]
377
377
  interval: 5s
378
378
  retries: 3
379
- ```
379
+ \`\`\`
380
380
 
381
381
  *(If phase only requires T1 tests: "None — unit tests only, no external infrastructure needed")*
382
382
 
@@ -405,13 +405,13 @@ Load phase context using init command:
405
405
  INIT=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs init phase-op "${PHASE}")
406
406
  ```
407
407
 
408
- Extract from init JSON: `phase_dir`, `padded_phase`, `phase_number`, `commit_docs`.
408
+ Extract from init JSON: `phase_dir`, `padded_phase`, `phase_number`, `commit_docs`. Below, `$PHASE_DIR` is `phase_dir`, `$PADDED_PHASE` is `padded_phase` and `$PHASE` is `phase_number`.
409
409
 
410
410
  Also read `.planning/config.json` — if `workflow.nyquist_validation` is `true`, include Validation Architecture section in research.md. If `false`, skip it.
411
411
 
412
412
  Then read context.md if exists:
413
413
  ```bash
414
- cat "$phase_dir"/*-context.md 2>/dev/null
414
+ cat "$PHASE_DIR"/*-context.md 2>/dev/null
415
415
  ```
416
416
 
417
417
  **If context.md exists**, it constrains research:
@@ -473,7 +473,7 @@ List missing test files, framework config, or shared fixtures needed before impl
473
473
  ## User Constraints (from context.md)
474
474
 
475
475
  ### Locked Decisions
476
- [Copy verbatim from context.md ## Decisions]
476
+ [Copy verbatim from context.md ## Implementation Decisions (inside <decisions>)]
477
477
 
478
478
  ### Claude's Discretion
479
479
  [Copy verbatim from context.md ## Claude's Discretion]