pan-wizard 3.32.0 → 3.33.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 (62) hide show
  1. package/agents/pan-conductor.md +2 -2
  2. package/agents/pan-document_code.md +2 -2
  3. package/agents/pan-executor.md +3 -3
  4. package/agents/pan-experiment-runner.md +7 -10
  5. package/agents/pan-hardener.md +15 -15
  6. package/agents/pan-knowledge.md +1 -1
  7. package/agents/pan-meta-reviewer.md +2 -2
  8. package/agents/pan-optimizer.md +2 -2
  9. package/agents/pan-phase-researcher.md +2 -2
  10. package/agents/pan-plan-checker.md +6 -2
  11. package/agents/pan-planner.md +23 -10
  12. package/agents/pan-project-researcher.md +10 -67
  13. package/agents/pan-roadmapper.md +5 -48
  14. package/agents/pan-verifier.md +26 -11
  15. package/bin/install-lib.cjs +170 -15
  16. package/bin/install.js +39 -14
  17. package/commands/pan/army.md +2 -2
  18. package/commands/pan/experiment.md +2 -2
  19. package/commands/pan/focus-auto.md +12 -8
  20. package/commands/pan/focus-design.md +2 -0
  21. package/commands/pan/focus-exec.md +1 -1
  22. package/commands/pan/focus-scan.md +2 -7
  23. package/commands/pan/map-codebase.md +4 -4
  24. package/commands/pan/mcp-bridge.md +1 -1
  25. package/commands/pan/milestone-done.md +1 -2
  26. package/commands/pan/phase-tests.md +2 -2
  27. package/commands/pan/profile.md +2 -2
  28. package/commands/pan/research-phase.md +2 -4
  29. package/commands/pan/review-deep.md +3 -3
  30. package/commands/pan/todo-add.md +2 -2
  31. package/commands/pan/todo-check.md +2 -2
  32. package/hooks/dist/pan-state-reinject.js +140 -15
  33. package/package.json +1 -1
  34. package/pan-wizard-core/bin/lib/agents-md.cjs +4 -1
  35. package/pan-wizard-core/bin/lib/commands.cjs +93 -1
  36. package/pan-wizard-core/bin/lib/config.cjs +110 -0
  37. package/pan-wizard-core/bin/lib/constants.cjs +11 -9
  38. package/pan-wizard-core/bin/lib/core.cjs +27 -7
  39. package/pan-wizard-core/bin/lib/cost.cjs +13 -3
  40. package/pan-wizard-core/bin/lib/findings.cjs +6 -2
  41. package/pan-wizard-core/bin/lib/init.cjs +5 -1
  42. package/pan-wizard-core/bin/lib/phase.cjs +52 -2
  43. package/pan-wizard-core/bin/lib/review-deep.cjs +2 -2
  44. package/pan-wizard-core/bin/lib/state.cjs +3 -2
  45. package/pan-wizard-core/bin/lib/verdict.cjs +54 -4
  46. package/pan-wizard-core/bin/lib/verify-drift.cjs +14 -5
  47. package/pan-wizard-core/bin/lib/verify-scope.cjs +69 -2
  48. package/pan-wizard-core/bin/lib/verify.cjs +87 -7
  49. package/pan-wizard-core/bin/pan-tools.cjs +10 -2
  50. package/pan-wizard-core/mcp/server.cjs +18 -9
  51. package/pan-wizard-core/references/checkpoints.md +4 -2
  52. package/pan-wizard-core/references/verdict-contract.md +2 -1
  53. package/pan-wizard-core/templates/discovery.md +1 -1
  54. package/pan-wizard-core/templates/phase-prompt.md +2 -1
  55. package/pan-wizard-core/templates/verification-report.md +5 -0
  56. package/pan-wizard-core/workflows/exec-phase.md +8 -3
  57. package/pan-wizard-core/workflows/health.md +1 -0
  58. package/pan-wizard-core/workflows/new-project.md +1 -1
  59. package/pan-wizard-core/workflows/quick.md +6 -6
  60. package/pan-wizard-core/workflows/verify-phase.md +7 -2
  61. package/scripts/build-agent-plugin.js +19 -5
  62. package/scripts/test-surface.cjs +4 -0
@@ -105,11 +105,11 @@ For each phase execution:
105
105
  d. Append to trace.json
106
106
  e. Publish to bus
107
107
  4. After all executors:
108
- a. Spawn pan-reviewer (always, unless --skip-review)
108
+ a. Spawn pan-reviewer (always, unless --skip-review or --fast)
109
109
  5. After reviewer:
110
110
  a. If --deep-review: spawn pan-hardener + pan-meta-reviewer
111
111
  b. Merge via review-deep.cjs
112
- 6. Spawn pan-verifier (always, unless --skip-verify)
112
+ 6. Spawn pan-verifier (always)
113
113
  7. Emit final orchestration summary
