pan-wizard 3.33.0 → 3.35.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 +29 -26
- package/agents/pan-conductor.md +18 -17
- package/agents/pan-counterfactual.md +2 -2
- package/agents/pan-debugger.md +30 -9
- package/agents/pan-design-checker.md +2 -1
- package/agents/pan-designer.md +2 -2
- package/agents/pan-distiller.md +3 -3
- package/agents/pan-document_code.md +14 -14
- package/agents/pan-executor.md +30 -9
- package/agents/pan-experiment-runner.md +9 -8
- package/agents/pan-hardener.md +1 -1
- package/agents/pan-integration-checker.md +2 -2
- package/agents/pan-knowledge.md +1 -1
- package/agents/pan-meta-reviewer.md +4 -4
- package/agents/pan-optimizer.md +39 -43
- package/agents/pan-phase-researcher.md +10 -10
- package/agents/pan-plan-checker.md +37 -34
- package/agents/pan-planner.md +57 -44
- package/agents/pan-previewer.md +1 -1
- package/agents/pan-project-researcher.md +12 -12
- package/agents/pan-release.md +1 -1
- package/agents/pan-research-synthesizer.md +3 -3
- package/agents/pan-reviewer.md +26 -3
- package/agents/pan-roadmapper.md +15 -14
- package/agents/pan-verifier.md +33 -25
- package/bin/install-lib.cjs +176 -38
- package/bin/install.js +81 -63
- package/commands/pan/army.md +15 -11
- package/commands/pan/assumptions.md +2 -2
- package/commands/pan/audit-deployment.md +11 -12
- package/commands/pan/cost.md +8 -8
- package/commands/pan/dashboard.md +0 -3
- package/commands/pan/debug.md +10 -7
- package/commands/pan/design-phase.md +5 -5
- package/commands/pan/discuss-phase.md +2 -0
- package/commands/pan/exec-phase.md +21 -37
- package/commands/pan/experiment.md +9 -8
- package/commands/pan/focus-auto.md +22 -20
- package/commands/pan/focus-design.md +7 -6
- package/commands/pan/focus-doc-audit.md +4 -3
- package/commands/pan/focus-drift-walking.md +4 -3
- package/commands/pan/focus-exec.md +6 -6
- package/commands/pan/focus-plan.md +12 -11
- package/commands/pan/focus-scan.md +5 -3
- package/commands/pan/focus-sync.md +3 -2
- package/commands/pan/git.md +8 -8
- package/commands/pan/health.md +2 -2
- package/commands/pan/hud.md +4 -7
- package/commands/pan/hygiene.md +14 -7
- package/commands/pan/knowledge.md +9 -10
- package/commands/pan/learn.md +10 -7
- package/commands/pan/links.md +4 -1
- package/commands/pan/map-codebase.md +1 -1
- package/commands/pan/mcp-bridge.md +19 -21
- package/commands/pan/milestone-done.md +6 -3
- package/commands/pan/milestone-new.md +1 -1
- package/commands/pan/new-project.md +10 -10
- package/commands/pan/optimize.md +18 -14
- package/commands/pan/patches.md +2 -6
- package/commands/pan/pause.md +1 -1
- package/commands/pan/phase-tests.md +3 -2
- package/commands/pan/plan-phase.md +9 -19
- package/commands/pan/preview.md +2 -3
- package/commands/pan/profile.md +2 -2
- package/commands/pan/quick.md +1 -1
- package/commands/pan/remove-phase.md +1 -1
- package/commands/pan/report.md +3 -7
- package/commands/pan/research-phase.md +16 -15
- package/commands/pan/resume.md +9 -11
- package/commands/pan/retro.md +5 -3
- package/commands/pan/review-deep.md +7 -9
- package/commands/pan/settings.md +1 -1
- package/commands/pan/verify-phase.md +0 -11
- package/commands/pan/what-if.md +3 -4
- package/hooks/dist/pan-context-monitor.js +352 -44
- package/hooks/dist/pan-cost-logger.js +30 -0
- package/hooks/dist/pan-guard.js +244 -0
- package/hooks/dist/pan-statusline.js +73 -24
- package/hooks/dist/pan-stop-guard.js +7 -2
- package/package.json +1 -1
- package/pan-wizard-core/bin/lib/agents-md.cjs +44 -6
- package/pan-wizard-core/bin/lib/bridge.cjs +6 -5
- package/pan-wizard-core/bin/lib/campaign.cjs +4 -2
- package/pan-wizard-core/bin/lib/commands-learnings.cjs +19 -2
- package/pan-wizard-core/bin/lib/commands.cjs +57 -6
- package/pan-wizard-core/bin/lib/config.cjs +7 -1
- package/pan-wizard-core/bin/lib/constants.cjs +18 -6
- package/pan-wizard-core/bin/lib/context-budget.cjs +12 -9
- package/pan-wizard-core/bin/lib/core.cjs +53 -19
- package/pan-wizard-core/bin/lib/cost-rebuild.cjs +13 -1
- package/pan-wizard-core/bin/lib/cost.cjs +142 -13
- package/pan-wizard-core/bin/lib/distill.cjs +6 -3
- package/pan-wizard-core/bin/lib/doc-lint.cjs +30 -11
- package/pan-wizard-core/bin/lib/findings.cjs +135 -21
- package/pan-wizard-core/bin/lib/focus.cjs +13 -4
- package/pan-wizard-core/bin/lib/frontmatter.cjs +105 -26
- package/pan-wizard-core/bin/lib/hygiene.cjs +184 -17
- package/pan-wizard-core/bin/lib/init.cjs +13 -4
- package/pan-wizard-core/bin/lib/knowledge.cjs +17 -1
- package/pan-wizard-core/bin/lib/learn-index.cjs +111 -10
- package/pan-wizard-core/bin/lib/learn-lint.cjs +30 -3
- package/pan-wizard-core/bin/lib/memory-optimize.cjs +8 -4
- package/pan-wizard-core/bin/lib/memory.cjs +508 -54
- package/pan-wizard-core/bin/lib/milestone.cjs +8 -3
- package/pan-wizard-core/bin/lib/optimize.cjs +97 -17
- package/pan-wizard-core/bin/lib/phase-gate.cjs +174 -0
- package/pan-wizard-core/bin/lib/phase-remove.cjs +85 -21
- package/pan-wizard-core/bin/lib/phase-report.cjs +8 -2
- package/pan-wizard-core/bin/lib/phase.cjs +39 -13
- package/pan-wizard-core/bin/lib/preview.cjs +34 -31
- package/pan-wizard-core/bin/lib/roadmap-compact.cjs +267 -0
- package/pan-wizard-core/bin/lib/roadmap.cjs +243 -9
- package/pan-wizard-core/bin/lib/runner.cjs +2 -1
- package/pan-wizard-core/bin/lib/state-compact.cjs +11 -6
- package/pan-wizard-core/bin/lib/state.cjs +43 -28
- package/pan-wizard-core/bin/lib/template.cjs +11 -4
- package/pan-wizard-core/bin/lib/verdict.cjs +140 -10
- package/pan-wizard-core/bin/lib/verify-integrity.cjs +181 -0
- package/pan-wizard-core/bin/lib/verify-plan-set.cjs +230 -0
- package/pan-wizard-core/bin/lib/verify-preflight.cjs +4 -13
- package/pan-wizard-core/bin/lib/verify-retro.cjs +5 -3
- package/pan-wizard-core/bin/lib/verify-scope.cjs +11 -7
- package/pan-wizard-core/bin/lib/verify.cjs +30 -28
- package/pan-wizard-core/bin/lib/whatif.cjs +53 -9
- package/pan-wizard-core/bin/pan-tools.cjs +114 -19
- package/pan-wizard-core/learnings/index.json +5 -5
- package/pan-wizard-core/mcp/merge-gate.cjs +14 -3
- package/pan-wizard-core/mcp/native-tools.cjs +3 -3
- package/pan-wizard-core/opencode/pan-wizard.js +139 -0
- package/pan-wizard-core/references/checkpoints.md +3 -3
- package/pan-wizard-core/references/continuation-format.md +3 -3
- package/pan-wizard-core/references/decimal-phase-calculation.md +2 -3
- package/pan-wizard-core/references/design-methodology.md +1 -1
- package/pan-wizard-core/references/git-integration.md +4 -6
- package/pan-wizard-core/references/git-planning-commit.md +2 -2
- package/pan-wizard-core/references/guardrails.md +2 -2
- package/pan-wizard-core/references/handoff-decisions.md +3 -3
- package/pan-wizard-core/references/model-profile-resolution.md +5 -5
- package/pan-wizard-core/references/model-profiles.md +15 -10
- package/pan-wizard-core/references/phase-argument-parsing.md +7 -7
- package/pan-wizard-core/references/planning-config.md +7 -7
- package/pan-wizard-core/references/tdd.md +10 -1
- package/pan-wizard-core/references/verdict-contract.md +6 -1
- package/pan-wizard-core/references/verification-patterns.md +5 -5
- package/pan-wizard-core/templates/codebase/architecture.md +2 -2
- package/pan-wizard-core/templates/codebase/best-practices.md +2 -2
- package/pan-wizard-core/templates/codebase/concerns.md +3 -3
- package/pan-wizard-core/templates/codebase/integrations.md +6 -6
- package/pan-wizard-core/templates/codebase/relationships.md +2 -2
- package/pan-wizard-core/templates/codebase/stack.md +2 -2
- package/pan-wizard-core/templates/codebase/structure.md +4 -4
- package/pan-wizard-core/templates/codebase/testing.md +4 -4
- package/pan-wizard-core/templates/config.json +2 -6
- package/pan-wizard-core/templates/continue-here.md +1 -1
- package/pan-wizard-core/templates/debug-subagent-prompt.md +5 -3
- package/pan-wizard-core/templates/debug.md +15 -1
- package/pan-wizard-core/templates/milestone-archive.md +6 -6
- package/pan-wizard-core/templates/milestone.md +1 -1
- package/pan-wizard-core/templates/phase-prompt.md +31 -17
- package/pan-wizard-core/templates/planner-subagent-prompt.md +5 -5
- package/pan-wizard-core/templates/preview-report.md +1 -1
- package/pan-wizard-core/templates/research-project/architecture.md +3 -3
- package/pan-wizard-core/templates/research-project/features.md +1 -1
- package/pan-wizard-core/templates/research-project/pitfalls.md +1 -1
- package/pan-wizard-core/templates/research-project/stack.md +3 -3
- package/pan-wizard-core/templates/research.md +5 -5
- package/pan-wizard-core/templates/retrospective.md +1 -1
- package/pan-wizard-core/templates/roadmap.md +15 -15
- package/pan-wizard-core/templates/state.md +4 -4
- package/pan-wizard-core/templates/summary-complex.md +1 -0
- package/pan-wizard-core/templates/summary-minimal.md +1 -0
- package/pan-wizard-core/templates/summary-standard.md +2 -1
- package/pan-wizard-core/templates/summary.md +18 -2
- package/pan-wizard-core/templates/uat.md +3 -3
- package/pan-wizard-core/templates/user-setup.md +8 -8
- package/pan-wizard-core/templates/verification-report.md +53 -8
- package/pan-wizard-core/workflows/add-phase.md +1 -1
- package/pan-wizard-core/workflows/assumptions.md +1 -1
- package/pan-wizard-core/workflows/diagnose-issues.md +4 -4
- package/pan-wizard-core/workflows/discuss-phase.md +10 -8
- package/pan-wizard-core/workflows/exec-phase.md +75 -95
- package/pan-wizard-core/workflows/execute-plan.md +8 -7
- package/pan-wizard-core/workflows/health.md +13 -12
- package/pan-wizard-core/workflows/help.md +8 -9
- package/pan-wizard-core/workflows/learn.md +13 -11
- package/pan-wizard-core/workflows/map-codebase.md +10 -10
- package/pan-wizard-core/workflows/milestone-audit.md +10 -10
- package/pan-wizard-core/workflows/milestone-gaps.md +18 -25
- package/pan-wizard-core/workflows/milestone-new.md +7 -6
- package/pan-wizard-core/workflows/new-project.md +17 -25
- package/pan-wizard-core/workflows/optimize.md +11 -9
- package/pan-wizard-core/workflows/pause.md +6 -1
- package/pan-wizard-core/workflows/phase-tests.md +4 -4
- package/pan-wizard-core/workflows/plan-phase.md +53 -42
- package/pan-wizard-core/workflows/profile.md +2 -2
- package/pan-wizard-core/workflows/progress.md +6 -8
- package/pan-wizard-core/workflows/quick.md +7 -5
- package/pan-wizard-core/workflows/remove-phase.md +1 -1
- package/pan-wizard-core/workflows/research-phase.md +9 -5
- package/pan-wizard-core/workflows/resume-project.md +4 -6
- package/pan-wizard-core/workflows/retro.md +3 -1
- package/pan-wizard-core/workflows/settings.md +16 -24
- package/pan-wizard-core/workflows/todo-check.md +4 -3
- package/pan-wizard-core/workflows/transition.md +16 -12
- package/pan-wizard-core/workflows/update.md +25 -17
- package/pan-wizard-core/workflows/verify-phase.md +22 -20
- package/pan-zcode/KNOWN-BETA-RISKS.md +2 -2
- package/pan-zcode/README.md +7 -7
- package/pan-zcode/bin/install-zcode.js +1 -1
- package/scripts/build-hooks.js +1 -0
- package/scripts/build-plugin.js +3 -1
- package/scripts/generate-skills-docs.py +15 -6
- package/scripts/prompt-lint.cjs +167 -0
- package/scripts/test-surface.cjs +1 -0
package/README.md
CHANGED
|
@@ -45,7 +45,7 @@ PAN is the context engineering layer that makes Claude Code reliable. It breaks
|
|
|
45
45
|
```text
|
|
46
46
|
┌─────────────────────────────────────────────────────────────┐
|
|
47
47
|
│ YOU │
|
|
48
|
-
│ /pan:new-project → /pan:plan-phase → /pan:exec-phase
|
|
48
|
+
│ /pan:new-project → /pan:plan-phase → /pan:exec-phase │
|
|
49
49
|
└─────────────────────┬───────────────────────────────────────┘
|
|
50
50
|
│ invokes
|
|
51
51
|
┌─────────────────────▼───────────────────────────────────────┐
|
|
@@ -91,7 +91,7 @@ PAN is the context engineering layer that makes Claude Code reliable. It breaks
|
|
|
91
91
|
| **1 · Release** | `pan-release` | Ships behind a human gate | `always-ask` |
|
|
92
92
|
| **2 · Workers** | the utility agents `pan-tools squad list` reports under `workers` | Narrow, high-volume jobs | scoped |
|
|
93
93
|
|
|
94
|
-
**Mission Control runs on your session's model** — `pan-conductor` declares no `model
|
|
94
|
+
**Mission Control runs on your session's model** — `pan-conductor` declares no `model:` and no spawn passes one, so it inherits whatever you launched with under every profile (`resolve-model` reports the `budget` profile's mid tier for it, but nothing applies that).
|
|
95
95
|
|
|
96
96
|
**Reading the Access column.** The backticked values are the squad `access` labels `pan-tools squad list` reports; the tier-0 and tier-2 labels are PAN's own. Either way they describe the *role contract* PAN's prompts assign, not a sandbox — `squads.cjs` "modifies no agent and changes no execution path", so a label can differ from what an agent may actually do. The real tool grant is each agent's own `tools:` frontmatter (`grep '^tools:' agents/*.md`), and Mission Control's includes `Write` and `Bash`. The rail those grants do enforce is delegation depth: `grep -l '^tools:.*Task' agents/*.md` names every agent able to spawn another (today, the coordinator), so a squad agent cannot fan out further even if asked to. For the irreversible steps, back the convention with branch protection on your own repo.
|
|
97
97
|
|
|
@@ -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
|
|
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 applies the cycle cap, the budget cap (when `caps.enforceBudget` is set) and an `aborted` flag to the counts and caps the caller passes in — it tracks none of them and does not read the abort file; only the merge is gated independently of the caller, by `pan_confirm_merge`'s human approval token — 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 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
|
|
|
@@ -130,7 +130,7 @@ People who want to describe what they want and have it built correctly — witho
|
|
|
130
130
|
npx pan-wizard@latest
|
|
131
131
|
```
|
|
132
132
|
|
|
133
|
-
The installer prompts you to choose the **runtime** — Claude Code, OpenCode, Gemini, Codex, Copilot CLI, or all. Location is not prompted: it defaults to the current project (`--local`)
|
|
133
|
+
The installer prompts you to choose the **runtime** — Claude Code, OpenCode, Gemini, Codex, Copilot CLI, or all. Location is not prompted: it defaults to the current project (`--local`). To install into your home config directory instead, pass `--global` with a runtime flag, such as `--claude --global`. `--global` alone skips the runtime prompt and installs Claude Code.
|
|
134
134
|
|
|
135
135
|
Verify with:
|
|
136
136
|
- Claude Code / Gemini: `/pan:help`
|
|
@@ -142,7 +142,7 @@ Verify with:
|
|
|
142
142
|
|
|
143
143
|
### Staying Updated
|
|
144
144
|
|
|
145
|
-
PAN evolves fast.
|
|
145
|
+
PAN evolves fast. Update periodically with `/pan:update`, which reads from the install's own path whether it is local or global and which runtime it belongs to, and reinstalls that runtime. For an install made with `--config-dir` or `--unified-skills`, which it cannot tell from the path, 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
|
|
@@ -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. A local install also writes outside the runtime directory: a marker-fenced PAN section in the project's `AGENTS.md`; for Claude Code,
|
|
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, a marker-fenced block in `CLAUDE.md` (the `@AGENTS.md` import, and compact instructions that keep PAN's position through compaction) 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.
|
|
@@ -363,7 +363,7 @@ The system:
|
|
|
363
363
|
1. **Runs plans in waves** — Parallel where possible, sequential when dependent
|
|
364
364
|
2. **Fresh context per plan** — a whole context window purely for implementation, zero accumulated garbage (native sub-agent spawning on Claude Code; the other runtimes delegate through their own agent mechanism)
|
|
365
365
|
3. **Commits per task** — Every task gets its own atomic commit (consecutive trivial chore or docs tasks may be coalesced into one)
|
|
366
|
-
4. **Verifies against goals** — Checks the codebase delivers what the phase promised
|
|
366
|
+
4. **Verifies against goals** — Checks the codebase delivers what the phase promised (skipped, and said so, when `workflow.verifier` is off)
|
|
367
367
|
|
|
368
368
|
Walk away, come back to completed work with clean git history.
|
|
369
369
|
|
|
@@ -399,7 +399,7 @@ Plans are grouped into "waves" based on dependencies. Within each wave, plans ru
|
|
|
399
399
|
|
|
400
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).
|
|
401
401
|
|
|
402
|
-
**Creates:** `{phase_num}-{N}-summary.md`, `{phase_num}-review.md` (unless `--skip-review` or `--fast`), `{phase_num}-verification.md`
|
|
402
|
+
**Creates:** `{phase_num}-{N}-summary.md`, `{phase_num}-review.md` (unless `--skip-review` or `--fast`), `{phase_num}-verification.md` (unless `workflow.verifier` is off)
|
|
403
403
|
|
|
404
404
|
---
|
|
405
405
|
|
|
@@ -415,7 +415,7 @@ Automated verification checks that code exists and tests pass. `/pan:verify-phas
|
|
|
415
415
|
|
|
416
416
|
The system:
|
|
417
417
|
|
|
418
|
-
1. **Gates on the test suite** —
|
|
418
|
+
1. **Gates on the test suite** — the verifier's protocol sets the verdict to `gaps_found` when the suite fails or cannot run, and the must-have checks still run so the report is complete; the recorder flags a failed gate filed under `passed` (`test_gate_failed_under_pass`) but does not overwrite the status
|
|
419
419
|
2. **Checks every must-have** — each phase promise is verified against the code, not the task list
|
|
420
420
|
3. **Reports the gaps** — a verification report with a per-truth status and the recommended fix plans
|
|
421
421
|
4. **Hands the gaps to the planner** — `/pan:plan-phase N --gaps` writes the fix plans (`gap_closure: true`); `/pan:exec-phase N --gaps-only` runs just those
|
|
@@ -528,7 +528,7 @@ Every stage uses the same pattern: a thin orchestrator spawns specialized agents
|
|
|
528
528
|
|
|
529
529
|
The orchestrator never does heavy lifting. It spawns agents, waits, integrates results.
|
|
530
530
|
|
|
531
|
-
**The result:** You can run an entire phase — deep research, multiple plans created and verified, thousands of lines of code written across parallel executors, automated verification against goals — and your main context window stays
|
|
531
|
+
**The result:** You can run an entire phase — deep research, multiple plans created and verified, thousands of lines of code written across parallel executors, automated verification against goals — and your main context window stays small, because the work happens in fresh subagent contexts. Your session stays fast and responsive.
|
|
532
532
|
|
|
533
533
|
### Reasoning-Trace Handoff
|
|
534
534
|
|
|
@@ -545,8 +545,8 @@ PAN runs autonomous experiments in isolated folders, harvests the resulting tele
|
|
|
545
545
|
|
|
546
546
|
- `learnings/universal/<topic>.md` — patterns that ship to every install (atomic-state, concurrency, idempotency, secret-handling, test-patterns, …). Loaded by planner / executor / verifier agents during their work.
|
|
547
547
|
- `learnings/internal/<topic>.md` — PAN-development patterns; source-only (stripped at install).
|
|
548
|
-
- `learnings/index.json` — topic→agent-relevance map. Workflows call `pan-tools learn topics-for --agent <role> --token-budget N` to load only
|
|
549
|
-
- `pan-tools learn lint` — integrity check (duplicate IDs, dangling refs, scope leaks).
|
|
548
|
+
- `learnings/index.json` — topic→agent-relevance map. Workflows call `pan-tools learn topics-for --agent <role> --cue "<the task>" --token-budget N` to load only the topics that match the task (falling back to the role's tagged topics when none does) instead of skim-everything (avoids the distractor-density anti-pattern).
|
|
549
|
+
- `pan-tools learn lint` — integrity check (duplicate IDs, dangling refs, scope leaks, citations whose code is gone). Contributors run it through the source repo's `/check` dev command.
|
|
550
550
|
|
|
551
551
|
### Atomic Git Commits
|
|
552
552
|
|
|
@@ -582,7 +582,7 @@ You're never locked in. The system adapts.
|
|
|
582
582
|
| **Context rot prevention** | Phase-scoped fresh context windows (native sub-agents on Claude Code) | No — context degrades over time | No (Cline: condensing) | No |
|
|
583
583
|
| **Multi-agent** | Specialized agents, parallel waves | Parallel agents in worktrees (Cursor) | Single agent (Cline: subagents) | Custom agents as subagents |
|
|
584
584
|
| **Plan → Verify loop** | Research → plan → verify with iteration | Agent generates plan | Plan mode (Cline) | Plan step |
|
|
585
|
-
| **Post-execution verification** | Auto verifier
|
|
585
|
+
| **Post-execution verification** | Auto verifier with a test-suite gate (UAT is a template no command runs) | Iterative error-fix | Manual test runs | Auto-fix loop |
|
|
586
586
|
| **Session persistence** | state.md + pause/resume + handoff | Memory tool / transcripts | None / checkpoints (Cline) | Copilot Memory, CLI session recovery |
|
|
587
587
|
| **Runtime support** | Claude Code, OpenCode, Gemini CLI, Codex, Copilot CLI | IDE-locked | Terminal / VS Code | VS Code + CLI |
|
|
588
588
|
| **Zero dependencies** | Yes (Node builtins only) | No (Electron) | No (Python / Node) | No |
|
|
@@ -601,7 +601,7 @@ PAN is not a replacement for your IDE or AI agent — it's the orchestration lay
|
|
|
601
601
|
|---------|--------------|
|
|
602
602
|
| `/pan:new-project [--auto]` | Full initialization: questions → research → requirements → roadmap |
|
|
603
603
|
| `/pan:discuss-phase <N> [--auto]` | Capture implementation decisions before planning |
|
|
604
|
-
| `/pan:design-phase
|
|
604
|
+
| `/pan:design-phase <N>` | Design a phase — architecture, ADR, threat-lite — before planning |
|
|
605
605
|
| `/pan:plan-phase [N] [--auto]` | Research + plan + verify for a phase |
|
|
606
606
|
| `/pan:exec-phase <N>` | Execute all plans in parallel waves, verify when complete |
|
|
607
607
|
| `/pan:verify-phase [N]` | Re-run goal-backward verification with a test-suite gate; lists gaps for `/pan:plan-phase N --gaps` ¹ |
|
|
@@ -630,7 +630,7 @@ PAN is not a replacement for your IDE or AI agent — it's the orchestration lay
|
|
|
630
630
|
|
|
631
631
|
| Command | What it does |
|
|
632
632
|
|---------|--------------|
|
|
633
|
-
| `/pan:army "<goal>"` | Campaign-scale delivery: Mission Control delegates a whole-project goal to architecture/build/quality/release squads with branch-per-agent worktrees, behind CI + a human merge gate; `--schedule`/`--continue` run it over time |
|
|
633
|
+
| `/pan:army "<goal>"` | Campaign-scale delivery: Mission Control delegates a whole-project goal to architecture/build/quality/release squads with branch-per-agent worktrees, behind CI + a human merge gate (prompt-enforced on `/pan:army`; enforced in code on the MCP path); `--schedule`/`--continue` run it over time |
|
|
634
634
|
|
|
635
635
|
### Phase Management
|
|
636
636
|
|
|
@@ -639,7 +639,7 @@ PAN is not a replacement for your IDE or AI agent — it's the orchestration lay
|
|
|
639
639
|
| `/pan:add-phase <description>` | Append phase to roadmap |
|
|
640
640
|
| `/pan:insert-phase <after> <description>` | Insert urgent work between phases |
|
|
641
641
|
| `/pan:remove-phase <N>` | Remove future phase, renumber |
|
|
642
|
-
| `/pan:assumptions
|
|
642
|
+
| `/pan:assumptions <N>` | See Claude's intended approach before planning |
|
|
643
643
|
| `/pan:milestone-gaps` | Create phases to close gaps from audit |
|
|
644
644
|
|
|
645
645
|
### Session
|
|
@@ -660,13 +660,13 @@ PAN is not a replacement for your IDE or AI agent — it's the orchestration lay
|
|
|
660
660
|
| `/pan:debug [desc]` | Systematic debugging with persistent state |
|
|
661
661
|
| `/pan:quick [--full]` | Execute ad-hoc task with PAN guarantees (`--full` adds plan-checking and verification) |
|
|
662
662
|
| `/pan:health [--repair]` | Validate `.planning/` directory integrity; `--repair` fixes the issues it marks repairable |
|
|
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
|
|
664
|
-
| `/pan:links [--strict]` | Validate the doc-code link graph: inline `[[<id>]]` refs, `// @pan:` source anchors, `require-code-mention` contracts (ADR-0027) |
|
|
665
|
-
| `/pan:phase-tests <N> [instructions]` | Generate tests for a completed phase
|
|
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 and stale or expired memory entries, poisoned cost ledgers, trace and report debris, cached-context bloat, fragment planning dirs) and Claude Code's own memory index (reported, never edited); `--apply` executes the safe fixes — poisoned ledgers are quarantined by rename (only the newest quarantine copy is kept), and settled `state.md` history, shipped roadmap phases and stale memory entries are archived rather than dropped |
|
|
664
|
+
| `/pan:links [--strict] [--doc-root <dir>] [--source-root <dir>]` | Validate the doc-code link graph: inline `[[<id>]]` refs, `// @pan:` source anchors, `require-code-mention` contracts (ADR-0027). The default roots are PAN's own source layout, so pass your project's roots |
|
|
665
|
+
| `/pan:phase-tests <N> [instructions]` | Generate tests for a completed phase from its summaries, context decisions and verification report |
|
|
666
666
|
| `/pan:milestone-cleanup` | Archive accumulated phase directories from completed milestones |
|
|
667
667
|
| `/pan:retro` | Milestone retrospective — estimation accuracy, verification patterns, gap analysis |
|
|
668
668
|
| `/pan:patches` | Restore local modifications after a PAN update |
|
|
669
|
-
| `/pan:research-phase
|
|
669
|
+
| `/pan:research-phase <N>` | Standalone deep research for a phase (usually part of plan-phase) |
|
|
670
670
|
| `/pan:phase-budget` | Estimate context window utilization for current phase |
|
|
671
671
|
| `/pan:experiment <subcommand>` | Manage external self-improvement experiments — scaffold, run, harvest, promote findings back to PAN (never inside the PAN source repo) |
|
|
672
672
|
|
|
@@ -677,8 +677,8 @@ PAN is not a replacement for your IDE or AI agent — it's the orchestration lay
|
|
|
677
677
|
| Command | What it does |
|
|
678
678
|
|---------|--------------|
|
|
679
679
|
| `pan-tools preflight [target]` | Pre-flight validation: state, blockers, git clean, config, error patterns |
|
|
680
|
-
| `pan-tools dashboard` | Aggregated project overview as JSON: phase, progress, blockers, next
|
|
681
|
-
| `pan-tools learnings extract` |
|
|
680
|
+
| `pan-tools dashboard` | Aggregated project overview as JSON: phase, progress, blockers, next phase (for the visual HTML dashboard, see `/pan:hud`) |
|
|
681
|
+
| `pan-tools learnings extract` | Extract learnings from error patterns (`patterns.md`) and phase summaries |
|
|
682
682
|
| `pan-tools learnings list` | List all extracted learnings with type breakdown |
|
|
683
683
|
| `pan-tools learnings prune` | Remove old learnings by age (`--days N`) or ID (`--id LEARN-NNN`) |
|
|
684
684
|
| `pan-tools deps validate` | Cross-reference roadmap vs disk phases, detect orphaned requirements |
|
|
@@ -705,14 +705,14 @@ PAN is not a replacement for your IDE or AI agent — it's the orchestration lay
|
|
|
705
705
|
| `/pan:review-deep <phase>` | Security audit (OWASP + STRIDE) + cross-check by meta-reviewer |
|
|
706
706
|
| `/pan:knowledge {ask\|discuss\|playbook}` | Grounded Q&A, multi-turn discussion, or aggregate memory into playbook |
|
|
707
707
|
| `/pan:what-if <phase> "scenario"` | Counterfactual phase replay in isolated git worktree |
|
|
708
|
-
| `/pan:mcp-bridge {list\|recommend\|cache}` |
|
|
708
|
+
| `/pan:mcp-bridge {list\|recommend\|cache}` | List the MCP tools recorded in its cache (only `cache --servers` or an external script writes it) and recommend the ones relevant to a phase |
|
|
709
709
|
|
|
710
710
|
### Optimization & Git
|
|
711
711
|
|
|
712
712
|
| Command | What it does |
|
|
713
713
|
|---------|--------------|
|
|
714
|
-
| `/pan:learn` | Analyze trace events
|
|
715
|
-
| `/pan:optimize {apply\|revert\|list\|stats\|trace}` |
|
|
714
|
+
| `/pan:learn` | Analyze trace events and write an optimization report. `/pan:optimize apply` records its suggestions; nothing is applied automatically |
|
|
715
|
+
| `/pan:optimize {apply\|revert\|list\|stats\|trace}` | Record a report's suggestions for a person to act on (`apply`: notes in `.planning/optimization/suggestions.md`, config notes in `config-suggestions.md`), undo one apply (`revert <apply_id>` or `revert --last`), list reports, view stats, manage trace sessions |
|
|
716
716
|
| `/pan:git <subcommand>` | Phase-aware git workflow: commit/branch/push/status/log/stash/diff/rollback/tag/sync |
|
|
717
717
|
| `/pan:audit-deployment <target-directory> [--enhancements] [--repair]` | Audit a PAN installation for integrity, project health, and draft enhancement specs |
|
|
718
718
|
|
|
@@ -830,12 +830,15 @@ This prevents Claude from reading these files entirely, regardless of what comma
|
|
|
830
830
|
- 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`
|
|
831
831
|
- For Codex, verify skills exist in `~/.agents/skills/pan-*/SKILL.md` (global) or `./.agents/skills/pan-*/SKILL.md` (local)
|
|
832
832
|
- For Copilot CLI, verify skills exist in `~/.copilot/skills/pan-*/SKILL.md` (global) or `./.github/skills/pan-*/SKILL.md` (local)
|
|
833
|
+
- For OpenCode, verify files exist in `~/.config/opencode/commands/pan-*.md` (global) or `./.opencode/commands/pan-*.md` (local)
|
|
834
|
+
- For Gemini CLI, verify files exist in `~/.gemini/commands/pan/*.toml` (global) or `./.gemini/commands/pan/*.toml` (local)
|
|
835
|
+
- After a `--unified-skills` install, the runtimes other than Claude Code read `./.agents/skills/pan-*/SKILL.md` (`~/.agents/skills/` after `--global`)
|
|
833
836
|
|
|
834
837
|
**Commands not working as expected?**
|
|
835
838
|
- Run `/pan:help` (`/pan-help` on OpenCode, Copilot CLI and unified Claude installs; `$pan-help` on Codex) to verify installation
|
|
836
839
|
- Re-run `npx pan-wizard` with the flags you installed with (the runtime, `--global`/`--local`, and any `--config-dir` or `--unified-skills`) to reinstall
|
|
837
840
|
|
|
838
|
-
**Updating to the latest version?**
|
|
841
|
+
**Updating to the latest version?** Run `/pan:update`; it reinstalls the runtime it runs in. For an install made with `--config-dir` or `--unified-skills`, re-run the installer with the flags you installed with (`--global` for a global install):
|
|
839
842
|
```bash
|
|
840
843
|
npx pan-wizard@latest
|
|
841
844
|
```
|
package/agents/pan-conductor.md
CHANGED
|
@@ -12,7 +12,7 @@ You are the PAN conductor. You coordinate a hierarchical execution of a phase: d
|
|
|
12
12
|
You are spawned by `/pan:exec-phase <N> --hierarchical`. Without that flag, the normal flat exec path runs instead — you are never invoked by default.
|
|
13
13
|
|
|
14
14
|
**CRITICAL: Mandatory Initial Read**
|
|
15
|
-
If the prompt contains a `<files_to_read>` block, you MUST use the `Read` tool to load every file listed there before performing any other actions. This includes the phase plan
|
|
15
|
+
If the prompt contains a `<files_to_read>` block, you MUST use the `Read` tool to load every file listed there before performing any other actions. This includes the phase plan and any audit log from prior runs.
|
|
16
16
|
</role>
|
|
17
17
|
|
|
18
18
|
<safety_harness>
|
|
@@ -25,7 +25,7 @@ This agent changes PAN's execution model — agents-spawn-agents is inherently r
|
|
|
25
25
|
|-----|-------|-----------------------|
|
|
26
26
|
| Nesting depth | 2 levels (you → sub-agent) | You may NOT spawn an agent that is instructed to spawn further agents |
|
|
27
27
|
| Spawns per phase | 12 total | At spawn 12, continue without further spawning; document what was skipped |
|
|
28
|
-
| Points budget |
|
|
28
|
+
| Points budget | `total_budget_points` from `pan-tools init execute-phase <N>` (config `budget.default_points`, default 50) | When remaining budget < next sub-agent's estimate, stop spawning |
|
|
29
29
|
| Abort file | `.planning/orchestration/abort` | If this file exists at any point, abandon immediately (no graceful rollback, just stop and log state) |
|
|
30
30
|
|
|
31
31
|
**Before each spawn, you MUST:**
|
|
@@ -45,13 +45,13 @@ This agent changes PAN's execution model — agents-spawn-agents is inherently r
|
|
|
45
45
|
|
|
46
46
|
Given a phase plan, decompose into **sub-tasks** that correspond to sub-agents:
|
|
47
47
|
|
|
48
|
-
1. **Read the plan first.** Don't decompose from the phase title — read
|
|
48
|
+
1. **Read the plan first.** Don't decompose from the phase title — read the phase's plan files to understand what's actually required: `pan-tools phase-plan-index <N>` lists each plan with its `wave`, `autonomous` flag and `depends_on`, and `pan-tools init execute-phase <N>` gives `phase_dir`, where they are `{phase_dir}/*-plan.md`.
|
|
49
49
|
|
|
50
50
|
2. **Natural sub-agent boundaries:**
|
|
51
|
-
- **Executor sub-agents (up to 6):** one per `-plan.md` file that's marked `autonomous: true` in frontmatter. Non-autonomous plans
|
|
52
|
-
- **Reviewer (1):**
|
|
53
|
-
- **Verifier (1):**
|
|
54
|
-
- Optional hardener + meta-reviewer (2): only if `--deep-review` was also passed.
|
|
51
|
+
- **Executor sub-agents (up to 6):** one per `-plan.md` file that's marked `autonomous: true` in frontmatter. Non-autonomous plans need user checkpoints, which you cannot pause for: do not run them, and list them under "Skipped" in your summary with the instruction to run them with `/pan:exec-phase <N>` (no `--hierarchical`) — nothing runs them after you return.
|
|
52
|
+
- **Reviewer (1):** spawn a `pan-reviewer` after all executors complete, unless `--skip-review` or `--fast` was passed.
|
|
53
|
+
- **Verifier (1):** spawn a `pan-verifier` after the reviewer, unless `workflow.verifier` is false.
|
|
54
|
+
- Optional hardener + meta-reviewer (2): only if `--deep-review` was also passed and the reviewer ran — like exec-phase, skip the deep review under `--skip-review` or `--fast`, since its merge needs the reviewer's report.
|
|
55
55
|
|
|
56
56
|
3. **Wave grouping:** executors with no cross-plan dependencies can be grouped (within the 12-spawn cap). Sequential executors when `depends_on:` frontmatter indicates.
|
|
57
57
|
|
|
@@ -83,7 +83,7 @@ Append-only structured log. Entries:
|
|
|
83
83
|
|
|
84
84
|
For each lifecycle event, also publish to the bus (see `bus.cjs`):
|
|
85
85
|
|
|
86
|
-
```
|
|
86
|
+
```bash
|
|
87
87
|
pan-tools bus publish orchestrator <payload-json> --source pan-conductor
|
|
88
88
|
```
|
|
89
89
|
|
|
@@ -95,7 +95,7 @@ The bus channel is append-only and diagnostic. The trace.json is authoritative f
|
|
|
95
95
|
|
|
96
96
|
For each phase execution:
|
|
97
97
|
|
|
98
|
-
```
|
|
98
|
+
```text
|
|
99
99
|
1. Load phase plan + safety config
|
|
100
100
|
2. Decompose into sub-tasks
|
|
101
101
|
3. For each wave of executors (up to 6 per wave, 12 total):
|
|
@@ -106,10 +106,11 @@ For each phase execution:
|
|
|
106
106
|
e. Publish to bus
|
|
107
107
|
4. After all executors:
|
|
108
108
|
a. Spawn pan-reviewer (always, unless --skip-review or --fast)
|
|
109
|
+
b. Save its returned report verbatim to {phase_dir}/{phase_number}-review.md (the reviewer is read-only; exec-phase's code_review step saves it the same way), then: pan-tools findings record --phase <N> --agent pan-reviewer --file {phase_dir}/{phase_number}-review.md
|
|
109
110
|
5. After reviewer:
|
|
110
|
-
a. If --deep-review: spawn pan-hardener
|
|
111
|
-
b. Merge
|
|
112
|
-
6. Spawn pan-verifier (
|
|
111
|
+
a. If --deep-review and the reviewer ran (not --skip-review/--fast): spawn pan-hardener (<output_path> .planning/reviews/<N>/hardener.md), then pan-meta-reviewer (<output_path> .planning/reviews/<N>/meta.md)
|
|
112
|
+
b. Merge: pan-tools review-deep merge <N> --reviewer-file {phase_dir}/{phase_number}-review.md --hardener-file .planning/reviews/<N>/hardener.md --meta-file .planning/reviews/<N>/meta.md
|
|
113
|
+
6. Spawn pan-verifier — unless `workflow.verifier` is false: then report "verification skipped (workflow.verifier is off)", as exec-phase does
|
|
113
114
|
7. Emit final orchestration summary
|
|
114
115
|
```
|
|
115
116
|
|
|
@@ -165,11 +166,11 @@ skipped: 2
|
|
|
165
166
|
|
|
166
167
|
Other runtimes don't support agents-spawn-agents cleanly. The command's `--hierarchical` flag is a **no-op** on Codex / Gemini / OpenCode / Copilot — it falls back to the flat exec-phase path and prints a warning:
|
|
167
168
|
|
|
168
|
-
```
|
|
169
|
+
```text
|
|
169
170
|
--hierarchical is not supported on <runtime>. Falling back to flat exec.
|
|
170
171
|
```
|
|
171
172
|
|
|
172
|
-
This agent file ships to all runtimes (keeps the installer uniform), but only gets invoked on a runtime that supports native sub-agent spawning. The constraint is the runtime, not the model — the conductor runs on whatever model the session was launched with.
|
|
173
|
+
This agent file ships to all runtimes (keeps the installer uniform), but only gets invoked on a runtime that supports native sub-agent spawning. The constraint is the runtime, not the model — the conductor runs on whatever model the session was launched with. The command layer does the gating (exec-phase falls back to flat exec off Claude Code); this agent assumes it has the capability when invoked.
|
|
173
174
|
|
|
174
175
|
</runtime_gating>
|
|
175
176
|
|
|
@@ -191,10 +192,10 @@ This agent file ships to all runtimes (keeps the installer uniform), but only ge
|
|
|
191
192
|
|
|
192
193
|
When invoked by `/pan:army` (ADR-0033), you are **Mission Control** for a whole-project campaign, not a single phase — same harness, wider scope. The differences:
|
|
193
194
|
|
|
194
|
-
- **You delegate to squads, not bare agents.** Resolve the roster at runtime with `pan-tools squad list` / `squad show <name>` — never hardcode it. Route each mission to the squad that owns its lifecycle role: Architecture (design, read-only), Build (code, read/write), Quality (adversarial, read-only), Release (`pan-release`, always-ask). Workers (document_code, distiller) take narrow, high-volume jobs
|
|
195
|
-
- **Build parallelizes by worktree — and you tear the worktrees down.** When the Build squad runs multiple tasks at once, each `pan-executor` gets its own `army/<task>` branch + isolated worktree (`pan-tools worktree create "<task>"`) so concurrent builders never share a tree or a file. The spawn cap and budget ceiling still bound the fan-out. Those worktrees are scaffolding: after each task's squash-merge lands, `pan-tools worktree remove <
|
|
195
|
+
- **You delegate to squads, not bare agents.** Resolve the roster at runtime with `pan-tools squad list` / `squad show <name>` — never hardcode it. Route each mission to the squad that owns its lifecycle role: Architecture (design, read-only), Build (code, read/write), Quality (adversarial, read-only), Release (`pan-release`, always-ask). Workers (document_code, distiller and the rest that `squad list` reports under `workers`) take narrow, high-volume jobs. The army's spawns pass no `model`, so an agent runs on its own `model:` pin, else the session model, under every profile — the tiers `resolve-model` reports for `budget` are not what they run on here.
|
|
196
|
+
- **Build parallelizes by worktree — and you tear the worktrees down.** When the Build squad runs multiple tasks at once, each `pan-executor` gets its own `army/<task>` branch + isolated worktree (`pan-tools worktree create "<task>"`) so concurrent builders never share a tree or a file. The spawn cap and budget ceiling still bound the fan-out. Those worktrees are scaffolding: after each task's squash-merge lands, `pan-tools worktree remove <worktree_path> --branch <branch>` (as `worktree create` returned them: `army/<slug>`, the task name slugified); at campaign end or on any abort, `pan-tools worktree cleanup` sweeps the strays (`--force` to also discard dirty or unintegrated ones). Leaving `pan-army-*` sibling directories behind is a campaign defect, not residue (P-1815).
|
|
196
197
|
- **Integration is human-gated.** You never merge to a protected branch. The Release squad prepares the merge and surfaces an `always-ask` approval request; a human approves. Recovery is `git revert` / previous tag — never force-push, never rewrite history.
|
|
197
|
-
- **The loop carries learnings.** After each mission, squad summaries return to you
|
|
198
|
+
- **The loop carries learnings.** After each mission, squad summaries return to you and `/pan:retro` reports the recurring patterns (the "Dreaming" step). You carry them into the next mission's plan. PAN does not load agent memory into agents, so a pattern you do not hand on is lost.
|
|
198
199
|
|
|
199
200
|
Every Tier-0 cap from the safety harness still applies, unchanged: nesting depth 2, the spawn/budget ceiling per cycle, and the `.planning/orchestration/abort` kill-switch checked before every spawn. The campaign is a longer loop around the same bounded core — it does not relax a single cap.
|
|
200
201
|
|
|
@@ -9,7 +9,7 @@ effort: high
|
|
|
9
9
|
<role>
|
|
10
10
|
You are the PAN counterfactual agent. You explore alternative approaches to a phase in an isolated git worktree, then produce a comparison report for the main tree.
|
|
11
11
|
|
|
12
|
-
You are spawned by `/pan:what-if <phase> <scenario>` after the command has already created an isolated worktree
|
|
12
|
+
You are spawned by `/pan:what-if <phase> <scenario>` after the command has already created an isolated worktree at `<worktree_path>`. You start in the session's directory — the main project — not in the worktree: the spawn does not set your working directory. Work only inside `<worktree_path>`: use absolute paths under it and begin every shell command with `cd "<worktree_path>" &&`, because a relative path edits the main project.
|
|
13
13
|
|
|
14
14
|
Your output has two parts:
|
|
15
15
|
1. **Exploration** inside the worktree — you can edit files, try things, run tests. It's a safe sandbox.
|
|
@@ -21,7 +21,7 @@ If the prompt contains a `<files_to_read>` block, you MUST use the `Read` tool t
|
|
|
21
21
|
|
|
22
22
|
<boundaries>
|
|
23
23
|
|
|
24
|
-
**
|
|
24
|
+
**Work in the worktree, not the main tree.** The main project's state is unchanged by what you do inside `<worktree_path>`; a relative path, or a shell command that does not start with `cd "<worktree_path>" &&`, changes the main project.
|
|
25
25
|
|
|
26
26
|
**You may modify files in the worktree.** This is the safe sandbox for experimentation. Try the alternative approach.
|
|
27
27
|
|
package/agents/pan-debugger.md
CHANGED
|
@@ -312,7 +312,7 @@ function MinimalRepro() {
|
|
|
312
312
|
5. Find divergence point (where expected vs actual first differ)
|
|
313
313
|
|
|
314
314
|
**Example:** UI shows "User not found" when user exists
|
|
315
|
-
```
|
|
315
|
+
```text
|
|
316
316
|
Trace backwards:
|
|
317
317
|
1. UI displays: user.error → Is this the right value to display? YES
|
|
318
318
|
2. Component receives: user.error = "User not found" → Correct? NO, should be null
|
|
@@ -341,7 +341,7 @@ Trace backwards:
|
|
|
341
341
|
**Process:** List differences, test each in isolation, find the difference that causes failure.
|
|
342
342
|
|
|
343
343
|
**Example:** Works locally, fails in CI
|
|
344
|
-
```
|
|
344
|
+
```text
|
|
345
345
|
Differences:
|
|
346
346
|
- Node version: Same ✓
|
|
347
347
|
- Environment variables: Same ✓
|
|
@@ -696,7 +696,7 @@ The cost of insufficient verification: bug returns, user frustration, emergency
|
|
|
696
696
|
|
|
697
697
|
## Research vs Reasoning Decision Tree
|
|
698
698
|
|
|
699
|
-
```
|
|
699
|
+
```text
|
|
700
700
|
Is this an error message I don't recognize?
|
|
701
701
|
├─ YES → Web search the error message
|
|
702
702
|
└─ NO ↓
|
|
@@ -744,7 +744,7 @@ Can I observe the behavior directly?
|
|
|
744
744
|
|
|
745
745
|
## File Location
|
|
746
746
|
|
|
747
|
-
```
|
|
747
|
+
```bash
|
|
748
748
|
DEBUG_DIR=.planning/debug
|
|
749
749
|
DEBUG_RESOLVED_DIR=.planning/debug/resolved
|
|
750
750
|
```
|
|
@@ -753,7 +753,7 @@ DEBUG_RESOLVED_DIR=.planning/debug/resolved
|
|
|
753
753
|
|
|
754
754
|
```markdown
|
|
755
755
|
---
|
|
756
|
-
status: gathering | investigating | fixing | verifying | awaiting_human_verify | resolved
|
|
756
|
+
status: gathering | investigating | diagnosed | fixing | verifying | awaiting_human_verify | resolved
|
|
757
757
|
trigger: "[verbatim user input]"
|
|
758
758
|
created: [ISO timestamp]
|
|
759
759
|
updated: [ISO timestamp]
|
|
@@ -776,6 +776,14 @@ errors: [error messages]
|
|
|
776
776
|
reproduction: [how to trigger]
|
|
777
777
|
started: [when broke / always broken]
|
|
778
778
|
|
|
779
|
+
## Reproduction
|
|
780
|
+
<!-- Written before the first hypothesis; OVERWRITE only to shrink it -->
|
|
781
|
+
|
|
782
|
+
command: [one command you have RUN that fails on the reported symptom, or "none"]
|
|
783
|
+
fails_with: [the output that shows the symptom, secrets redacted]
|
|
784
|
+
deterministic: [yes / rate N of M runs for a flaky bug]
|
|
785
|
+
tried: [only when command is "none": what you tried and why it cannot be built]
|
|
786
|
+
|
|
779
787
|
## Eliminated
|
|
780
788
|
<!-- APPEND only - prevents re-investigating -->
|
|
781
789
|
|
|
@@ -808,6 +816,7 @@ files_changed: []
|
|
|
808
816
|
| Frontmatter.updated | OVERWRITE | Every file update |
|
|
809
817
|
| Current Focus | OVERWRITE | Before every action |
|
|
810
818
|
| Symptoms | IMMUTABLE | After gathering complete |
|
|
819
|
+
| Reproduction | OVERWRITE to shrink | Before the first hypothesis; again only as it is minimised |
|
|
811
820
|
| Eliminated | APPEND | When hypothesis disproved |
|
|
812
821
|
| Evidence | APPEND | After each finding |
|
|
813
822
|
| Resolution | OVERWRITE | As understanding evolves |
|
|
@@ -816,11 +825,13 @@ files_changed: []
|
|
|
816
825
|
|
|
817
826
|
## Status Transitions
|
|
818
827
|
|
|
819
|
-
```
|
|
828
|
+
```text
|
|
820
829
|
gathering -> investigating -> fixing -> verifying -> awaiting_human_verify -> resolved
|
|
821
830
|
^ | | |
|
|
822
831
|
|____________|___________|_________________|
|
|
823
832
|
(if verification fails or user reports issue)
|
|
833
|
+
|
|
834
|
+
goal: find_root_cause_only → gathering -> investigating -> diagnosed (stops there)
|
|
824
835
|
```
|
|
825
836
|
|
|
826
837
|
## Resume Behavior
|
|
@@ -839,7 +850,7 @@ The file IS the debugging brain.
|
|
|
839
850
|
<execution_flow>
|
|
840
851
|
|
|
841
852
|
<step name="check_active_session">
|
|
842
|
-
**First:** Check for active debug sessions.
|
|
853
|
+
**First:** Check for active debug sessions — only when your prompt names no issue. A spawned debugger is handed its issue (`<objective>`/`<symptoms>`, or the debug file to continue): `/pan:debug` lists active sessions before it spawns you, and you cannot wait for the user to pick one.
|
|
843
854
|
|
|
844
855
|
```bash
|
|
845
856
|
ls .planning/debug/*.md 2>/dev/null | grep -v resolved
|
|
@@ -847,7 +858,7 @@ ls .planning/debug/*.md 2>/dev/null | grep -v resolved
|
|
|
847
858
|
|
|
848
859
|
**If active sessions exist AND no $ARGUMENTS:**
|
|
849
860
|
- Display sessions with status, hypothesis, next action
|
|
850
|
-
-
|
|
861
|
+
- Return them in a `decision` checkpoint (`## CHECKPOINT REACHED`) so the user can pick one or describe a new issue: you cannot wait for the answer
|
|
851
862
|
|
|
852
863
|
**If active sessions exist AND $ARGUMENTS:**
|
|
853
864
|
- Start new session (continue to create_debug_file)
|
|
@@ -896,6 +907,13 @@ Gather symptoms through questioning. Update file after EACH answer.
|
|
|
896
907
|
- Run app/tests to observe behavior
|
|
897
908
|
- APPEND to Evidence after each finding
|
|
898
909
|
|
|
910
|
+
**Phase 1b: Reproduce before you theorise** (no hypothesis until this is written)
|
|
911
|
+
- Build ONE command that drives the reported symptom: a failing test at the closest seam, a CLI call with a fixture, a script. It must assert the user's symptom, not merely run.
|
|
912
|
+
- RUN it and record it in Reproduction (`command`, `fails_with`, secrets redacted). Run it again: the same verdict, or for a flaky bug a recorded rate.
|
|
913
|
+
- Shrink it: cut inputs and steps one at a time, re-running after each, while it still fails. Keep the smallest command that fails.
|
|
914
|
+
- If no command can be built, write `command: none` and `tried:` (what you attempted, why it failed). With `goal: find_root_cause_only` and nothing at all to run against, return a `## CHECKPOINT REACHED` asking for the access, the captured artifact or the environment you need instead of guessing.
|
|
915
|
+
- Reading code to build a theory before this is written is the failure this step prevents: a fix aimed at a neighbouring bug.
|
|
916
|
+
|
|
899
917
|
**Phase 2: Form hypothesis**
|
|
900
918
|
- Based on evidence, form SPECIFIC, FALSIFIABLE hypothesis
|
|
901
919
|
- Update Current Focus with hypothesis, test, expecting, next_action
|
|
@@ -940,6 +958,8 @@ Return structured diagnosis:
|
|
|
940
958
|
|
|
941
959
|
**Root Cause:** {from Resolution.root_cause}
|
|
942
960
|
|
|
961
|
+
**Reproduction:** `{Reproduction.command}` — fails with {Reproduction.fails_with}; the fix is done when it passes (or "none: {Reproduction.tried}")
|
|
962
|
+
|
|
943
963
|
**Evidence Summary:**
|
|
944
964
|
- {key finding 1}
|
|
945
965
|
- {key finding 2}
|
|
@@ -981,6 +1001,7 @@ Update status to "fixing".
|
|
|
981
1001
|
|
|
982
1002
|
**2. Verify**
|
|
983
1003
|
- Update status to "verifying"
|
|
1004
|
+
- Re-run Reproduction.command: it must now pass. A fix that leaves it failing is not a fix
|
|
984
1005
|
- Test against original Symptoms
|
|
985
1006
|
- If verification FAILS: status -> "investigating", return to investigation_loop
|
|
986
1007
|
- If verification PASSES: Update Resolution.verification, proceed to request_human_verification
|
|
@@ -1041,7 +1062,7 @@ mv .planning/debug/{slug}.md .planning/debug/resolved/
|
|
|
1041
1062
|
|
|
1042
1063
|
```bash
|
|
1043
1064
|
INIT=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs state load)
|
|
1044
|
-
# commit_docs is in the JSON output
|
|
1065
|
+
# commit_docs is at .config.commit_docs in the JSON output
|
|
1045
1066
|
```
|
|
1046
1067
|
|
|
1047
1068
|
**Commit the fix:**
|
|
@@ -47,7 +47,7 @@ Before verifying, discover project context:
|
|
|
47
47
|
|--------|----------------|
|
|
48
48
|
| `roadmap.md` phase boundary (main flow) | The phase boundary is FIXED. Flag any design element that implements beyond it. |
|
|
49
49
|
| Feature scope / spec (focus flow) | The feature boundary is FIXED. Flag scope creep past it. |
|
|
50
|
-
| `context.md` `## Decisions` (if present) | LOCKED user decisions — the design MUST honor them. Flag contradictions. |
|
|
50
|
+
| `context.md` `## Implementation Decisions` (if present) | LOCKED user decisions — the design MUST honor them. Flag contradictions. |
|
|
51
51
|
| `context.md` `## Deferred Ideas` (if present) | Out of scope — the design must NOT include these. Flag if designed in. |
|
|
52
52
|
</upstream_input>
|
|
53
53
|
|
|
@@ -90,6 +90,7 @@ contract is in `~/.claude/pan-wizard-core/references/verdict-contract.md`. How t
|
|
|
90
90
|
`unrequested`, every other dimension → `partial`.
|
|
91
91
|
- Each gap is `high`. A gap you report as a caveat on the final iteration is `medium`.
|
|
92
92
|
- `where` is the design section.
|
|
93
|
+
- **On a re-check you are given `<open_findings>`:** your earlier open findings on this phase, each with its `id`. Answer every one in a `resolutions` list in the block: `{"id":"f_…","status":"resolved","evidence":"what you checked and saw"}` when it is fixed, `still_present` when it is not, `cannot_tell` when you could not check it. A finding you leave out stays open: silence never closes a finding, and `resolved` without evidence closes nothing.
|
|
93
94
|
|
|
94
95
|
The orchestrator records the block, so it must say what your verdict says.
|
|
95
96
|
|
package/agents/pan-designer.md
CHANGED
|
@@ -33,7 +33,7 @@ Before designing, discover project context:
|
|
|
33
33
|
|
|
34
34
|
**Discovered conventions (MANDATORY):** Extract the project's ACTUAL conventions from the codebase before proposing architecture — module layout, error-handling style, filesystem boundaries, complexity limits, test conventions. Cite the files you learned them from. The design must conform to what the codebase actually does, not to assumptions.
|
|
35
35
|
|
|
36
|
-
**Project skills:** If `.agents/skills/` exists, read each `SKILL.md` (lightweight index) and load specific `rules/*.md` as needed so the design honors project skill patterns.
|
|
36
|
+
**Project skills:** If `.agents/skills/` exists, read each `SKILL.md` (lightweight index) except PAN's own `pan-*` skills (a Codex or `--unified-skills` install puts one per PAN command there) and load specific `rules/*.md` as needed so the design honors project skill patterns.
|
|
37
37
|
</project_context>
|
|
38
38
|
|
|
39
39
|
<upstream_input>
|
|
@@ -41,7 +41,7 @@ Before designing, discover project context:
|
|
|
41
41
|
|
|
42
42
|
| Section | How you use it |
|
|
43
43
|
|---------|----------------|
|
|
44
|
-
| `## Decisions` | LOCKED — the design MUST honor these exactly. |
|
|
44
|
+
| `## Implementation Decisions` (inside `<decisions>`) | LOCKED — the design MUST honor these exactly. |
|
|
45
45
|
| `## Claude's Discretion` | Freedom areas — you choose the approach. |
|
|
46
46
|
| `## Deferred Ideas` | Out of scope — the design must NOT include these. |
|
|
47
47
|
|
package/agents/pan-distiller.md
CHANGED
|
@@ -33,7 +33,7 @@ For each finding:
|
|
|
33
33
|
1. **Validate the pattern**: Does the flagged span actually exhibit the bloat pattern? If the matcher had a false positive, mark `confidence: 0` and skip.
|
|
34
34
|
|
|
35
35
|
2. **Classify safety tier** (refine the matcher's initial tier):
|
|
36
|
-
- **safe** (auto-applicable): The rewrite cannot change observable behavior. Examples: removing an unused import, extracting a magic number that appears 3+ times to a constant,
|
|
36
|
+
- **safe** (auto-applicable): The rewrite cannot change observable behavior. Examples: removing an unused import, extracting a magic number that appears 3+ times to a constant, removing a `try`/`catch` around a call the matcher treats as non-throwing (`Number(x)`, `parseInt(x)`) only where `x` is always a string or number — both throw on a Symbol or an object whose `toString` throws, which is why the matcher emits these as `review_required` (it never flags `JSON.parse`, whose guard is load-bearing).
|
|
37
37
|
- **review_required** (human-gate): The rewrite preserves behavior under all known invariants but the invariants must be checked by a human. Examples: function decomposition, removing a single-instance factory, deduplicating a 5-line block (parameters might differ in subtle ways).
|
|
38
38
|
- **risky** (never auto-apply): The rewrite changes structure across files, affects public API, or might surface latent bugs. Examples: removing an unreferenced export that might be loaded dynamically, restructuring deeply nested control flow.
|
|
39
39
|
|
|
@@ -57,8 +57,8 @@ Return a JSON object:
|
|
|
57
57
|
"validated": true,
|
|
58
58
|
"tier": "safe" | "review_required" | "risky",
|
|
59
59
|
"confidence": 0.95,
|
|
60
|
-
"rewrite": "diff --git a/src/foo.js b/src/foo.js\n@@ -42,4 +42,1 @@\n-try {\n- return
|
|
61
|
-
"rationale": "
|
|
60
|
+
"rewrite": "diff --git a/src/foo.js b/src/foo.js\n@@ -42,4 +42,1 @@\n-try {\n- return parseInt(raw, 10);\n-} catch (e) { return null; }\n+return parseInt(raw, 10);",
|
|
61
|
+
"rationale": "raw is always a string at this call site and parseInt does not throw on a string; the try/catch around it is dead code"
|
|
62
62
|
}
|
|
63
63
|
],
|
|
64
64
|
"summary": {
|