pan-wizard 3.28.0 → 3.30.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 (40) hide show
  1. package/README.md +39 -39
  2. package/bin/install-lib.cjs +65 -58
  3. package/bin/install.js +199 -188
  4. package/commands/pan/army.md +2 -2
  5. package/commands/pan/audit-deployment.md +2 -2
  6. package/commands/pan/cost.md +19 -7
  7. package/commands/pan/exec-phase.md +2 -0
  8. package/commands/pan/focus-auto.md +5 -5
  9. package/hooks/dist/pan-check-update.js +4 -0
  10. package/hooks/dist/pan-cost-logger.js +322 -43
  11. package/hooks/dist/pan-stop-guard.js +81 -2
  12. package/hooks/dist/pan-trace-logger.js +275 -32
  13. package/package.json +4 -1
  14. package/pan-wizard-core/bin/lib/agents-md.cjs +3 -2
  15. package/pan-wizard-core/bin/lib/commands.cjs +3 -1
  16. package/pan-wizard-core/bin/lib/constants.cjs +17 -0
  17. package/pan-wizard-core/bin/lib/context-budget.cjs +10 -0
  18. package/pan-wizard-core/bin/lib/core.cjs +17 -4
  19. package/pan-wizard-core/bin/lib/cost-rebuild.cjs +511 -0
  20. package/pan-wizard-core/bin/lib/cost.cjs +165 -55
  21. package/pan-wizard-core/bin/lib/git.cjs +5 -1
  22. package/pan-wizard-core/bin/lib/hud.cjs +5 -3
  23. package/pan-wizard-core/bin/lib/hygiene.cjs +22 -25
  24. package/pan-wizard-core/bin/lib/memory-rebuild.cjs +3 -3
  25. package/pan-wizard-core/bin/lib/memory.cjs +14 -8
  26. package/pan-wizard-core/bin/lib/optimize.cjs +78 -2
  27. package/pan-wizard-core/bin/lib/utils.cjs +22 -0
  28. package/pan-wizard-core/bin/lib/verify-deploy.cjs +1 -1
  29. package/pan-wizard-core/bin/lib/verify.cjs +24 -10
  30. package/pan-wizard-core/bin/pan-tools.cjs +8 -1
  31. package/pan-wizard-core/references/model-profiles.md +4 -4
  32. package/pan-wizard-core/references/planning-config.md +19 -23
  33. package/pan-wizard-core/workflows/health.md +1 -0
  34. package/pan-wizard-core/workflows/settings.md +2 -4
  35. package/scripts/coverage-gate.cjs +257 -0
  36. package/scripts/install-git-hooks.js +5 -0
  37. package/scripts/mutation-probe.cjs +272 -0
  38. package/scripts/release-check.js +33 -12
  39. package/scripts/test-quality-lint.cjs +240 -0
  40. package/scripts/test-surface.cjs +336 -0
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # PanWizard
6
6
 
7
- **Command a bot army for your codebase** — a *Mission Control* agent delegates whole-project goals to specialist squads and ships behind a human merge gate (the army runs on Claude Code; the planning pipeline runs on all five CLIs). Five AI CLIs, zero context rot.
7
+ **Command a bot army for your codebase** — a *Mission Control* agent delegates whole-project goals to specialist squads and ships behind a human merge gate (the army is built for Claude Code; the planning pipeline runs on all five CLIs). Five AI CLIs, zero context rot.
8
8
 
9
9
  **Solves context rot** — the quality degradation that happens as the model fills its context window.
10
10
 
@@ -56,12 +56,12 @@ PAN is the context engineering layer that makes Claude Code reliable. It breaks
56
56
  ┌─────────────────────▼───────────────────────────────────────┐
57
57
  │ AGENTS (specialized) │
58
58
  │ planner · executor · verifier · researcher · debugger ... │
59
- │ Each runs in a fresh context window │
59
+ │ Each in its own context (native on Claude Code) │
60
60
  └─────────────────────┬───────────────────────────────────────┘
61
61
  │ uses
62
62
  ┌─────────────────────▼───────────────────────────────────────┐
63
63
  │ CORE LIBRARY (pan-wizard-core/) │
64
- │ config · state · init · verify · commit · phase-utils │
64
+ │ config · state · init · verify · commit · phase · roadmap │
65
65
  │ Cross-platform CLI tools, zero runtime dependencies │
66
66
  └─────────────────────┬───────────────────────────────────────┘
67
67
  │ reads/writes
@@ -76,7 +76,7 @@ PAN is the context engineering layer that makes Claude Code reliable. It breaks
76
76
 
77
77
  ## Bot Army
78
78
 
