pan-wizard 3.33.0 → 3.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (197) hide show
  1. package/README.md +23 -20
  2. package/agents/pan-conductor.md +17 -16
  3. package/agents/pan-counterfactual.md +2 -2
  4. package/agents/pan-debugger.md +27 -8
  5. package/agents/pan-design-checker.md +1 -1
  6. package/agents/pan-designer.md +2 -2
  7. package/agents/pan-distiller.md +3 -3
  8. package/agents/pan-document_code.md +14 -14
  9. package/agents/pan-executor.md +12 -8
  10. package/agents/pan-experiment-runner.md +8 -7
  11. package/agents/pan-integration-checker.md +2 -2
  12. package/agents/pan-knowledge.md +1 -1
  13. package/agents/pan-meta-reviewer.md +3 -3
  14. package/agents/pan-optimizer.md +39 -43
  15. package/agents/pan-phase-researcher.md +8 -8
  16. package/agents/pan-plan-checker.md +30 -28
  17. package/agents/pan-planner.md +54 -43
  18. package/agents/pan-previewer.md +1 -1
  19. package/agents/pan-project-researcher.md +11 -11
  20. package/agents/pan-release.md +1 -1
  21. package/agents/pan-research-synthesizer.md +2 -2
  22. package/agents/pan-reviewer.md +24 -2
  23. package/agents/pan-roadmapper.md +15 -14
  24. package/agents/pan-verifier.md +32 -24
  25. package/bin/install-lib.cjs +58 -23
  26. package/bin/install.js +47 -1
  27. package/commands/pan/army.md +15 -11
  28. package/commands/pan/assumptions.md +2 -2
  29. package/commands/pan/audit-deployment.md +11 -12
  30. package/commands/pan/cost.md +8 -4
  31. package/commands/pan/debug.md +10 -7
  32. package/commands/pan/design-phase.md +3 -3
  33. package/commands/pan/discuss-phase.md +2 -0
  34. package/commands/pan/exec-phase.md +21 -37
  35. package/commands/pan/experiment.md +9 -8
  36. package/commands/pan/focus-auto.md +22 -20
  37. package/commands/pan/focus-design.md +7 -6
  38. package/commands/pan/focus-doc-audit.md +4 -3
  39. package/commands/pan/focus-drift-walking.md +4 -3
  40. package/commands/pan/focus-exec.md +6 -6
  41. package/commands/pan/focus-plan.md +12 -11
  42. package/commands/pan/focus-scan.md +5 -3
  43. package/commands/pan/focus-sync.md +3 -2
  44. package/commands/pan/git.md +8 -8
  45. package/commands/pan/health.md +2 -2
  46. package/commands/pan/hud.md +3 -2
  47. package/commands/pan/hygiene.md +14 -7
  48. package/commands/pan/knowledge.md +9 -9
  49. package/commands/pan/learn.md +10 -7
  50. package/commands/pan/links.md +4 -1
  51. package/commands/pan/map-codebase.md +1 -1
  52. package/commands/pan/mcp-bridge.md +18 -18
  53. package/commands/pan/milestone-done.md +6 -3
  54. package/commands/pan/milestone-new.md +1 -1
  55. package/commands/pan/new-project.md +10 -10
  56. package/commands/pan/optimize.md +16 -14
  57. package/commands/pan/patches.md +2 -6
  58. package/commands/pan/pause.md +1 -1
  59. package/commands/pan/phase-tests.md +2 -1
  60. package/commands/pan/plan-phase.md +9 -19
  61. package/commands/pan/preview.md +1 -1
  62. package/commands/pan/profile.md +2 -2
  63. package/commands/pan/quick.md +1 -1
  64. package/commands/pan/remove-phase.md +1 -1
  65. package/commands/pan/report.md +2 -2
  66. package/commands/pan/research-phase.md +12 -11
  67. package/commands/pan/resume.md +9 -11
  68. package/commands/pan/retro.md +5 -3
  69. package/commands/pan/review-deep.md +7 -7
  70. package/commands/pan/settings.md +1 -1
  71. package/commands/pan/verify-phase.md +0 -11
  72. package/commands/pan/what-if.md +2 -2
  73. package/hooks/dist/pan-context-monitor.js +343 -44
  74. package/hooks/dist/pan-cost-logger.js +30 -0
  75. package/hooks/dist/pan-statusline.js +68 -22
  76. package/hooks/dist/pan-stop-guard.js +7 -2
  77. package/package.json +1 -1
  78. package/pan-wizard-core/bin/lib/agents-md.cjs +44 -6
  79. package/pan-wizard-core/bin/lib/bridge.cjs +6 -5
  80. package/pan-wizard-core/bin/lib/campaign.cjs +4 -2
  81. package/pan-wizard-core/bin/lib/commands-learnings.cjs +19 -2
  82. package/pan-wizard-core/bin/lib/commands.cjs +33 -4
  83. package/pan-wizard-core/bin/lib/config.cjs +2 -1
  84. package/pan-wizard-core/bin/lib/constants.cjs +18 -6
  85. package/pan-wizard-core/bin/lib/context-budget.cjs +12 -9
  86. package/pan-wizard-core/bin/lib/core.cjs +53 -19
  87. package/pan-wizard-core/bin/lib/cost-rebuild.cjs +13 -1
  88. package/pan-wizard-core/bin/lib/cost.cjs +142 -13
  89. package/pan-wizard-core/bin/lib/distill.cjs +6 -3
  90. package/pan-wizard-core/bin/lib/doc-lint.cjs +30 -11
  91. package/pan-wizard-core/bin/lib/findings.cjs +9 -2
  92. package/pan-wizard-core/bin/lib/focus.cjs +13 -4
  93. package/pan-wizard-core/bin/lib/frontmatter.cjs +105 -26
  94. package/pan-wizard-core/bin/lib/hygiene.cjs +178 -17
  95. package/pan-wizard-core/bin/lib/init.cjs +7 -4
  96. package/pan-wizard-core/bin/lib/knowledge.cjs +17 -1
  97. package/pan-wizard-core/bin/lib/learn-index.cjs +111 -10
  98. package/pan-wizard-core/bin/lib/learn-lint.cjs +30 -3
  99. package/pan-wizard-core/bin/lib/memory-optimize.cjs +8 -4
  100. package/pan-wizard-core/bin/lib/memory.cjs +508 -54
  101. package/pan-wizard-core/bin/lib/milestone.cjs +8 -3
  102. package/pan-wizard-core/bin/lib/optimize.cjs +84 -16
  103. package/pan-wizard-core/bin/lib/phase-remove.cjs +85 -21
  104. package/pan-wizard-core/bin/lib/phase-report.cjs +8 -2
  105. package/pan-wizard-core/bin/lib/phase.cjs +15 -13
  106. package/pan-wizard-core/bin/lib/preview.cjs +3 -1
  107. package/pan-wizard-core/bin/lib/roadmap-compact.cjs +267 -0
  108. package/pan-wizard-core/bin/lib/roadmap.cjs +243 -9
  109. package/pan-wizard-core/bin/lib/runner.cjs +2 -1
  110. package/pan-wizard-core/bin/lib/state-compact.cjs +11 -6
  111. package/pan-wizard-core/bin/lib/state.cjs +43 -28
  112. package/pan-wizard-core/bin/lib/template.cjs +11 -4
  113. package/pan-wizard-core/bin/lib/verify-preflight.cjs +4 -13
  114. package/pan-wizard-core/bin/lib/verify-retro.cjs +5 -3
  115. package/pan-wizard-core/bin/lib/verify-scope.cjs +5 -2
  116. package/pan-wizard-core/bin/lib/verify.cjs +30 -28
  117. package/pan-wizard-core/bin/lib/whatif.cjs +5 -3
  118. package/pan-wizard-core/bin/pan-tools.cjs +101 -15
  119. package/pan-wizard-core/learnings/index.json +5 -5
  120. package/pan-wizard-core/opencode/pan-wizard.js +111 -0
  121. package/pan-wizard-core/references/checkpoints.md +3 -3
  122. package/pan-wizard-core/references/continuation-format.md +3 -3
  123. package/pan-wizard-core/references/decimal-phase-calculation.md +2 -3
  124. package/pan-wizard-core/references/design-methodology.md +1 -1
  125. package/pan-wizard-core/references/git-integration.md +4 -6
  126. package/pan-wizard-core/references/git-planning-commit.md +2 -2
  127. package/pan-wizard-core/references/guardrails.md +2 -2
  128. package/pan-wizard-core/references/handoff-decisions.md +3 -3
  129. package/pan-wizard-core/references/model-profile-resolution.md +5 -5
  130. package/pan-wizard-core/references/model-profiles.md +14 -9
  131. package/pan-wizard-core/references/phase-argument-parsing.md +7 -7
  132. package/pan-wizard-core/references/planning-config.md +4 -4
  133. package/pan-wizard-core/references/tdd.md +10 -1
  134. package/pan-wizard-core/references/verification-patterns.md +5 -5
  135. package/pan-wizard-core/templates/codebase/architecture.md +2 -2
  136. package/pan-wizard-core/templates/codebase/best-practices.md +2 -2
  137. package/pan-wizard-core/templates/codebase/concerns.md +3 -3
  138. package/pan-wizard-core/templates/codebase/integrations.md +6 -6
  139. package/pan-wizard-core/templates/codebase/relationships.md +2 -2
  140. package/pan-wizard-core/templates/codebase/stack.md +2 -2
  141. package/pan-wizard-core/templates/codebase/structure.md +4 -4
  142. package/pan-wizard-core/templates/codebase/testing.md +4 -4
  143. package/pan-wizard-core/templates/continue-here.md +1 -1
  144. package/pan-wizard-core/templates/debug-subagent-prompt.md +3 -2
  145. package/pan-wizard-core/templates/debug.md +15 -1
  146. package/pan-wizard-core/templates/milestone-archive.md +6 -6
  147. package/pan-wizard-core/templates/milestone.md +1 -1
  148. package/pan-wizard-core/templates/phase-prompt.md +29 -17
  149. package/pan-wizard-core/templates/planner-subagent-prompt.md +3 -5
  150. package/pan-wizard-core/templates/research-project/architecture.md +3 -3
  151. package/pan-wizard-core/templates/research-project/features.md +1 -1
  152. package/pan-wizard-core/templates/research-project/pitfalls.md +1 -1
  153. package/pan-wizard-core/templates/research-project/stack.md +3 -3
  154. package/pan-wizard-core/templates/research.md +5 -5
  155. package/pan-wizard-core/templates/retrospective.md +1 -1
  156. package/pan-wizard-core/templates/roadmap.md +15 -15
  157. package/pan-wizard-core/templates/summary-complex.md +1 -0
  158. package/pan-wizard-core/templates/summary-minimal.md +1 -0
  159. package/pan-wizard-core/templates/summary-standard.md +2 -1
  160. package/pan-wizard-core/templates/summary.md +18 -2
  161. package/pan-wizard-core/templates/uat.md +3 -3
  162. package/pan-wizard-core/templates/user-setup.md +8 -8
  163. package/pan-wizard-core/templates/verification-report.md +53 -8
  164. package/pan-wizard-core/workflows/add-phase.md +1 -1
  165. package/pan-wizard-core/workflows/assumptions.md +1 -1
  166. package/pan-wizard-core/workflows/discuss-phase.md +9 -8
  167. package/pan-wizard-core/workflows/exec-phase.md +26 -57
  168. package/pan-wizard-core/workflows/execute-plan.md +8 -7
  169. package/pan-wizard-core/workflows/health.md +13 -12
  170. package/pan-wizard-core/workflows/help.md +8 -9
  171. package/pan-wizard-core/workflows/learn.md +13 -11
  172. package/pan-wizard-core/workflows/map-codebase.md +10 -10
  173. package/pan-wizard-core/workflows/milestone-audit.md +10 -10
  174. package/pan-wizard-core/workflows/milestone-gaps.md +17 -24
  175. package/pan-wizard-core/workflows/milestone-new.md +7 -6
  176. package/pan-wizard-core/workflows/new-project.md +9 -9
  177. package/pan-wizard-core/workflows/optimize.md +11 -9
  178. package/pan-wizard-core/workflows/pause.md +6 -1
  179. package/pan-wizard-core/workflows/phase-tests.md +4 -4
  180. package/pan-wizard-core/workflows/plan-phase.md +31 -34
  181. package/pan-wizard-core/workflows/profile.md +2 -2
  182. package/pan-wizard-core/workflows/progress.md +5 -7
  183. package/pan-wizard-core/workflows/quick.md +5 -3
  184. package/pan-wizard-core/workflows/remove-phase.md +1 -1
  185. package/pan-wizard-core/workflows/research-phase.md +9 -5
  186. package/pan-wizard-core/workflows/resume-project.md +4 -6
  187. package/pan-wizard-core/workflows/retro.md +3 -1
  188. package/pan-wizard-core/workflows/settings.md +16 -24
  189. package/pan-wizard-core/workflows/todo-check.md +1 -1
  190. package/pan-wizard-core/workflows/transition.md +12 -12
  191. package/pan-wizard-core/workflows/update.md +25 -17
  192. package/pan-wizard-core/workflows/verify-phase.md +17 -15
  193. package/pan-zcode/KNOWN-BETA-RISKS.md +2 -2
  194. package/pan-zcode/README.md +7 -7
  195. package/pan-zcode/bin/install-zcode.js +1 -1
  196. package/scripts/build-plugin.js +3 -1
  197. package/scripts/generate-skills-docs.py +13 -4