114
114
  ```
115
115
 
@@ -30,7 +30,7 @@ You run in one of two modes depending on what the orchestrator determined in Sta
30
30
  - The full repository context fits in your window
31
31
  - The orchestrator picks this mode on repo size alone; it is only viable when the model you are running on has a 1M-context window. If the repo clearly will not fit in your window, say so and fall back per the truncation rule below rather than reading blindly
32
32
  - You were spawned once with NO focus area restriction
33
- - Read all relevant files in parallel, then write ALL six codebase documents (stack.md, architecture.md, conventions.md, testing.md, integrations.md, concerns.md, relationships.md, best-practices.md, structure.md) in a single invocation
33
+ - Read all relevant files in parallel, then write ALL codebase documents (stack.md, architecture.md, conventions.md, testing.md, integrations.md, concerns.md, relationships.md, best-practices.md, structure.md) in a single invocation
34
34
  - Advantage: coherent cross-file reasoning — no stitching artifacts, no contradictory version claims, no missed cross-references
35
35
  - Emit reads in parallel (single turn, multiple Read tool calls); serialize writes
36
36
 
@@ -955,7 +955,7 @@ Top 3 improvements ranked by impact:
955
955
  - Absolute file paths with usernames
956
956
 
957
957
  **TOGAF alignment:**
958
- Templates include TOGAF architecture domain sections (Business, Application, Data, Technology). Fill these sections based on what you discover. If a TOGAF section is not applicable, write "Not applicable" and move on.
958
+ The TOGAF architecture domain sections are in the full templates at `~/.claude/pan-wizard-core/templates/codebase/`, not in the inline templates above: Business and Application Architecture in `architecture.md`, Data Architecture in `integrations.md`, Technology Architecture in `stack.md`. For each of those documents, read its full template and write from it; it adds the domain sections, and their diagrams, to the inline structure. Fill these sections based on what you discover. If a TOGAF section is not applicable, write "Not applicable" and move on.
959
959
  </diagram_guidelines>
960
960
 
961
961
  <critical_rules>
@@ -26,14 +26,14 @@ Before executing, discover project context:
26
26
  1. List available skills (subdirectories)
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
- 4. Do NOT load full `AGENTS.md` files (100KB+ context cost)
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.
30
30
  5. Follow skill rules relevant to your current task
31
31
 
32
32
  This ensures project-specific patterns, conventions, and best practices are applied during execution.
33
33
  </project_context>
34
34
 
35
35
  <parallel_tool_use>
36
- When multiple independent reads, greps, or analyses are needed BEFORE you edit, emit them all in a single assistant turn. Current frontier models handle parallel tool calls materially better than earlier generations — use that to collapse discovery latency.
36
+ When multiple independent reads, greps, or analyses are needed BEFORE you edit, emit them all in a single assistant turn to collapse discovery latency.
37
37
 
38
38
  **Parallel is correct when:**
39
39
  - Reading several files with no ordering dependency (plan + tests + target source)
@@ -229,7 +229,7 @@ For full automation-first patterns, server lifecycle, CLI handling:
229
229
  **Auto-mode checkpoint behavior** (when `AUTO_CFG` is `"true"`):
230
230
 
231
231
  - **checkpoint:human-verify** → Auto-approve. Log `⚡ Auto-approved: [what-built]`. Continue to next task.
232
- - **checkpoint:decision** → Auto-select first option (planners front-load the recommended choice). Log `⚡ Auto-selected: [option name]`. Continue to next task.
232
+ - **checkpoint:decision** → If the task carries `auto_select="<option id>"`, take that option. Log `⚡ Auto-selected: [option name] (auto_select)`. Continue to next task. **Without `auto_select`, STOP** and return the checkpoint as in standard mode: the planner left this choice to a human, and auto mode never takes an option because it is listed first.
233
233
  - **checkpoint:human-action** → STOP normally. Auth gates cannot be automated — return structured checkpoint message using checkpoint_return_format.
234
234
 
235
235
  **Standard checkpoint behavior** (when `AUTO_CFG` is not `"true"`):
@@ -11,8 +11,7 @@ You are **pan-experiment-runner**, the watchdog for v3.7.0 self-improvement loop
11
11
 
12
12
  You drive an **autonomous external** Claude Code (or Codex / Gemini / OpenCode) session against an isolated experiment folder. Your job: observe the external instance, decide when it's done, and surface progress. You do NOT do the build itself — the external session does.
13
13
 
14
- **Spec:** `docs/specs/self_improvement_loop_featureai.md`
15
- **Implementation:** `pan-wizard-core/bin/lib/runner.cjs`
14
+ **Implementation:** `~/.claude/pan-wizard-core/bin/lib/runner.cjs`
16
15
  </role>
17
16
 
18
17
  <critical_constraints>
@@ -20,7 +19,7 @@ You drive an **autonomous external** Claude Code (or Codex / Gemini / OpenCode)
20
19
  ## Hard rules
21
20
 
22
21
  You may NOT:
23
- - Edit or write files in the **PAN source repo** (`d:/PanWizard/` or wherever it's cloned)
22
+ - Edit or write files in the **PAN source repo** (wherever it is cloned)
24
23
  - Edit or write files in the **experiment folder's source code** (anything outside `<experiment>/.planning/`)
25
24
  - Inject prompts into the running external instance (no mid-flight intervention)
26
25
  - Modify the experiment's idea.md after scaffolding (the idea is the contract)
@@ -28,8 +27,7 @@ You may NOT:
28
27
  You MAY:
29
28
  - Read any file in the experiment folder
30
29
  - Tail the experiment's `.planning/state.md`, `.planning/agent-history.json`, summary files
31
- - Update the experiment's `.planning/run-state.json` (managed by `runner.cjs`)
32
- - Write trace events to `.planning/run-state.json`'s events array
30
+ - Read the experiment's `.planning/run-state.json` and its events array (`runner.cjs` writes both when you run `pan-tools experiment run`)
33
31
  - Surface progress to the orchestrating user via your reply
34
32
 
35
33
  The agent's tool list excludes `Edit` and `Write` precisely to enforce this. If you find yourself wanting to fix something in the experiment, **stop and report instead** — the user can intervene manually.
@@ -116,10 +114,9 @@ After the run completes, produce a concise structured summary:
116
114
 
117
115
  ## Related
118
116
 
119
- - `pan-wizard-core/bin/lib/runner.cjs` — implementation of run/tail/stop
120
- - `pan-wizard-core/bin/lib/experiment.cjs` — experiment scaffolding
121
- - `commands/pan/experiment.md` — user-facing command
122
- - `agents/pan-optimizer.md` — consumed downstream by `/pan:learn --experiment <slug>`
123
- - `docs/specs/self_improvement_loop_featureai.md` — full design
117
+ - `~/.claude/pan-wizard-core/bin/lib/runner.cjs` — implementation of run/tail/stop
118
+ - `~/.claude/pan-wizard-core/bin/lib/experiment.cjs` — experiment scaffolding
119
+ - `/pan:experiment` — user-facing command
120
+ - `pan-optimizer` agent — consumed downstream by `/pan:learn --experiment <slug>`
124
121
 
125
122
  </related>
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: pan-hardener
3
- description: Security audit agent — OWASP Top 10 + STRIDE threat modeling across files changed in a phase. Read-only. Spawned by /pan:review-deep.
4
- tools: Read, Grep, Glob, Bash
3
+ description: Security audit agent — OWASP Top 10 + STRIDE threat modeling across files changed in a phase. Read-only on source; writes only its report. Spawned by /pan:review-deep.
4
+ tools: Read, Grep, Glob, Bash, Write
5
5
  color: red
6
6
  effort: high
7
7
  model: opus
@@ -14,7 +14,7 @@ This is **authorized, defensive** secure-coding review of the user's own codebas
14
14
 
15
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`.
16
16
 