79
- > **Don't run one phase — run the whole project.** `/pan:army` (Claude Code only — it needs native sub-agent spawning; the other runtimes run the flat pipeline) turns PAN's agents into a coordinated army that delivers a goal end-to-end: a **Mission Control** agent plans the mission and delegates to specialist **squads**, parallel builders each work an isolated git worktree, and **nothing reaches your main branch without green checks and your explicit approval.**
79
+ > **Don't run one phase — run the whole project.** `/pan:army` (built and tested on Claude Code, which has native sub-agent spawning; the command installs on every runtime, but nothing gates it elsewhere and it is untested there — use the flat pipeline on the other runtimes) turns PAN's agents into a coordinated army that delivers a goal end-to-end: a **Mission Control** agent plans the mission and delegates to specialist **squads**, parallel builders each work an isolated git worktree, and **the Release squad stops at your explicit approval instead of merging.** On the MCP path that gate is enforced in code; on `/pan:army` it is the squads' instructions, so pair it with branch protection to make green checks a rule your repository enforces.
80
80
 
81
81
  <div align="center">
82
82
  <img src="https://cdn.jsdelivr.net/npm/pan-wizard@latest/assets/pan-orchestration.png" alt="PanWizard specialist agents orchestrated along a pipeline" width="340" />
@@ -101,7 +101,7 @@ PAN is the context engineering layer that makes Claude Code reliable. It breaks
101
101
 
102
102
  - **A human merges.** The Release squad prepares a squash-merge and surfaces an `always-ask` approval instead of merging; pair it with branch protection on your repo, which is what makes that unbypassable rather than merely instructed. Recovery is `git revert` or the previous tag, never a force-push.
103
103
  - **Isolated builders.** Each Build agent forks its own `army/<task>` branch + git worktree, so parallel agents never share a file.
104
- - **Caps.** Delegation-depth cap, per-cycle spawn + budget ceilings, and a `.planning/orchestration/abort` kill-switch, re-checked before every spawn by Mission Control's protocol (prompt-enforced; the MCP `pan_next_action` path enforces the cycle cap, the budget cap when `caps.enforceBudget` is set, the abort switch and the human gate in code — delegation depth is bounded by which agents hold the `Task` tool) — the same harness as hierarchical exec, at campaign scale.
104
+ - **Caps.** Delegation-depth cap, per-cycle spawn + budget ceilings, and a `.planning/orchestration/abort` kill-switch, re-checked before every spawn by Mission Control's protocol (prompt-enforced; the MCP `pan_next_action` path enforces the cycle cap, the budget cap when `caps.enforceBudget` is set, an `aborted` flag the caller sets (it does not read the abort file) and the human gate in code — delegation depth is bounded by which agents hold the `Task` tool) — the same harness as hierarchical exec, at campaign scale.
105
105
 