@@ -2,6 +2,7 @@
2
2
  name: experiment
3
3
  group: Self-Improvement
4
4
  description: Manage external experiments — scaffold, run, harvest, promote findings back to PAN
5
+ argument-hint: "new <slug> --idea <path> [--runtime r] [--root path] [--budget n] | list [--root path] | manifest <slug> | run <slug> [--timeout sec] [--prompt text] | status <slug> | stop <slug> | harvest <slug> [--source-root path] [--force] | prune <slug> [--hard]"
5
6
  allowed-tools:
6
7
  - Read
7
8
  - Write
@@ -47,7 +48,7 @@ Scaffold a new experiment folder. Creates:
47
48
  ├── .planning/
48
49
  │ ├── idea.md ← copied from --idea path
49
50
  │ └── experiment.json ← manifest (slug, runtime, created_at, etc.)
50
- └── .claude/ (or .codex/, .gemini/, .opencode/, .github/) ← PAN install for chosen runtime
51
+ └── .claude/ (or .codex/, .gemini/, .opencode/, .github/) ← PAN install for chosen runtime — only when pan-tools runs from a source checkout (beside `bin/install.js`); the installed copy skips it and records `installer_skipped` in experiment.json
51
52
  ```
52
53
 
53
54
  **Flags:**
@@ -57,7 +58,7 @@ Scaffold a new experiment folder. Creates:
57
58
  | `--idea <path>` | required | Path to the idea.md doc; copied into the experiment |
58
59
  | `--runtime <r>` | `claude` | Which AI coding runtime to install: claude / codex / gemini / opencode / copilot |
59
60
  | `--root <path>` | `~/pan-experiments/` | Override the experiment root directory |
60
- | `--budget <pts>` | `80` | Optional budget cap (saved to manifest, enforced by W2 runner) |
61
+ | `--budget <pts>` | none | Optional budget cap, saved to the manifest (the runner does not enforce it) |
61
62
  | `--skip-installer` | `false` | Don't run the PAN installer (dev-only) |
62
63
 
63
64
  **Slug rules:** lowercase letters, digits, hyphens. Max 40 chars. No leading/trailing hyphen.
@@ -73,7 +74,7 @@ Enumerate all experiments under the root. Returns `{ experiments: [...], count }
73
74
  | Flag | Default | Purpose |