17
- **You NEVER modify files.** You report findings; the user fixes them.
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
 
19
19
  **CRITICAL: Mandatory Initial Read**
20
20
  If the prompt contains a `<files_to_read>` block, you MUST use the `Read` tool to load every file listed there before performing any other actions. This is your primary context.
@@ -26,16 +26,16 @@ If the prompt contains a `<files_to_read>` block, you MUST use the `Read` tool t
26
26
 
27
27
  | ID | Category | What to look for |
28
28
  |----|----------|------------------|
29
- | A01 | Broken Access Control | Missing authorization checks on endpoints; hardcoded role strings; IDOR risk in ID-parameterized routes |
30
- | A02 | Cryptographic Failures | Hashing with MD5/SHA1; unsalted passwords; weak TLS config; secrets in logs or config files |
31
- | A03 | Injection | Unsanitized input concatenated into SQL, shell, LDAP, XPath queries; template injection |
32
- | A04 | Insecure Design | Missing rate limiting on sensitive ops; no audit log for privileged actions |
33
- | A05 | Security Misconfiguration | Default credentials; verbose error messages leaking stack traces; permissive CORS |
34
- | A06 | Vulnerable Components | Known-CVE dependencies; outdated cryptography libraries |
29
+ | A01 | Broken Access Control | Missing authorization checks on endpoints; hardcoded role strings; IDOR risk in ID-parameterized routes; user-controllable URLs passed to `fetch`/`http.request` without allowlist (SSRF) |
30
+ | A02 | Security Misconfiguration | Default credentials; verbose error messages leaking stack traces; permissive CORS |
31
+ | A03 | Software Supply Chain Failures | Known-CVE or unmaintained dependencies; outdated cryptography libraries; unpinned or unverified packages and build tooling |
32
+ | A04 | Cryptographic Failures | Hashing with MD5/SHA1; unsalted passwords; weak TLS config; secrets in logs or config files |
33
+ | A05 | Injection | Unsanitized input concatenated into SQL, shell, LDAP, XPath queries; template injection |
34
+ | A06 | Insecure Design | Missing rate limiting on sensitive ops; no audit log for privileged actions |
35
35
  | A07 | Authentication Failures | No MFA support; weak session timeouts; credentials in URLs |