106
106
  **Run it over days.** `--schedule` arms a resumable campaign with a per-day budget that burns the backlog down across sessions (the per-day budget is advisory — `campaign status` shows the day's spend — and an external scheduler triggers each `--continue`) — and *still* waits for you at every merge. **Autonomy runs up to the irreversible step; a human is at the step.**
107
107
 
@@ -163,8 +163,8 @@ npx pan-wizard --opencode --global # Install to ~/.config/opencode/
163
163
  npx pan-wizard --gemini --global # Install to ~/.gemini/
164
164
 
165
165
  # Codex (skills-first)
166
- npx pan-wizard --codex --global # Install to ~/.codex/
167
- npx pan-wizard --codex --local # Install to ./.codex/
166
+ npx pan-wizard --codex --global # Skills to ~/.agents/skills/, core and hooks to ~/.codex/
167
+ npx pan-wizard --codex --local # Skills to ./.agents/skills/, core and hooks to ./.codex/
168
168
 
169
169
  # GitHub Copilot CLI (skills-first)
170
170
  npx pan-wizard --copilot --global # Install to ~/.copilot/
@@ -176,7 +176,7 @@ npx pan-wizard --all --global # Install to all directories
176
176
 
177
177
  Use `--global` (`-g`) to install into your home config directory; `--local` (`-l`) is the default and may be omitted.
178
178
  Use `--claude`, `--opencode`, `--gemini`, `--codex`, `--copilot`, or `--all` to skip the runtime prompt.
179
- Add `--unified-skills` to install commands as one shared `.agents/skills/` tree read natively by every runtime (and Antigravity CLI) instead of per-runtime formats — see the User Guide for details.
179
+ Add `--unified-skills` to install commands as one shared `.agents/skills/` tree instead of per-runtime formats. Codex, Gemini CLI, OpenCode, Copilot CLI and Antigravity CLI read that tree; Claude Code does not, so for Claude the installer also copies each skill into `.claude/skills/` and the commands become `/pan-<name>`. Gemini CLI gives skills no slash command, so on a unified Gemini install you ask for the task and `/skills list` shows what loaded. See the User Guide for details.
180
180
 
181
181
  > **Gemini CLI note:** from June 18, 2026, Google's Gemini CLI serves Gemini Code Assist (Standard/Enterprise) customers; individual free / AI Pro / Ultra accounts are directed to Antigravity CLI instead. PAN's `--gemini` target installs for Gemini CLI. Antigravity CLI is not yet a PAN install target, but it reads the shared `.agents/skills/` tree natively — install with `--unified-skills` and PAN's commands are usable from Antigravity in the same project.
182
182
 
@@ -283,7 +283,7 @@ If you prefer not to use that flag, add this to your project's `.claude/settings
283
283
 
284
284
  ## How It Works
285
285
 
286
- > **Already have code?** Run `/pan:map-codebase` first. It analyzes your stack, architecture, conventions, and concerns — single-shot with one agent for repositories under the sharding threshold, six-way sharded above it. Then `/pan:new-project` knows your codebase — questions focus on what you're adding, and planning automatically loads your patterns.
286
+ > **Already have code?** Run `/pan:map-codebase` first. It analyzes your stack, architecture, conventions, and concerns — single-shot with one agent for repositories under the sharding threshold, sharded across parallel mapper agents above it. Then `/pan:new-project` knows your codebase — questions focus on what you're adding, and planning automatically loads your patterns.
287
287
 
288
288
  ### 1. Initialize Project
289
289
 
@@ -438,7 +438,7 @@ On Claude Code, `/pan-diagnose-issues <phase>` spawns one debugger per failed UA
438
438
 
439
439
  Loop **discuss → plan → execute → verify** until milestone complete.
440
440
 
441
- Each phase gets your input (discuss), proper research (plan), clean execution (execute), and human verification (verify). Context stays fresh. Quality stays high.
441
+ Each phase gets your input (discuss), proper research (plan), clean execution (execute), and goal-backward verification (verify). Context stays fresh. Quality stays high.
442
442
 
443
443
  When all phases are done, `/pan:milestone-done` archives the milestone and tags the release.
444
444
 
@@ -467,7 +467,7 @@ Use for: bug fixes, small features, config changes, one-off tasks.
467
467
  > What do you want to do? "Add dark mode toggle to settings"
468
468
  ```
469
469
 
470
- **Creates:** `.planning/quick/001-add-dark-mode-toggle/001-plan.md`, `001-summary.md`
470
+ **Creates:** `.planning/quick/1-add-dark-mode-toggle-to-settings/1-plan.md`, `1-summary.md`
471
471
 
472
472
  ---
473
473
 
@@ -491,7 +491,7 @@ PAN handles it for you:
491
491
  | `standards.md` | Selected industry standards (OWASP, WCAG, NIST, etc.) — advisory checklists for agents |
492
492
  | `todos/` | Captured ideas and tasks for later work |
493
493
 
494
- Size limits based on where Claude's quality degrades. Stay under, get consistent excellence.
494
+ Sizing guidance, not an enforced limit: the planner aims to finish each plan within about half a context window, before quality starts to degrade. Stay under it and results stay consistent.
495
495
 
496
496
  ### XML Prompt Formatting
497
497
 
@@ -519,9 +519,9 @@ Every stage uses the same pattern: a thin orchestrator spawns specialized agents
519
519
 
520
520
  | Stage | Orchestrator does | Agents do |
521
521
  |-------|------------------|-----------|
522
- | Research | Coordinates, presents findings | 4 parallel researchers investigate stack, features, architecture, pitfalls |
522
+ | Research | Coordinates, presents findings | Parallel researchers investigate stack, features, architecture and pitfalls |
523
523
  | Planning | Validates, manages iteration | Planner creates plans, checker verifies, up to three passes |
524
- | Execution | Groups into waves, tracks progress | Executors implement in parallel, each with a fresh context window |
524
+ | Execution | Groups into waves, tracks progress | Executors implement in parallel, each in a fresh context (native sub-agents on Claude Code, each runtime's own delegation elsewhere) |
525
525
  | Verification | Presents results, routes next | Verifier checks codebase against goals, debuggers diagnose failures |
526
526
 
527
527
  The orchestrator never does heavy lifting. It spawns agents, waits, integrates results.
@@ -535,7 +535,7 @@ When agents hand work off via files, only OUTPUTS get passed by default — not
535
535
  - Plans carry a `## Plan Decisions` section (Locked / Open / Considered+rejected buckets) — the executor reads it before coding so it doesn't re-argue settled choices.
536
536
  - Summaries carry an `## Implementation Decisions` section — the verifier reads it to understand WHY the executor deviated from the plan, not just THAT it did.
537
537
 
538
- The plan-checker enforces this with two dedicated dimensions (Spec Sufficiency for Handoff, Decision Trace Completeness). Schema lives in `pan-wizard-core/references/handoff-decisions.md`.
538
+ The plan-checker enforces this with dedicated dimensions for Spec Sufficiency for Handoff and Decision Trace Completeness. Schema lives in `pan-wizard-core/references/handoff-decisions.md`.
539
539
 
540
540
  ### Self-Improving Learnings
541
541
 
@@ -548,7 +548,7 @@ PAN runs autonomous experiments in isolated folders, harvests the resulting tele
548
548
 
549
549
  ### Atomic Git Commits
550
550
 
551
- Each task gets its own commit immediately after completion (consecutive trivial chore or docs tasks are coalesced):
551
+ The executor commits each task as soon as it completes — a rule of its protocol, not a git hook (consecutive trivial chore or docs tasks are coalesced):
552
552
 
553
553
  ```bash
554
554
  abc123f docs(08-02): complete user registration plan
@@ -575,13 +575,13 @@ You're never locked in. The system adapts.
575
575
 
576
576
  ## How PAN Compares
577
577
 
578
- | | PAN Wizard | Cursor / Windsurf | Aider / Cline | GitHub Copilot |
578
+ | | PAN Wizard | Cursor / Devin Desktop (ex-Windsurf) | Aider / Cline | GitHub Copilot |
579
579
  |---|---|---|---|---|
580
- | **Context rot prevention** | Phase-scoped fresh context windows | No — context degrades over time | No (Cline: condensing) | No |
581
- | **Multi-agent** | Specialized agents, parallel waves | Up to 8 parallel (Cursor 2.0) | Single agent | Specialized sub-agents |
580
+ | **Context rot prevention** | Phase-scoped fresh context windows (native sub-agents on Claude Code) | No — context degrades over time | No (Cline: condensing) | No |
581
+ | **Multi-agent** | Specialized agents, parallel waves | Parallel agents in worktrees (Cursor) | Single agent (Cline: subagents) | Custom agents as subagents |
582
582
  | **Plan → Verify loop** | Research → plan → verify with iteration | Agent generates plan | Plan mode (Cline) | Plan step |
583
583
  | **Post-execution verification** | Auto verifier + human UAT | Iterative error-fix | Manual test runs | Auto-fix loop |
584
- | **Session persistence** | state.md + pause/resume + handoff | Notepad / Memories | None / Task history | None |
584
+ | **Session persistence** | state.md + pause/resume + handoff | Memory tool / transcripts | None / checkpoints (Cline) | Copilot Memory, CLI session recovery |
585
585
  | **Runtime support** | Claude Code, OpenCode, Gemini CLI, Codex, Copilot CLI | IDE-locked | Terminal / VS Code | VS Code + CLI |
586
586
  | **Zero dependencies** | Yes (Node builtins only) | No (Electron) | No (Python / Node) | No |
587
587
 
@@ -598,7 +598,7 @@ PAN is not a replacement for your IDE or AI agent — it's the orchestration lay
598
598
  | Command | What it does |
599
599
  |---------|--------------|
600
600
  | `/pan:new-project [--auto]` | Full initialization: questions → research → requirements → roadmap |
601
- | `/pan:discuss-phase [N] [--auto]` | Capture implementation decisions before planning |
601
+ | `/pan:discuss-phase <N> [--auto]` | Capture implementation decisions before planning |
602
602
  | `/pan:design-phase [N]` | Design a phase — architecture, ADR, threat-lite — before planning |
603
603
  | `/pan:plan-phase [N] [--auto]` | Research + plan + verify for a phase |
604
604
  | `/pan:exec-phase <N>` | Execute all plans in parallel waves, verify when complete |
@@ -659,7 +659,7 @@ PAN is not a replacement for your IDE or AI agent — it's the orchestration lay
659
659
  | `/pan:quick [--full]` | Execute ad-hoc task with PAN guarantees (`--full` adds plan-checking and verification) |
660
660
  | `/pan:health [--repair]` | Validate `.planning/` directory integrity; `--repair` auto-fixes detected issues |
661
661
  | `/pan:hygiene [--apply] [--trace-age-days N] [--all-tracks]` | Scan for PAN version drift and stale project artifacts (legacy filenames, .tmp orphans, memory bloat, poisoned cost ledgers, trace and report debris, cached-context bloat, fragment planning dirs); `--apply` executes the safe fixes — poisoned ledgers are quarantined by rename (only the newest quarantine copy is kept), and settled `state.md` history is archived rather than dropped |
662
- | `/pan:links [--strict]` | Validate the doc-code link graph: inline `[[<id>]]` refs, `// @pan:` source anchors, `require-code-mention` contracts (ADR-0027, v3.8.0+) |
662
+ | `/pan:links [--strict]` | Validate the doc-code link graph: inline `[[<id>]]` refs, `// @pan:` source anchors, `require-code-mention` contracts (ADR-0027) |
663
663
  | `/pan:phase-tests <N> [instructions]` | Generate tests for a completed phase based on UAT criteria |
664
664
  | `/pan:milestone-cleanup` | Archive accumulated phase directories from completed milestones |
665
665
  | `/pan:retro` | Milestone retrospective — estimation accuracy, verification patterns, gap analysis |
@@ -684,15 +684,15 @@ PAN is not a replacement for your IDE or AI agent — it's the orchestration lay
684
684
  | Command | What it does |
685
685
  |---------|--------------|
686
686
  | `/pan:focus-scan` | Collect, classify, and prioritize all work items with Reality Score |
687
- | `/pan:focus-plan` | Create capacity-budgeted execution batch (4 modes: bugfix/balanced/features/full) |
687
+ | `/pan:focus-plan` | Create capacity-budgeted execution batch (modes: bugfix, balanced, features, full) |
688
688
  | `/pan:focus-exec` | Execute items from batch with tier-based test cadence |
689
- | `/pan:focus-auto` | Continuous scan→plan→exec loop with purpose-driven categories and 5-layer safety harness |
689
+ | `/pan:focus-auto` | Continuous scan→plan→exec loop with purpose-driven categories and a layered safety harness |
690
690
  | `/pan:focus-sync` | Detect and report stale documentation counts |
691
- | `/pan:focus-design` | 10-phase strategic feature investigation pipeline |
691
+ | `/pan:focus-design` | Multi-phase strategic feature investigation pipeline |
692
692
  | `/pan:focus-drift-walking` | Walk project tree, detect doc-code drift, score severity, auto-repair |
693
- | `/pan:focus-doc-audit` | Multi-dimensional document audit with 8-dimension quality scoring |
693
+ | `/pan:focus-doc-audit` | Multi-dimensional document audit with a quality score per dimension |
694
694
 
695
- ### Spec B v2 (v3.0–v3.4)
695
+ ### Cost, Foresight & Review
696
696
 
697
697
  | Command | What it does |
698
698
  |---------|--------------|
@@ -703,7 +703,7 @@ PAN is not a replacement for your IDE or AI agent — it's the orchestration lay
703
703
  | `/pan:what-if <phase> "scenario"` | Counterfactual phase replay in isolated git worktree |
704
704
  | `/pan:mcp-bridge {list\|recommend\|cache}` | Discover MCP tools and recommend per-phase relevance |
705
705
 
706
- ### Optimization & Git (v3.5)
706
+ ### Optimization & Git
707
707
 
708
708
  | Command | What it does |
709
709
  |---------|--------------|
@@ -724,7 +724,7 @@ PAN stores project settings in `.planning/config.json`. Configure during `/pan:n
724
724
 
725
725
  | Setting | Options | Default | What it controls |
726
726
  |---------|---------|---------|------------------|
727
- | `mode` | `yolo`, `interactive` | chosen at `/pan:new-project` (usually `interactive`) | Auto-approve vs confirm at each step |
727
+ | `mode` | `yolo`, `interactive` | chosen at `/pan:new-project` (`yolo` is the recommended answer; `--auto` always sets it) | Auto-approve vs confirm at each step |
728
728
  | `depth` | `quick`, `standard`, `comprehensive` | chosen at `/pan:new-project` (usually `standard`) | Planning thoroughness (phases × plans) |
729
729
 
730
730
  ### Model Profiles
@@ -737,7 +737,7 @@ Control which Claude model each agent uses. Balance quality vs token spend.
737
737
  | `balanced` (default) | reasoning | reasoning | reasoning |
738
738
  | `budget` | Sonnet | Sonnet | Haiku |
739
739
 
740
- > `reasoning` = the session model (inherit) — every agent runs on the model you launched the session with, except the reviewer-class agents (reviewer, hardener, meta-reviewer), which pin a reasoning-tier model. Both `quality` and `balanced` resolve this way; only `budget` steps down to a Sonnet/Haiku mix. Actual assignment varies by agent role — see [User Guide](docs/USER-GUIDE.md#model-profiles-per-agent-breakdown) for the full per-agent breakdown.
740
+ > `reasoning` = the session model (inherit) — every agent runs on the model you launched the session with, except the reviewer-class agents (reviewer, hardener, meta-reviewer), which pin a reasoning-tier model on Claude Code. The other runtimes' agent files drop the pin, so there those agents inherit the session model too. Both `quality` and `balanced` resolve this way; only `budget` steps down — to a Sonnet/Haiku mix on Claude Code, and to the provider's own mid and fast models where PAN detects OpenAI (Codex, OpenCode) or Google (Gemini CLI); `pan-tools resolve-model <agent>` prints the id. Actual assignment varies by agent role — see [User Guide](docs/USER-GUIDE.md#model-profiles-per-agent-breakdown) for the full per-agent breakdown.
741
741
 
742
742
  Switch profiles:
743
743
  ```text
@@ -767,7 +767,7 @@ Use `/pan:settings` to toggle these, or override per-invocation:
767
767
  | Setting | Default | What it controls |
768
768
  |---------|---------|------------------|
769
769
  | `parallelization.enabled` | `true` | Run independent plans simultaneously |
770
- | `planning.commit_docs` | `true` | Track `.planning/` in git |
770
+ | `commit_docs` | `true` | Track `.planning/` in git |
771
771
 
772
772
  ### Git Branching
773
773
 
@@ -775,14 +775,14 @@ Control how PAN handles branches during execution.
775
775
 
776
776
  | Setting | Options | Default | What it does |
777
777
  |---------|---------|---------|--------------|
778
- | `git.branching_strategy` | `none`, `phase`, `milestone` | `none` | Branch creation strategy |
779
- | `git.phase_branch_template` | string | `pan/phase-{phase}-{slug}` | Template for phase branches |
780
- | `git.milestone_branch_template` | string | `pan/{milestone}-{slug}` | Template for milestone branches |
778
+ | `branching_strategy` | `none`, `phase`, `milestone` | `none` | Branch creation strategy |
779
+ | `phase_branch_template` | string | `pan/phase-{phase}-{slug}` | Template for phase branches |
780
+ | `milestone_branch_template` | string | `pan/{milestone}-{slug}` | Template for milestone branches |
781
781
 
782
782
  **Strategies:**
783
783
  - **`none`** — Commits to current branch (default PAN behavior)
784
- - **`phase`** — Creates a branch per phase, merges at phase completion
785
- - **`milestone`** — Creates one branch for entire milestone, merges at completion
784
+ - **`phase`** — Creates a branch per phase; you merge it yourself (PAN never merges)
785
+ - **`milestone`** — Creates one branch for the entire milestone; you merge it yourself
786
786
 
787
787
  At milestone completion you merge the milestone branch yourself (`git merge --squash` or `--no-ff`); `/pan:milestone-done <version>` archives and tags but does not merge.
788
788
 
@@ -823,12 +823,12 @@ This prevents Claude from reading these files entirely, regardless of what comma
823
823
 
824
824
  **Commands not found after install?**
825
825
  - Restart your runtime to reload commands/skills
826
- - Verify files exist in `~/.claude/commands/pan/` (global) or `./.claude/commands/pan/` (local)
826
+ - For Claude Code, verify files exist in `~/.claude/commands/pan/` (global) or `./.claude/commands/pan/` (local) — or, after a `--unified-skills` install, in `.claude/skills/pan-*/SKILL.md`
827
827
  - For Codex, verify skills exist in `~/.agents/skills/pan-*/SKILL.md` (global) or `./.agents/skills/pan-*/SKILL.md` (local)
828
828
  - For Copilot CLI, verify skills exist in `~/.copilot/skills/pan-*/SKILL.md` (global) or `./.github/skills/pan-*/SKILL.md` (local)
829
829
 
830
830
  **Commands not working as expected?**
831
- - Run `/pan:help` to verify installation
831
+ - Run `/pan:help` (`/pan-help` on OpenCode, Copilot CLI and unified Claude installs; `$pan-help` on Codex) to verify installation
832
832
  - Re-run `npx pan-wizard` to reinstall
833
833
 
834
834
  **Updating to the latest version?**
@@ -879,7 +879,7 @@ This removes all PAN commands, agents, hooks, and settings while preserving your
879
879
  | [User Guide](docs/USER-GUIDE.md) | Users | Workflow diagrams, command reference, config schema, troubleshooting |
880
880
  | [FAQ](docs/FAQ.md) | Users | Common questions about cost, runtimes, customization |
881
881
  | [Examples](docs/EXAMPLES.md) | Users | Worked examples from new project to cost-conscious development |
882
- | [Architecture](docs/ARCHITECTURE.md) | Contributors | 5-layer system design, data flow, module graph |
882
+ | [Architecture](docs/ARCHITECTURE.md) | Contributors | Layered system design, data flow, module graph |
883
883
  | [Development Guide](docs/DEVELOPMENT.md) | Contributors | Setup, how to add commands/agents/tests, cross-platform pitfalls |
884
884
  | [CLI Reference](docs/CLI-REFERENCE.md) | Contributors | Every pan-tools.cjs subcommand with args, flags, and JSON output |
885
885
  | [Agent System](docs/AGENTS.md) | Contributors | Agent inventory, lifecycle, model profiles, collaboration patterns |
@@ -446,7 +446,7 @@ function convertClaudeCommandToCodexSkill(content, skillName) {
446
446
  *
447
447
  * Unlike the Codex/Copilot adapters, this header makes no assumptions about
448
448
  * the consuming runtime — the same SKILL.md in the shared `.agents/skills/`
449
- * tree is read by every runtime, so invocation, delegation, and interaction
449
+ * tree is read by every runtime (Claude Code via its byte-identical .claude/skills/ copy), so invocation, delegation, and interaction
450
450
  * guidance are phrased in terms of "your runtime's native mechanism".
451
451
  */
452
452
  function getUnifiedSkillAdapterHeader(skillName, note) {
@@ -884,51 +884,6 @@ function buildHookCommand(configDir, hookName) {
884
884
 
885
885
  // ─── Opus 4.7 Skills & Thinking ────────────────────────────────────────────
886
886
 
887
- /**
888
- * Build a Claude Code native skill shim for a PAN command.
889
- *
890
- * Claude Code 1.x discovers skills in `.claude/skills/` by frontmatter.
891
- * PAN's commands live in `.claude/commands/pan/`, so we write a small shim
892
- * that registers the command as a skill pointing back at the command file.
893
- *
894
- * @param {Object} opts
895
- * @param {string} opts.commandName - e.g. "focus-scan"
896
- * @param {string} opts.description - Human-readable one-liner (≤120 chars preferred)
897
- * @param {string} [opts.trigger] - Optional trigger guidance for auto-invocation
898
- * @returns {string} Skill markdown content
899
- */
900
- function buildClaudeSkillShim(opts) {
901
- if (!opts || typeof opts.commandName !== 'string' || !opts.commandName.trim()) {
902
- throw new Error('buildClaudeSkillShim: commandName is required');
903
- }
904
- const name = opts.commandName.trim();
905
- const description = (opts.description || '').replace(/\s+/g, ' ').trim();
906
- const trigger = (opts.trigger || '').replace(/\s+/g, ' ').trim();
907
-
908
- const frontmatter = [
909
- '---',
910
- `name: pan-${name}`,
911
- `description: ${yamlQuote(description)}`,
912
- trigger ? `trigger: ${yamlQuote(trigger)}` : null,
913
- 'source: pan-wizard',
914
- '---',
915
- ].filter(Boolean).join('\n');
916
-
917
- const body = [
918
- '',
919
- `# /pan:${name}`,
920
- '',
921
- description || `PAN command: ${name}`,
922
- '',
923
- `Invokes the command defined at \`.claude/commands/pan/${name}.md\`.`,
924
- '',
925
- `To use, run: \`/pan:${name}\``,
926
- '',
927
- ].join('\n');
928
-
929
- return frontmatter + body;
930
- }
931
-
932
887
  /**
933
888
  * Translate a reasoning-depth directive from the generic PAN frontmatter
934
889
  * shape into runtime-specific syntax (or prose fallback).
@@ -1075,7 +1030,7 @@ function buildCopilotHooksConfig(commands) {
1075
1030
  config.hooks.postToolUse = [{ type: 'command', command: contextMonitorCommand }];
1076
1031
  }
1077
1032
  // subagentStop is Copilot's SubagentStop equivalent (verified docs.github.com
1078
- // 2026-06) — carries the cost + trace loggers, same as Claude/Gemini.
1033
+ // 2026-06) — carries the cost + trace loggers, same as Claude and Codex (Gemini registers neither).
1079
1034
  const subagentStop = [];
1080
1035
  if (costLoggerCommand) subagentStop.push({ type: 'command', command: costLoggerCommand });
1081
1036
  if (traceLoggerCommand) subagentStop.push({ type: 'command', command: traceLoggerCommand });
@@ -1088,21 +1043,72 @@ function buildCopilotHooksConfig(commands) {
1088
1043
  // ─── Codex hooks config (2026-06) ───────────────────────────────────────────
1089
1044
 
1090
1045
  /**
1091
- * Cross-runtime hook event map (canonical PAN event → per-runtime name).
1092
- * Claude/Gemini register in settings.json; Codex in `.codex/hooks.json`
1093
- * (Claude-compatible PascalCase events — verified developers.openai.com
1094
- * 2026-06, project-scoped hooks load once the project is trusted); Copilot
1095
- * in `.github/hooks/pan.json` (camelCase — verified docs.github.com 2026-06).
1096
- * OpenCode has no hook support.
1046
+ * Cross-runtime hook event map: canonical PAN slot → the event name PAN registers
1047
+ * under on each runtime, or null where PAN deliberately registers nothing for that
1048
+ * slot. The installers read this table; tests/fixtures/hook-vocabulary.json holds
1049
+ * each runtime's documented event names, and tests/hook-vocabulary.test.cjs fails
1050
+ * when an emitted key is not one of them.
1051
+ *
1052
+ * - claude: settings.json, PascalCase (code.claude.com/docs/en/hooks).
1053
+ * - gemini: settings.json, in Gemini's OWN vocabulary (gemini-cli
1054
+ * packages/core/src/hooks/types.ts `HookEventName`, read 2026-09-23). Any
1055
+ * other key is skipped at load with an "Invalid hook event name" warning —
1056
+ * which is what PAN's Claude-named PostToolUse, SubagentStop and Stop entries
1057
+ * were from v3.4 until 2026-09-23: registered, reported, never run (R29).
1058
+ * postToolUse is null because no Gemini hook payload or setting exposes the
1059
+ * context-window usage the context monitor reads (Gemini has no statusline
1060
+ * command either). subagentStop is null because Gemini has no
1061
+ * subagent-completion event and hands every hook the main session's
1062
+ * transcript, not the subagent's, so neither logger has anything to measure.
1063
+ * - codex: `.codex/hooks.json`, Claude-compatible PascalCase (developers.openai.com
1064
+ * 2026-06; codex-rs config/src/hook_config.rs read 2026-09-23). Project-scoped
1065
+ * hooks load once the project is trusted.
1066
+ * - copilot: `.github/hooks/pan.json`, camelCase (docs.github.com hooks reference).
1067
+ * - opencode: no hook system.
1068
+ *
1069
+ * `stop` is where the auto-advance stop guard registers (P-1809): Claude's Stop
1070
+ * and Gemini's AfterAgent, both of which re-prompt the agent when a hook blocks.
1071
+ * Codex and Copilot have a stop event too; PAN does not register the guard there yet.
1097
1072
  */
1098
1073
  const HOOK_EVENT_MAP = Object.freeze({
1099
- claude: { surface: 'settings.json', sessionStart: 'SessionStart', postToolUse: 'PostToolUse', subagentStop: 'SubagentStop' },
1100
- gemini: { surface: 'settings.json', sessionStart: 'SessionStart', postToolUse: 'PostToolUse', subagentStop: 'SubagentStop' },
1101
- codex: { surface: 'hooks.json', sessionStart: 'SessionStart', postToolUse: 'PostToolUse', subagentStop: 'SubagentStop' },
1102
- copilot: { surface: 'hooks/pan.json', sessionStart: 'sessionStart', postToolUse: 'postToolUse', subagentStop: 'subagentStop' },
1074
+ claude: { surface: 'settings.json', sessionStart: 'SessionStart', postToolUse: 'PostToolUse', subagentStop: 'SubagentStop', stop: 'Stop' },
1075
+ gemini: { surface: 'settings.json', sessionStart: 'SessionStart', postToolUse: null, subagentStop: null, stop: 'AfterAgent' },
1076
+ codex: { surface: 'hooks.json', sessionStart: 'SessionStart', postToolUse: 'PostToolUse', subagentStop: 'SubagentStop', stop: null },
1077
+ copilot: { surface: 'hooks/pan.json', sessionStart: 'sessionStart', postToolUse: 'postToolUse', subagentStop: 'subagentStop', stop: null },
1103
1078
  opencode: null,
1104
1079
  });
1105
1080
 
1081
+ /** The hook scripts PAN registers in a Claude-shaped settings.json `hooks` block. */
1082
+ const PAN_SETTINGS_HOOKS = Object.freeze(['pan-check-update', 'pan-context-monitor', 'pan-cost-logger', 'pan-trace-logger', 'pan-stop-guard']);
1083
+
1084
+ /**
1085
+ * Remove, from every event array of a Claude-shaped `hooks` object except
1086
+ * `keepEvent`, the entries that run one of `hookNames`; emptied arrays are
1087
+ * dropped. Returns the event names entries were removed from. Mutates `hooks`.
1088
+ *
1089
+ * This is how a hook that moved event, or lost its event on a runtime, is cleaned
1090
+ * up on upgrade and on uninstall — keyed on the script, never on a remembered list
1091
+ * of event names, which is how dead keys survived before (R29).
1092
+ *
1093
+ * @param {object} hooks - settings.hooks
1094
+ * @param {string[]} hookNames - script basenames without `.js` (e.g. 'pan-stop-guard')
1095
+ * @param {string|null} [keepEvent] - the event the hook now belongs to, left alone
1096
+ * @returns {string[]}
1097
+ */
1098
+ function stripPanHookEntries(hooks, hookNames, keepEvent = null) {
1099
+ const touched = [];
1100
+ if (!hooks || typeof hooks !== 'object' || Array.isArray(hooks)) return touched;
1101
+ for (const event of Object.keys(hooks)) {
1102
+ if (event === keepEvent || !Array.isArray(hooks[event])) continue;
1103
+ const before = hooks[event].length;
1104
+ hooks[event] = hooks[event].filter(entry => !(entry && Array.isArray(entry.hooks)
1105
+ && entry.hooks.some(h => h && typeof h.command === 'string' && hookNames.some(n => h.command.includes(n)))));
1106
+ if (hooks[event].length < before) touched.push(event);
1107
+ if (hooks[event].length === 0) delete hooks[event];
1108
+ }
1109
+ return touched;
1110
+ }
1111
+
1106
1112
  // ─── MCP server registration (2026-08) ──────────────────────────────────────
1107
1113
 
1108
1114
  /**
@@ -2289,7 +2295,6 @@ module.exports = {
2289
2295
  parseJsonc,
2290
2296
  // Opus 4.7 capabilities
2291
2297
  detectModelCapabilities,
2292
- buildClaudeSkillShim,
2293
2298
  translateThinkingDirective,
2294
2299
  stripThinkingFrontmatter,
2295
2300
  // Gemini CLI → Antigravity transition (2026-06)
@@ -2300,6 +2305,8 @@ module.exports = {
2300
2305
  // Copilot CLI hooks config (2026-06)
2301
2306
  buildCopilotHooksConfig,
2302
2307
  HOOK_EVENT_MAP,
2308
+ PAN_SETTINGS_HOOKS,
2309
+ stripPanHookEntries,
2303
2310
  mergeCodexHooksConfig,
2304
2311
  MCP_REGISTRATION,
2305
2312
  buildMcpServerEntry,