pan-wizard 3.31.0 → 3.32.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.
- package/README.md +28 -24
- package/agents/pan-design-checker.md +18 -0
- package/agents/pan-optimizer.md +5 -1
- package/agents/pan-plan-checker.md +23 -0
- package/agents/pan-reviewer.md +19 -0
- package/agents/pan-verifier.md +23 -0
- package/commands/pan/design-phase.md +8 -0
- package/commands/pan/exec-phase.md +1 -1
- package/commands/pan/git.md +2 -2
- package/commands/pan/learn.md +2 -0
- package/commands/pan/optimize.md +14 -2
- package/commands/pan/review-deep.md +5 -5
- package/hooks/dist/pan-context-monitor.js +1 -1
- package/hooks/dist/pan-cost-logger.js +63 -11
- package/hooks/dist/pan-state-reinject.js +2 -2
- package/hooks/dist/pan-stop-guard.js +2 -2
- package/hooks/dist/pan-trace-logger.js +283 -18
- package/package.json +1 -1
- package/pan-wizard-core/bin/lib/commands.cjs +2 -1
- package/pan-wizard-core/bin/lib/constants.cjs +28 -0
- package/pan-wizard-core/bin/lib/cost.cjs +3 -3
- package/pan-wizard-core/bin/lib/findings.cjs +381 -0
- package/pan-wizard-core/bin/lib/focus.cjs +72 -19
- package/pan-wizard-core/bin/lib/foreign-planning.cjs +24 -6
- package/pan-wizard-core/bin/lib/hygiene.cjs +12 -2
- package/pan-wizard-core/bin/lib/init.cjs +4 -1
- package/pan-wizard-core/bin/lib/optimize.cjs +349 -21
- package/pan-wizard-core/bin/lib/review-deep.cjs +36 -0
- package/pan-wizard-core/bin/lib/state.cjs +7 -2
- package/pan-wizard-core/bin/lib/verdict.cjs +431 -0
- package/pan-wizard-core/bin/lib/verify-preflight.cjs +4 -2
- package/pan-wizard-core/bin/lib/verify-scope.cjs +156 -0
- package/pan-wizard-core/bin/lib/verify.cjs +25 -2
- package/pan-wizard-core/bin/pan-tools.cjs +59 -5
- package/pan-wizard-core/learnings/README.md +10 -7
- package/pan-wizard-core/mcp/tool-registry.cjs +2 -0
- package/pan-wizard-core/references/verdict-contract.md +101 -0
- package/pan-wizard-core/templates/verification-report.md +16 -0
- package/pan-wizard-core/workflows/exec-phase.md +65 -47
- package/pan-wizard-core/workflows/health.md +2 -0
- package/pan-wizard-core/workflows/learn.md +4 -2
- package/pan-wizard-core/workflows/milestone-audit.md +15 -3
- package/pan-wizard-core/workflows/optimize.md +14 -1
- package/pan-wizard-core/workflows/plan-phase.md +20 -15
- package/pan-wizard-core/workflows/verify-phase.md +3 -13
- package/pan-zcode/README.md +3 -3
- package/scripts/git-hooks/pre-commit +2 -1
package/README.md
CHANGED
|
@@ -105,16 +105,16 @@ PAN is the context engineering layer that makes Claude Code reliable. It breaks
|
|
|
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 unless the schedule is armed with `--enforce-budget`, which pauses the day's run once spent — `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
|
|
|
108
|
-
**
|
|
108
|
+
**See it.** `/pan:hud` renders a single self-contained HTML snapshot — Mission Control over the squads, in-flight worktrees, campaign budget, telemetry, and the safety harness — in one page. The page does not refresh itself; re-run the command for a fresh one.
|
|
109
109
|
|
|
110
110
|
```bash
|
|
111
111
|
/pan:army "ship the v1 reporting module" # plan → delegate → build → review → human-gated ship
|
|
112
112
|
/pan:army "harden auth across the app" --schedule daily --daily-budget 200
|
|
113
113
|
/pan:army --status # where the campaign stands
|
|
114
|
-
/pan:hud --open #
|
|
114
|
+
/pan:hud --open # snapshot of the army's current state
|
|
115
115
|
```
|
|
116
116
|
|
|
117
|
-
Resolve the live squad roster any time with `pan-tools squad list
|
|
117
|
+
Resolve the live squad roster any time with `pan-tools squad list` (`pan-tools` is shorthand; see [Operations](#operations) for how to run it).
|
|
118
118
|
|
|
119
119
|
---
|
|
120
120
|
|
|
@@ -142,7 +142,7 @@ Verify with:
|
|
|
142
142
|
|
|
143
143
|
### Staying Updated
|
|
144
144
|
|
|
145
|
-
PAN evolves fast.
|
|
145
|
+
PAN evolves fast. On Claude Code, update periodically with `/pan:update`, which detects whether the install is local or global but passes no other flag, so it always updates Claude Code in its default location. For any other runtime, or an install made with `--config-dir` or `--unified-skills`, re-run the installer yourself with the flags you installed with (add `--global` for a global install, since the installer defaults to the current project):
|
|
146
146
|
|
|
147
147
|
```bash
|
|
148
148
|
npx pan-wizard@latest
|
|
@@ -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 # Skills to ~/.agents/skills/, core and hooks to ~/.codex/
|
|
167
|
-
npx pan-wizard --codex --local # Skills to ./.agents/skills/, core and hooks to ./.codex/
|
|
166
|
+
npx pan-wizard --codex --global # Skills to ~/.agents/skills/, core, agents and hooks to ~/.codex/
|
|
167
|
+
npx pan-wizard --codex --local # Skills to ./.agents/skills/, core, agents and hooks to ./.codex/
|
|
168
168
|
|
|
169
169
|
# GitHub Copilot CLI (skills-first)
|
|
170
170
|
npx pan-wizard --copilot --global # Install to ~/.copilot/
|
|
@@ -175,7 +175,7 @@ npx pan-wizard --all --global # Install to all directories
|
|
|
175
175
|
```
|
|
176
176
|
|
|
177
177
|
Use `--global` (`-g`) to install into your home config directory; `--local` (`-l`) is the default and may be omitted.
|
|
178
|
-
Use `--claude`, `--opencode`, `--gemini`, `--codex`, `--copilot`, or `--all` to skip the runtime prompt.
|
|
178
|
+
Use `--claude`, `--opencode`, `--gemini`, `--codex`, `--copilot`, or `--all` to skip the runtime prompt. A local install also writes outside the runtime directory: a marker-fenced PAN section in the project's `AGENTS.md`; for Claude Code, an `@AGENTS.md` import in `CLAUDE.md` and a `pan` MCP server in `.mcp.json`; and for Codex or `--unified-skills`, the shared `.agents/` tree (skills, plus a shared core under `--unified-skills`). `--uninstall` removes them (the `AGENTS.md` and `CLAUDE.md` blocks and the `.agents/` tree stay while another PAN runtime in the project still uses them).
|
|
179
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.
|
|
@@ -190,8 +190,10 @@ directory. The installer hard-refuses to install into its own source repo (a
|
|
|
190
190
|
`PAN_SOURCE_ROOT` guard exits with an error), so point it at a different target:
|
|
191
191
|
|
|
192
192
|
```bash
|
|
193
|
-
# 1. Get the source
|
|
193
|
+
# 1. Get the source and build the hooks (hooks/dist/ is build output a clone lacks;
|
|
194
|
+
# the installer copies the hooks from there)
|
|
194
195
|
git clone https://github.com/oharms/PanWizard.git
|
|
196
|
+
cd PanWizard && npm run build:hooks
|
|
195
197
|
|
|
196
198
|
# 2. Install into a DIFFERENT project directory (never the PanWizard source dir)
|
|
197
199
|
cd /path/to/some-test-project
|
|
@@ -346,7 +348,7 @@ The system:
|
|
|
346
348
|
|
|
347
349
|
Each plan is small enough to execute in a fresh context window. No degradation, no "I'll be more concise now."
|
|
348
350
|
|
|
349
|
-
**Creates:** `{phase_num}-research.md`, `{phase_num}-{N}-plan.md`
|
|
351
|
+
**Creates:** `{phase_num}-research.md`, `{phase_num}-{N}-plan.md`, `{phase_num}-plan-check.md` (the checker's report, when the checker runs)
|
|
350
352
|
|
|
351
353
|
---
|
|
352
354
|
|
|
@@ -397,7 +399,7 @@ Plans are grouped into "waves" based on dependencies. Within each wave, plans ru
|
|
|
397
399
|
|
|
398
400
|
This is why "vertical slices" (Plan 01: User feature end-to-end) parallelize better than "horizontal layers" (Plan 01: All models, Plan 02: All APIs).
|
|
399
401
|
|
|
400
|
-
**Creates:** `{phase_num}-{N}-summary.md`, `{phase_num}-verification.md`
|
|
402
|
+
**Creates:** `{phase_num}-{N}-summary.md`, `{phase_num}-review.md` (unless `--skip-review` or `--fast`), `{phase_num}-verification.md`
|
|
401
403
|
|
|
402
404
|
---
|
|
403
405
|
|
|
@@ -481,7 +483,7 @@ PAN handles it for you:
|
|
|
481
483
|
|
|
482
484
|
| File | What it does |
|
|
483
485
|
|------|--------------|
|
|
484
|
-
| `project.md` | Project vision,
|
|
486
|
+
| `project.md` | Project vision, read when PAN plans, researches or resumes work |
|
|
485
487
|
| `research/` | Ecosystem knowledge (stack, features, architecture, pitfalls) |
|
|
486
488
|
| `requirements.md` | Scoped v1/v2 requirements with phase traceability |
|
|
487
489
|
| `roadmap.md` | Where you're going, what's done |
|
|
@@ -522,7 +524,7 @@ Every stage uses the same pattern: a thin orchestrator spawns specialized agents
|
|
|
522
524
|
| Research | Coordinates, presents findings | Parallel researchers investigate stack, features, architecture and pitfalls |
|
|
523
525
|
| Planning | Validates, manages iteration | Planner creates plans, checker verifies, up to three passes |
|
|
524
526
|
| 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
|
-
| Verification | Presents results, routes next | Verifier checks codebase against goals,
|
|
527
|
+
| Verification | Presents results, routes next | Verifier checks codebase against goals; on Claude Code, `/pan-diagnose-issues` sends one debugger per failed UAT truth |
|
|
526
528
|
|
|
527
529
|
The orchestrator never does heavy lifting. It spawns agents, waits, integrates results.
|
|
528
530
|
|
|
@@ -613,7 +615,7 @@ PAN is not a replacement for your IDE or AI agent — it's the orchestration lay
|
|
|
613
615
|
|---------|--------------|
|
|
614
616
|
| `/pan:progress` | Where am I? What's next? |
|
|
615
617
|
| `/pan:hud` (alias `/pan:dashboard`) | Render a self-contained HTML dashboard of project + bot-army state to `.planning/hud.html` (`--open`, `--out`, `--stdout`) |
|
|
616
|
-
| `/pan:report phase <N> \| index \| all` | Self-contained HTML report for one phase, or a timeline index linking every phase report (`--out`, `--open`, `--stdout`; `--bundle` on `index` inlines every phase report into one file) |
|
|
618
|
+
| `/pan:report phase <N> \| index \| all` | Self-contained HTML report for one phase, or a timeline index linking every phase report (`--out`, `--open`, `--stdout` on `phase` and `index`; `--bundle` on `index` inlines every phase report into one file; `all` regenerates every phase report plus the index and takes only `--open`) |
|
|
617
619
|
| `/pan:help` | Show all commands and usage guide |
|
|
618
620
|
| `/pan:update` | Update PAN with changelog preview |
|
|
619
621
|
| `/pan:discord` | Join the PAN Discord community |
|
|
@@ -657,7 +659,7 @@ PAN is not a replacement for your IDE or AI agent — it's the orchestration lay
|
|
|
657
659
|
| `/pan:todo-check` | List pending todos |
|
|
658
660
|
| `/pan:debug [desc]` | Systematic debugging with persistent state |
|
|
659
661
|
| `/pan:quick [--full]` | Execute ad-hoc task with PAN guarantees (`--full` adds plan-checking and verification) |
|
|
660
|
-
| `/pan:health [--repair]` | Validate `.planning/` directory integrity; `--repair`
|
|
662
|
+
| `/pan:health [--repair]` | Validate `.planning/` directory integrity; `--repair` fixes the issues it marks repairable |
|
|
661
663
|
| `/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
664
|
| `/pan:links [--strict]` | Validate the doc-code link graph: inline `[[<id>]]` refs, `// @pan:` source anchors, `require-code-mention` contracts (ADR-0027) |
|
|
663
665
|
| `/pan:phase-tests <N> [instructions]` | Generate tests for a completed phase based on UAT criteria |
|
|
@@ -670,6 +672,8 @@ PAN is not a replacement for your IDE or AI agent — it's the orchestration lay
|
|
|
670
672
|
|
|
671
673
|
### Operations
|
|
672
674
|
|
|
675
|
+
`pan-tools` is shorthand for `node .claude/pan-wizard-core/bin/pan-tools.cjs`; the installer adds no `pan-tools` command to your PATH. Use your runtime's directory in place of `.claude` (`.codex`, `.gemini`, `.opencode`, `.github`), or its global config directory after a `--global` install.
|
|
676
|
+
|
|
673
677
|
| Command | What it does |
|
|
674
678
|
|---------|--------------|
|
|
675
679
|
| `pan-tools preflight [target]` | Pre-flight validation: state, blockers, git clean, config, error patterns |
|
|
@@ -687,7 +691,7 @@ PAN is not a replacement for your IDE or AI agent — it's the orchestration lay
|
|
|
687
691
|
| `/pan:focus-plan` | Create capacity-budgeted execution batch (modes: bugfix, balanced, features, full) |
|
|
688
692
|
| `/pan:focus-exec` | Execute items from batch with tier-based test cadence |
|
|
689
693
|
| `/pan:focus-auto` | Continuous scan→plan→exec loop with purpose-driven categories and a layered safety harness |
|
|
690
|
-
| `/pan:focus-sync` | Detect
|
|
694
|
+
| `/pan:focus-sync` | Detect stale documentation (counts, missing commands, outdated references); `--all` also fixes it |
|
|
691
695
|
| `/pan:focus-design` | Multi-phase strategic feature investigation pipeline |
|
|
692
696
|
| `/pan:focus-drift-walking` | Walk project tree, detect doc-code drift, score severity, auto-repair |
|
|
693
697
|
| `/pan:focus-doc-audit` | Multi-dimensional document audit with a quality score per dimension |
|
|
@@ -697,7 +701,7 @@ PAN is not a replacement for your IDE or AI agent — it's the orchestration lay
|
|
|
697
701
|
| Command | What it does |
|
|
698
702
|
|---------|--------------|
|
|
699
703
|
| `/pan:cost` | Token usage + estimated cost across PAN invocations (json/table/chart) |
|
|
700
|
-
| `/pan:preview <
|
|
704
|
+
| `/pan:preview phase <N>\|phases\|milestone` | Read-only foresight: blast radius, dependency graph, milestone ETA |
|
|
701
705
|
| `/pan:review-deep <phase>` | Security audit (OWASP + STRIDE) + cross-check by meta-reviewer |
|
|
702
706
|
| `/pan:knowledge {ask\|discuss\|playbook}` | Grounded Q&A, multi-turn discussion, or aggregate memory into playbook |
|
|
703
707
|
| `/pan:what-if <phase> "scenario"` | Counterfactual phase replay in isolated git worktree |
|
|
@@ -708,7 +712,7 @@ PAN is not a replacement for your IDE or AI agent — it's the orchestration lay
|
|
|
708
712
|
| Command | What it does |
|
|
709
713
|
|---------|--------------|
|
|
710
714
|
| `/pan:learn` | Analyze trace events, generate optimization report with auto-apply block |
|
|
711
|
-
| `/pan:optimize {apply\|list\|stats\|trace}` | Apply optimizer recommendations, list reports, view stats, manage trace sessions |
|
|
715
|
+
| `/pan:optimize {apply\|revert\|list\|stats\|trace}` | Apply optimizer recommendations, undo one apply (`revert <apply_id>` or `revert --last`), list reports, view stats, manage trace sessions |
|
|
712
716
|
| `/pan:git <subcommand>` | Phase-aware git workflow: commit/branch/push/status/log/stash/diff/rollback/tag/sync |
|
|
713
717
|
| `/pan:audit-deployment <target-directory> [--enhancements] [--repair]` | Audit a PAN installation for integrity, project health, and draft enhancement specs |
|
|
714
718
|
|
|
@@ -725,7 +729,7 @@ PAN stores project settings in `.planning/config.json`. Configure during `/pan:n
|
|
|
725
729
|
| Setting | Options | Default | What it controls |
|
|
726
730
|
|---------|---------|---------|------------------|
|
|
727
731
|
| `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
|
-
| `depth` | `quick`, `standard`, `comprehensive` | chosen at `/pan:new-project` (
|
|
732
|
+
| `depth` | `quick`, `standard`, `comprehensive` | chosen at `/pan:new-project` (`--auto` uses `quick` unless the idea document's frontmatter sets `planning_depth`) | Planning thoroughness (phases × plans) |
|
|
729
733
|
|
|
730
734
|
### Model Profiles
|
|
731
735
|
|
|
@@ -766,7 +770,7 @@ Use `/pan:settings` to toggle these, or override per-invocation:
|
|
|
766
770
|
|
|
767
771
|
| Setting | Default | What it controls |
|
|
768
772
|
|---------|---------|------------------|
|
|
769
|
-
| `parallelization
|
|
773
|
+
| `parallelization` | `true` | Run independent plans simultaneously |
|
|
770
774
|
| `commit_docs` | `true` | Track `.planning/` in git |
|
|
771
775
|
|
|
772
776
|
### Git Branching
|
|
@@ -781,7 +785,7 @@ Control how PAN handles branches during execution.
|
|
|
781
785
|
|
|
782
786
|
**Strategies:**
|
|
783
787
|
- **`none`** — Commits to current branch (default PAN behavior)
|
|
784
|
-
- **`phase`** — Creates a branch per phase; you merge it yourself (
|
|
788
|
+
- **`phase`** — Creates a branch per phase; you merge it yourself (the phase workflows never merge it)
|
|
785
789
|
- **`milestone`** — Creates one branch for the entire milestone; you merge it yourself
|
|
786
790
|
|
|
787
791
|
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.
|
|
@@ -829,20 +833,20 @@ This prevents Claude from reading these files entirely, regardless of what comma
|
|
|
829
833
|
|
|
830
834
|
**Commands not working as expected?**
|
|
831
835
|
- Run `/pan:help` (`/pan-help` on OpenCode, Copilot CLI and unified Claude installs; `$pan-help` on Codex) to verify installation
|
|
832
|
-
- Re-run `npx pan-wizard` to reinstall
|
|
836
|
+
- Re-run `npx pan-wizard` with the flags you installed with (the runtime, `--global`/`--local`, and any `--config-dir` or `--unified-skills`) to reinstall
|
|
833
837
|
|
|
834
|
-
**Updating to the latest version?**
|
|
838
|
+
**Updating to the latest version?** On Claude Code, run `/pan:update`. For any other runtime, or an install made with `--config-dir` or `--unified-skills`, re-run the installer with the flags you installed with (`--global` for a global install):
|
|
835
839
|
```bash
|
|
836
840
|
npx pan-wizard@latest
|
|
837
841
|
```
|
|
838
842
|
|
|
839
843
|
**Using Docker or containerized environments?**
|
|
840
844
|
|
|
841
|
-
If
|
|
845
|
+
If Claude Code in the container reads its config from somewhere other than the installing user's `~/.claude`, set `CLAUDE_CONFIG_DIR` to that directory before installing (`--global --config-dir <path>` does the same):
|
|
842
846
|
```bash
|
|
843
847
|
CLAUDE_CONFIG_DIR=/home/youruser/.claude npx pan-wizard --global
|
|
844
848
|
```
|
|
845
|
-
|
|
849
|
+
PAN then installs into that directory and writes its absolute path into the installed commands, agents and hook commands. A global install writes absolute paths whether or not the variable is set.
|
|
846
850
|
|
|
847
851
|
### Uninstalling
|
|
848
852
|
|
|
@@ -80,4 +80,22 @@ asserting a gap that forces unnecessary rework.
|
|
|
80
80
|
check → revise → check → final) — the same guardrail `plan-phase` uses with
|
|
81
81
|
`pan-plan-checker`. On the final iteration, report remaining gaps as caveats
|
|
82
82
|
rather than blocking indefinitely.
|
|
83
|
+
|
|
84
|
+
**Machine verdict (required).** End the verdict with a `pan-verdict` block. The
|
|
85
|
+
contract is in `~/.claude/pan-wizard-core/references/verdict-contract.md`. How to fill it:
|
|
86
|
+
- `verdict` is `PASS` or `GAPS`, and `outcome` is `pass` or `fail`.
|
|
87
|
+
- Add one finding per gap, in your ranked order.
|
|
88
|
+
- The class follows the dimension: requirement coverage → `missing`, architecture
|
|
89
|
+
conformance → `contradicts`, threat coverage → `risk`, scope discipline →
|
|
90
|
+
`unrequested`, every other dimension → `partial`.
|
|
91
|
+
- Each gap is `high`. A gap you report as a caveat on the final iteration is `medium`.
|
|
92
|
+
- `where` is the design section.
|
|
93
|
+
|
|
94
|
+
The orchestrator records the block, so it must say what your verdict says.
|
|
95
|
+
|
|
96
|
+
````markdown
|
|
97
|
+
```pan-verdict
|
|
98
|
+
{"contract":"1.0","agent":"pan-design-checker","phase":"{phase}","verdict":"GAPS","outcome":"fail","findings":[{"class":"missing","severity":"high","where":"{phase}-design.md#requirements","summary":"REQ-12 (export to CSV) maps to no design element"}]}
|
|
99
|
+
```
|
|
100
|
+
````
|
|
83
101
|
</output_contract>
|
package/agents/pan-optimizer.md
CHANGED
|
@@ -32,14 +32,18 @@ Read all inputs before producing the report.
|
|
|
32
32
|
### Step 1: Load the analysis JSON
|
|
33
33
|
|
|
34
34
|
Read the `-analysis.json` file. It contains:
|
|
35
|
-
- `summary` — total event counts by type
|
|
35
|
+
- `summary` — total event counts by type, plus `tool_errors`, `spawns_with_tool_errors` / `spawns_measured`, `verdict_failures`, `verdict_retries`
|
|
36
36
|
- `error_patterns` — recurring error categories (sorted by frequency)
|
|
37
|
+
- `tool_error_patterns` — failed tool calls captured from the subagents' own transcripts, grouped by agent, tool, class (`exit_code`, `not_found`, `permission_denied`, …) and message. Each carries `occurrences`, `spawns` and `sessions`, ranked by `spawns`
|
|
38
|
+
- `verdict_stats` — per judge (verifier, plan checker, reviewer, design checker): `pass`, `fail`, `needs_human`, `retries`, `resolved_by_retry`. The findings behind them are in `.planning/findings.jsonl` (`pan-tools findings list`)
|
|
37
39
|
- `gap_patterns` — knowledge gaps the model had to infer
|
|
38
40
|
- `memory_miss_patterns` — topics missing from memory
|
|
39
41
|
- `agent_stats` — per-agent error rates
|
|
40
42
|
- `critical_events` / `major_events` — highest-impact events
|
|
41
43
|
- `raw_events` — the full event stream
|
|
42
44
|
|
|
45
|
+
**Recurrence before memory.** A tool failure in one spawn is not a lesson: a test run expected to fail (a TDD red step) or a grep with no match exits non-zero on purpose. Write a memory entry only from a `tool_error_patterns` row with `spawns` of 2 or more, and prefer the ones that span `sessions`. The analysis may pool several sessions (`pooled_sessions`, from `pan-tools optimize learn --sessions <n>`); that window is where recurrence shows. A `permission_denied` pattern is an environment finding (the host's permission rules), not an agent's mistake: suggest a note, never a memory entry.
|
|
46
|
+
|
|
43
47
|
### Step 2: Read raw trace events
|
|
44
48
|
|
|
45
49
|
Scan `trace.jsonl` for events. Look for:
|
|
@@ -756,6 +756,13 @@ Return all issues as a structured `issues:` YAML list (see dimension examples fo
|
|
|
756
756
|
|
|
757
757
|
<structured_returns>
|
|
758
758
|
|
|
759
|
+
**Every return ends with a `pan-verdict` block.** The contract is in `~/.claude/pan-wizard-core/references/verdict-contract.md`. How to fill it:
|
|
760
|
+
- `verdict` is `passed` or `issues_found` (the status from Step 10), and `outcome` is `pass` or `fail`.
|
|
761
|
+
- Add one finding per issue you list. Blocker → `high`, warning → `medium`, info → `info`. The class follows the dimension, as mapped in the reference.
|
|
762
|
+
- `where` is the plan file, plus `#task-N` when the issue is about one task.
|
|
763
|
+
|
|
764
|
+
The orchestrator records the block, and the record is what it branches on. The block must say the same thing as your heading.
|
|
765
|
+
|
|
759
766
|
## VERIFICATION PASSED
|
|
760
767
|
|
|
761
768
|
```markdown
|
|
@@ -782,6 +789,14 @@ Return all issues as a structured `issues:` YAML list (see dimension examples fo
|
|
|
782
789
|
Plans verified. Run `/pan:exec-phase {phase}` to proceed.
|
|
783
790
|
```
|
|
784
791
|
|
|
792
|
+
End it with:
|
|
793
|
+
|
|
794
|
+
````markdown
|
|
795
|
+
```pan-verdict
|
|
796
|
+
{"contract":"1.0","agent":"pan-plan-checker","phase":"{phase}","verdict":"passed","outcome":"pass","findings":[]}
|
|
797
|
+
```
|
|
798
|
+
````
|
|
799
|
+
|
|
785
800
|
## ISSUES FOUND
|
|
786
801
|
|
|
787
802
|
```markdown
|
|
@@ -813,6 +828,14 @@ Plans verified. Run `/pan:exec-phase {phase}` to proceed.
|
|
|
813
828
|
{N} blocker(s) require revision. Returning to planner with feedback.
|
|
814
829
|
```
|
|
815
830
|
|
|
831
|
+
End it with one finding per listed issue:
|
|
832
|
+
|
|
833
|
+
````markdown
|
|
834
|
+
```pan-verdict
|
|
835
|
+
{"contract":"1.0","agent":"pan-plan-checker","phase":"{phase}","verdict":"issues_found","outcome":"fail","findings":[{"class":"missing","severity":"high","where":"{phase}-01-plan.md","summary":"requirement AUTH-02 (password reset) has no covering task"},{"class":"risk","severity":"medium","where":"{phase}-02-plan.md","summary":"plan 02 modifies 12 files across 5 tasks; split it"}]}
|
|
836
|
+
```
|
|
837
|
+
````
|
|
838
|
+
|
|
816
839
|
</structured_returns>
|
|
817
840
|
|
|
818
841
|
<anti_patterns>
|
package/agents/pan-reviewer.md
CHANGED
|
@@ -69,6 +69,10 @@ If a changed file path starts with any of these prefixes, **skip it silently**.
|
|
|
69
69
|
| Duplicate code | > 10 identical lines across files | INFO |
|
|
70
70
|
| TODO/FIXME/HACK | New instances added in this phase | INFO |
|
|
71
71
|
|
|
72
|
+
## Scope (unrequested work)
|
|
73
|
+
|
|
74
|
+
Compare what the changed code does with what the phase's plans asked for (their tasks and `must_haves`). Code that adds behaviour no plan task or requirement mentions is a finding: a feature nobody asked for, an unrelated refactor folded into the change, or an option no requirement needs. Use category `Unrequested` at WARNING, or at ERROR when it changes existing behaviour without a plan saying so. Its class in the `pan-verdict` block is `unrequested`. Supporting code the tasks need (tests, types, wiring) is not a finding.
|
|
75
|
+
|
|
72
76
|
</review_checks>
|
|
73
77
|
|
|
74
78
|
<output_format>
|
|
@@ -106,6 +110,21 @@ Return a structured review report:
|
|
|
106
110
|
- **PASS**: Zero errors, zero warnings
|
|
107
111
|
- **PASS_WITH_WARNINGS**: Zero errors, warnings present
|
|
108
112
|
- **NEEDS_FIXES**: Any errors present
|
|
113
|
+
|
|
114
|
+
**Machine verdict (required).** End the report with a `pan-verdict` block. The contract is in `~/.claude/pan-wizard-core/references/verdict-contract.md`. How to fill it:
|
|
115
|
+
- `verdict` is the word under `### Verdict`; `outcome` is `fail` for NEEDS_FIXES and `pass` otherwise.
|
|
116
|
+
- Add one finding per table row. ERROR → `high`, WARNING → `medium`, INFO → `info`.
|
|
117
|
+
- Category maps to class: Convention → `quality`, Security → `risk`, Code Quality → `defect`, Unrequested → `unrequested`.
|
|
118
|
+
- `where` is `file:line`.
|
|
119
|
+
- A clean review has `"findings": []`.
|
|
120
|
+
|
|
121
|
+
The orchestrator records this block. It is how your findings reach the phase's findings ledger and `/pan:review-deep`.
|
|
122
|
+
|
|
123
|
+
````markdown
|
|
124
|
+
```pan-verdict
|
|
125
|
+
{"contract":"1.0","agent":"pan-reviewer","phase":"{phase_number}","verdict":"NEEDS_FIXES","outcome":"fail","findings":[{"class":"quality","severity":"high","where":"src/utils/parser.ts:42","summary":"Inconsistent naming — uses snake_case, project uses camelCase"}]}
|
|
126
|
+
```
|
|
127
|
+
````
|
|
109
128
|
</output_format>
|
|
110
129
|
|
|
111
130
|
<constraints>
|
package/agents/pan-verifier.md
CHANGED
|
@@ -450,6 +450,21 @@ Include in verification report under a "### Standards Compliance" section:
|
|
|
450
450
|
|
|
451
451
|
This is advisory only — standards gaps do NOT block verification status. They appear as warnings/info in the report.
|
|
452
452
|
|
|
453
|
+
## Step 7c: Check Scope — Unrequested Work
|
|
454
|
+
|
|
455
|
+
Find what the phase changed that no plan asked for. The file list is mechanical; the judgement is yours:
|
|
456
|
+
|
|
457
|
+
```bash
|
|
458
|
+
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs verify scope "$PHASE_NUM"
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
`candidates` are files the phase changed that no plan declared in `files_modified`. The changes come from the phase's plan commits and its summaries' key-files; the planning tree, lockfiles and PAN's own directories are already excluded. Judge each candidate:
|
|
462
|
+
|
|
463
|
+
- **Supporting work** the declared tasks need is not a finding. That includes a test for a declared file (`hint: test_for_declared`), a fixture, a config entry the feature requires, and a type the declared code imports.
|
|
464
|
+
- **Work the plans' intent does not cover** goes in the frontmatter as an `unrequested:` entry: `path` and `what` (what it adds that nobody asked for). Examples are a feature nobody asked for, an unrelated refactor, or a file outside the phase's purpose. Behaviour counts too: a declared file that also does something no requirement asked for is unrequested work in that file.
|
|
465
|
+
|
|
466
|
+
Unrequested work never changes the status on its own; a phase can pass with it. Keeping it (a decision) or removing it is the user's call, and the recorded finding is how the call gets made.
|
|
467
|
+
|
|
453
468
|
## Step 8: Identify Human Verification Needs
|
|
454
469
|
|
|
455
470
|
**Always needs human:** Visual appearance, user flow completion, real-time behavior, external service integration, performance feel, error message clarity.
|
|
@@ -536,6 +551,9 @@ human_verification: # Only if status: human_needed
|
|
|
536
551
|
- test: "What to do"
|
|
537
552
|
expected: "What should happen"
|
|
538
553
|
why_human: "Why can't verify programmatically"
|
|
554
|
+
unrequested: # Only if Step 7c found work no plan asked for
|
|
555
|
+
- path: "src/path/to/file.tsx"
|
|
556
|
+
what: "What it adds that no plan or requirement asked for"
|
|
539
557
|
---
|
|
540
558
|
|
|
541
559
|
# Phase {X}: {Name} Verification Report
|
|
@@ -581,6 +599,10 @@ human_verification: # Only if status: human_needed
|
|
|
581
599
|
|
|
582
600
|
{Items needing human testing — detailed format for user}
|
|
583
601
|
|
|
602
|
+
### Unrequested Work
|
|
603
|
+
|
|
604
|
+
{Files or behaviour no plan asked for (Step 7c), each with what it adds — or "None: every change traces to a plan."}
|
|
605
|
+
|
|
584
606
|
### Gaps Summary
|
|
585
607
|
|
|
586
608
|
{Narrative summary of what's missing and why}
|
|
@@ -706,6 +728,7 @@ return <div>No messages</div> // Always shows "no messages"
|
|
|
706
728
|
- [ ] Requirements coverage assessed (if applicable)
|
|
707
729
|
- [ ] Anti-patterns scanned and categorized
|
|
708
730
|
- [ ] Human verification items identified
|
|
731
|
+
- [ ] Scope checked with `verify scope`; unrequested work recorded in `unrequested:`
|
|
709
732
|
- [ ] Overall status determined
|
|
710
733
|
- [ ] Gaps structured in YAML frontmatter (if gaps_found)
|
|
711
734
|
- [ ] Re-verification metadata included (if previous existed)
|
|
@@ -58,6 +58,14 @@ ELSE (default):
|
|
|
58
58
|
- If it finds gaps (iteration 1) → `pan-designer` revises (address genuine gaps only), re-check.
|
|
59
59
|
- If it finds gaps (iteration 2) → final revision, record remaining gaps as caveats.
|
|
60
60
|
- **Max 2 revision iterations** (design → check → revise → check → final) — the same guardrail `plan-phase` uses with `pan-plan-checker`.
|
|
61
|
+
- **Record each check.** Save the checker's returned text verbatim to `{phase_dir}/{padded_phase}-design-check.md` with the Write tool. Record it and branch on the verdict it prints (`PASS` or `GAPS`):
|
|
62
|
+
```bash
|
|
63
|
+
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs findings record --phase "{phase}" --agent pan-design-checker --file "{phase_dir}/{padded_phase}-design-check.md" --raw
|
|
64
|
+
```
|
|
65
|
+
A re-check is the next attempt and closes the gaps it no longer reports. When the final iteration still has gaps, record them as the caveats they are before writing the design:
|
|
66
|
+
```bash
|
|
67
|
+
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs findings dispose --phase "{phase}" --agent pan-design-checker --open --as deferred --reason "design caveat after 2 revision iterations"
|
|
68
|
+
```
|
|
61
69
|
5. **Write** `{phase}-design.md` to the phase directory and commit via `pan-tools commit`.
|
|
62
70
|
6. **Present** results + next step (`/pan:plan-phase` — which will consume this design.md).
|
|
63
71
|
</process>
|
|
@@ -61,7 +61,7 @@ Phase: $ARGUMENTS
|
|
|
61
61
|
- `--skip-tests` — Skip automatic test generation after execution completes.
|
|
62
62
|
- `--skip-review` — Skip automatic code review after execution completes.
|
|
63
63
|
- `--fast` — Skip both test generation and code review (implies `--skip-tests --skip-review`).
|
|
64
|
-
- `--deep-review`
|
|
64
|
+
- `--deep-review` — After the normal code review, run the deep review inline: the `/pan:review-deep` process, a security audit by pan-hardener plus a cross-check by pan-meta-reviewer, merged into `.planning/reviews/<N>/deep-review.md`. It builds on the normal review, so it is skipped with `--skip-review` or `--fast`. Recommended for phases touching auth, payment, PII, migrations, or public APIs. Costs roughly 3× a normal review.
|
|
65
65
|
- `--hierarchical` (v3.4+, Claude Code only — needs native sub-agent spawning) — Spawn `pan-conductor` as a top-level orchestrator that decomposes the phase and spawns executor/reviewer/verifier sub-agents in sequence. `pan-conductor` runs on the reasoning tier under the default profile, which inherits the model you launched with (the `budget` profile drops it to mid). Bounded by safety harness: max 2 nesting levels, 12 spawns per phase, budget ceiling, `.planning/orchestration/abort` kill-switch. On runtimes that cannot spawn nested agents, this flag is a no-op with a warning and falls back to flat exec. Use only for large phases (≥4 autonomous plans) where wall-clock reduction justifies the ~20-30% orchestration tax.
|
|
66
66
|
|
|
67
67
|
Context files are resolved inside the workflow via `pan-tools init execute-phase` and per-subagent `<files_to_read>` blocks.
|
package/commands/pan/git.md
CHANGED
|
@@ -13,7 +13,7 @@ allowed-tools:
|
|
|
13
13
|
---
|
|
14
14
|
|
|
15
15
|
<objective>
|
|
16
|
-
Phase-aware git workflow with safety guardrails built in. Every subcommand that modifies history runs safety checks. Rollback uses PAN snapshot tags
|
|
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
18
|
Works with any git repository — PAN installation not required.
|
|
19
19
|
</objective>
|
|
@@ -185,7 +185,7 @@ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs git rollback --tag pan-rollback
|
|
|
185
185
|
```
|
|
186
186
|
|
|
187
187
|
**Rollback workflow:**
|
|
188
|
-
1. Lists all `pan-rollback-*` tags (created
|
|
188
|
+
1. Lists all `pan-rollback-*` tags (created with `pan-tools rollback-snapshot <phase>`)
|
|
189
189
|
2. Verifies working tree is clean (blocks on dirty tree unless `--dry-run`)
|
|
190
190
|
3. Runs `git reset --hard <tag>`
|
|
191
191
|
|
package/commands/pan/learn.md
CHANGED
|
@@ -18,12 +18,14 @@ Analyze the most recent trace session and generate an optimization report.
|
|
|
18
18
|
```
|
|
19
19
|
/pan:learn
|
|
20
20
|
/pan:learn --session <session-id>
|
|
21
|
+
/pan:learn --sessions 3
|
|
21
22
|
/pan:learn --experiment <slug>
|
|
22
23
|
/pan:learn --apply
|
|
23
24
|
```
|
|
24
25
|
|
|
25
26
|
**Flags:**
|
|
26
27
|
- `--session <id>` — analyze a specific session instead of the most recent
|
|
28
|
+
- `--sessions <n>` — pool the last n sessions into one analysis, so recommendations rest on failures that recur across runs
|
|
27
29
|
- `--experiment <slug>` *(v3.7.0+, W3)* — analyze a harvested experiment instead of the current project's traces. Reads from `<source-repo>/experiments/<slug>/.planning/optimization/` and writes the report to `<source-repo>/experiments/<slug>/learnings/report-<timestamp>.md`. Used by the self-improvement loop. Run `/pan:experiment harvest <slug>` first.
|
|
28
30
|
- `--apply` — automatically apply safe optimizations after generating the report (equivalent to running `/pan:optimize apply` immediately after)
|
|
29
31
|
|
package/commands/pan/optimize.md
CHANGED
|
@@ -19,6 +19,8 @@ Manage the circular optimization loop: apply recommendations, view stats, list r
|
|
|
19
19
|
```
|
|
20
20
|
/pan:optimize apply
|
|
21
21
|
/pan:optimize apply --report <filename>
|
|
22
|
+
/pan:optimize revert <apply_id>
|
|
23
|
+
/pan:optimize revert --last
|
|
22
24
|
/pan:optimize list
|
|
23
25
|
/pan:optimize stats
|
|
24
26
|
/pan:optimize trace init [--description "what you're building"]
|
|
@@ -42,7 +44,17 @@ Requires human review (never auto-applied):
|
|
|
42
44
|
- Workflow step additions
|
|
43
45
|
- Structural changes to commands
|
|
44
46
|
|
|
45
|
-
After applying, the report lists what was applied and what still needs review.
|
|
47
|
+
After applying, the report lists what was applied and what still needs review, plus the `apply_id` that undoes it. Every apply is recorded action by action in `.planning/optimization/applied.jsonl`: the path, whether the file was created or appended to, the exact text, and a hash of the file after the write. Applying the same report a second time writes nothing: each action names the apply that already wrote it.
|
|
48
|
+
|
|
49
|
+
### revert
|
|
50
|
+
Undo one apply exactly: delete the memory files it created and cut the text it appended (`revert --last` for the newest).
|
|
51
|
+
|
|
52
|
+
Revert never destroys work someone did since:
|
|
53
|
+
- It refuses a file whose content changed after the apply. The comparison ignores line endings, so a CRLF checkout still matches.
|
|
54
|
+
- It refuses a file that a later apply also wrote. Revert that later apply first.
|
|
55
|
+
- It says which files it refused, and why.
|
|
56
|
+
|
|
57
|
+
A CRLF file comes back CRLF. Applies logged before apply records existed cannot be reverted. After a revert, the same report can be applied again.
|
|
46
58
|
|
|
47
59
|
### list
|
|
48
60
|
List all optimization reports in `.planning/optimization/reports/`, most recent first.
|
|
@@ -52,7 +64,7 @@ Show cumulative optimization statistics:
|
|
|
52
64
|
- Total trace sessions run
|
|
53
65
|
- Total events traced
|
|
54
66
|
- Total errors/gaps/redundancies seen
|
|
55
|
-
- Total optimizations applied across all runs
|
|
67
|
+
- Total optimizations applied across all runs, the apply runs, the reverted runs, and the last `apply_id`
|
|
56
68
|
- Current active trace session (if any)
|
|
57
69
|
|
|
58
70
|
### trace init
|
|
@@ -38,7 +38,7 @@ Consolidates Spec B v1's X-4 (self-review) + X-12 (harden) into a single command
|
|
|
38
38
|
/pan:review-deep 07
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
-
Run after `/pan:exec-phase 07` completes.
|
|
41
|
+
Run after `/pan:exec-phase 07` completes. It reads the review that exec-phase's code-review step saved in the phase directory (`.planning/phases/07-<slug>/07-review.md`). The reviewer is read-only, so it is exec-phase that writes the review there.
|
|
42
42
|
|
|
43
43
|
### Integrated with exec-phase
|
|
44
44
|
|
|
@@ -46,7 +46,7 @@ Run after `/pan:exec-phase 07` completes. Requires `pan-reviewer` to have alread
|
|
|
46
46
|
/pan:exec-phase 07 --deep-review
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
Runs the normal exec → reviewer pipeline, then
|
|
49
|
+
Runs the normal exec → reviewer pipeline, then runs this command's process inline, before the verifier. Recommended for phases touching auth, payment, PII, migrations, or public APIs.
|
|
50
50
|
|
|
51
51
|
### Integrated with focus-exec
|
|
52
52
|
|
|
@@ -60,7 +60,7 @@ Per-item deep review during focus campaigns. Useful for high-stakes batches.
|
|
|
60
60
|
|
|
61
61
|
<process>
|
|
62
62
|
|
|
63
|
-
1. **Load reviewer output
|
|
63
|
+
1. **Load reviewer output.** Resolve the phase with `pan-tools find-phase <N>`, then read `{directory}/{phase_number}-review.md`, which exec-phase's code-review step wrote. If it is missing, warn and offer to run `pan-reviewer` first. Its findings come from the report's closing `pan-verdict` block.
|
|
64
64
|
|
|
65
65
|
2. **Spawn pan-hardener** (parallel-safe with step 3 isolation below, but recommended sequential for audit clarity):
|
|
66
66
|
- Prompt includes: `<files_to_read>` with phase plan + diff + reviewer output; `<output_path>` = `.planning/reviews/<N>/hardener.md`; `<framework_scope>` block reminding of OWASP/STRIDE coverage.
|
|
@@ -73,7 +73,7 @@ Per-item deep review during focus campaigns. Useful for high-stakes batches.
|
|
|
73
73
|
4. **Merge** — call:
|
|
74
74
|
```
|
|
75
75
|
pan-tools review-deep merge <N> \
|
|
76
|
-
--reviewer-file
|
|
76
|
+
--reviewer-file {directory}/{phase_number}-review.md \
|
|
77
77
|
--hardener-file .planning/reviews/<N>/hardener.md \
|
|
78
78
|
--meta-file .planning/reviews/<N>/meta.md
|
|
79
79
|
```
|
|
@@ -99,7 +99,7 @@ Verdict is driven by the highest-severity finding across all three sources. Meta
|
|
|
99
99
|
|
|
100
100
|
<output_files>
|
|
101
101
|
|
|
102
|
-
-
|
|
102
|
+
- `{phase_dir}/{phase_number}-review.md` — pan-reviewer output (written by exec-phase's code-review step)
|
|
103
103
|
- `.planning/reviews/<N>/hardener.md` — pan-hardener output (new)
|
|
104
104
|
- `.planning/reviews/<N>/meta.md` — pan-meta-reviewer output (new)
|
|
105
105
|
- `.planning/reviews/<N>/deep-review.md` — merged consolidated report (final deliverable)
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// context limits (the statusline only shows the user).
|
|
6
6
|
//
|
|
7
7
|
// How it works:
|
|
8
|
-
// 1. The statusline hook writes metrics to
|
|
8
|
+
// 1. The statusline hook writes metrics to <os tmpdir>/pan-hooks-<uid>/claude-ctx-{session_id}.json
|
|
9
9
|
// 2. This hook reads those metrics after each tool use
|
|
10
10
|
// 3. When remaining context drops below thresholds, it injects a warning
|
|
11
11
|
// as additionalContext, which the agent sees in its conversation
|