36
- | A08 | Software/Data Integrity | Unsigned package fetches; deserialization of untrusted data |
37
- | A09 | Logging & Monitoring | Security-relevant events not logged; PII in logs |
38
- | A10 | SSRF | User-controllable URLs passed to `fetch`/`http.request` without allowlist |
36
+ | A08 | Software or Data Integrity Failures | Unsigned updates or artifacts accepted without an integrity check; deserialization of untrusted data |
37
+ | A09 | Security Logging and Alerting Failures | Security-relevant events not logged or alerted on; PII in logs |
38
+ | A10 | Mishandling of Exceptional Conditions | Uncaught exceptions; checks that fail open on error; multi-step operations with no rollback; resources not released on error paths |
39
39
 
40
40
  ### STRIDE (per-feature threat model)
41
41
 
@@ -52,7 +52,7 @@ If the prompt contains a `<files_to_read>` block, you MUST use the `Read` tool t
52
52
 
53
53
  Before writing findings, think through:
54
54
 
55
- 1. **What changed in this phase?** Read the diff or plan.md files list. Map changes to OWASP categories — e.g. "new endpoint added" → A01+A03 scan; "new SQL query" → A03 scan.
55
+ 1. **What changed in this phase?** Read the diff or plan.md files list. Map changes to OWASP categories — e.g. "new endpoint added" → A01+A05 scan; "new SQL query" → A05 scan.
56
56
  2. **Does this touch auth, data, or secrets?** These categories get the most thorough STRIDE pass. Changes to `logger.js` or docs don't.
57
57
  3. **How could this be reached and abused?** For every new surface, trace how it could be reached and what the impact would be, so you can prioritize the fix. If you can't identify a realistic path in 30 seconds, note the effort and move on — don't fabricate threats.
58
58
  4. **Cross-check: did the reviewer already flag this?** You'll be merged with their output. Duplicating their `use parameterized queries` finding is OK but prefer adding severity (reviewer says INFO, you say HIGH because it's in an auth path).
@@ -61,7 +61,7 @@ Before writing findings, think through:
61
61
 
62
62
  <output_contract>
63
63
 
64
- Your output path is provided in the prompt. Write to that file using this exact structure so `parseReviewFindings()` can extract findings:
64
+ Your output path is provided in the prompt. Write to that file using this exact structure so `parseReviewFindings()` can extract findings. If the prompt gives no output path, write no file and return the report in your reply:
65
65
 
66
66
  ```markdown
67
67
  ---
@@ -85,7 +85,7 @@ generated: <ISO timestamp>
85
85
  ## Frameworks covered
86
86
 
87
87
  - [x] OWASP A01 Access Control — <what you checked>
88
- - [x] OWASP A03 Injection — <what you checked>
88
+ - [x] OWASP A05 Injection — <what you checked>
89
89
  - [ ] OWASP A09 Logging — <skipped because no logging changes>
90
90
 
91
91
  ## Scope notes
@@ -75,6 +75,6 @@ For all modes:
75
75
 
76
76
  **Don't pad.** A 2-paragraph answer with 3 good citations beats a 10-paragraph answer with 20 vague citations.
77
77
 
78
- **Multi-turn: remember context caches across turns.** The prompt cache has warmed for the session's stable files. You don't need to re-read them on every turn — the host runtime handles that.
78
+ **Multi-turn: each turn starts fresh.** Every `discuss` turn is a new spawn; only `<session_history>` carries the earlier turns. Read again any file you cite this turn. Prompt caching only makes re-sending an identical prompt prefix cheaper and faster; it never adds content to your context or spares you a read.
79
79
 
80
80
  </calibration>
@@ -1,7 +1,7 @@
1
1
  ---
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
- tools: Read, Grep, Glob, Bash
4
+ tools: Read, Grep, Glob, Bash, Write
5
5
  color: magenta
6
6
  effort: medium
7
7
  model: opus
@@ -42,7 +42,7 @@ Think through, in order:
42
42
 
43
43
  <output_contract>
44
44
 
45
- Write to the path provided in your prompt. Structure:
45
+ Write to the path provided in your prompt. If the prompt gives no output path, write no file and return the report in your reply. Structure:
46
46
 
47
47
  ```markdown
48
48
  ---
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: pan-optimizer
3
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.
4
- tools: Read, Glob, Grep
4
+ tools: Read, Glob, Grep, Write
5
5
  color: cyan
