pan-wizard 3.21.1 → 3.24.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 +38 -24
- package/agents/pan-conductor.md +3 -3
- package/agents/pan-design-checker.md +83 -0
- package/agents/pan-designer.md +67 -0
- package/agents/pan-document_code.md +3 -2
- package/agents/pan-executor.md +2 -2
- package/agents/pan-plan-checker.md +19 -6
- package/agents/pan-planner.md +4 -1
- package/agents/pan-previewer.md +1 -1
- package/agents/pan-roadmapper.md +3 -1
- package/agents/pan-verifier.md +10 -10
- package/bin/install-lib.cjs +128 -17
- package/bin/install.js +480 -74
- package/commands/pan/army.md +20 -14
- package/commands/pan/audit-deployment.md +17 -14
- package/commands/pan/cost.md +2 -2
- package/commands/pan/debug.md +1 -1
- package/commands/pan/design-phase.md +77 -0
- package/commands/pan/exec-phase.md +2 -2
- package/commands/pan/experiment.md +18 -14
- package/commands/pan/focus-auto.md +5 -5
- package/commands/pan/focus-design.md +13 -1
- package/commands/pan/focus-exec.md +1 -1
- package/commands/pan/learn.md +1 -1
- package/commands/pan/links.md +3 -1
- package/commands/pan/map-codebase.md +4 -4
- package/commands/pan/mcp-bridge.md +1 -1
- package/commands/pan/milestone-new.md +3 -1
- package/commands/pan/optimize.md +2 -2
- package/commands/pan/patches.md +1 -1
- package/commands/pan/plan-phase.md +3 -1
- package/commands/pan/preview.md +3 -3
- package/commands/pan/profile.md +3 -3
- package/commands/pan/research-phase.md +1 -1
- package/commands/pan/retro.md +4 -1
- package/commands/pan/review-deep.md +1 -1
- package/commands/pan/settings.md +2 -2
- package/commands/pan/what-if.md +1 -1
- package/hooks/dist/pan-check-update.js +149 -38
- package/hooks/dist/pan-context-monitor.js +155 -81
- package/hooks/dist/pan-cost-logger.js +288 -13
- package/hooks/dist/pan-statusline.js +24 -8
- package/hooks/dist/pan-stop-guard.js +160 -0
- package/hooks/dist/pan-trace-logger.js +261 -19
- package/package.json +2 -2
- package/pan-wizard-core/bin/lib/bridge.cjs +1 -1
- package/pan-wizard-core/bin/lib/bus.cjs +19 -4
- package/pan-wizard-core/bin/lib/campaign.cjs +8 -3
- package/pan-wizard-core/bin/lib/codebase.cjs +15 -5
- package/pan-wizard-core/bin/lib/commands.cjs +88 -6
- package/pan-wizard-core/bin/lib/config.cjs +27 -2
- package/pan-wizard-core/bin/lib/constants.cjs +1 -0
- package/pan-wizard-core/bin/lib/core.cjs +113 -8
- package/pan-wizard-core/bin/lib/cost.cjs +61 -24
- package/pan-wizard-core/bin/lib/distill.cjs +22 -4
- package/pan-wizard-core/bin/lib/doc-lint.cjs +25 -7
- package/pan-wizard-core/bin/lib/experiment.cjs +25 -1
- package/pan-wizard-core/bin/lib/focus.cjs +42 -7
- package/pan-wizard-core/bin/lib/frontmatter.cjs +62 -31
- package/pan-wizard-core/bin/lib/git.cjs +51 -16
- package/pan-wizard-core/bin/lib/hud.cjs +17 -2
- package/pan-wizard-core/bin/lib/init.cjs +2 -5
- package/pan-wizard-core/bin/lib/knowledge.cjs +20 -1
- package/pan-wizard-core/bin/lib/learn-lint.cjs +50 -0
- package/pan-wizard-core/bin/lib/links.cjs +9 -6
- package/pan-wizard-core/bin/lib/lock.cjs +23 -4
- package/pan-wizard-core/bin/lib/memory-optimize.cjs +101 -17
- package/pan-wizard-core/bin/lib/memory-rebuild.cjs +26 -2
- package/pan-wizard-core/bin/lib/milestone.cjs +11 -5
- package/pan-wizard-core/bin/lib/optimize.cjs +18 -7
- package/pan-wizard-core/bin/lib/phase-remove.cjs +41 -2
- package/pan-wizard-core/bin/lib/phase.cjs +82 -11
- package/pan-wizard-core/bin/lib/preview.cjs +23 -4
- package/pan-wizard-core/bin/lib/review-deep.cjs +14 -6
- package/pan-wizard-core/bin/lib/roadmap.cjs +6 -2
- package/pan-wizard-core/bin/lib/runner.cjs +17 -7
- package/pan-wizard-core/bin/lib/squads.cjs +43 -11
- package/pan-wizard-core/bin/lib/state.cjs +32 -11
- package/pan-wizard-core/bin/lib/template.cjs +8 -3
- package/pan-wizard-core/bin/lib/verify-deploy.cjs +14 -2
- package/pan-wizard-core/bin/lib/verify-drift.cjs +15 -1
- package/pan-wizard-core/bin/lib/verify-preflight.cjs +9 -3
- package/pan-wizard-core/bin/lib/verify.cjs +84 -39
- package/pan-wizard-core/bin/lib/whatif.cjs +8 -1
- package/pan-wizard-core/bin/pan-tools.cjs +42 -19
- package/pan-wizard-core/learnings/index.json +7 -7
- package/pan-wizard-core/learnings/universal/autonomous-loop.md +5 -3
- package/pan-wizard-core/learnings/universal/concurrency.md +1 -1
- package/pan-wizard-core/references/design-methodology.md +94 -0
- package/pan-wizard-core/references/git-integration.md +9 -9
- package/pan-wizard-core/references/guardrails.md +4 -1
- package/pan-wizard-core/references/model-profile-resolution.md +1 -1
- package/pan-wizard-core/references/model-profiles.md +44 -34
- package/pan-wizard-core/references/planning-config.md +5 -5
- package/pan-wizard-core/references/verification-patterns.md +67 -0
- package/pan-wizard-core/templates/codebase/architecture.md +1 -1
- package/pan-wizard-core/templates/codebase/concerns.md +1 -1
- package/pan-wizard-core/templates/codebase/conventions.md +1 -1
- package/pan-wizard-core/templates/codebase/integrations.md +1 -1
- package/pan-wizard-core/templates/codebase/stack.md +1 -1
- package/pan-wizard-core/templates/codebase/structure.md +1 -1
- package/pan-wizard-core/templates/codebase/testing.md +1 -1
- package/pan-wizard-core/templates/design.md +146 -0
- package/pan-wizard-core/templates/discovery.md +3 -3
- package/pan-wizard-core/templates/milestone-archive.md +2 -2
- package/pan-wizard-core/templates/playbook.md +1 -1
- package/pan-wizard-core/templates/uat.md +1 -1
- package/pan-wizard-core/workflows/diagnose-issues.md +9 -7
- package/pan-wizard-core/workflows/exec-phase.md +28 -8
- package/pan-wizard-core/workflows/execute-plan.md +2 -3
- package/pan-wizard-core/workflows/health.md +24 -1
- package/pan-wizard-core/workflows/help.md +5 -4
- package/pan-wizard-core/workflows/learn.md +5 -5
- package/pan-wizard-core/workflows/map-codebase.md +1 -1
- package/pan-wizard-core/workflows/milestone-audit.md +1 -1
- package/pan-wizard-core/workflows/milestone-new.md +4 -4
- package/pan-wizard-core/workflows/new-project.md +47 -32
- package/pan-wizard-core/workflows/optimize.md +8 -8
- package/pan-wizard-core/workflows/pause.md +1 -1
- package/pan-wizard-core/workflows/phase-tests.md +2 -2
- package/pan-wizard-core/workflows/plan-phase.md +4 -0
- package/pan-wizard-core/workflows/profile.md +13 -10
- package/pan-wizard-core/workflows/research-phase.md +1 -1
- package/pan-wizard-core/workflows/resume-project.md +1 -1
- package/pan-wizard-core/workflows/settings.md +9 -9
- package/pan-wizard-core/workflows/transition.md +24 -8
- package/pan-wizard-core/workflows/update.md +23 -20
- package/pan-wizard-core/workflows/verify-phase.md +7 -2
- package/pan-zcode/KNOWN-BETA-RISKS.md +8 -0
- package/pan-zcode/README.md +14 -2
- package/pan-zcode/bin/install-zcode.js +1 -1
- package/pan-zcode/mcp/native-tools.cjs +1 -1
- package/pan-zcode/mcp/server.cjs +76 -14
- package/scripts/build-hooks.js +2 -1
- package/scripts/generate-skills-docs.py +0 -4
- package/scripts/run-tests.cjs +11 -4
package/commands/pan/army.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: army
|
|
3
3
|
group: Army
|
|
4
|
-
description: Bot-army campaign — Mission Control (
|
|
4
|
+
description: Bot-army campaign — Mission Control (the reasoning-tier conductor) delegates a whole-project goal to squads (architecture / build / quality / release), each squad working branch-per-agent worktrees under a hard safety harness, gated by CI + a human merge, looping plan→delegate→execute→review→integrate→learn until the goal ships or a stop condition fires.
|
|
5
5
|
allowed-tools:
|
|
6
6
|
- Read
|
|
7
7
|
- Write
|
|
@@ -15,24 +15,30 @@ allowed-tools:
|
|
|
15
15
|
|
|
16
16
|
# /pan:army — Bot-Army Campaign (mission control → squads → ship)
|
|
17
17
|
|
|
18
|
-
Run a whole-project delivery as a coordinated bot army (ADR-0032 squads · ADR-0033 campaign). **Mission Control** — the
|
|
18
|
+
Run a whole-project delivery as a coordinated bot army (ADR-0032 squads · ADR-0033 campaign). **Mission Control** — the reasoning-tier `pan-conductor`, elevated to campaign scope — plans the mission and delegates to **squads** over the Agent toolset rather than implementing anything itself. Each squad owns its lifecycle role; the Build squad parallelizes by giving every builder its own `army/<task>` branch in an isolated git worktree. Nothing reaches a protected branch without green CI and a human's approval. $ARGUMENTS
|
|
19
19
|
|
|
20
20
|
The army is the campaign-scale sibling of `/pan:exec-phase --hierarchical` (one phase) and `/pan:focus-auto` (a category/backlog loop). It composes both: the conductor harness bounds it, the focus-auto loop drives it, the squads structure it.
|
|
21
21
|
|
|
22
22
|
---
|
|
23
23
|
|
|
24
|
-
## Tiers
|
|
24
|
+
## Tiers — the squad rows from `pan-tools squad list`, plus PAN's own hierarchy positions
|
|
25
25
|
|
|
26
|
-
| Tier | Who | Model | Access |
|
|
27
|
-
|
|
28
|
-
| 0 · Mission Control | `pan-conductor` |
|
|
29
|
-
| 1 · Architecture |
|
|
30
|
-
| 1 · Build | `pan-executor` |
|
|
31
|
-
| 1 · Quality |
|
|
32
|
-
| 1 · Release | `pan-release` |
|
|
33
|
-
| 2 · Workers |
|
|
26
|
+
| Tier | Who | Model tier | Access |
|
|
27
|
+
|------|-----|-----------|--------|
|
|
28
|
+
| 0 · Mission Control | `pan-conductor` | `reasoning` (`mid` under `budget`) | delegation-first (Agent toolset) — instructed to route work, not write it |
|
|
29
|
+
| 1 · Architecture | design + planning agents — `squad show architecture` lists them | `reasoning` | `read-only` |
|
|
30
|
+
| 1 · Build | `pan-executor` | `reasoning` | `read-write-bash` — one branch+worktree per agent |
|
|
31
|
+
| 1 · Quality | adversarial review + debug agents — `squad show quality` lists them | `mid` | `read-only`, adversarial |
|
|
32
|
+
| 1 · Release | `pan-release` | `mid` | `always-ask` — human gate |
|
|
33
|
+
| 2 · Workers | the agents `squad list` reports under `workers` | `reasoning`; `budget` down-tiers **per agent** (see below) | narrow, high-volume jobs |
|
|
34
34
|
|
|
35
|
-
Resolve the roster at runtime — never hardcode it: `pan-tools squad list` and `pan-tools squad show <name>`.
|
|
35
|
+
**Where each row comes from.** The tier-1 rows mirror the `squads[]` records `pan-tools squad list` prints — label, `tier`, `access` (their member names come from `squad show <name>`, since `squad list` reports only a count). The Tier 0 and Tier 2 rows are PAN's hierarchy positions: the same command names them under its `coordinator` and `workers` keys, but reports nothing else about them, so the Model-tier and Access values on those two rows are written here rather than returned by the command. Resolve the roster at runtime — never hardcode it: `pan-tools squad list` and `pan-tools squad show <name>`.
|
|
36
|
+
|
|
37
|
+
**Reading the Model-tier column.** These are PAN *tiers*, not model names. `reasoning` resolves to `inherit` — the model you launched with — while `mid` and `fast` map to the provider's mid/fast models (Sonnet and Haiku on Anthropic).
|
|
38
|
+
|
|
39
|
+
**Reading the Access column.** The backticked values on the tier-1 rows are the `access` labels `squad list` reports; tier 0 and tier 2 carry PAN's own. They are role contracts the conductor's prompt assigns when it delegates, not a sandbox: `squads.cjs` says of itself that it "modifies no agent and changes no execution path", so a label can differ from what an agent may actually do — expect that, since several `read-only` squad members hold `Write` to emit planning or verification artifacts. The binding grant is each agent's own `tools:` frontmatter (`grep '^tools:' agents/*.md`), and Mission Control's includes `Write` and `Bash`: routing rather than coding is how it is instructed to behave, not something the runtime prevents. The rail those grants do enforce is delegation depth — `grep -l '^tools:.*Task' agents/*.md` names every agent able to spawn another (today, `pan-conductor`), so a squad agent cannot fan out further.
|
|
40
|
+
|
|
41
|
+
**Squad tier is not profile tier.** The tier column above is a `squads.cjs` grouping attribute — what `pan-tools squad list` reports — and it is not what resolves an agent's model; that comes from the active `model_profile` (`quality` and `balanced` are `reasoning` for every agent, and `budget` is the only profile that down-tiers), plus any `model:` pin in an agent's own frontmatter. So the `mid` on the Quality and Release rows does not describe what those agents run under the default profile — under `quality` and `balanced` they resolve `reasoning` like everything else. The tier-1 values above are the squad groupings; the tier-0 and tier-2 values are per-agent profile tiers. **`budget` resolves per agent, not per row:** it sends some workers to `fast` and others to `mid`, so no single value is true of the Tier 2 row — `MODEL_PROFILES` in `pan-wizard-core/bin/lib/core.cjs` is the table, and it is the one to read rather than a tier written into a doc. For the agents that pin a model outright, `grep -l '^model: opus' agents/*.md` lists them — the pin applies on Claude Code only, since the installer strips it for the other runtimes.
|
|
36
42
|
|
|
37
43
|
---
|
|
38
44
|
|
|
@@ -97,7 +103,7 @@ Every cap the conductor enforces applies to the campaign, scaled up:
|
|
|
97
103
|
```
|
|
98
104
|
/pan:army
|
|
99
105
|
Phase 0 MUSTER — squad list + roster validate · cache prime · baseline · loop-state · abort-file clear
|
|
100
|
-
Phase 1 PLAN — Mission Control (
|
|
106
|
+
Phase 1 PLAN — Mission Control (session model, xhigh effort) decomposes the goal into dependency-ordered missions
|
|
101
107
|
Phase 2 DELEGATE — pick the next item (focus-auto --source) · route to the owning squad over the Agent toolset
|
|
102
108
|
Phase 3 EXECUTE — Build squad: one army/<task> worktree per agent (parallel); Architecture/Quality research in parallel (read-only)
|
|
103
109
|
Phase 4 REVIEW — Quality squad on the built tree: reviewer + hardener + meta → verdict ladder; a block is a hard gate
|
|
@@ -161,7 +167,7 @@ The campaign is complete when ANY holds: `--max-cycles` reached · backlog empty
|
|
|
161
167
|
- Integrate a mission that hasn't passed Quality green.
|
|
162
168
|
|
|
163
169
|
## ALWAYS DO
|
|
164
|
-
- Plan on
|
|
170
|
+
- Plan on the session model Mission Control inherits, delegate over the Agent toolset, keep each squad's return a tight summary.
|
|
165
171
|
- One worktree per Build agent; parallel research/verify; serial human-gated integrate.
|
|
166
172
|
- Check the abort file + spawn/budget caps before every spawn.
|
|
167
173
|
- Finish with the clean-build seal; write learnings back to memory.
|
|
@@ -77,9 +77,12 @@ For the detected runtime config directory (CONFIG_DIR), audit ALL of the followi
|
|
|
77
77
|
- [ ] `CONFIG_DIR/pan-wizard-core/references/` — non-empty, every manifest-listed reference present
|
|
78
78
|
|
|
79
79
|
**1.4 Commands**
|
|
80
|
-
- For Claude/Gemini: `CONFIG_DIR/commands/pan/` — every manifest-listed command
|
|
81
|
-
- For OpenCode: `CONFIG_DIR/
|
|
82
|
-
- For
|
|
80
|
+
- For Claude/Gemini: `CONFIG_DIR/commands/pan/` — every manifest-listed command file present
|
|
81
|
+
- For OpenCode: `CONFIG_DIR/commands/` — every manifest-listed `pan-*.md` present (flat, one file per command)
|
|
82
|
+
- For Copilot: `CONFIG_DIR/skills/pan-*/SKILL.md` — every manifest-listed skill directory present
|
|
83
|
+
- For Codex: the SHARED skills tree, not `CONFIG_DIR` — `./.agents/skills/pan-*/SKILL.md` for a local
|
|
84
|
+
install, `~/.agents/skills/pan-*/SKILL.md` for a global one. Codex has no `skills/` of its own; if you
|
|
85
|
+
look under `.codex/` you will find no commands and wrongly report a broken install.
|
|
83
86
|
|
|
84
87
|
**1.5 Agents**
|
|
85
88
|
- [ ] `CONFIG_DIR/agents/` — every manifest-listed agent file present
|
|
@@ -111,18 +114,18 @@ Record all findings with severity: CRITICAL (missing core), WARNING (missing opt
|
|
|
111
114
|
Check `.planning/` directory in the target:
|
|
112
115
|
|
|
113
116
|
**2.1 Core Planning Files**
|
|
114
|
-
- [ ] `.planning/config.json` — exists, valid JSON, has
|
|
117
|
+
- [ ] `.planning/config.json` — exists, valid JSON, has expected keys (`model_profile`, `commit_docs`, `workflow`, `budget`)
|
|
115
118
|
- [ ] `.planning/project.md` — exists, has "What This Is", "Core Value", "Requirements" sections
|
|
116
119
|
- [ ] `.planning/state.md` — exists, has "Current Position", "Performance Metrics" sections
|
|
117
120
|
- [ ] `.planning/roadmap.md` — exists, has phase table
|
|
118
121
|
- [ ] `.planning/requirements.md` — exists if project used requirements tracking
|
|
119
122
|
|
|
120
123
|
**2.2 Phase Directories**
|
|
121
|
-
- Scan for
|
|
124
|
+
- Scan `.planning/phases/` for numbered phase directories
|
|
122
125
|
- For each phase directory:
|
|
123
|
-
- [ ]
|
|
124
|
-
- [ ]
|
|
125
|
-
- [ ] verification.md exists (phase was verified)
|
|
126
|
+
- [ ] At least one `*-plan.md` file exists (phase was planned)
|
|
127
|
+
- [ ] A matching `*-summary.md` file exists (phase was executed)
|
|
128
|
+
- [ ] A `*-verification.md` file exists (phase was verified)
|
|
126
129
|
- Count: total phases, phases with plans, phases verified, phases with gaps
|
|
127
130
|
|
|
128
131
|
**2.3 Research Artifacts** (if brownfield/research was enabled)
|
|
@@ -138,10 +141,10 @@ Check `.planning/` directory in the target:
|
|
|
138
141
|
|
|
139
142
|
**2.5 Config Sanity**
|
|
140
143
|
- Validate config.json values are within expected ranges
|
|
141
|
-
-
|
|
142
|
-
-
|
|
143
|
-
-
|
|
144
|
-
-
|
|
144
|
+
- `model_profile`: "quality" | "balanced" | "budget"
|
|
145
|
+
- `commit_docs`: boolean
|
|
146
|
+
- `workflow.*` toggles (research, plan_check, verifier, ...): all boolean
|
|
147
|
+
- `budget`: `default_points` numeric, `enforce` boolean
|
|
145
148
|
</step>
|
|
146
149
|
|
|
147
150
|
<step name="workflow_quality_audit">
|
|
@@ -150,7 +153,7 @@ Check `.planning/` directory in the target:
|
|
|
150
153
|
Assess how well the project workflow was followed:
|
|
151
154
|
|
|
152
155
|
**3.1 Planning Quality**
|
|
153
|
-
For each phase with
|
|
156
|
+
For each phase with plan files (`*-plan.md`, e.g. `01-01-plan.md`):
|
|
154
157
|
- Does it have clear objectives?
|
|
155
158
|
- Does it reference requirements?
|
|
156
159
|
- Are plans sequential with dependencies noted?
|
|
@@ -226,7 +229,7 @@ Verification Coverage: <N>%
|
|
|
226
229
|
- [P-W01] <description> — <suggestion>
|
|
227
230
|
|
|
228
231
|
### Phase Health
|
|
229
|
-
| Phase |
|
|
232
|
+
| Phase | Planned | Plans | Verified | Status |
|
|
230
233
|
|-------|---------|-------|----------|--------|
|
|
231
234
|
| 01 | ✓ | 3 | ✓ | Complete |
|
|
232
235
|
| 02 | ✓ | 5 | ✗ | Unverified |
|
package/commands/pan/cost.md
CHANGED
|
@@ -81,13 +81,13 @@ pan-tools cost clear
|
|
|
81
81
|
</subcommands>
|
|
82
82
|
|
|
83
83
|
<rate_table>
|
|
84
|
-
|
|
84
|
+
PAN ships a built-in rate table (USD per million tokens) covering the current Claude, GPT and Gemini families, with a per-tier fallback for anything it doesn't recognize. Override it in `.planning/config.json` — key on a PAN tier (`reasoning` / `mid` / `fast`), on a model family (longest-prefix match, so a family key also covers the dated ids the hooks record), or on an exact model id:
|
|
85
85
|
|
|
86
86
|
```json
|
|
87
87
|
{
|
|
88
88
|
"cost": {
|
|
89
89
|
"rates": {
|
|
90
|
-
"
|
|
90
|
+
"reasoning": { "input": 5.0, "output": 25.0, "cache_read": 0.5, "cache_write": 6.25 },
|
|
91
91
|
"my-custom-model": { "input": 1.0, "output": 2.0, "cache_read": 0.1, "cache_write": 1.25 }
|
|
92
92
|
}
|
|
93
93
|
}
|
package/commands/pan/debug.md
CHANGED
|
@@ -15,7 +15,7 @@ Debug issues using scientific method with subagent isolation.
|
|
|
15
15
|
|
|
16
16
|
**Orchestrator role:** Gather symptoms, spawn pan-debugger agent, handle checkpoints, spawn continuations.
|
|
17
17
|
|
|
18
|
-
**Why subagent:** Investigation burns context fast (reading files, forming hypotheses, testing).
|
|
18
|
+
**Why subagent:** Investigation burns context fast (reading files, forming hypotheses, testing). A fresh context window per investigation. Main context stays lean for user interaction.
|
|
19
19
|
</objective>
|
|
20
20
|
|
|
21
21
|
<context>
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pan:design-phase
|
|
3
|
+
group: Phase Lifecycle
|
|
4
|
+
description: Design a roadmap phase before planning — architecture, ADR, threat-lite, machine-checkable criteria — verified by an independent checker
|
|
5
|
+
argument-hint: "[phase] [--spike] [--skip-design] [--redesign]"
|
|
6
|
+
agent: pan-designer
|
|
7
|
+
allowed-tools:
|
|
8
|
+
- Read
|
|
9
|
+
- Write
|
|
10
|
+
- Bash
|
|
11
|
+
- Glob
|
|
12
|
+
- Grep
|
|
13
|
+
- Task
|
|
14
|
+
- WebFetch
|
|
15
|
+
- mcp__context7__*
|
|
16
|
+
---
|
|
17
|
+
<objective>
|
|
18
|
+
Produce a verified design (`{phase}-design.md`) for a roadmap phase BEFORE it is planned, so `pan-planner` builds against an architecture instead of improvising one. This is the main flow's design step — the per-phase counterpart to the focus flow's `/pan:focus-design`, running the shared `phase` tier from `~/.claude/pan-wizard-core/references/design-methodology.md` (ADR-0042).
|
|
19
|
+
|
|
20
|
+
**Lifecycle position:** `discuss → research → **design** → plan → verify`.
|
|
21
|
+
|
|
22
|
+
**Orchestrator role:** parse arguments, validate phase, spawn `pan-designer` (tier `phase`), verify with `pan-design-checker`, iterate until pass or max iterations, write `{phase}-design.md`, present results.
|
|
23
|
+
</objective>
|
|
24
|
+
|
|
25
|
+
<altitude_boundary>
|
|
26
|
+
Per-phase design covers **how** to build an already-scoped phase: architecture, design decisions, a phase-scoped ADR, a threat-lite pass, and machine-checkable success criteria. It does NOT re-open product questions — demand validation, competitive intelligence, and market/strategy belong to feature/milestone creation (`/pan:focus-design`, `/pan:milestone-new`), done once, not per phase. Keep this step at the phase altitude.
|
|
27
|
+
</altitude_boundary>
|
|
28
|
+
|
|
29
|
+
<routing_decision_tree>
|
|
30
|
+
Evaluate top-to-bottom; take the FIRST match.
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
IF --skip-design:
|
|
34
|
+
→ Skip design entirely. Note that plan-phase will proceed WITHOUT a design.md.
|
|
35
|
+
|
|
36
|
+
ELSE IF {phase}-design.md exists AND --redesign NOT set:
|
|
37
|
+
→ Reuse existing design. Offer: view / redesign / continue to plan.
|
|
38
|
+
|
|
39
|
+
ELSE IF phase is trivial (auto-detect: single small task, no new module,
|
|
40
|
+
no new interface, no external surface):
|
|
41
|
+
→ Auto-skip with a one-line rationale. A trivial phase does not need a
|
|
42
|
+
design artifact; recommend proceeding to plan-phase.
|
|
43
|
+
→ --spike or an explicit invocation overrides auto-skip.
|
|
44
|
+
|
|
45
|
+
ELSE (default):
|
|
46
|
+
→ DESIGN (spawn pan-designer at tier `phase`, or `spike` if --spike)
|
|
47
|
+
→ VERIFY (pan-design-checker reflexion loop)
|
|
48
|
+
→ WRITE {phase}-design.md
|
|
49
|
+
```
|
|
50
|
+
</routing_decision_tree>
|
|
51
|
+
|
|
52
|
+
<process>
|
|
53
|
+
1. **Validate phase** — error if the phase number is missing or not in `roadmap.md`.
|
|
54
|
+
2. **Prime context** — resolve the phase directory; gather `{phase}-context.md`, `{phase}-research.md`, and the phase boundary from `roadmap.md`.
|
|
55
|
+
3. **Design** — spawn `pan-designer` with a `<files_to_read>` block (context, research, roadmap boundary, `CLAUDE.md`). It fills in `templates/design.md` at the `phase` tier (`spike` if `--spike`).
|
|
56
|
+
4. **Verify (reflexion loop)** — spawn `pan-design-checker` with the drafted design + the boundary source:
|
|
57
|
+
- If it PASSES → done.
|
|
58
|
+
- If it finds gaps (iteration 1) → `pan-designer` revises (address genuine gaps only), re-check.
|
|
59
|
+
- If it finds gaps (iteration 2) → final revision, record remaining gaps as caveats.
|
|
60
|
+
- **Max 2 revision iterations** (design → check → revise → check → final) — the same guardrail `plan-phase` uses with `pan-plan-checker`.
|
|
61
|
+
5. **Write** `{phase}-design.md` to the phase directory and commit via `pan-tools commit`.
|
|
62
|
+
6. **Present** results + next step (`/pan:plan-phase` — which will consume this design.md).
|
|
63
|
+
</process>
|
|
64
|
+
|
|
65
|
+
<completion_contract>
|
|
66
|
+
Design is complete when ALL conditions are met:
|
|
67
|
+
1. `{phase}-design.md` created in the phase directory (unless `--skip-design` or an auto-skipped trivial phase — state which).
|
|
68
|
+
2. `pan-design-checker` PASSED, or 2 revision iterations were exhausted with remaining gaps recorded as caveats.
|
|
69
|
+
3. The artifact contains, at the `phase` tier: problem+scope, ≥2 machine-checkable success criteria, architecture (conventions cited, no layer violation), a phase-scoped ADR (every negative consequence mitigated/accepted, no placeholders), a threat-lite pass, and test hooks.
|
|
70
|
+
4. User presented with results and the next-step option.
|
|
71
|
+
|
|
72
|
+
Design FAILS if: phase not found in roadmap, or the designer returns empty/malformed output after retries.
|
|
73
|
+
</completion_contract>
|
|
74
|
+
|
|
75
|
+
<handoff>
|
|
76
|
+
`{phase}-design.md` is an **optional upstream input** to `/pan:plan-phase`, consumed by `pan-planner` exactly as `{phase}-context.md` is. `pan-plan-checker` verifies the plan conforms to it (Design Conformance dimension). A phase without a design.md still plans — the design step strengthens planning, it does not gate it.
|
|
77
|
+
</handoff>
|
|
@@ -62,7 +62,7 @@ Phase: $ARGUMENTS
|
|
|
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
64
|
- `--deep-review` (v3.4+) — After the normal reviewer step, also run `/pan:review-deep <phase>` (security audit via pan-hardener + cross-check via pan-meta-reviewer). Produces `.planning/reviews/<N>/deep-review.md`. Recommended for phases touching auth, payment, PII, migrations, or public APIs. Costs roughly 3× a normal review.
|
|
65
|
-
- `--hierarchical` (v3.4+, Claude
|
|
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.
|
|
68
68
|
</context>
|
|
@@ -97,7 +97,7 @@ pan-tools cache prime --summary
|
|
|
97
97
|
|
|
98
98
|
This returns `{blocks: [{path, bytes, cache}], total_bytes, sha}` for the cacheable set (project.md, requirements.md, roadmap.md, state.md, standards.md). The `sha` is stable across identical inputs, so repeated calls within the phase hit cached reads.
|
|
99
99
|
|
|
100
|
-
When spawning subagents for wave execution, include the cacheable block paths in each agent's system-context so
|
|
100
|
+
When spawning subagents for wave execution, include the cacheable block paths in each agent's system-context so a host runtime that supports prompt caching (Claude Code does) can mark them `cache_control: ephemeral`. Where prompt caching is unavailable, this step is a no-op — nothing breaks, just no savings.
|
|
101
101
|
</cache_priming>
|
|
102
102
|
|
|
103
103
|
<process>
|
|
@@ -17,8 +17,8 @@ allowed-tools:
|
|
|
17
17
|
> **Self-protection:** This command **scaffolds external project folders OUTSIDE the PAN source repo** to drive autonomous AI coding sessions against fresh ideas, then harvests the resulting telemetry back into `pan-wizard-core/learnings/`. It is a **PAN-development tool**, not a feature for end-users of PAN to invoke on their own projects.
|
|
18
18
|
|
|
19
19
|
**Spec:** `docs/specs/self_improvement_loop_featureai.md`
|
|
20
|
-
**ADR:** ADR-0026 (
|
|
21
|
-
**Status:** v3.7.0
|
|
20
|
+
**ADR:** ADR-0026 (Accepted — shipped W1-W4 in v3.7.0)
|
|
21
|
+
**Status:** v3.7.0 — scaffolding (`new`/`list`/`manifest`) + external runner (`run`/`status`/`stop`) + harvest (`harvest`/`prune`) + promote integration with `/pan:learn` (`learn promote`/`unpromote`/`list-promoted`).
|
|
22
22
|
|
|
23
23
|
---
|
|
24
24
|
|
|
@@ -31,7 +31,7 @@ allowed-tools:
|
|
|
31
31
|
## When NOT to use this
|
|
32
32
|
|
|
33
33
|
- Building production user features. Use `/pan:new-project` and `/pan:exec-phase` directly.
|
|
34
|
-
- Validating a single-file change. The experiment loop is heavy — use `npm test` and `/pan:
|
|
34
|
+
- Validating a single-file change. The experiment loop is heavy — use `npm test` and `/pan:quick`.
|
|
35
35
|
- Inside the PAN source repo. The command **refuses** to scaffold experiments inside `d:\PanWizard\` (or wherever the source is cloned). The experiment root defaults to `~/pan-experiments/`.
|
|
36
36
|
|
|
37
37
|
---
|
|
@@ -97,7 +97,7 @@ Spawn the external AI runtime against the experiment folder. **Synchronous** —
|
|
|
97
97
|
|
|
98
98
|
| Flag | Default | Purpose |
|
|
99
99
|
|------|---------|---------|
|
|
100
|
-
| `--timeout <sec>` | `
|
|
100
|
+
| `--timeout <sec>` | `3600` (60 min) | Hard timeout in seconds; runner sends SIGTERM at deadline |
|
|
101
101
|
| `--prompt <text>` | `/pan:new-project --auto @.planning/idea.md` | Prompt passed to the external runtime |
|
|
102
102
|
| `--root <path>` | `~/pan-experiments/` | Override the experiment root |
|
|
103
103
|
|
|
@@ -105,7 +105,7 @@ Spawn the external AI runtime against the experiment folder. **Synchronous** —
|
|
|
105
105
|
|
|
106
106
|
**Runtime support:** claude / codex / gemini / opencode (via `RUNTIME_RUNNERS` adapter map in `runner.cjs`). GitHub Copilot CLI is **unsupported** for the `run` subcommand — no documented headless prompt mode. Copilot users can still scaffold and harvest manually.
|
|
107
107
|
|
|
108
|
-
**Billing note (Claude runtime):** headless `claude -p` runs bill against the **Claude Agent SDK credit pool** — a monthly allotment separate from your interactive subscription limits (Anthropic split the two effective June 15, 2026). Experiment runs do not consume interactive-session quota, but heavy experimentation can exhaust the SDK pool independently.
|
|
108
|
+
**Billing note (Claude runtime):** headless `claude -p` runs bill against the **Claude Agent SDK credit pool** — a monthly allotment separate from your interactive subscription limits (Anthropic split the two effective June 15, 2026). Experiment runs do not consume interactive-session quota, but heavy experimentation can exhaust the SDK pool independently. Note: the CLI `experiment run` does not capture a metrics envelope — the `billing_pool: "agent_sdk"` tagging is produced only via the runner module's capture-metrics API, not from the command line, so CLI run-state has no `metrics` key to reconcile against.
|
|
109
109
|
|
|
110
110
|
### `/pan:experiment status <slug>`
|
|
111
111
|
|
|
@@ -113,7 +113,7 @@ Read the current `run-state.json` snapshot. Returns the full state object (`stat
|
|
|
113
113
|
|
|
114
114
|
### `/pan:experiment stop <slug>`
|
|
115
115
|
|
|
116
|
-
|
|
116
|
+
Finalize and record a stopped experiment. This **cannot** terminate an already-running synchronous experiment: while a run is in flight the runner blocks and no pid is available to signal, so `stop` only reconciles the run-state after the fact. If a completed run left the state un-finalized, it records `status: failed, stop_reason: manual` and returns the updated state. If no pid is recorded (an in-flight run), it returns an error and writes nothing.
|
|
117
117
|
|
|
118
118
|
If the experiment has already finished, returns the existing run state without error.
|
|
119
119
|
|
|
@@ -163,17 +163,21 @@ Remove the experiment folder after harvest.
|
|
|
163
163
|
|
|
164
164
|
**Returns:** `{ pruned: <slug>, mode: "soft"|"hard", archive_path? }`.
|
|
165
165
|
|
|
166
|
-
##
|
|
166
|
+
## Promote integration (shipped, W4)
|
|
167
167
|
|
|
168
|
-
|
|
169
|
-
|------------|------|---------|
|
|
170
|
-
| `archive <slug>` | W4 | Alias for `prune` (kept for clarity in scripts) |
|
|
171
|
-
| `delete <slug> --confirm` | W4 | Alias for `prune --hard` with confirmation prompt |
|
|
172
|
-
|
|
173
|
-
W4 also adds:
|
|
168
|
+
The self-improvement loop closes via `/pan:learn` and the `learn` CLI:
|
|
174
169
|
- `/pan:learn --experiment <slug>` — runs pan-optimizer over harvested data
|
|
175
170
|
- `pan-tools learn promote --pattern <id> --scope universal --topic <name>` — extracts a finding into `pan-wizard-core/learnings/{universal,internal}/<topic>.md`
|
|
176
|
-
- `pan-tools learn unpromote/list-promoted` — rollback and inventory
|
|
171
|
+
- `pan-tools learn unpromote` / `learn list-promoted` — rollback and inventory
|
|
172
|
+
|
|
173
|
+
## Not yet shipped
|
|
174
|
+
|
|
175
|
+
| Subcommand | Purpose |
|
|
176
|
+
|------------|---------|
|
|
177
|
+
| `archive <slug>` | Alias for `prune` (kept for clarity in scripts) |
|
|
178
|
+
| `delete <slug> --confirm` | Alias for `prune --hard` with confirmation prompt |
|
|
179
|
+
|
|
180
|
+
Until these land, use `prune` / `prune --hard` directly.
|
|
177
181
|
|
|
178
182
|
---
|
|
179
183
|
|
|
@@ -364,21 +364,21 @@ Between cycles, manage context to prevent quality degradation over long campaign
|
|
|
364
364
|
|
|
365
365
|
Display one-line cycle summary: `Cycle N/M | X/Y pts | Z items done | Tests: A -> B`
|
|
366
366
|
|
|
367
|
-
#### Step 2.5a: Reflection Gate (
|
|
367
|
+
#### Step 2.5a: Reflection Gate (`reasoning` tier only)
|
|
368
368
|
|
|
369
|
-
Before committing to the next cycle, call the reflection helper:
|
|
369
|
+
Before committing to the next cycle, call the reflection helper, passing the tier the run actually resolved to (not a literal — `"reasoning"` below is just the enabling case):
|
|
370
370
|
|
|
371
371
|
```
|
|
372
|
-
echo '{"run": <run-state>, "cycle": <just-completed-cycle>, "batch": <proposed-next-batch>, "tier": "
|
|
372
|
+
echo '{"run": <run-state>, "cycle": <just-completed-cycle>, "batch": <proposed-next-batch>, "tier": "<resolved-tier>"}' \
|
|
373
373
|
| pan-tools focus reflection
|
|
374
374
|
```
|
|
375
375
|
|
|
376
|
-
The helper returns `{reflect: true, prompt: "..."}` when the
|
|
376
|
+
The helper returns `{reflect: true, prompt: "..."}` only when the resolved tier is `reasoning` (`REFLECTION_THRESHOLD.enable_on_tiers`), or when the run state sets `reflection_enabled: true`, which overrides the tier check in both directions. Being *thinking-capable* is not enough on its own: a `mid`-tier Sonnet supports extended thinking but still gets `reflect: false` unless `reflection_enabled` is set. If `reflect: true`, think through the prompt — which asks whether running another cycle is worthwhile given telemetry and remaining items — and respond with JSON: `{"continue": true|false, "rationale": "..."}`.
|
|
377
377
|
|
|
378
378
|
- If `continue: false`: stop the campaign and treat as a user-reason stop (preserve state, skip to Phase 3).
|
|
379
379
|
- If `continue: true`: proceed to the next cycle.
|
|
380
380
|
|
|
381
|
-
If the helper returns `reflect: false` (tier
|
|
381
|
+
If the helper returns `reflect: false` (resolved tier is `mid`/`fast` and `reflection_enabled` is unset, or `reflection_enabled: false` in run state, or no next batch): skip this step silently and continue to the next cycle.
|
|
382
382
|
|
|
383
383
|
The reflection gate catches "zero progress" or "wrong category" drift earlier than the automatic stop rules.
|
|
384
384
|
|
|
@@ -22,7 +22,7 @@ Research, design, and specify a new feature with strategic analysis. $ARGUMENTS
|
|
|
22
22
|
|
|
23
23
|
**Goal:** Produce a best-of-breed feature specification that (a) validates the problem with evidence, (b) maps the competitive landscape, (c) identifies strategic differentiation, (d) designs an architecturally sound implementation, (e) plans for error handling, security, and testability from day one, (f) defines an incremental delivery ladder, and (g) outputs a ready-to-implement spec with ADR, test plan, and implementation tasks.
|
|
24
24
|
|
|
25
|
-
**Methodology:** Synthesizes Spec-Driven Development, Blue Ocean Strategy, Wardley Mapping, STRIDE-lite threat modeling, Architecture Decision Records, and structured workflow methodology into a single investigative pipeline.
|
|
25
|
+
**Methodology:** Synthesizes Spec-Driven Development, Blue Ocean Strategy, Wardley Mapping, STRIDE-lite threat modeling, Architecture Decision Records, and structured workflow methodology into a single investigative pipeline. The design-quality bar and depth tiers are the shared ones in `~/.claude/pan-wizard-core/references/design-methodology.md` (this pipeline runs the `feature`/`full` tiers; the main flow's `/pan:design-phase` runs the `phase` tier) — and the same independent verifier, `pan-design-checker`, gates both (ADR-0042).
|
|
26
26
|
|
|
27
27
|
---
|
|
28
28
|
|
|
@@ -883,6 +883,16 @@ Before writing the ADR file, verify ALL of these:
|
|
|
883
883
|
- **Straw-man options:** Including obviously bad alternatives just to make the chosen option look good
|
|
884
884
|
- **Missing migration strategy:** Documenting breaking changes without explaining how to handle them
|
|
885
885
|
|
|
886
|
+
### 5.4 Independent Verification (pan-design-checker)
|
|
887
|
+
|
|
888
|
+
The self-check in 5.2 is necessary but not sufficient — an author is a poor judge of their own design. After the ADR and design synthesis are drafted, spawn **`pan-design-checker`** for an *independent, adversarial* pass (the same assurance model `/pan:plan-phase` gets from `pan-plan-checker`).
|
|
889
|
+
|
|
890
|
+
- Pass the checker a `<files_to_read>` block: the drafted ADR + spec, the feature boundary/spec, and any `context.md`.
|
|
891
|
+
- The checker verifies the seven dimensions in `~/.claude/pan-wizard-core/references/design-methodology.md` at the `feature`/`full` tier: requirement coverage, ≥2 machine-checkable criteria, architecture conformance (independently confirmed against the codebase — not the design's own claims), ADR honesty, threat coverage, testability, and scope discipline.
|
|
892
|
+
- **Reflexion loop:** if the checker returns gaps, revise the affected phase output and re-check. Cap at **2 revision iterations** (design → check → revise → check → final); re-read each critique and fix only genuine gaps, not false positives from missing context. On the final iteration, record any remaining gaps as caveats rather than looping further.
|
|
893
|
+
|
|
894
|
+
Do not proceed to Phase 10 output until the checker PASSES or the 2-iteration cap is reached.
|
|
895
|
+
|
|
886
896
|
---
|
|
887
897
|
|
|
888
898
|
## Phase 6: Error Handling & Diagnostics Design
|
|
@@ -1039,6 +1049,8 @@ Write ADR to: `docs/decisions/ADR-NNNN-<feature_name>.md`
|
|
|
1039
1049
|
|
|
1040
1050
|
**ADR completeness gate:** Before saving, verify the ADR passes ALL checks from Phase 5.2. The ADR file must contain every section defined in Phase 5.1 with substantive content — no placeholder brackets, no skeleton sections, no missing tables. If any section would be empty, go back to the relevant phase and extract the content.
|
|
1041
1051
|
|
|
1052
|
+
**Independent verification gate:** The final artifact must have PASSED `pan-design-checker` in Phase 5.4 (or reached the 2-iteration cap with remaining gaps recorded as caveats). Re-run the checker here on the *saved* spec + ADR as a final gate — the independent pass, not just the 5.2 self-check, is what authorizes handing this design to `/pan:focus-plan`.
|
|
1053
|
+
|
|
1042
1054
|
**Minimum ADR size:** A proper ADR for a `--full` mode investigation should be 80-200+ lines. If the ADR is under 60 lines, it is almost certainly missing required sections. For `--internal` mode, minimum 60 lines. For `--outward` mode, minimum 70 lines.
|
|
1043
1055
|
|
|
1044
1056
|
### 10.3 Report Summary
|
|
@@ -255,7 +255,7 @@ Display the execution batch to user, then continue automatically.
|
|
|
255
255
|
```
|
|
256
256
|
pan-tools focus classify-stages --raw
|
|
257
257
|
```
|
|
258
|
-
The CLI reads the latest batch and returns `{waves, parallelism_hint}`. When `parallelism_hint` is `emit-micro-in-parallel` or `emit-standard-in-parallel`, all reads and greps for items in the current wave SHOULD be emitted in a single assistant turn (parallel tool calls).
|
|
258
|
+
The CLI reads the latest batch and returns `{waves, parallelism_hint}`. When `parallelism_hint` is `emit-micro-in-parallel` or `emit-standard-in-parallel`, all reads and greps for items in the current wave SHOULD be emitted in a single assistant turn (parallel tool calls). Current frontier models are markedly better at emitting parallel tool calls than earlier generations; use that to collapse Stage 3 latency on MICRO-heavy batches.
|
|
259
259
|
|
|
260
260
|
Serialize on `FULL` tier items — each is its own wave.
|
|
261
261
|
|
package/commands/pan/learn.md
CHANGED
|
@@ -72,4 +72,4 @@ The optimization report in `.planning/optimization/reports/` contains:
|
|
|
72
72
|
|
|
73
73
|
**See also:** `/pan:optimize`, `/pan:exec-phase`, `/pan:experiment` (v3.7.0+ self-improvement loop)
|
|
74
74
|
|
|
75
|
-
Follow the workflow at
|
|
75
|
+
Follow the workflow at `~/.claude/pan-wizard-core/workflows/learn.md`.
|
package/commands/pan/links.md
CHANGED
|
@@ -12,6 +12,8 @@ allowed-tools:
|
|
|
12
12
|
|
|
13
13
|
Validate the doc-code link graph. Walks `docs/`, `pan-wizard-core/`, `commands/`, and `agents/` for inline `[[<id>]]` references and `// @pan: <id>` source-comment anchors. Reports broken refs, stale anchors, and uncovered backlink contracts.
|
|
14
14
|
|
|
15
|
+
> **User projects:** the default roots (`docs/`, `pan-wizard-core/`, `commands/`, `agents/`) are the **PAN source-repo** layout. A typical user project has none of these, so a bare `/pan:links` scans almost nothing and reports a hollow `pass`. In a user project you **must** point it at your own layout with `--doc-root` / `--source-root` (both repeatable), e.g. `/pan:links --doc-root docs --source-root src`. Treat any run where `doc_files_scanned` (or `source_files_scanned`) is `0` as a **warning that the roots are misconfigured**, not a clean pass.
|
|
16
|
+
|
|
15
17
|
**Usage:**
|
|
16
18
|
```
|
|
17
19
|
/pan:links
|
|
@@ -99,4 +101,4 @@ Anchors cluster at the top of a file under a single banner; comment leader must
|
|
|
99
101
|
- ADR-0027 — Doc–Code Link Graph
|
|
100
102
|
- `docs/specs/doc_code_link_graph_featureai.md` — wire-level spec
|
|
101
103
|
- `pan-tools doc-lint` — frontmatter schema validator (orthogonal concern)
|
|
102
|
-
- `pan-tools verify
|
|
104
|
+
- `pan-tools verify key-links` — legacy frontmatter-only link verifier (subsumed; both still ship)
|
|
@@ -56,12 +56,12 @@ Run: `node ~/.claude/pan-wizard-core/bin/pan-tools.cjs codebase estimate-size --
|
|
|
56
56
|
|
|
57
57
|
The CLI returns `{mode, total_tokens, file_count, languages}`:
|
|
58
58
|
|
|
59
|
-
- **`mode: "single-shot"`** — repo is small enough (≤700K tokens) for one
|
|
60
|
-
- **`mode: "sharded"`** — repo exceeds 700K tokens. Fall back to the default 6-way parallel sharding (tech, arch, quality, concerns, relationships, practices). Each shard
|
|
59
|
+
- **`mode: "single-shot"`** — repo is small enough (≤700K tokens) for one agent with a 1M-context window to ingest the whole thing. Spawn a single `pan-document_code` agent with the full repo in context. This avoids the 6-way stitching artifacts of sharded mode (contradictory version claims, duplicated mentions, missed cross-file references).
|
|
60
|
+
- **`mode: "sharded"`** — repo exceeds 700K tokens. Fall back to the default 6-way parallel sharding (tech, arch, quality, concerns, relationships, practices). Each shard is mapped by its own agent in its own context window, so no single agent has to hold the whole repo.
|
|
61
61
|
|
|
62
62
|
Record the chosen mode + telemetry in the final `.planning/codebase/overview.md` so future runs can reason about drift.
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
**The mode is decided by repo size alone** — `estimate-size` compares the token estimate to `--threshold` and applies no model check. So single-shot only pays off when the model you launched with actually has a 1M-context window (the default Opus and current Sonnet-class models do; legacy 200K-context models do not). On a 200K-context model, pass a threshold that matches your real window (e.g. `--threshold 150000`) so anything larger resolves to `sharded` instead of overflowing a single agent.
|
|
65
65
|
</stage_0_ingest_mode>
|
|
66
66
|
|
|
67
67
|
<tool_priority>
|
|
@@ -85,7 +85,7 @@ The orchestrator loads context in layers — NOT everything upfront. Mapper agen
|
|
|
85
85
|
- Each agent discovers its own details via Glob/Grep/Read within its focus area
|
|
86
86
|
- Agents do NOT receive other agents' output (parallel, independent)
|
|
87
87
|
|
|
88
|
-
**Why:** Loading the entire codebase into the orchestrator before spawning agents wastes orchestrator context. Each agent has a fresh
|
|
88
|
+
**Why:** Loading the entire codebase into the orchestrator before spawning agents wastes orchestrator context. Each agent has a fresh window — let them explore independently. The orchestrator only needs enough context to spawn correctly and verify outputs exist.
|
|
89
89
|
</progressive_context>
|
|
90
90
|
|
|
91
91
|
<process>
|
|
@@ -98,7 +98,7 @@ Normally the host runtime writes this file. The CLI path exists for test fixture
|
|
|
98
98
|
|
|
99
99
|
<workflow>
|
|
100
100
|
|
|
101
|
-
**New to a project with MCP tools?** Run `/pan:mcp-bridge list` to see what's available. If empty, check the host runtime's MCP config —
|
|
101
|
+
**New to a project with MCP tools?** Run `/pan:mcp-bridge list` to see what's available. If empty, check the host runtime's MCP config — each runtime keeps it somewhere different: Claude Code in `settings.json` under its config dir, OpenCode in `opencode.json`, Copilot in `.github/mcp.json`, Codex in its own config, Gemini in its settings file.
|
|
102
102
|
|
|
103
103
|
**Planning a phase that might touch external systems?** Run `/pan:mcp-bridge recommend <phase>` to get a ranked shortlist. Copy relevant tool names into the phase plan's "External tools" section so the executor knows to invoke them.
|
|
104
104
|
|
|
@@ -22,7 +22,9 @@ Brownfield equivalent of new-project. Project exists, project.md has history. Ga
|
|
|
22
22
|
- `.planning/roadmap.md` — phase structure (continues numbering)
|
|
23
23
|
- `.planning/state.md` — reset for new milestone
|
|
24
24
|
|
|
25
|
-
**After:** `/pan:plan-phase [N]` to
|
|
25
|
+
**After:** `/pan:design-phase [N]` → `/pan:plan-phase [N]` to design then plan the first phase.
|
|
26
|
+
|
|
27
|
+
**Design altitude (ADR-0042):** product/strategic design — demand validation, competitive intelligence, market positioning — belongs HERE at milestone creation (via the requirements/research cycle, or `/pan:focus-design` for a strategic feature), done ONCE. Per-phase architecture/ADR/threat design is `/pan:design-phase`, run per phase. Do not defer product questions to per-phase design, and do not re-open them there.
|
|
26
28
|
</objective>
|
|
27
29
|
|
|
28
30
|
<execution_context>
|
package/commands/pan/optimize.md
CHANGED
|
@@ -23,7 +23,7 @@ Manage the circular optimization loop: apply recommendations, view stats, list r
|
|
|
23
23
|
/pan:optimize stats
|
|
24
24
|
/pan:optimize trace init [--description "what you're building"]
|
|
25
25
|
/pan:optimize trace end
|
|
26
|
-
/pan:optimize trace
|
|
26
|
+
/pan:optimize trace current
|
|
27
27
|
/pan:optimize trace list
|
|
28
28
|
```
|
|
29
29
|
|
|
@@ -67,7 +67,7 @@ Start a new trace session before running a build. The hook fires automatically o
|
|
|
67
67
|
### trace end
|
|
68
68
|
Finalize the current trace session (writes summary stats to session.json).
|
|
69
69
|
|
|
70
|
-
### trace
|
|
70
|
+
### trace current
|
|
71
71
|
Show the active trace session ID and event count.
|
|
72
72
|
|
|
73
73
|
### trace list
|
package/commands/pan/patches.md
CHANGED
|
@@ -19,6 +19,8 @@ Create executable phase prompts (plan.md files) for a roadmap phase with integra
|
|
|
19
19
|
|
|
20
20
|
**Default flow:** Research (if needed) → Plan → Verify → Done
|
|
21
21
|
|
|
22
|
+
**Design input (ADR-0042):** if `{phase}-design.md` exists (from `/pan:design-phase`, verified by `pan-design-checker`), it is an authoritative upstream input — `pan-planner` implements its approved architecture/decisions and `pan-plan-checker` verifies conformance (Design Conformance dimension). It is optional: a phase without a design.md plans exactly as before.
|
|
23
|
+
|
|
22
24
|
**Orchestrator role:** Parse arguments, validate phase, research domain (unless skipped), spawn pan-planner, verify with pan-plan-checker, iterate until pass or max iterations, present results.
|
|
23
25
|
</objective>
|
|
24
26
|
|
|
@@ -132,7 +134,7 @@ Run once per invocation:
|
|
|
132
134
|
pan-tools cache prime --summary
|
|
133
135
|
```
|
|
134
136
|
|
|
135
|
-
Returns `{blocks: [{path, bytes, cache}], total_bytes, sha}`. On Claude Code
|
|
137
|
+
Returns `{blocks: [{path, bytes, cache}], total_bytes, sha}`. On a host runtime that supports prompt caching (Claude Code does), the host translates these block references into `cache_control: ephemeral`. Where prompt caching is unavailable this is a no-op — nothing breaks.
|
|
136
138
|
</cache_priming>
|
|
137
139
|
|
|
138
140
|
<process>
|
package/commands/pan/preview.md
CHANGED
|
@@ -51,7 +51,7 @@ Consolidates Spec B v1's architect + simulate + predict-milestone into one entry
|
|
|
51
51
|
|
|
52
52
|
**Output:** `.planning/architecture/dependency-graph.md`
|
|
53
53
|
|
|
54
|
-
**
|
|
54
|
+
**1M-context bonus:** when the full repo fits in a single agent window — which needs a model with a 1M-context window — the agent cross-references plan text with actual source imports to catch coupling the frontmatter missed. On smaller-context models, the agent relies on data-layer output alone.
|
|
55
55
|
|
|
56
56
|
### `milestone` — Completion ETA
|
|
57
57
|
|
|
@@ -103,12 +103,12 @@ The command returns the path to the generated preview document. Never paste the
|
|
|
103
103
|
|
|
104
104
|
| Runtime | phase | phases | milestone |
|
|
105
105
|
|---------|-------|--------|-----------|
|
|
106
|
-
| Claude Code | Full, thinking enabled | Full, 1M-ctx bonus
|
|
106
|
+
| Claude Code | Full, thinking enabled | Full, plus 1M-ctx bonus when the window allows | Full |
|
|
107
107
|
| OpenCode | Full | Data-layer + simple report | Full |
|
|
108
108
|
| Gemini CLI | Full | Data-layer + simple report | Full |
|
|
109
109
|
| Codex CLI | Full | Data-layer + simple report | Full |
|
|
110
110
|
| Copilot CLI | Full | Data-layer + simple report | Full |
|
|
111
111
|
|
|
112
|
-
The data layer (`pan-tools preview …`) works identically on all runtimes. What varies is the quality of the agent's synthesis —
|
|
112
|
+
The data layer (`pan-tools preview …`) works identically on all runtimes. What varies is the quality of the agent's synthesis — a thinking-capable Opus-class model catches subtler risks than smaller ones.
|
|
113
113
|
|
|
114
114
|
</runtime_compatibility>
|
package/commands/pan/profile.md
CHANGED
|
@@ -37,7 +37,7 @@ The workflow handles all logic including:
|
|
|
37
37
|
</process>
|
|
38
38
|
|
|
39
39
|
<tier_decision_tree>
|
|
40
|
-
**
|
|
40
|
+
**Capability-aware routing** (shipped v2.10.0 — E-7). Even within a single profile, PAN picks a tier per-call based on three hints: context estimate, whether the task needs extended thinking, and whether prompt cache is warm.
|
|
41
41
|
|
|
42
42
|
The decision order `resolveModel` applies after the baseline profile pick:
|
|
43
43
|
|
|
@@ -46,7 +46,7 @@ Baseline tier (from MODEL_PROFILES[agent][profile])
|
|
|
46
46
|
│
|
|
47
47
|
▼
|
|
48
48
|
┌─────────────────────────────────────────────┐
|
|
49
|
-
│ context_estimate > 700K tokens? │── yes ──▶ force reasoning (
|
|
49
|
+
│ context_estimate > 700K tokens? │── yes ──▶ force reasoning (widest ctx tier)
|
|
50
50
|
└─────────────────────────────────────────────┘
|
|
51
51
|
│ no
|
|
52
52
|
▼
|
|
@@ -66,7 +66,7 @@ Final tier → provider-native model name
|
|
|
66
66
|
|
|
67
67
|
**Quick guide:**
|
|
68
68
|
- Heavy verification (plan-checker, verifier, integration-checker, reviewer, debugger): `needs_thinking: true` — baseline upgrades fast→mid.
|
|
69
|
-
-
|
|
69
|
+
- Whole-repo context estimates above the large-context threshold (`context_estimate > 700K` tokens — `LARGE_CONTEXT_TOKEN_THRESHOLD`): forced to reasoning, which inherits the model you launched with. Note the direction: `/pan:map-codebase` picks `single-shot` **at or below** 700K and `sharded` above it, so the repos that trip this rule are the ones the mapper is already sharding.
|
|
70
70
|
- Routine exec tasks with project.md cached: `cache_warm + small ctx` — mid gets downgraded to fast for a cost win.
|
|
71
71
|
- All rules are additive to the `quality` / `balanced` / `budget` profile you pick here — profile sets the floor, capability hints adjust upward or downward within that floor's band.
|
|
72
72
|
|