74
75
  |------|---------|---------|
75
76
  | `--root <path>` | `~/pan-experiments/` | Override the root |
76
- | `--raw` | `false` | Human-readable output instead of JSON |
77
+ | `--raw` | `false` | No effect: `list` always prints JSON |
77
78
 
78
79
  ### `/pan:experiment manifest <slug>`
79
80
 
@@ -98,12 +99,12 @@ Spawn the external AI runtime against the experiment folder. **Synchronous** —
98
99
  | Flag | Default | Purpose |
99
100
  |------|---------|---------|
100
101
  | `--timeout <sec>` | `3600` (60 min) | Hard timeout in seconds; runner sends SIGTERM at deadline |
101
- | `--prompt <text>` | `/pan:new-project --auto @.planning/idea.md` | Prompt passed to the external runtime |
102
+ | `--prompt <text>` | `/pan:new-project --auto @.planning/idea.md` — the Claude Code / Gemini form; pass the runtime's own for Codex (`$pan-new-project …`) or OpenCode (`/pan-new-project …`) | Prompt passed to the external runtime |
102
103
  | `--root <path>` | `~/pan-experiments/` | Override the experiment root |
103
104
 
104
- **Returns:** `{ status: "done"\|"failed", stop_reason: "success"\|"error"\|"timeout"\|"manual", exit_code, elapsed_ms, started_at, ended_at }`. Run-state is also persisted to `<experiment>/.planning/run-state.json`.
105
+ **Returns:** `{ experiment_id, status: "done"\|"incomplete"\|"failed", stop_reason: "success"\|"incomplete"\|"error"\|"timeout", exit_code, elapsed_ms, started_at, ended_at }` — `incomplete` is an exit 0 whose state.md does not show the milestone completed. Run-state is also persisted to `<experiment>/.planning/run-state.json`.
105
106
 
106
- **Runtime support:** claude / codex / gemini / opencode (via `RUNTIME_RUNNERS` adapter map in `runner.cjs`). GitHub Copilot CLI is **unsupported** for the `run` subcommand — no documented headless prompt mode. Copilot users can still scaffold and harvest manually.
107
+ **Runtime support:** claude / codex / gemini / opencode (via `RUNTIME_RUNNERS` adapter map in `runner.cjs`). GitHub Copilot CLI is **unsupported** for the `run` subcommand — the runner has no Copilot adapter yet (`copilot -p` does run a prompt headless). Copilot users can still scaffold and harvest manually.
107
108
 
108
109
  **Billing note (Claude runtime):** headless `claude -p` runs bill against the **Claude Agent SDK credit pool** — a monthly allotment separate from your interactive subscription limits (Anthropic split the two effective June 15, 2026). Experiment runs do not consume interactive-session quota, but heavy experimentation can exhaust the SDK pool independently. Note: the CLI `experiment run` does not capture a metrics envelope — the `billing_pool: "agent_sdk"` tagging is produced only via the runner module's capture-metrics API, not from the command line, so CLI run-state has no `metrics` key to reconcile against.
109
110
 
@@ -140,7 +141,7 @@ A `harvest.json` manifest is written at the destination capturing source path, t
140
141
  | Flag | Default | Purpose |
141
142
  |------|---------|---------|
142
143
  | `--root <path>` | `~/pan-experiments/` | Override the experiment root |
143
- | `--source-root <path>` | PAN source repo | Override harvest destination |
144
+ | `--source-root <path>` | the root of the PAN copy running pan-tools: a source checkout, or the runtime's config dir (e.g. `.claude/`) for an installed copy | Override harvest destination |
144
145
  | `--force` | `false` | Overwrite an existing harvest at the destination |
145
146
 
146
147
  **Returns:** `{ experiment_id, harvest_path, harvested_paths: [...], total_bytes, harvested_at, pan_version }`. On conflict without `--force`, returns `{ error }`.
@@ -222,4 +223,4 @@ pan-tools experiment manifest md-lint
222
223
 
223
224
  ## Runtime support
224
225
 
225
- Works in all 5 runtimes (Claude / Codex / Gemini / OpenCode / Copilot). The W2 external runner (subprocess invocation of the external session) supports Claude / Codex / Gemini / OpenCode; GitHub Copilot CLI lacks a headless prompt mode and is opt-out for the `run` subcommand.
226
+ Works in all 5 runtimes (Claude / Codex / Gemini / OpenCode / Copilot). The W2 external runner (subprocess invocation of the external session) supports Claude / Codex / Gemini / OpenCode; GitHub Copilot CLI has no runner adapter yet and is opt-out for the `run` subcommand.
@@ -2,6 +2,7 @@
2
2
  name: focus-auto
3
3
  group: Focus
4
4
  description: Continuous scan-plan-exec loop with purpose-driven categories and a layered safety harness
5
+ argument-hint: "[--source scan|backlog] [--category CAT] [--mode MODE] [--budget N] [--max-cycles N] [--total-budget N] [--enforce-budget] [--verify-reserve F] [--continue] [--stop] [--status] [--dry-run] [--deep-review] [--parallel-research] [--parallel-verify] [--clean-seal]"
5
6
  allowed-tools:
6
7
  - Read
7
8
  - Write
@@ -23,7 +24,7 @@ Run purpose-driven improvement campaigns with a single command. The auto-runner
23
24
  This command runs improvement campaigns on the **host project's source code** — not on PAN Wizard's own infrastructure.
24
25
 
25
26
  **Exclude these directories from scanning and execution:**
26
- - `.claude/`, `.github/copilot-instructions.md`, `.opencode/`, `.gemini/`, `.codex/` — PAN runtime directories
27
+ - `.claude/`, `.codex/`, `.gemini/`, `.opencode/`, `.agents/`, 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`) — PAN runtime directories
27
28
  - Any `pan-wizard-core/`, `pan-tools`, agent `.md`, or command `.md` files within PAN runtime directories
28
29
 
29
30
  **These directories are PAN's own tooling installed into the project.** Do not scan PAN files for TODOs, do not report PAN files as lacking coverage, do not modify PAN agents/commands/core as part of a campaign. If a scan finding or batch item targets a PAN infrastructure file — DROP IT.
@@ -35,9 +36,10 @@ A campaign is complete when ANY stop condition is met:
35
36
  1. Max cycles reached (--max-cycles, default 10)
36
37
  2. Total budget exhausted (--total-budget) — **advisory by default**: tracked and surfaced but does NOT stop the run unless `--enforce-budget` (or config `budget.enforce: true`) is set
37
38
  3. Scan returns zero items for the selected category
38
- 4. Context window drops below 25% (CRITICAL threshold)
39
- 5. User sends /pan:focus-auto --stop
40
- 6. Category-specific completion (e.g., prompts_remaining === 0)
39
+ 4. User sends /pan:focus-auto --stop
40
+ 5. Category-specific completion (e.g., prompts_remaining === 0)
41
+
42
+ The context monitor's notes are not a stop condition: they give no figure and ask for a checkpoint. On the critical note, bring the scan file up to date (items completed and failed) before the next step, then carry on with the cycle. Record it with `focus auto --update` only at its end (Step 2.4): `--update` closes a cycle and runs the stop checks, so a mid-cycle call with nothing done ends the run as `zero_completed`. After the host compacts, re-read the campaign with `focus auto --status`: PAN's state re-injection carries state.md's position, not the campaign's. If the session ends instead, `focus auto --continue` resumes only a stopped run or one with no cycle recorded yet: run `/pan:focus-auto --stop`, then `--continue`.
41
43
 
42
44
  Each cycle is complete when: scan → plan → exec → commit succeeds, OR a safety harness triggers and the cycle is cleanly aborted with state preserved.
43
45
  </completion_contract>
@@ -133,7 +135,7 @@ When `--source backlog` is set, work is selected from the **curated planning sur
133
135
 
134
136
  1. **Read the backlog once** at Phase 0: actionable items are unchecked rows in `roadmap.md` (phase/plan checkboxes) and unmet `requirements.md` REQ rows. Skip anything struck, completed, or marked blocked.
135
137
  2. **Score from the CURRENT document — never a hardcoded ID list.** For each item, derive `RS = (UserValue + TimeCriticality + RiskReduction) / Effort` (1–5 each; Effort from the row's size tag). Sort by wave/priority ascending → RS descending → effort ascending. This re-derives the order from whatever the roadmap says today, so it never goes stale.
136
- 3. **Pop the top survivor each cycle**; re-rank only if a landing changed a dependency. The same budget/cycle/context stops and safety harness apply unchanged.
138
+ 3. **Pop the top survivor each cycle**; re-rank only if a landing changed a dependency. The same budget/cycle stops and safety harness apply unchanged.
137
139
  4. The backlog ranker reads only PAN's planning files — it embeds **no** project-specific item IDs, test counts, or build commands. A project with no actionable backlog items is a clean stop (`scan returns zero items` equivalent).
138
140
 
139
141
  ## Concurrency model (when `--parallel-research` / `--parallel-verify`, ADR-0031)
@@ -188,7 +190,7 @@ Phase 2 (each cycle): Scan → Plan → Exec → Commit is strictly sequential w
188
190
  HARD STOP conditions:
189
191
  - Phase 1 fails (tests broken): Do not enter main loop — report and exit
190
192
  - Any cycle: test count drops below baseline after revert → stop campaign, preserve state
191
- - Context drops below 25%: stop campaign cleanly (safety harness)
193
+ - The context monitor's critical note is not a stop: bring the scan file up to date before the next step, then carry on; record the cycle (`focus auto --update`) only at its end, since `--update` closes the cycle and runs the stop checks
192
194
  </phase_dependencies>
193
195
 
194
196
  ### Phase 2: Main Loop
@@ -244,7 +246,7 @@ For P3-P6 items, compute Reality Score: `RS = (UV + TC + RR) / JS`
244
246
  - RS >= 3.0 = DO, RS 1.5-2.9 = DEFER, RS < 1.5 = BACKLOG
245
247
 
246
248
  **2.1.4 Filter by Category**
247
- Only keep items within the run's category priority range (see Category Defaults table). Drop items outside the range. If 0 items match: go to Phase 3 (Campaign End).
249
+ Only keep items within the run's category priority range (see Category Defaults table). Drop items outside the range. If 0 items match: record the empty cycle with Step 2.4's update, `focus auto --update --items-completed 0 --items-failed 0 --points-used 0 --tests-before <N> --tests-after <N>` (`<N>` is the current test count: the last recorded cycle's `tests_after`, or the Phase 1 baseline before the first cycle), so the run ends with its stop reason — `zero_completed`, or `security_complete` / `distill_complete` for those categories (`max_cycles` if this was the run's last cycle) — then go to Phase 3 (Campaign End).
248
250
 
249
251
  **2.1.5 Write Scan**
250
252
  Write scan results to `.planning/focus/scan-<YYYY-MM-DD>-<category>.md` with:
@@ -259,10 +261,10 @@ Create a capacity-budgeted batch from the scan items found in Step 2.1.
259
261
  **Capacity Points:** XS=1, S=2, M=4, L=10, XL=20
260
262
 
261
263
  **Allocation by Mode:**
262
- - `bugfix`: All budget on P0 mandatory, then P1, then P2-P4 smallest-first. No feature work.
264
+ - `bugfix`: All budget on P0 mandatory, then P1, then P2-P4 smallest-first; no separate feature pass (P3-P4 are taken in priority order, P5-P6 left out).
263
265
  - `balanced`: 60% stability (P0-P2), 40% features (P3-P6)
264
266
  - `features`: P0 mandatory, then 80% on P3-P5, 20% on P1-P2 quick wins
265
- - `full`: All priorities equally weighted, largest-impact-first
267
+ - `full`: One pass over every priority in priority order (P0 first), smallest-first within each
266
268
 
267
269
  **Execution Tiers:** XS/S = MICRO, M = STANDARD, L/XL = FULL
268
270
  Select items fitting within the cycle's `budget_per_cycle`. Order: MICRO first, then STANDARD, then FULL.
@@ -354,9 +356,9 @@ Check the response for stop conditions:
354
356
  - `zero_completed`: No items completed in this cycle — go to Phase 3
355
357
  - `diminishing_returns`: Optimize only — cycle efficiency < 30% of previous cycle — go to Phase 3
356
358
  - `prompts_complete`: Prompts only — all prompts in document executed — go to Phase 3
357
- - `security_complete`: Security only — scan found no HIGH/CRITICAL items remaining — go to Phase 3
358
- - `distill_complete`: Distill only — scan found no bloat findings remaining — go to Phase 3
359
- - `deep_review_block`: `--deep-review` only — critical pattern detected in changed files — go to Phase 3 with warning
359
+ - `security_complete`: Security only — the cycle recorded zero completed items (how an empty scan ends the run; for this category it replaces `zero_completed`) — go to Phase 3
360
+ - `distill_complete`: Distill only — the cycle recorded zero completed items (how an empty scan ends the run; for this category it replaces `zero_completed`) — go to Phase 3
361
+ - `weekly_limit`: Claude Code's 7-day usage window reached `cost.weekly_limit_stop_pct` (default 90%; read by `pan-tools cost limits`) — the run is stopped, not completed: go to Phase 3, and resume with `--continue` once the window has room
360
362
  - `null`: Continue to next cycle
361
363
 
362
364
  #### Step 2.5: Inter-Cycle Context Management
@@ -491,7 +493,7 @@ Alternative format — checklist style:
491
493
  5. If tests pass: mark the prompt as complete (`- [x]`), commit, move to next prompt
492
494
  6. If tests fail: one fix attempt, then revert and mark prompt as FAILED, move to next prompt
493
495
  7. Each prompt = one batch item. Budget: 1 prompt per cycle unless prompt is trivial (XS)
494
- 8. Record `prompts_remaining` count in cycle update — when 0, `prompts_complete` stop fires
496
+ 8. Record the count with `--prompts-remaining N` on the cycle's `focus auto --update` — at 0, `prompts_complete` fires; without the flag the count is null and it never fires
495
497
 
496
498
  **Key rules:**
497
499
  - Execute prompts in document order — NEVER skip ahead or reorder
@@ -528,7 +530,7 @@ When a specification document is found that doesn't have a matching micro-prompt
528
530
 
529
531
  ## Security Category — Execution Details
530
532
 
531
- The security category scans for OWASP Top 10 (2025) violations and STRIDE threats, then fixes them cycle by cycle until the scan returns zero HIGH/CRITICAL findings.
533
+ The security category scans for OWASP Top 10 (2025) violations and STRIDE threats, then fixes them cycle by cycle until the scan finds no P0-P2 (critical, high or medium) items or a cycle completes nothing.
532
534
 
533
535
  ### Scan approach (Step 2.1)
534
536
 
@@ -552,7 +554,7 @@ Three passes per cycle:
552
554
  - Check for prototype pollution risk: `Object.assign(req.body)` or spread from untrusted input into a stored object
553
555
 
554
556
  **Pass 3 — Semantic depth (Agent tool, for M/L items only):**
555
- When a pattern match needs code-path confirmation, spawn an Explore subagent:
557
+ When a pattern match needs code-path confirmation, spawn the `pan-hardener` subagent:
556
558
  > "Read [file]. Confirm whether [line N] is reachable from an unauthenticated request path and whether the input is sanitized before use."
557
559
 
558
560
  Use the confirmation to decide whether to include the item at P0/P1 or drop it as a false positive.
@@ -582,9 +584,9 @@ Treat each security item as a STANDARD or FULL item regardless of effort estimat
582
584
 
583
585
  ### Stop condition
584
586
 
585
- `security_complete` fires when the scan finds zero P0/P1 items. P2 items (medium) may remain — they won't stop the campaign unless `zero_completed` fires (no items at all).
587
+ `security_complete` fires when a security cycle records zero completed items — `--update` cannot see the scan, so this is how an empty scan ends the run. A cycle whose items all failed reports it too: for this category it replaces `zero_completed`. P2 items (medium) the scan still finds are worked like any other, so they keep the campaign running.
586
588
 
587
- A security campaign that ends with `security_complete` means: no critical or high OWASP violations found in the scanned files. Medium/low items can be addressed in subsequent targeted passes or documented as accepted risk.
589
+ A security campaign that ends with `security_complete` had a cycle that completed nothing: if its scan was empty, no critical or high OWASP violations were found in the scanned files; if its items failed, they are still open. Medium/low items can be addressed in subsequent targeted passes or documented as accepted risk.
588
590
 
589
591
  ---
590
592
 
@@ -600,7 +602,7 @@ The `distill` category targets **AI-generated code bloat** with a 5-pass pipelin
600
602
  | 2 | **AST-style analysis** — single-instance factories, deep nesting | Free | review |
601
603
  | 3 | **Cross-file graph** — repeated 5+ line blocks, unreferenced exports | Free | review |
602
604
  | 4 | **LLM judgment** — pan-distiller agent receives ONLY flagged spans (max 50 lines context per finding); validates pattern, refines tier, proposes minimal rewrite | LLM tokens | safe / review / risky |
603
- | 5 | **Cross-session memory** — compares findings to `.planning/memory/distill-patterns.md`; flags **regressed** patterns ("we already fixed this") | Free | metadata |
605
+ | 5 | **Cross-session memory** — compares findings to `.planning/memory/distill-patterns.md`; flags **recurring** patterns (detected in an earlier session — the file records detections, not fixes) | Free | metadata |
604
606
 
605
607
  ### Safety Tiers
606
608
 
@@ -624,7 +626,7 @@ Default threshold: **2.0x**. If a cycle's ratio exceeds threshold, the bloat bud
624
626
 
625
627
  ### Stop condition
626
628
 
627
- `distill_complete` fires when the scan finds zero bloat findings. The codebase is fully distilled for the patterns the deterministic + AST + graph passes detect.
629
+ `distill_complete` fires when a distill cycle records zero completed items — how an empty scan ends the run, and also what a cycle whose items all failed reports, since for this category it replaces `zero_completed`. After an empty scan the codebase is fully distilled for the patterns the deterministic + AST + graph passes detect; after a cycle whose items all failed, those findings are still open.
628
630
 
629
631
  ### CLI
630
632
 
@@ -634,7 +636,7 @@ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs distill analyze [--touched-loc
634
636
  node ~/.claude/pan-wizard-core/bin/pan-tools.cjs distill report
635
637
  ```
636
638
 
637
- `scan` returns findings. `analyze` adds bloat budget + regressed pattern detection. `report` writes findings to `.planning/memory/distill-patterns.md` for the next session.
639
+ `scan` returns findings. `analyze` adds bloat budget + recurring-pattern detection (its `regressed` list: findings already recorded in an earlier session). `report` writes findings to `.planning/memory/distill-patterns.md` for the next session.
638
640
 
639
641
  <failure_pattern_capture>
640
642
  When the same failure pattern appears in 2+ items within a campaign, capture it for future runs.
@@ -2,6 +2,7 @@
2
2
  name: focus-design
3
3
  group: Focus
4
4
  description: Strategic 10-phase feature investigation, design, and specification pipeline
5
+ argument-hint: "<feature description> [--full | --internal | --outward | --spike] [--gate] [--audit] [--mvp]"
5
6
  allowed-tools:
6
7
  - Read
7
8
  - Write
@@ -31,7 +32,7 @@ Research, design, and specify a new feature with strategic analysis. $ARGUMENTS
31
32
  This command investigates and designs features for the **host project** — NOT for PAN Wizard itself.
32
33
 
33
34
  **NEVER investigate, design for, or reference these PAN infrastructure directories as part of the project:**
34
- - `.claude/`, `.github/copilot-instructions.md`, `.opencode/`, `.gemini/`, `.codex/` — PAN runtime directories
35
+ - `.claude/`, `.codex/`, `.gemini/`, `.opencode/`, `.agents/`, 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`) — PAN runtime directories
35
36
  - `.planning/` — PAN planning state (read for context, but don't treat as project source code)
36
37
  - Any `pan-wizard-core/`, `pan-tools`, agent `.md`, or command `.md` files within those directories
37
38
 
@@ -148,7 +149,7 @@ Use case: Quick prototyping, time-boxed exploration, "should we even try this?"
148
149
 
149
150
  **Modifiers (layer on top of any mode):**
150
151
  - `--gate` — Pause after Phase 3 (Strategy) for user review before proceeding to design
151
- - `--audit` — Add Phase 2.5 reality check of existing implementation (not available with `--spike`)
152
+ - `--audit` — Add Phase 2.5 reality check of existing implementation (not available with `--internal` or `--spike`, which skip Phase 2.5)
152
153
  - `--mvp` — Stop after generating the v0 (MVP) task list — skip v1/v2 layers
153
154
 
154
155
  ### Scope Calibration (Auto-Detection)
@@ -195,7 +196,7 @@ Present the suggested mode and rationale. If the user hasn't specified, use the
195
196
  ### 0.1 Problem Statement
196
197
  Write a crisp, one-paragraph problem statement answering:
197
198
  - What user pain or limitation does this address?
198
- - Why does it matter NOW for the target users (developers using AI coding assistants)?
199
+ - Why does it matter NOW for the project's target users (as the project's own docs describe them)?
199
200
  - What is the cost of NOT doing this?
200
201
 
201
202
  ### 0.2 Demand Evidence (MANDATORY)
@@ -400,7 +401,7 @@ Based on Phase 0.8 investigation and Phase 1 reconnaissance findings, ask 2-4 IN
400
401
 
401
402
  ## Phase 2: Competitive Intelligence
402
403
 
403
- **Research how the best AI workflow tools solve this problem.**
404
+ **Research how the best tools in the feature's domain solve this problem.**
404
405
 
405
406
  ### 2.1 Deep-Dive Research (6+ Tools)
406
407
  Select competitor tools relevant to the FEATURE DOMAIN, not a fixed list. Use web search for each.
@@ -707,9 +708,9 @@ or architectural constraints from Phase 3.5]
707
708
  [How does this fit into the existing system? Include the dependency map from Phase 1.4
708
709
  and the layer violation check from Phase 3.5.2. Show which modules are touched.]
709
710
 
710
- ```
711
+ ~~~
711
712
  [Dependency diagram or integration flow from Phase 1.4 / 3.5.6]
712
- ```
713
+ ~~~
713
714
 
714
715
  ### Interface Contract
715
716
  [The output schema or API contract from Phase 3.5.3 — exact format, not just description.
@@ -2,6 +2,7 @@
2
2
  name: focus-doc-audit
3
3
  group: Focus
4
4
  description: Multi-dimensional document audit — accuracy, freshness, links, cross-consistency, and structural quality
5
+ argument-hint: "[file|directory] [--deep] [--links] [--fix] [--all] [--score-only] [--min-score N] [--format markdown|json|checklist]"
5
6
  allowed-tools:
6
7
  - Read
7
8
  - Write
@@ -28,7 +29,7 @@ Audit project documentation for accuracy, freshness, broken links, structural qu
28
29
  This command audits the **host project's documentation** — NOT PAN Wizard's own infrastructure files.
29
30
 
30
31
  **NEVER audit, modify, or report issues in these PAN directories:**
31
- - `.claude/`, `.github/copilot-instructions.md`, `.opencode/`, `.gemini/`, `.codex/` — PAN runtime directories
32
+ - `.claude/`, `.codex/`, `.gemini/`, `.opencode/`, `.agents/`, 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`) — PAN runtime directories
32
33
  - `.planning/` — PAN planning state (read for context, never audit as project docs)
33
34
  - Any `pan-wizard-core/`, `pan-tools`, agent `.md`, or command `.md` files within PAN runtime directories
34
35
 
@@ -316,7 +317,7 @@ For all audited documents, extract overlapping claims and check for contradictio
316
317
  When documents disagree, determine which is correct:
317
318
 
318
319
  ```
319
- Config files > README > CLAUDE.md > docs/ > CHANGELOG > inline comments
320
+ Config files > README > CLAUDE.md > inline comments > docs/ > CHANGELOG
320
321
  ```
321
322
 
322
323
  The document closer to code is more likely correct.
@@ -499,7 +500,7 @@ Score = (Accuracy × 0.25) + (Freshness × 0.15) + (Completeness × 0.15) +
499
500
  | Actionability | 82% | INSTALL.md (70%) | CONTRIBUTING.md (95%) |
500
501
  | Readability | 88% | — | — |
501
502
 
502
- **Recommended priority:** Fix docs/API.md (Grade F) → Fix CONTRIBUTING.md (Grade C) → Update INSTALL.md freshness
503
+ **Recommended priority:** Fix docs/API.md (Grade D) → Fix CONTRIBUTING.md (Grade C) → Update INSTALL.md freshness
503
504
  ```
504
505
 
505
506
  ---
@@ -2,6 +2,7 @@
2
2
  name: focus-drift-walking
3
3
  group: Focus
4
4
  description: Deep documentation-code drift detection, CLAUDE.md alignment, and auto-repair across all project directories
5
+ argument-hint: "[--create] [--audit] [--repair] [--report] [--dir <path>] [--depth N] [--severity critical|high|medium|low|info] [--format markdown|json|checklist] [--quick]"
5
6
  allowed-tools:
6
7
  - Read
7
8
  - Write
@@ -27,7 +28,7 @@ Walk every directory in the project, detect drift between documentation and code
27
28
  This command walks the **host project's directories and documentation** — NOT PAN Wizard's own infrastructure.
28
29
 
29
30
  **ALWAYS EXCLUDE these directories from walking:**
30
- - `.claude/`, `.github/copilot-instructions.md`, `.opencode/`, `.gemini/`, `.codex/` — PAN runtime directories
31
+ - `.claude/`, `.codex/`, `.gemini/`, `.opencode/`, `.agents/`, 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`) — PAN runtime directories
31
32
  - `.planning/` — PAN planning state (read for context, never report as drift)
32
33
  - Any `pan-wizard-core/`, `pan-tools`, agent `.md`, or command `.md` files within PAN runtime directories
33
34
  - Build output directories: `build/`, `dist/`, `out/`, `target/`, `bin/`, `obj/`, `node_modules/`, `.git/`, `__pycache__/`, `.next/`, `.nuxt/`
@@ -49,7 +50,7 @@ When `/pan:focus-drift-walking` is invoked, execute ALL phases for the selected
49
50
  - `--report` — Dry run: detect and report drift without modifying anything
50
51
  - `--dir <path>` — Target a specific directory subtree only
51
52
  - `--depth <n>` — Limit walk depth (default: unlimited)
52
- - `--severity <level>` — Filter report: `critical`, `warning`, `info` (default: all)
53
+ - `--severity <level>` — Filter report: `critical`, `high`, `medium`, `low`, `info` (default: all)
53
54
  - `--format <type>` — Output format: `markdown` (default), `json`, `checklist`
54
55
  - `--quick` — Skip Phase 4 (deep semantic analysis) and Phase 7 (cross-project sync)
55
56
 
@@ -503,7 +504,7 @@ When root docs and sub-docs disagree:
503
504
 
504
505
  - Walk build output directories (`build/`, `dist/`, `node_modules/`, `target/`, `obj/`, `__pycache__/`, `.git/`)
505
506
  - Report PAN infrastructure files as project drift
506
- - Auto-fix purpose statements, architecture descriptions, or conventions without `--repair`
507
+ - Auto-fix purpose statements, architecture descriptions, conventions, dependency directions or build commands — even `--repair` only flags these (Phase 6.2)
507
508
  - Create documentation for trivial directories (< 3 source files)
508
509
  - Include secrets, credentials, or API keys in any generated documentation
509
510
  - Guess at file contents — always read and verify
@@ -2,6 +2,7 @@
2
2
  name: focus-exec
3
3
  group: Focus
4
4
  description: Automated batch execution pipeline with 6 stages, behavioral rules, 3 execution tiers
5
+ argument-hint: "[--budget N] [--mode bugfix|balanced|features|full] [--priority P0-P6] [--dry-run] [--no-commit] [--continue] [--deep-review]"
5
6
  allowed-tools:
6
7
  - Read
7
8
  - Write
@@ -85,7 +86,7 @@ Each stage has a restricted set of appropriate actions. Using the wrong tool at
85
86
  This command executes work on the **host project's source code** — not on PAN Wizard's own infrastructure.
86
87
 
87
88
  **Do not read, modify, or fix files in these PAN directories:**
88
- - `.claude/`, `.github/copilot-instructions.md`, `.opencode/`, `.gemini/`, `.codex/` — PAN runtime directories
89
+ - `.claude/`, `.codex/`, `.gemini/`, `.opencode/`, `.agents/`, 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`) — PAN runtime directories
89
90
  - Any `pan-wizard-core/`, `pan-tools`, agent `.md`, or command `.md` files within PAN runtime directories
90
91
 
91
92
  **These directories are PAN's own tooling installed into the project.** If a batch item targets a PAN infrastructure file, SKIP it with reason "PAN infrastructure — out of scope." Never modify PAN's agents, commands, core modules, or dispatcher as part of project work.
@@ -116,7 +117,7 @@ HARD STOP conditions (do not proceed to next stage):
116
117
  - `--dry-run` — Run Stages 1-2 only (show what WOULD be executed)
117
118
  - `--no-commit` — Skip the commit step in Stage 6
118
119
  - `--continue` — Resume a previously interrupted execution
119
- - `--deep-review` (v3.4+) — After each high-stakes item's execution, run `/pan:review-deep` for that item (pan-hardener + pan-meta-reviewer security + cross-check). Slows the campaign by roughly 3× per item that triggers the deep pass; use for batches touching auth/payment/migrations.
120
+ - `--deep-review` (v3.4+) — After each high-stakes item's execution, run the deep pass on that item's changed files: spawn pan-hardener (`<output_path>` `.planning/reviews/<item-id>/hardener.md`), then pan-meta-reviewer on its report (`.planning/reviews/<item-id>/meta.md`), and merge with `pan-tools review-deep merge <item-id> --hardener-file … --meta-file …` (no first-pass review, so no `--reviewer-file`; `/pan:review-deep` itself needs a phase). Slows the campaign by roughly 3× per item that triggers the deep pass; use for batches touching auth/payment/migrations.
120
121
 
121
122
  ---
122
123
 
@@ -161,7 +162,7 @@ Every code change must be tested before moving to the next item.
161
162
  Test cadence by tier:
162
163
  - **MICRO (XS/S):** Run specific test after implementing. Batch up to 3 independent items before smoke.
163
164
  - **STANDARD (M):** Full test suite after each item.
164
- - **FULL (L/XL):** Build hooks + full test suite after each item.
165
+ - **FULL (L/XL):** The project's build step (if it has one) + full test suite after each item.
165
166
 
166
167
  ### Rule 4: Don't Invent — Follow the Plan
167
168
  Implement exactly what the batch says. Do not:
@@ -210,8 +211,7 @@ This catches emergent interactions: 5 "add try-catch" fixes might reveal the mod
210
211
  1. **Check Project Status** — git status, recent commits
211
212
  2. **Test Baseline** — run test suite, record current counts
212
213
  3. **Create rollback snapshot** — git tag for safety
213
- 4. **Prime prompt cache** — `pan-tools cache prime --summary` (once; all sub-agents in the next 5 min hit cached context)
214
- 5. **Report** — Output session start summary
214
+ 4. **Report** — Output session start summary
215
215
 
216
216
  **Circular optimization — init trace:**
217
217
  ```bash
@@ -286,7 +286,7 @@ Display the execution batch to user, then continue automatically.
286
286
  3. DESIGN — outline approach before coding
287
287
  4. STATE INTENT — "I will modify [files]. Risk: [what could break]"
288
288
  5. IMPLEMENT in logical chunks
289
- 6. BUILD — build hooks if hooks changed
289
+ 6. BUILD — run the project's build step if the item changed what it builds
290
290
  7. TEST — full test suite
291
291
  8. CONFIRM — all pass -> DONE | fail -> investigate (15 min max) -> REVERT -> FAILED
292
292
  ```
@@ -2,6 +2,7 @@
2
2
  name: focus-plan
3
3
  group: Focus
4
4
  description: Create capacity-budgeted work batch with spec coverage verification and 4 execution modes
5
+ argument-hint: "[--budget N] [--mode bugfix|balanced|features|full] [--priority P0-P6] [--lean] [--no-spec-check]"
5
6
  allowed-tools:
6
7
  - Read
7
8
  - Write
@@ -24,7 +25,7 @@ Create a capacity-budgeted work batch from focus-scan results **with mandatory v
24
25
  This command plans work batches for the **host project** — NOT for PAN Wizard's own infrastructure.
25
26
 
26
27
  **NEVER include items targeting these PAN directories:**
27
- - `.claude/`, `.github/copilot-instructions.md`, `.opencode/`, `.gemini/`, `.codex/` — PAN runtime directories
28
+ - `.claude/`, `.codex/`, `.gemini/`, `.opencode/`, `.agents/`, 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`) — PAN runtime directories
28
29
  - Any `pan-wizard-core/`, `pan-tools`, agent `.md`, or command `.md` files within PAN runtime directories
29
30
 
30
31
  If a scan item points to a PAN infrastructure file, DROP it from the batch. PAN's files are not the project's responsibility.
@@ -38,11 +39,11 @@ If no recent scan exists, run `/pan:focus-scan` automatically before proceeding.
38
39
  **Flags:**
39
40
  - `--budget N` — Override capacity budget in points (default: 50, min: 5, max: 100)
40
41
  - `--mode MODE` — Execution mode. Default: `balanced`
41
- - `bugfix` — P0->P1->smallest-first, no feature work (40 pts)
42
+ - `bugfix` — one pass over P0-P4 in priority order, smallest-first within each; P5-P6 left out (40 pts)
42
43
  - `balanced` — **Default.** Mix of stability fixes + feature development, 60/40 split (50 pts)
43
- - `features` — Feature-focused: 80% budget on P3-P5, P0 crashes still mandatory (50 pts)
44
- - `full` — Full-spectrum: enhanced budget, all priorities equally weighted (60 pts)
45
- - `--priority P0-P6` — Only pick items from these priority tiers
44
+ - `features` — Feature-focused: P0 crashes mandatory, then 80% of what that leaves on P3-P5 (50 pts)
45
+ - `full` — Full-spectrum: one pass over every priority, P0 first and smallest-first within each; budget raised to at least 60 (60 pts)
46
+ - `--priority PN` — Only pick items at priority PN or higher (P0 through PN), e.g. `--priority P2`
46
47
  - `--lean` — Apply RS filtering: exclude items with RS < 1.5
47
48
  - `--no-spec-check` — Skip spec coverage verification (NOT recommended — use only for pure bugfix batches)
48
49
 
@@ -133,13 +134,13 @@ This becomes the **spec gap backlog** — items that specs/ADRs promised but the
133
134
  ### `features` — Feature-Focused Sprint
134
135
  - **Budget:** 50 pts
135
136
  - **Mandatory pass:** All P0 items
136
- - **Feature pass (80%):** 40 pts for P3-P5
137
- - **Stability pass (20%):** 10 pts for P1-P2 quick wins
137
+ - **Feature pass (80%):** 80% of what the P0 pass left, for P3-P5 (40 pts when there are no P0 items)
138
+ - **Stability pass (20%):** the rest of it, for P1-P2 quick wins (10 pts when there are no P0 items)
138
139
  - **Spec coverage:** Feature items MUST map to spec requirements — reject unspecified feature work
139
140
 
140
141
  ### `full` — Full-Spectrum Marathon
141
142
  - **Budget:** 60 pts
142
- - **All priorities weighted equally, largest-impact-first**
143
+ - **One pass over every priority in priority order, smallest-first within each**
143
144
  - **Spec coverage:** Full traceability — every item maps to a spec/ADR requirement or is flagged as unspecified
144
145
 
145
146
  ### Batch Selection Algorithm
@@ -220,7 +221,7 @@ This becomes the post-execution checklist for `/pan:focus-exec`.
220
221
 
221
222
  ## Phase 5: Output
222
223
 
223
- Produce a batch file at `.planning/focus/batch-<YYYY-MM-DD>.json` via `pan-tools focus plan`:
224
+ Write the batch to `.planning/focus/batch-<YYYY-MM-DD>.json` yourself — `{date, mode, budget, allocated, items: [...]}`, each item `{id, title, priority, effort, points, tier, files}` with `tier` one of `MICRO`, `STANDARD`, `FULL` (`focus exec` and `focus classify-stages` group items by it, and an item without it lands in no wave); `focus exec`, `focus classify-stages` and `/pan:focus-exec` read an `items` or `batch` array. Do not hand this step to `pan-tools focus plan`: it ignores the scan and the spec mapping, batches only incomplete roadmap phases, pending todos and `.planning/patterns.md` entries, and overwrites the day's batch file:
224
225
 
225
226
  ```markdown
226
227
  ## Focus Batch — <date>
@@ -252,11 +253,11 @@ Produce a batch file at `.planning/focus/batch-<YYYY-MM-DD>.json` via `pan-tools
252
253
  | NCA affordability | ADR-0018 SC-4 | Blocked by SC-1, SC-2 | After this batch |
253
254
 
254
255
  ### Dependency Order
255
- ```
256
+ ~~~
256
257
  #1 (P0 crash fix) → independent
257
258
  #3 (categories) → #4 (keywords) → #5 (match types)
258
259
  #2 (tests) → independent
259
- ```
260
+ ~~~
260
261
 
261
262
  ### Post-Execution Verification Checklist
262
263
  - [ ] SC-1: Category count >= 65 → `SELECT COUNT(*) FROM stx_category`
@@ -2,8 +2,10 @@
2
2
  name: focus-scan
3
3
  group: Focus
4
4
  description: Deep-dive strategic work scan with prioritized items and Reality Score filtering
5
+ argument-hint: "[--focus <area>] [--quick] [--refresh] [--lean]"
5
6
  allowed-tools:
6
7
  - Read
8
+ - Write
7
9
  - Bash
8
10
  - Grep
9
11
  - Glob
@@ -22,13 +24,13 @@ Survey the project for prioritized work items with evidence-based scoring. $ARGU
22
24
  This command scans the **host project's source code** for work items — not PAN Wizard's own infrastructure.
23
25
 
24
26
  **Exclude these directories from scanning:**
25
- - `.claude/`, `.github/copilot-instructions.md`, `.opencode/`, `.gemini/`, `.codex/` — PAN runtime directories
27
+ - `.claude/`, `.codex/`, `.gemini/`, `.opencode/`, `.agents/`, 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`) — PAN runtime directories
26
28
  - `.planning/` — PAN planning state (read for context, but never report PAN planning files as "issues")
27
29
  - Any `pan-wizard-core/`, `pan-tools`, agent `.md`, or command `.md` files within PAN runtime directories
28
30
 
29
31
  **These directories are PAN's own tooling installed into the project.** Do not report TODO/FIXME items found in PAN files. Do not flag PAN files as lacking test coverage. Do not suggest improvements to PAN's agents, commands, or core modules.
30
32
 
31
- If a scan finding points to a file inside `.claude/`, `.github/`, `.opencode/`, `.gemini/`, or `.codex/` — DROP IT. It is not the project's responsibility.
33
+ If a scan finding points to a file in one of the PAN paths listed above — DROP IT. It is not the project's responsibility.
32
34
 
33
35
  ---
34
36
 
@@ -235,7 +237,7 @@ Gather items from:
235
237
  ## Phase 5: Scan Assembly
236
238
 
237
239
  ### 5.1 Output
238
- Return JSON via `pan-tools focus scan` with all items, or write to `.planning/focus/` for persistence.
240
+ Write the scan to `.planning/focus/scan-<YYYY-MM-DD>.md`, where `/pan:focus-plan` builds from it and `/pan:focus-exec` updates it (Stage 5.2). `pan-tools focus scan` does not take these items: it lists only incomplete roadmap phases that have a directory, pending todos and `.planning/patterns.md` entries.
239
241
 
240
242
  ### 5.2 Document Structure
241
243
 
@@ -2,6 +2,7 @@
2
2
  name: focus-sync
3
3
  group: Focus
4
4
  description: Synchronize documentation after changes — check staleness and update counts
5
+ argument-hint: "[--readme | --docs | --arch | --all]"
5
6
  allowed-tools:
6
7
  - Read
7
8
  - Bash
@@ -24,7 +25,7 @@ Synchronize project documentation across all files. $ARGUMENTS
24
25
  This command synchronizes the **host project's documentation** — NOT PAN Wizard's own infrastructure files.
25
26
 
26
27
  **NEVER sync, modify, or report staleness in these PAN directories:**
27
- - `.claude/`, `.github/copilot-instructions.md`, `.opencode/`, `.gemini/`, `.codex/` — PAN runtime directories
28
+ - `.claude/`, `.codex/`, `.gemini/`, `.opencode/`, `.agents/`, 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`) — PAN runtime directories
28
29
  - Any `pan-wizard-core/`, `pan-tools`, agent `.md`, or command `.md` files within PAN runtime directories
29
30
 
30
31
  **These directories are PAN's own tooling.** Documentation sync applies to the project's README, docs, guides, and code comments — not to PAN's installed agents or command definitions.
@@ -91,7 +92,7 @@ CHANGELOG.md <- Version history
91
92
 
92
93
  ## Report
93
94
 
94
- Output via `pan-tools focus sync`:
95
+ Report in this shape (`pan-tools focus sync` itself returns only JSON — `actuals` (counts of commands, agents and modules), `stale` / `current` entries for those counts, any `--tests` / `--suites` counts, renamed `/pan:` commands and the package.json-vs-CHANGELOG version, plus `stale_count` and `needs_sync`):
95
96
 
96
97
  ```
97
98
  | Area | Status | Finding |
@@ -15,7 +15,7 @@ allowed-tools:
15
15
  <objective>
16
16
  Phase-aware git workflow with safety guardrails built in. Every subcommand that modifies history runs safety checks. Rollback uses PAN snapshot tags (`pan-rollback-*`), which `pan-tools rollback-snapshot <phase>` creates; no workflow creates them for you.
17
17
 
18
- Works with any git repository — PAN installation not required.
18
+ Works with any git repository — no PAN project (`.planning/`) needed, only the installed `pan-tools.cjs`.
19
19
  </objective>
20
20
 
21
21
  <subcommands>
@@ -59,19 +59,19 @@ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs git commit \
59
59
  ```
60
60
 
61
61
  **Options:**
62
- - `--type` — `feat | fix | docs | test | refactor | chore`
62
+ - `--type` — `feat | fix | docs | test | refactor | perf | chore`
63
63
  - `--message` — Commit message body
64
64
  - `--all` — Stage all changes before committing
65
65
  - `--files f1 f2` — Stage specific files
66
66
  - `--amend` — Amend last commit (no message needed)
67
- - `--force` — Bypass deleted-file and sensitive-file blocks
67
+ - `--force` — Bypass the deleted-file block (not the sensitive-file block)
68
68
 
69
69
  **Safety checks run automatically:**
70
70
 
71
71
  | Check | Blocks on | Override |
72
72
  |-------|-----------|---------|
73
- | Deleted files | Staged deletions found | `--force` |
74
- | Sensitive files | `.env`, `.pem`, `.key`, `secret`, `password`, `token` | `--force` |
73
+ | Deleted files | A deletion anywhere in the repository (`git status --porcelain`, staged or not) | `--force` |
74
+ | Sensitive files | A staged path ending `.env`, `.pem` or `.key`, or containing `credentials`, `secret`, `password` or `token` (PAN's own `.planning/metrics/tokens.jsonl` is exempt) | None: narrow `commit.sensitive_patterns` in `.planning/config.json`, or commit the file yourself |
75
75
 
76
76
  **Output:** `{committed, hash, type, safety_checks}`
77
77
 
@@ -174,14 +174,14 @@ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs git diff --staged --file src/ap
174
174
  ### rollback — Revert to PAN Snapshot
175
175
 
176
176
  ```bash
177
- # Rollback to latest PAN snapshot tag (requires clean working tree)
177
+ # Rollback to the last pan-rollback-* tag in name order — the newest only among one phase's snapshots (requires clean working tree)
178
178
  node ~/.claude/pan-wizard-core/bin/pan-tools.cjs git rollback
179
179
 
180
180
  # Preview — does NOT reset, shows what would happen
181
181
  node ~/.claude/pan-wizard-core/bin/pan-tools.cjs git rollback --dry-run
182
182
 
183
183
  # Rollback to specific tag
184
- node ~/.claude/pan-wizard-core/bin/pan-tools.cjs git rollback --tag pan-rollback-03-1714000000
184
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs git rollback --tag pan-rollback-3-20260415T101500
185
185
  ```
186
186
 
187
187
  **Rollback workflow:**
@@ -219,5 +219,5 @@ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs git sync --remote upstream --br
219
219
  </workflow>
220
220
 
221
221
  <runtime_note>
222
- All subcommands work with any git repository regardless of whether PAN is installed or `.planning/` exists. The only requirement is a valid git repo (`git init` or cloned).
222
+ All subcommands work with any git repository, whether or not it holds a PAN project (`.planning/`); they run the installed `pan-tools.cjs`. The only requirement is a valid git repo (`git init` or cloned).
223
223
  </runtime_note>
@@ -2,7 +2,7 @@
2
2
  name: pan:health
3
3
  group: System
4
4
  description: Diagnose planning directory health and optionally repair issues
5
- argument-hint: "[--repair]"
5
+ argument-hint: "[--repair] [--standards] [--full] [--drift] [--links]"
6
6
  allowed-tools:
7
7
  - Read
8
8
  - Bash
@@ -19,5 +19,5 @@ Validate `.planning/` directory integrity and report actionable issues. Checks f
19
19
 
20
20
  <process>
21
21
  Execute the health workflow from @~/.claude/pan-wizard-core/workflows/health.md end-to-end.
22
- Parse --repair flag from arguments and pass to workflow.
22
+ Pass the arguments to the workflow, which forwards `--repair`, `--standards`, `--full`, `--drift` and `--links` to `validate health`.
23
23
  </process>