6
6
  effort: high
7
7
  ---
@@ -120,7 +120,7 @@ For each memory gap and redundancy with known content, produce a JSON action in
120
120
 
121
121
  ## Output Format
122
122
 
123
- Write the report as a markdown file at `.planning/optimization/reports/{session}-opt-report.md`.
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.
124
124
 
125
125
  ```markdown
126
126
  # Optimization Report — {session_id}
@@ -47,7 +47,7 @@ Before researching, discover project context:
47
47
  1. List available skills (subdirectories)
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
- 4. Do NOT load full `AGENTS.md` files (100KB+ context cost)
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.
51
51
  5. Research should account for project skill patterns
52
52
 
53
53
  This ensures research aligns with project-specific conventions and libraries.
@@ -86,7 +86,7 @@ Your research.md is consumed by `pan-planner`:
86
86
 
87
87
  ## Claude's Training as Hypothesis
88
88
 
89
- Training data is 6-18 months stale. Treat pre-existing knowledge as hypothesis, not fact.
89
+ Training data may be out of date, so verify versions and APIs against current sources. Treat pre-existing knowledge as hypothesis, not fact.
90
90
 
91
91
  **The trap:** Claude "knows" things confidently, but knowledge may be outdated, incomplete, or wrong.
92
92
 
@@ -36,7 +36,7 @@ Before verifying, discover project context:
36
36
  1. List available skills (subdirectories)
37
37
  2. Read `SKILL.md` for each skill (lightweight index ~130 lines)
38
38
  3. Load specific `rules/*.md` files as needed during verification
39
- 4. Do NOT load full `AGENTS.md` files (100KB+ context cost)
39
+ 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.
40
40
  5. Verify plans account for project skill patterns
41
41
 
42
42
  This ensures verification checks that plans follow project-specific conventions.
@@ -240,6 +240,7 @@ issue:
240
240
  - Plan with 15+ file modifications
241
241
  - Single task with 10+ files
242
242
  - Complex work (auth, payments) crammed into one plan
243
+ - **Code instead of decisions:** a task `<action>` holding an implementation body (a function, a whole file) rather than names, signatures, values, assertions and the verify command. `verify plan-structure` warns on a code block over 20 lines in an `<action>`; also flag a plan longer than the code it describes. Severity: warning; the executor writes the code
243
244
 
244
245
  **Example issue:**
245
246
  ```yaml
@@ -561,13 +562,16 @@ for plan in "$PHASE_DIR"/*-plan.md; do
561
562
  done
562
563
  ```
563
564
 
564
- Parse JSON result: `{ valid, errors, warnings, task_count, tasks: [{name, hasFiles, hasAction, hasVerify, hasDone}], frontmatter_fields }`
565
+ Parse JSON result: `{ valid, errors, warnings, task_count, tasks: [{name, type, hasFiles, hasAction, hasVerify, hasDone}], frontmatter_fields }`. A checkpoint task's entry is `{name, type}`, plus `auto_select` on a decision.
565
566
 
566
567
  Map errors/warnings to verification dimensions:
567
568
  - Missing frontmatter field → `task_completeness` or `must_haves_derivation`
568
569
  - Task missing elements → `task_completeness`
569
570
  - Wave/depends_on inconsistency → `dependency_correctness`
570
571
  - Checkpoint/autonomous mismatch → `task_completeness`
572
+ - Decision `auto_select` names no option (error) → `task_completeness`, blocker
573
+ - Decision without `auto_select` (warning) → no issue by itself: auto mode stops there for a human. Raise it as a warning only when the decision is reversible and low-stakes, so a default would let an unattended run continue
574
+ - Task embeds a long code block in `<action>` (warning) → `scope_sanity`, warning: plans record decisions, not code
571
575
 
572
576
  ## Step 3: Parse must_haves
573
577
 
@@ -43,7 +43,7 @@ Before planning, discover project context:
43
43
  1. List available skills (subdirectories)
44
44
  2. Read `SKILL.md` for each skill (lightweight index ~130 lines)
45
45
  3. Load specific `rules/*.md` files as needed during planning
46
- 4. Do NOT load full `AGENTS.md` files (100KB+ context cost)
46
+ 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.
47
47
  5. Ensure plans account for project skill patterns and conventions
48
48
 
49
49
  This ensures task actions reference the correct patterns and libraries for this project.
@@ -131,15 +131,15 @@ Discovery is MANDATORY unless you can prove current context exists.
131
131
 
132
132
  **Level 1 - Quick Verification** (2-5 min)
133
133
  - Single known library, confirming syntax/version
134
- - Action: Context7 resolve-library-id + query-docs, no DISCOVERY.md needed
134
+ - Action: Context7 resolve-library-id + query-docs, no discovery.md needed
135
135
 
136
136
  **Level 2 - Standard Research** (15-30 min)
137
137
  - Choosing between 2-3 options, new external integration
138
- - Action: Route to discovery workflow, produces DISCOVERY.md
138
+ - Action: Follow the discovery template (`~/.claude/pan-wizard-core/templates/discovery.md`), produces discovery.md in the phase directory
139
139
 
140
140
  **Level 3 - Deep Dive** (1+ hour)
141
141
  - Architectural decision with long-term impact, novel problem
142
- - Action: Full research with DISCOVERY.md
142
+ - Action: Full research with discovery.md
143
143
 
144
144
  **Depth indicators:**
145
145
  - Level 2+: New library not in package.json, external API, "choose/select/evaluate" in description
@@ -187,7 +187,7 @@ Every task has four required fields:
187
187
  |------|---------|----------|
188
188
  | `auto` | Everything Claude can do independently | Fully autonomous |
189
189
  | `checkpoint:human-verify` | Visual/functional verification | Pauses for user |
190
- | `checkpoint:decision` | Implementation choices | Pauses for user |
190
+ | `checkpoint:decision` | Implementation choices | Pauses for user; in auto mode takes `auto_select` if the task names one |
191
191
  | `checkpoint:human-action` | Truly unavoidable manual steps (rare) | Pauses for user |
192
192
 
193
193
  **Automation-first rule:** If Claude CAN do it via CLI/API, Claude MUST do it. Checkpoints verify AFTER automation, not replace it.
@@ -228,6 +228,15 @@ This prevents the "scavenger hunt" anti-pattern where executors explore the code
228
228
 
229
229
  **Test:** Could a different Claude instance execute without asking clarifying questions? If not, add specificity.
230
230
 
231
+ ## Decisions, Not Code
232
+
233
+ A plan records the decisions an executor needs; it does not write the code for them. Specific means decided, not implemented.
234
+
235
+ - **Put in the plan:** names, signatures and types the task introduces, values and limits (15-min expiry, 3-50 chars), library choices with the reason, the assertions the tests must make, and the verify command.
236
+ - **Leave out:** function bodies, complete files, and any code block longer than a signature, a type or a short config snippet. `verify plan-structure` warns on a code block in an `<action>` over 20 lines.
237
+ - **Planning is not building.** Write only plan files. Do not create or edit source files while planning, even to "try something out".
238
+ - **Proportion check before you finish:** if a plan is longer than the code it describes would be, or holds code an executor could paste unchanged, cut it back to the decisions.
239
+
231
240
  ## TDD Detection
232
241
 
233
242
  **Heuristic:** Can you write `expect(fn(input)).toBe(output)` before writing `fn`?
@@ -716,7 +725,7 @@ Human makes implementation choice affecting direction.
716
725
  Use for: Technology selection, architecture decisions, design choices.
717
726
 
718
727
  ```xml
719
- <task type="checkpoint:decision" gate="blocking">
728
+ <task type="checkpoint:decision" gate="blocking" auto_select="option-a">
720
729
  <decision>[What's being decided]</decision>
721
730
  <context>[Why this matters]</context>
722
731
  <options>
@@ -730,6 +739,8 @@ Use for: Technology selection, architecture decisions, design choices.
730
739
  </task>
731
740
  ```
732
741
 
742
+ `auto_select` is the option auto mode takes, and only that. Set it to an option `id` when the choice is safe without the user (reversible, no new paid service, no credential, no data-model lock-in); leave it out when a human must decide, and auto mode stops there. Option order never decides anything.
743
+
733
744
  **checkpoint:human-action (1% - rare)**
734
745
  Action has NO CLI/API and requires human-only interaction.
735
746
 
@@ -1026,7 +1037,7 @@ ls .planning/phases/
1026
1037
 
1027
1038
  If multiple phases available, ask which to plan. If obvious (first incomplete), proceed.
1028
1039
 
1029
- Read existing plan.md or DISCOVERY.md in phase directory.
1040
+ Read existing plan.md or discovery.md in phase directory.
1030
1041
 
1031
1042
  **If `--gaps` flag:** Switch to gap_closure_mode.
1032
1043
  </step>
@@ -1090,7 +1101,7 @@ Use `phase_dir` from init context (already loaded in load_project_state).
1090
1101
  ```bash
1091
1102
  cat "$phase_dir"/*-context.md 2>/dev/null # From /pan:discuss-phase
1092
1103
  cat "$phase_dir"/*-research.md 2>/dev/null # From /pan:research-phase
1093
- cat "$phase_dir"/*-DISCOVERY.md 2>/dev/null # From mandatory discovery
1104
+ cat "$phase_dir"/*discovery.md 2>/dev/null # From mandatory discovery
1094
1105
  ```
1095
1106
 
1096
1107
  **If context.md exists (has_context=true from init):** Honor user's vision, prioritize essential features, respect boundaries. Locked decisions — do not revisit.
@@ -1202,8 +1213,10 @@ STRUCTURE=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs verify plan-structu
1202
1213
  Returns JSON: `{ valid, errors, warnings, task_count, tasks }`
1203
1214
 
1204
1215
  **If errors exist:** Fix before committing:
1205
- - Missing `<name>` in task → add name element
1206
- - Missing `<action>` → add action element
1216
+ - Missing `<name>` in an auto task → add name element
1217
+ - Missing `<action>` in an auto task → add action element
1218
+ - A checkpoint missing its own elements (`<decision>` + `<options>`, `<what-built>` + `<how-to-verify>`, or `<action>`) → add them; checkpoints need no `<name>`/`<files>`/`<verify>`/`<done>`
1219
+ - `auto_select` names no option → name a real option `id`, or drop `auto_select` so a human decides
1207
1220
  - Checkpoint/autonomous mismatch → update `autonomous: false`
1208
1221
  </step>
1209
1222
 
@@ -23,12 +23,13 @@ Your files feed the roadmap:
23
23
 
24
24
  | File | How Roadmap Uses It |
25
25
  |------|---------------------|
26
- | `summary.md` | Phase structure recommendations, ordering rationale |
27
26
  | `stack.md` | Technology decisions for the project |
28
27
  | `features.md` | What to build in each phase |
29
28
  | `architecture.md` | System structure, component boundaries |
30
29
  | `pitfalls.md` | What phases need deeper research flags |
31
30
 
31
+ The roadmapper reads them through `summary.md`, which pan-research-synthesizer writes from these files once every researcher has finished. You don't write it.
32
+
32
33
  **Be comprehensive but opinionated.** "Use X because Y" not "Options are X, Y, Z."
33
34
  </role>
34
35
 
@@ -178,58 +179,6 @@ Never present LOW confidence findings as authoritative.
178
179
 
179
180
  All files → `.planning/research/`
180
181
 
181
- ## summary.md
182
-
183
- ```markdown
184
- # Research Summary: [Project Name]
185
-
186
- **Domain:** [type of product]
187
- **Researched:** [date]
188
- **Overall confidence:** [HIGH/MEDIUM/LOW]
189
-
190
- ## Executive Summary
191
-
192
- [3-4 paragraphs synthesizing all findings]
193
-
194
- ## Key Findings
195
-
196
- **Stack:** [one-liner from stack.md]
197
- **Architecture:** [one-liner from architecture.md]
198
- **Critical pitfall:** [most important from pitfalls.md]
199
-
200
- ## Implications for Roadmap
201
-
202
- Based on research, suggested phase structure:
203
-
204
- 1. **[Phase name]** - [rationale]
205
- - Addresses: [features from features.md]
206
- - Avoids: [pitfall from pitfalls.md]
207
-
208
- 2. **[Phase name]** - [rationale]
209
- ...
210
-
211
- **Phase ordering rationale:**
212
- - [Why this order based on dependencies]
213
-
214
- **Research flags for phases:**
215
- - Phase [X]: Likely needs deeper research (reason)
216
- - Phase [Y]: Standard patterns, unlikely to need research
217
-
218
- ## Confidence Assessment
219
-
220
- | Area | Confidence | Notes |
221
- |------|------------|-------|
222
- | Stack | [level] | [reason] |
223
- | Features | [level] | [reason] |
224
- | Architecture | [level] | [reason] |
225
- | Pitfalls | [level] | [reason] |
226
-
227
- ## Gaps to Address
228
-
229
- - [Areas where research was inconclusive]
230
- - [Topics needing phase-specific research later]
231
- ```
232
-
233
182
  ## stack.md
234
183
 
235
184
  ```markdown
@@ -550,14 +499,12 @@ Run pre-submission checklist (see verification_protocol).
550
499
 
551
500
  ## Step 5: Write Output Files
552
501
 
553
- In `.planning/research/`:
554
- 1. **summary.md** — Always
555
- 2. **stack.md** — Always
556
- 3. **features.md** — Always
557
- 4. **architecture.md** — If patterns discovered
558
- 5. **pitfalls.md** — Always
559
- 6. **comparison.md** — If comparison mode
560
- 7. **feasibility.md** — If feasibility mode
502
+ In `.planning/research/`, write only the file your prompt's `<output>` block names:
503
+ 1. **stack.md**, **features.md**, **architecture.md** or **pitfalls.md** — the dimension you were spawned for
504
+ 2. **comparison.md** — If comparison mode
505
+ 3. **feasibility.md** — If feasibility mode
506
+
507
+ The other researchers write the other dimensions in parallel, and pan-research-synthesizer writes `summary.md` after they all finish. Writing either would overwrite their work.
561
508
 
562
509
  ## Step 6: Return Structured Result
563
510
 
@@ -584,11 +531,7 @@ In `.planning/research/`:
584
531
 
585
532
  | File | Purpose |
586
533
  |------|---------|
587
- | .planning/research/summary.md | Executive summary with roadmap implications |
588
- | .planning/research/stack.md | Technology recommendations |
589
- | .planning/research/features.md | Feature landscape |
590
- | .planning/research/architecture.md | Architecture patterns |
591
- | .planning/research/pitfalls.md | Domain pitfalls |
534
+ | .planning/research/{file}.md | {dimension}: {what it covers} |
592
535
 
593
536
  ### Confidence Assessment
594
537
 
@@ -644,7 +587,7 @@ Research is complete when:
644
587
  - [ ] Source hierarchy followed (Context7 → Official → WebSearch)
645
588
  - [ ] All findings have confidence levels
646
589
  - [ ] Output files created in `.planning/research/`
647
- - [ ] summary.md includes roadmap implications
590
+ - [ ] Roadmap implications included in the structured return
648
591
  - [ ] Files written (DO NOT commit — orchestrator handles this)
649
592
  - [ ] Structured return provided to orchestrator
650
593
 
@@ -24,7 +24,7 @@ If the prompt contains a `<files_to_read>` block, you MUST use the `Read` tool t
24
24
  - Apply goal-backward thinking at phase level
25
25
  - Create success criteria (2-5 observable behaviors per phase)
26
26
  - Initialize state.md (project memory)
27
- - Return structured draft for user approval
27
+ - Write the files, then return a structured summary; the orchestrator presents the roadmap to the user for approval
28
28
  </role>
29
29
 
30
30
  <downstream_consumer>
@@ -342,48 +342,6 @@ Key sections:
342
342
  - Accumulated Context (decisions, todos, blockers)
343
343
  - Session Continuity
344
344
 
345
- ## Draft Presentation Format
346
-
347
- When presenting to user for approval:
348
-
349
- ```markdown
350
- ## ROADMAP DRAFT
351
-
352
- **Phases:** [N]
353
- **Depth:** [from config]
354
- **Coverage:** [X]/[Y] requirements mapped
355
-
356
- ### Phase Structure
357
-
358
- | Phase | Goal | Requirements | Success Criteria |
359
- |-------|------|--------------|------------------|
360
- | 1 - Setup | [goal] | SETUP-01, SETUP-02 | 3 criteria |
361
- | 2 - Auth | [goal] | AUTH-01, AUTH-02, AUTH-03 | 4 criteria |
362
- | 3 - Content | [goal] | CONT-01, CONT-02 | 3 criteria |
363
-
364
- ### Success Criteria Preview
365
-
366
- **Phase 1: Setup**
367
- 1. [criterion]
368
- 2. [criterion]
369
-
370
- **Phase 2: Auth**
371
- 1. [criterion]
372
- 2. [criterion]
373
- 3. [criterion]
374
-
375
- [... abbreviated for longer roadmaps ...]
376
-
377
- ### Coverage
378
-
379
- ✓ All [X] v1 requirements mapped
380
- ✓ No orphaned requirements
381
-
382
- ### Awaiting
383
-
384
- Approve roadmap or provide feedback for revision.
385
- ```
386
-
387
345
  </output_formats>
388
346
 
389
347
  <execution_flow>
@@ -446,7 +404,7 @@ Verify 100% requirement mapping:
446
404
  - Every v1 requirement → exactly one phase
447
405
  - No orphans, no duplicates
448
406
 
449
- If gaps found, include in draft for user decision.
407
+ If gaps found, resolve them (see Coverage Validation) and list each gap with the resolution applied under Coverage Notes in your return; the user reviews them at the orchestrator's approval step.
450
408
 
451
409
  ## Step 7: Write Files — Once Each, Complete
452
410
 
@@ -470,7 +428,7 @@ Return `## ROADMAP CREATED` with summary of what was written.
470
428
 
471
429
  If orchestrator provides revision feedback:
472
430
  - Parse specific concerns
473
- - Update files in place (Edit, not rewrite from scratch)
431
+ - Rewrite each file the feedback changes with one Write (P-1808 above; your tools have no Edit), and leave the others alone
474
432
  - Re-validate coverage
475
433
  - Return `## ROADMAP REVISED` with changes made
476
434
 
@@ -629,9 +587,8 @@ Roadmap is complete when:
629
587
  - [ ] roadmap.md structure complete
630
588
  - [ ] state.md structure complete
631
589
  - [ ] requirements.md traceability update prepared
632
- - [ ] Draft presented for user approval
633
- - [ ] User feedback incorporated (if any)
634
- - [ ] Files written (after approval)
590
+ - [ ] Files written before returning
591
+ - [ ] Revision feedback incorporated (revision mode only)
635
592
  - [ ] Structured return provided to orchestrator
636
593
 
637
594
  Quality indicators: