pan-wizard 3.22.0 → 3.25.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 (135) hide show
  1. package/README.md +38 -24
  2. package/agents/pan-conductor.md +4 -4
  3. package/agents/pan-design-checker.md +83 -0
  4. package/agents/pan-designer.md +67 -0
  5. package/agents/pan-document_code.md +3 -2
  6. package/agents/pan-executor.md +2 -2
  7. package/agents/pan-plan-checker.md +19 -6
  8. package/agents/pan-planner.md +4 -1
  9. package/agents/pan-previewer.md +1 -1
  10. package/agents/pan-roadmapper.md +3 -1
  11. package/agents/pan-verifier.md +10 -10
  12. package/bin/install-lib.cjs +128 -17
  13. package/bin/install.js +480 -74
  14. package/commands/pan/army.md +34 -14
  15. package/commands/pan/audit-deployment.md +17 -14
  16. package/commands/pan/cost.md +2 -2
  17. package/commands/pan/debug.md +1 -1
  18. package/commands/pan/design-phase.md +77 -0
  19. package/commands/pan/exec-phase.md +2 -2
  20. package/commands/pan/experiment.md +18 -14
  21. package/commands/pan/focus-auto.md +5 -5
  22. package/commands/pan/focus-design.md +13 -1
  23. package/commands/pan/focus-exec.md +1 -1
  24. package/commands/pan/learn.md +1 -1
  25. package/commands/pan/links.md +3 -1
  26. package/commands/pan/map-codebase.md +4 -4
  27. package/commands/pan/mcp-bridge.md +1 -1
  28. package/commands/pan/milestone-new.md +3 -1
  29. package/commands/pan/optimize.md +2 -2
  30. package/commands/pan/patches.md +1 -1
  31. package/commands/pan/plan-phase.md +3 -1
  32. package/commands/pan/preview.md +3 -3
  33. package/commands/pan/profile.md +3 -3
  34. package/commands/pan/research-phase.md +1 -1
  35. package/commands/pan/retro.md +4 -1
  36. package/commands/pan/review-deep.md +1 -1
  37. package/commands/pan/settings.md +2 -2
  38. package/commands/pan/what-if.md +1 -1
  39. package/hooks/dist/pan-check-update.js +149 -38
  40. package/hooks/dist/pan-context-monitor.js +155 -81
  41. package/hooks/dist/pan-cost-logger.js +288 -13
  42. package/hooks/dist/pan-statusline.js +24 -8
  43. package/hooks/dist/pan-stop-guard.js +160 -0
  44. package/hooks/dist/pan-trace-logger.js +261 -19
  45. package/package.json +2 -2
  46. package/pan-wizard-core/bin/lib/bridge.cjs +1 -1
  47. package/pan-wizard-core/bin/lib/bus.cjs +19 -4
  48. package/pan-wizard-core/bin/lib/campaign.cjs +8 -3
  49. package/pan-wizard-core/bin/lib/codebase.cjs +15 -5
  50. package/pan-wizard-core/bin/lib/commands.cjs +88 -6
  51. package/pan-wizard-core/bin/lib/config.cjs +27 -2
  52. package/pan-wizard-core/bin/lib/constants.cjs +1 -0
  53. package/pan-wizard-core/bin/lib/core.cjs +113 -8
  54. package/pan-wizard-core/bin/lib/cost.cjs +61 -24
  55. package/pan-wizard-core/bin/lib/distill.cjs +22 -4
  56. package/pan-wizard-core/bin/lib/doc-lint.cjs +25 -7
  57. package/pan-wizard-core/bin/lib/experiment.cjs +25 -1
  58. package/pan-wizard-core/bin/lib/focus.cjs +42 -7
  59. package/pan-wizard-core/bin/lib/frontmatter.cjs +62 -31
  60. package/pan-wizard-core/bin/lib/git.cjs +51 -16
  61. package/pan-wizard-core/bin/lib/hud.cjs +17 -2
  62. package/pan-wizard-core/bin/lib/init.cjs +2 -5
  63. package/pan-wizard-core/bin/lib/knowledge.cjs +20 -1
  64. package/pan-wizard-core/bin/lib/learn-lint.cjs +50 -0
  65. package/pan-wizard-core/bin/lib/links.cjs +9 -6
  66. package/pan-wizard-core/bin/lib/lock.cjs +23 -4
  67. package/pan-wizard-core/bin/lib/memory-optimize.cjs +11 -6
  68. package/pan-wizard-core/bin/lib/milestone.cjs +11 -5
  69. package/pan-wizard-core/bin/lib/optimize.cjs +18 -7
  70. package/pan-wizard-core/bin/lib/phase-remove.cjs +41 -2
  71. package/pan-wizard-core/bin/lib/phase.cjs +82 -11
  72. package/pan-wizard-core/bin/lib/preview.cjs +23 -4
  73. package/pan-wizard-core/bin/lib/review-deep.cjs +14 -6
  74. package/pan-wizard-core/bin/lib/roadmap.cjs +6 -2
  75. package/pan-wizard-core/bin/lib/runner.cjs +17 -7
  76. package/pan-wizard-core/bin/lib/squads.cjs +43 -11
  77. package/pan-wizard-core/bin/lib/state.cjs +32 -11
  78. package/pan-wizard-core/bin/lib/template.cjs +8 -3
  79. package/pan-wizard-core/bin/lib/verify-deploy.cjs +14 -2
  80. package/pan-wizard-core/bin/lib/verify-drift.cjs +15 -1
  81. package/pan-wizard-core/bin/lib/verify-preflight.cjs +9 -3
  82. package/pan-wizard-core/bin/lib/verify.cjs +84 -39
  83. package/pan-wizard-core/bin/lib/whatif.cjs +8 -1
  84. package/pan-wizard-core/bin/lib/worktree.cjs +98 -0
  85. package/pan-wizard-core/bin/pan-tools.cjs +45 -20
  86. package/pan-wizard-core/learnings/index.json +7 -7
  87. package/pan-wizard-core/learnings/universal/autonomous-loop.md +5 -3
  88. package/pan-wizard-core/learnings/universal/concurrency.md +1 -1
  89. package/pan-wizard-core/references/design-methodology.md +94 -0
  90. package/pan-wizard-core/references/git-integration.md +9 -9
  91. package/pan-wizard-core/references/guardrails.md +4 -1
  92. package/pan-wizard-core/references/model-profile-resolution.md +1 -1
  93. package/pan-wizard-core/references/model-profiles.md +44 -34
  94. package/pan-wizard-core/references/planning-config.md +5 -5
  95. package/pan-wizard-core/references/verification-patterns.md +67 -0
  96. package/pan-wizard-core/templates/codebase/architecture.md +1 -1
  97. package/pan-wizard-core/templates/codebase/concerns.md +1 -1
  98. package/pan-wizard-core/templates/codebase/conventions.md +1 -1
  99. package/pan-wizard-core/templates/codebase/integrations.md +1 -1
  100. package/pan-wizard-core/templates/codebase/stack.md +1 -1
  101. package/pan-wizard-core/templates/codebase/structure.md +1 -1
  102. package/pan-wizard-core/templates/codebase/testing.md +1 -1
  103. package/pan-wizard-core/templates/design.md +146 -0
  104. package/pan-wizard-core/templates/discovery.md +3 -3
  105. package/pan-wizard-core/templates/milestone-archive.md +2 -2
  106. package/pan-wizard-core/templates/playbook.md +1 -1
  107. package/pan-wizard-core/templates/uat.md +1 -1
  108. package/pan-wizard-core/workflows/diagnose-issues.md +9 -7
  109. package/pan-wizard-core/workflows/exec-phase.md +28 -8
  110. package/pan-wizard-core/workflows/execute-plan.md +2 -3
  111. package/pan-wizard-core/workflows/health.md +24 -1
  112. package/pan-wizard-core/workflows/help.md +5 -4
  113. package/pan-wizard-core/workflows/learn.md +5 -5
  114. package/pan-wizard-core/workflows/map-codebase.md +1 -1
  115. package/pan-wizard-core/workflows/milestone-audit.md +1 -1
  116. package/pan-wizard-core/workflows/milestone-new.md +4 -4
  117. package/pan-wizard-core/workflows/new-project.md +47 -32
  118. package/pan-wizard-core/workflows/optimize.md +8 -8
  119. package/pan-wizard-core/workflows/pause.md +1 -1
  120. package/pan-wizard-core/workflows/phase-tests.md +2 -2
  121. package/pan-wizard-core/workflows/plan-phase.md +4 -0
  122. package/pan-wizard-core/workflows/profile.md +13 -10
  123. package/pan-wizard-core/workflows/research-phase.md +1 -1
  124. package/pan-wizard-core/workflows/resume-project.md +1 -1
  125. package/pan-wizard-core/workflows/settings.md +9 -9
  126. package/pan-wizard-core/workflows/transition.md +24 -8
  127. package/pan-wizard-core/workflows/update.md +23 -20
  128. package/pan-wizard-core/workflows/verify-phase.md +7 -2
  129. package/pan-zcode/README.md +12 -2
  130. package/pan-zcode/bin/install-zcode.js +1 -1
  131. package/pan-zcode/mcp/native-tools.cjs +1 -1
  132. package/pan-zcode/mcp/server.cjs +76 -14
  133. package/scripts/build-hooks.js +2 -1
  134. package/scripts/generate-skills-docs.py +0 -4
  135. package/scripts/run-tests.cjs +11 -4
@@ -0,0 +1,146 @@
1
+ # Design Artifact Template
2
+
3
+ Template for `{scope}-design.md` — the design a change carries **before** it is
4
+ planned or executed. Produced by `pan-designer` (per phase, via
5
+ `/pan:design-phase`) or `focus-design` (per feature). Held to the quality bar in
6
+ `references/design-methodology.md` and verified by `pan-design-checker`.
7
+
8
+ **Purpose:** Capture the *how* (and, at deeper tiers, the *whether/what*) of a
9
+ change — architecture, decisions, ADR, threats, and machine-checkable success
10
+ criteria — so the planner builds against a verified design instead of improvising
11
+ architecture inside the plan.
12
+
13
+ **Depth tiers** select which sections are mandatory (see
14
+ `references/design-methodology.md`): `spike` < `phase` < `feature` < `full`.
15
+ Sections are labeled with the tier at which they become **required**; a shallower
16
+ tier may omit them.
17
+
18
+ **Downstream consumers:**
19
+ - `pan-planner` — reads locked decisions, interface contract, and file scope to create tasks that implement the approved design (same way it reads `context.md`).
20
+ - `pan-plan-checker` — verifies the plan conforms to this design (Design Conformance dimension).
21
+ - `pan-design-checker` — verifies THIS artifact against the quality bar before it is handed off.
22
+
23
+ ---
24
+
25
+ ## File Template
26
+
27
+ ```markdown
28
+ # [Scope]: [Name] — Design
29
+
30
+ **Tier:** spike | phase | feature | full
31
+ **Designed:** [date]
32
+ **Status:** Draft | Verified (pan-design-checker) | Superseded
33
+
34
+ <problem>
35
+ ## Problem & Scope <!-- all tiers -->
36
+
37
+ **Problem:** [What problem exists, why it matters, cost of inaction. Concrete.]
38
+
39
+ **In scope:** [What this design covers]
40
+ **Out of scope / boundary:** [The fixed boundary this must not exceed — phase boundary from roadmap.md, or feature boundary]
41
+ </problem>
42
+
43
+ <success_criteria>
44
+ ## Success Criteria <!-- phase+ -->
45
+
46
+ [3–7 criteria. At least 2 MUST be machine-checkable — name the automated check.]
47
+
48
+ | # | Criterion | Machine-checkable? | Check |
49
+ |---|-----------|--------------------|-------|
50
+ | SC-1 | [criterion] | yes | [test / command that verifies it] |
51
+ | SC-2 | [criterion] | yes | [test / command that verifies it] |
52
+ | SC-3 | [criterion] | no | [how confirmed] |
53
+ </success_criteria>
54
+
55
+ <architecture>
56
+ ## Architecture & Synthesis <!-- phase+ -->
57
+
58
+ **Discovered conventions:** [Actual conventions extracted from the codebase — module layout, error style, boundaries. Cite files. Do not assume.]
59
+
60
+ **Components & boundaries:** [Modules added/touched; confirm no layer/boundary violation against the discovered conventions.]
61
+
62
+ **Interface contract:** [Exact invocation + input/output schema + status/exit codes, per project convention.]
63
+
64
+ **State & filesystem scope:**
65
+ - Reads from: [paths — within project root]
66
+ - Writes to: [paths — within .planning/ or project root]
67
+ - Side effects: [git ops, dir creation, etc.]
68
+
69
+ **Design decisions:**
70
+ | Decision | Chosen | Alternative rejected | Rationale |
71
+ |----------|--------|----------------------|-----------|
72
+ | [point] | [what] | [alt] | [why] |
73
+ </architecture>
74
+
75
+ <adr>
76
+ ## ADR <!-- phase+ (phase = inline; feature/full = standalone docs/decisions/ADR-NNNN) -->
77
+
78
+ **Context:** [Problem, forces/constraints, current state, requirements traceability.]
79
+ **Decision:** [Summary + numbered sub-decisions, each with rationale.]
80
+ **Consequences:** [Positive AND negative. Every negative has a mitigation or explicit acceptance — no unmitigated costs, no placeholder sections.]
81
+ </adr>
82
+
83
+ <threats>
84
+ ## Threat Model <!-- phase = lite (own surface); feature+ = full STRIDE-lite -->
85
+
86
+ | Threat | Vector | Mitigation (or explicit acceptance) |
87
+ |--------|--------|-------------------------------------|
88
+ | [threat] | [how] | [mitigation] |
89
+ </threats>
90
+
91
+ <error_handling>
92
+ ## Error Handling & Diagnostics <!-- feature+ -->
93
+
94
+ | Condition | Output shape | Handling style |
95
+ |-----------|-------------|----------------|
96
+ | [error] | [output] | [validate-before-side-effect / safe-read-null / actionable message] |
97
+ </error_handling>
98
+
99
+ <test_plan>
100
+ ## Test Plan <!-- phase = hooks; feature+ = full -->
101
+
102
+ [How each success criterion is verified — unit vs scenario, and the seed inputs for the machine-checkable ones.]
103
+ </test_plan>
104
+
105
+ <strategy>
106
+ ## Demand & Strategy <!-- feature (demand + ladder); full (+ competitive, ERRC, adoption) -->
107
+
108
+ **Demand evidence:** [Evidence, or explicit "speculative — no demand evidence" flag.]
109
+ **Feature ladder:** v0 (MVP) → v1 (complete) → v2 (enhanced).
110
+ [full tier: competitive intelligence, ERRC strategic analysis, adoption analysis.]
111
+ </strategy>
112
+
113
+ <deferred>
114
+ ## Deferred Ideas <!-- all tiers -->
115
+
116
+ [Scope-expanding ideas that came up — captured so they're not lost, explicitly NOT designed in.]
117
+ [If none: "None — design stayed within boundary."]
118
+ </deferred>
119
+
120
+ ---
121
+
122
+ *Scope: [phase XX-name | feature-name]*
123
+ *Tier: [tier] · Designed: [date] · Verified: [date or "pending"]*
124
+ ```
125
+
126
+ <guidelines>
127
+ **This template captures a VERIFIED design for downstream agents.**
128
+
129
+ The output should answer: "What is the architecture, what was decided and why,
130
+ how do we know it's safe, and how will we prove it works?"
131
+
132
+ **Good content (concrete, verifiable):**
133
+ - "Add `resolveRate()` to cost.cjs; longest-prefix match so tier keys win — SC verified by tests/cost.test.cjs"
134
+ - "Negative consequence: per-phase latency → mitigated by auto-skip + design.md caching"
135
+ - "Threat: agent-supplied path escapes tmpdir → mitigated by tmpRoot prefix + basename check"
136
+
137
+ **Bad content (vague, unverifiable):**
138
+ - "Good architecture"
139
+ - "Handles errors well"
140
+ - "Secure by design"
141
+
142
+ **After creation:**
143
+ - Main flow: file lives in the phase directory as `{phase_num}-design.md`; `pan-planner` consumes it.
144
+ - Focus flow: the ADR is written standalone to `docs/decisions/`; the spec to `docs/specs/`.
145
+ - `pan-design-checker` must pass the artifact (or exhaust 2 reflexion iterations) before it is handed to planning.
146
+ </guidelines>
@@ -1,8 +1,8 @@
1
1
  # Discovery Template
2
2
 
3
- Template for `.planning/phases/XX-name/DISCOVERY.md` - shallow research for library/option decisions.
3
+ Template for `.planning/phases/XX-name/discovery.md` - shallow research for library/option decisions.
4
4
 
5
- **Purpose:** Answer "which library/option should we use" questions during mandatory discovery in plan-phase.
5
+ **Purpose:** Answer "which library/option should we use" questions when a phase needs a quick option comparison before planning.
6
6
 
7
7
  For deep ecosystem research ("how do experts build this"), use `/pan:research-phase` which produces research.md.
8
8
 
@@ -71,7 +71,7 @@ Before completing discovery, verify:
71
71
 
72
72
 
73
73
  <output_structure>
74
- Create `.planning/phases/XX-name/DISCOVERY.md`:
74
+ Create `.planning/phases/XX-name/discovery.md`:
75
75
 
76
76
  ```markdown
77
77
  # [Topic] Discovery
@@ -1,6 +1,6 @@
1
1
  # Milestone Archive Template
2
2
 
3
- This template is used by the complete-milestone workflow to create archive files in `.planning/milestones/`.
3
+ This template is used by the milestone-done workflow to create archive files in `.planning/milestones/`.
4
4
 
5
5
  ---
6
6
 
@@ -98,7 +98,7 @@ _For current project status, see .planning/roadmap.md_
98
98
  <guidelines>
99
99
  **When to create milestone archives:**
100
100
  - After completing all phases in a milestone (v1.0, v1.1, v2.0, etc.)
101
- - Triggered by complete-milestone workflow
101
+ - Triggered by milestone-done workflow
102
102
  - Before planning next milestone work
103
103
 
104
104
  **How to fill template:**
@@ -1,5 +1,5 @@
1
1
  <!--
2
- Template for .planning/PLAYBOOK.md generated by `/pan:knowledge playbook`.
2
+ Template for .planning/playbook.md generated by `/pan:knowledge playbook`.
3
3
  Populated by knowledge.cjs buildPlaybook() + writePlaybook() from the
4
4
  accumulated lessons in `.planning/memory/*.md`.
5
5
 
@@ -106,7 +106,7 @@ skipped: [N]
106
106
 
107
107
  **After testing complete (status: complete), if gaps exist:**
108
108
 
109
- 1. User runs diagnosis (from verify-work offer or manually)
109
+ 1. User runs diagnosis (from verify-phase offer or manually)
110
110
  2. diagnose-issues workflow spawns parallel debug agents
111
111
  3. Each agent investigates one gap, returns root cause
112
112
  4. uat.md Gaps section updated with diagnosis:
@@ -64,7 +64,7 @@ Spawning parallel debug agents to investigate root causes:
64
64
  | Delete removes comment | blocker |
65
65
 
66
66
  Each agent will:
67
- 1. Create DEBUG-{slug}.md with symptoms pre-filled
67
+ 1. Create ${DEBUG_DIR}/{slug}.md with symptoms pre-filled
68
68
  2. Investigate autonomously (read code, form hypotheses, test)
69
69
  3. Return root cause
70
70
 
@@ -80,22 +80,24 @@ For each gap, fill the debug-subagent-prompt template and spawn:
80
80
  ```
81
81
  Task(
82
82
  prompt=filled_debug_subagent_prompt + "\n\n<files_to_read>\n- {phase_dir}/{phase_num}-uat.md\n- .planning/state.md\n</files_to_read>",
83
- subagent_type="general-purpose",
84
- description="Debug: {truth_short}"
83
+ subagent_type="pan-debugger",
84
+ description="Debug: {issue_summary_short}"
85
85
  )
86
86
  ```
87
87
 
88
88
  **All agents spawn in single message** (parallel execution).
89
89
 
90
- Template placeholders:
91
- - `{truth}`: The expected behavior that failed
90
+ Template placeholders (see `debug-subagent-prompt.md`):
91
+ - `{issue_id}`: Stable id for the gap, e.g. `UAT-{test_num}`
92
+ - `{issue_summary}`: The expected behavior that failed
92
93
  - `{expected}`: From UAT test
93
94
  - `{actual}`: Verbatim user description from reason field
94
95
  - `{errors}`: Any error messages from UAT (or "None reported")
95
96
  - `{reproduction}`: "Test {test_num} in UAT"
96
97
  - `{timeline}`: "Discovered during UAT"
98
+ - `{true_or_false}`: `true` (symptoms are prefilled from the UAT gap)
97
99
  - `{goal}`: `find_root_cause_only` (UAT flow - plan-phase --gaps handles fixes)
98
- - `{slug}`: Generated from truth
100
+ - `{slug}`: Generated from the issue summary
99
101
  </step>
100
102
 
101
103
  <step name="collect_results">
@@ -200,7 +202,7 @@ Agents only diagnose—plan-phase --gaps handles fixes (no fix application).
200
202
  - Report incomplete diagnosis
201
203
 
202
204
  **Agent times out:**
203
- - Check DEBUG-{slug}.md for partial progress
205
+ - Check ${DEBUG_DIR}/{slug}.md for partial progress
204
206
  - Can resume with /pan:debug
205
207
 
206
208
  **All agents fail:**
@@ -160,7 +160,7 @@ Execute each wave in sequence. Within a wave: parallel if `PARALLELIZATION=true`
160
160
 
161
161
  2. **Spawn executor agents:**
162
162
 
163
- Pass paths only — executors read files themselves with their fresh 200k context.
163
+ Pass paths only — executors read files themselves in their own fresh context window.
164
164
  This keeps orchestrator context lean (~10-15%).
165
165
 
166
166
  ```
@@ -286,11 +286,23 @@ When executor returns a checkpoint AND `AUTO_CFG` is `"true"`:
286
286
  [Awaiting section from agent return]
287
287
  ```
288
288
  5. User responds: "approved"/"done" | issue description | decision selection
289
- 6. **Spawn continuation agent (NOT resume)** using continuation-prompt.md template:
290
- - `{completed_tasks_table}`: From checkpoint return
291
- - `{resume_task_number}` + `{resume_task_name}`: Current task
292
- - `{user_response}`: What user provided
293
- - `{resume_instructions}`: Based on checkpoint type
289
+ 6. **Spawn continuation agent (NOT resume)** with a prompt built inline from this structure:
290
+ ```
291
+ Continue executing plan {plan_id}. A previous agent paused at a checkpoint.
292
+
293
+ ## Already completed
294
+ {completed_tasks_table} ← the completed-tasks table from the checkpoint return
295
+
296
+ ## Resume point
297
+ Task {resume_task_number}: {resume_task_name} ← the current (paused) task
298
+ User response to checkpoint: {user_response} ← "approved"/"done", the chosen decision option, or the issue description the user typed
299
+
300
+ ## Instructions
301
+ {resume_instructions} ← derived from the checkpoint type: human-verify → "resume the paused task";
302
+ decision → "apply the selected option, then continue"; issue → "address the
303
+ described issue first, then continue". Verify the previous commits before proceeding.
304
+ ```
305
+ All five placeholders are defined here — there is no separate template file to load.
294
306
  7. Continuation agent verifies previous commits, continues from resume point
295
307
  8. Repeat until plan completes or user stops
296
308
 
@@ -602,7 +614,7 @@ The CLI handles:
602
614
 
603
615
  Extract from result: `next_phase`, `next_phase_name`, `is_last_phase`.
604
616
 
605
- **Phase reports (opt-in build deliverable):** when `workflow.phase_reports.enabled` is `true`, generate the self-contained per-phase HTML report — and, when `workflow.phase_reports.index` is `true`, the project timeline index — at this verify→complete gate so they ship with the phase and ride the commit below. Disabled by default; phase-less projects are skipped automatically by `report`. Never opens a browser here (that's reserved for a manual `pan-tools report --open`).
617
+ **Phase reports (opt-in build deliverable):** when `workflow.phase_reports.enabled` is `true`, generate the self-contained per-phase HTML report — and, when `workflow.phase_reports.index` is `true`, the project timeline index — at this verify→complete gate so they ship with the phase and ride the commit below. Disabled by default; phase-less projects are skipped automatically by `report`. Never opens a browser here (that's reserved for a manual `pan-tools report index --open`).
606
618
 
607
619
  ```bash
608
620
  REPORT_FILES=""
@@ -704,6 +716,10 @@ STOP — do not auto-advance. Return to user.
704
716
  ```bash
705
717
  AUTO_CFG=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs config-get workflow.auto_advance 2>/dev/null || echo "false")
706
718
  ```
719
+ 3. **If `--auto` flag present AND `AUTO_CFG` is not true — persist it** (same as discuss-phase's auto_advance step). The flag lives only in this invocation's arguments; the rest of the chain, and the P-1809 stop guard, can only see the run as autonomous if the disk says so (P-1810 — the guard missed a real boundary drop because a flag-driven run left config unarmed):
720
+ ```bash
721
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs config-set workflow.auto_advance true
722
+ ```
707
723
 
708
724
  **If `--auto` flag present OR `AUTO_CFG` is true (AND verification passed with no gaps):**
709
725
 
@@ -718,6 +734,10 @@ Execute the transition workflow inline (do NOT use Task — orchestrator context
718
734
 
719
735
  Read and follow `~/.claude/pan-wizard-core/workflows/transition.md`, passing through the `--auto` flag so it propagates to the next phase invocation.
720
736
 
737
+ **Contract (P-1807):** transition.md's continuation gates key on the same trigger you just evaluated (`--auto` flag, `workflow.auto_advance`, or `mode: yolo`) — NOT on `mode` alone. Having announced AUTO-ADVANCING, the transition must end in a `Task(...)` spawn of the next phase (Route A) or reach the milestone boundary (Route B). If you find yourself printing a "Next Up" menu and stopping after the banner above, that is the P-1801/P-1807 regression, not a valid outcome.
738
+
739
+ **Post-transition self-check (MANDATORY final action in auto mode):** after transition.md finishes, confirm one of its two valid terminal states actually happened: (a) a `Task(...)` spawn for the next phase was issued (Route A), or (b) the milestone boundary was reached (Route B). If neither — state was updated but no spawn went out — you are inside the P-1801/P-1807 failure right now: return to transition.md `offer_next_phase` Route A and issue the Task spawn before ending your turn.
740
+
721
741
  **If neither `--auto` nor `AUTO_CFG` is true:**
722
742
 
723
743
  The workflow ends. The user runs `/pan:progress` or invokes the transition workflow manually.
@@ -726,7 +746,7 @@ The workflow ends. The user runs `/pan:progress` or invokes the transition workf
726
746
  </process>
727
747
 
728
748
  <context_efficiency>
729
- Orchestrator: ~10-15% context. Subagents: fresh 200k each. No polling (Task blocks). No context bleed.
749
+ Orchestrator: ~10-15% context. Subagents: a fresh window each. No polling (Task blocks). No context bleed.
730
750
  </context_efficiency>
731
751
 
732
752
  <failure_handling>
@@ -94,14 +94,13 @@ Fresh context per subagent preserves peak quality. Main context stays lean.
94
94
  if [ ! -f .planning/agent-history.json ]; then
95
95
  echo '{"version":"1.0","max_entries":50,"entries":[]}' > .planning/agent-history.json
96
96
  fi
97
- rm -f .planning/current-agent-id.txt
98
97
  if [ -f .planning/current-agent-id.txt ]; then
99
98
  INTERRUPTED_ID=$(cat .planning/current-agent-id.txt)
100
99
  echo "Found interrupted agent: $INTERRUPTED_ID"
101
100
  fi
102
101
  ```
103
102
 
104
- If interrupted: ask user to resume (Task `resume` parameter) or start fresh.
103
+ If interrupted: ask user to resume (Task `resume` parameter) or start fresh. Only AFTER that decision (per the tracking protocol below — resume detection must see the stale id first) clear the marker with `rm -f .planning/current-agent-id.txt`.
105
104
 
106
105
  **Tracking protocol:** On spawn: write agent_id to `current-agent-id.txt`, append to agent-history.json: `{"agent_id":"[id]","task_description":"[desc]","phase":"[phase]","plan":"[plan]","segment":[num|null],"timestamp":"[ISO]","status":"spawned","completion_timestamp":null}`. On completion: status → "completed", set completion_timestamp, delete current-agent-id.txt. Prune: if entries > max_entries, remove oldest "completed" (never "spawned").
107
106
 
@@ -423,7 +422,7 @@ FIRST_TASK=$(git log --oneline --grep="feat({phase}-{plan}):" --grep="fix({phase
423
422
  git diff --name-only ${FIRST_TASK}^..HEAD 2>/dev/null
424
423
  ```
425
424
 
426
- Update only structural changes: new src/ dir → STRUCTURE.md | deps → STACK.md | file pattern → CONVENTIONS.md | API client → INTEGRATIONS.md | config → STACK.md | renamed → update paths. Skip code-only/bugfix/content changes.
425
+ Update only structural changes: new src/ dir → structure.md | deps → stack.md | file pattern → conventions.md | API client → integrations.md | config → stack.md | renamed → update paths. Skip code-only/bugfix/content changes.
427
426
 
428
427
  ```bash
429
428
  node ~/.claude/pan-wizard-core/bin/pan-tools.cjs commit "" --files .planning/codebase/*.md --amend
@@ -157,9 +157,32 @@ Report final status.
157
157
  | W003 | warning | config.json not found | Yes |
158
158
  | W004 | warning | config.json invalid field value | No |
159
159
  | W005 | warning | Phase directory naming mismatch | No |
160
- | W006 | warning | Phase in ROADMAP but no directory | No |
160
+ | W006 | warning | Phase in ROADMAP at or behind current phase, but no directory | No |
161
161
  | W007 | warning | Phase on disk but not in ROADMAP | No |
162
162
  | I001 | info | Plan without SUMMARY (may be in progress) | No |
163
+ | I002 | info | Phase in ROADMAP ahead of current phase, not planned yet | No |
164
+ | STATE_REQ_DRIFT | warning | state.md complete but REQUIREMENTS.md has unchecked boxes | Yes |
165
+ | STATE_ROADMAP_DRIFT | warning | state.md complete but roadmap.md has unchecked plan boxes | Yes |
166
+ | VERIFICATION_GATE_MISSING | warning | Phase has completed plans but no verification record | No |
167
+
168
+ Flag-gated codes:
169
+
170
+ | Code | Severity | Flag | Description | Repairable |
171
+ |------|----------|------|-------------|------------|
172
+ | TESTS_FAIL | error | --full | Test run exited non-zero | No |
173
+ | BUILD_FAIL | error | --full | Build exited non-zero | No |
174
+ | MEM_BUDGET | warning / info | --full | Memory injection over budget | No |
175
+ | DRIFT_HIGH | warning | --drift | Drift verdict is high | No |
176
+ | DRIFT_MEDIUM | info | --drift | Drift verdict is medium | No |
177
+ | LINKS_ERR | warning | --links | Link graph has errors | No |
178
+ | STD-000 | info | --standards | No standards.md found | No |
179
+ | STD-001 | info | --standards | standards.md has no recognized standards | No |
180
+ | STD-*id* | warning / info | --standards | Per-standard coverage (warning at 0%) | No |
181
+ | STD-SUMMARY | info | --standards | Overall coverage across standards | No |
182
+
183
+ **I002 vs W006:** a roadmap phase the project has not reached yet is normal progress,
184
+ not a defect — it reports as info and does not degrade health. Only a missing phase at
185
+ or behind the current position warns.
163
186
 
164
187
  </error_codes>
165
188
 
@@ -1,5 +1,5 @@
1
1
  <purpose>
2
- Display the complete PAN command reference. Output ONLY the reference content. Do NOT add project-specific analysis, git status, next-step suggestions, or any commentary beyond the reference.
2
+ Display the PAN command reference. Output ONLY the reference content. Do NOT add project-specific analysis, git status, next-step suggestions, or any commentary beyond the reference.
3
3
  </purpose>
4
4
 
5
5
  <reference>
@@ -148,7 +148,6 @@ The Focus workflow is a **scan → plan → exec → sync** pipeline. Each step
148
148
  **Flags:**
149
149
  - `--mode <mode>` — select execution mode (default: balanced)
150
150
  - `--budget N` — override point budget (5-100)
151
- - `--dry-run` — show what would be selected without writing
152
151
  - `--lean` — exclude items with RS < 1.5
153
152
 
154
153
  ### Step 3: `/pan:focus-exec`
@@ -208,7 +207,9 @@ The Focus workflow is a **scan → plan → exec → sync** pipeline. Each step
208
207
 
209
208
  ---
210
209
 
211
- ## All Commands (42)
210
+ ## All Commands
211
+
212
+ > This table is a **curated subset** of the most-used commands, not an exhaustive list. For the full, always-current command set, browse the `commands/pan/*.md` files in your install (each `.md` is one `/pan:<name>` command).
212
213
 
213
214
  ### Getting Started
214
215
  | Command | Description |
@@ -389,7 +390,7 @@ The Focus workflow is a **scan → plan → exec → sync** pipeline. Each step
389
390
 
390
391
  **`/pan:settings`** — Toggle researcher, plan checker, verifier agents. Select model profile.
391
392
 
392
- **`/pan:profile <name>`** — Quick profile switch: `quality` (Opus everywhere), `balanced` (Opus plan + Sonnet exec, default), `budget` (Sonnet + Haiku).
393
+ **`/pan:profile <name>`** — Quick profile switch: `quality` and `balanced` (reasoning tier for every agent; `balanced` is the default), `budget` (mid tier for writing, fast tier for research/verification).
393
394
 
394
395
  **Planning config** (`.planning/config.json`):
395
396
  - `commit_docs: true` — commit planning artifacts to git (set `false` + add `.planning/` to `.gitignore` for private planning)
@@ -16,12 +16,12 @@ Analyze the most recent trace session and generate a circular optimization repor
16
16
 
17
17
  Run:
18
18
  ```
19
- node .claude/pan-wizard-core/bin/pan-tools.cjs optimize trace current
19
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs optimize trace current
20
20
  ```
21
21
 
22
22
  If no active session, run:
23
23
  ```
24
- node .claude/pan-wizard-core/bin/pan-tools.cjs optimize trace list
24
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs optimize trace list
25
25
  ```
26
26
  Use the most recent session unless `--session <id>` was specified.
27
27
 
@@ -31,7 +31,7 @@ If `--session <id>` was specified, use that session ID.
31
31
 
32
32
  Run:
33
33
  ```
34
- node .claude/pan-wizard-core/bin/pan-tools.cjs optimize learn [--session <id>]
34
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs optimize learn [--session <id>]
35
35
  ```
36
36
 
37
37
  This produces `.planning/optimization/reports/{session}-analysis.json`.
@@ -67,7 +67,7 @@ Present to the user:
67
67
 
68
68
  If the `--apply` flag was passed, immediately run:
69
69
  ```
70
- node .claude/pan-wizard-core/bin/pan-tools.cjs optimize apply
70
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs optimize apply
71
71
  ```
72
72
 
73
73
  Show what was applied and what still needs review.
@@ -82,7 +82,7 @@ After applying, tell the user what to watch in the next run:
82
82
  ## Edge cases
83
83
 
84
84
  **No events in trace:**
85
- - Tell the user the trace session is empty. They may need to ensure the `pan-trace-logger` hook is registered in `.claude/settings.json`.
85
+ - Tell the user the trace session is empty. They may need to ensure the `pan-trace-logger` hook is registered in `~/.claude/settings.json`.
86
86
 
87
87
  **Too few events (< 5):**
88
88
  - The optimizer can still run but note the small sample size.
@@ -315,7 +315,7 @@ This would expose credentials if committed.
315
315
  **Action required:**
316
316
  1. Review the flagged content above
317
317
  2. If these are real secrets, they must be removed before committing
318
- 3. Consider adding sensitive files to Claude Code "Deny" permissions
318
+ 3. Consider adding sensitive files to your AI coding tool's deny/ignore list
319
319
 
320
320
  Pausing before commit. Reply "safe to proceed" if the flagged content is not actually sensitive, or edit the files first.
321
321
  ```
@@ -129,7 +129,7 @@ For each REQ-ID, determine status using all three sources:
129
129
 
130
130
  ## 6. Aggregate into v{version}-milestone-audit.md
131
131
 
132
- Create `.planning/v{version}-v{version}-milestone-audit.md` with:
132
+ Create `.planning/v{version}-milestone-audit.md` with:
133
133
 
134
134
  ```yaml
135
135
  ---
@@ -17,12 +17,12 @@ Read all files referenced by the invoking prompt's execution_context before star
17
17
  - Read project.md (existing project, validated requirements, decisions)
18
18
  - Read milestones.md (what shipped previously)
19
19
  - Read state.md (pending todos, blockers)
20
- - Check for MILESTONE-context.md (from /pan:discuss-milestone)
20
+ - Check for MILESTONE-context.md (optional pre-seeded context, if the user prepared one)
21
21
 
22
22
  ## 2. Gather Milestone Goals
23
23
 
24
24
  **If MILESTONE-context.md exists:**
25
- - Use features and scope from discuss-milestone
25
+ - Use features and scope from MILESTONE-context.md
26
26
  - Present summary for confirmation
27
27
 
28
28
  **If no context file:**
@@ -151,7 +151,7 @@ Use template: ~/.claude/pan-wizard-core/templates/research-project/{FILE}
151
151
  | QUESTION | What stack additions/changes are needed for [new features]? | How do [target features] typically work? Expected behavior? | How do [target features] integrate with existing architecture? | Common mistakes when adding [target features] to [domain]? |
152
152
  | CONSUMER | Specific libraries with versions for NEW capabilities, integration points, what NOT to add | Table stakes vs differentiators vs anti-features, complexity noted, dependencies on existing | Integration points, new components, data flow changes, suggested build order | Warning signs, prevention strategy, which phase should address it |
153
153
  | GATES | Versions current (verify with Context7), rationale explains WHY, integration considered | Categories clear, complexity noted, dependencies identified | Integration points identified, new vs modified explicit, build order considers deps | Pitfalls specific to adding these features, integration pitfalls covered, prevention actionable |
154
- | FILE | STACK.md | FEATURES.md | ARCHITECTURE.md | PITFALLS.md |
154
+ | FILE | stack.md | features.md | architecture.md | pitfalls.md |
155
155
 
156
156
  After all 4 complete, spawn synthesizer:
157
157
 
@@ -195,7 +195,7 @@ Display key findings from summary.md:
195
195
 
196
196
  Read project.md: core value, current milestone goals, validated requirements (what exists).
197
197
 
198
- **If research exists:** Read FEATURES.md, extract feature categories.
198
+ **If research exists:** Read features.md, extract feature categories.
199
199
 
200
200
  Present features by category:
201
201
  ```