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
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
name: focus-plan
|
|
3
3
|
group: Focus
|
|
4
4
|
description: Create capacity-budgeted work batch with spec coverage verification and 4 execution modes
|
|
5
|
+
argument-hint: "[--budget N] [--mode bugfix|balanced|features|full] [--priority P0-P6] [--lean] [--no-spec-check]"
|
|
5
6
|
allowed-tools:
|
|
6
7
|
- Read
|
|
7
8
|
- Write
|
|
@@ -24,7 +25,7 @@ Create a capacity-budgeted work batch from focus-scan results **with mandatory v
|
|
|
24
25
|
This command plans work batches for the **host project** — NOT for PAN Wizard's own infrastructure.
|
|
25
26
|
|
|
26
27
|
**NEVER include items targeting these PAN directories:**
|
|
27
|
-
- `.claude/`, `.
|
|
28
|
+
- `.claude/`, `.codex/`, `.gemini/`, `.opencode/`, `.agents/`, and the Copilot runtime paths PAN installs into under `.github/` (`agents/`, `skills/`, `hooks/`, `copilot/`, `pan-wizard-core/`, `pan-local-patches/`, `mcp.json`, `package.json`, `pan-file-manifest.json`) — PAN runtime directories
|
|
28
29
|
- Any `pan-wizard-core/`, `pan-tools`, agent `.md`, or command `.md` files within PAN runtime directories
|
|
29
30
|
|
|
30
31
|
If a scan item points to a PAN infrastructure file, DROP it from the batch. PAN's files are not the project's responsibility.
|
|
@@ -38,11 +39,11 @@ If no recent scan exists, run `/pan:focus-scan` automatically before proceeding.
|
|
|
38
39
|
**Flags:**
|
|
39
40
|
- `--budget N` — Override capacity budget in points (default: 50, min: 5, max: 100)
|
|
40
41
|
- `--mode MODE` — Execution mode. Default: `balanced`
|
|
41
|
-
- `bugfix` — P0
|
|
42
|
+
- `bugfix` — one pass over P0-P4 in priority order, smallest-first within each; P5-P6 left out (40 pts)
|
|
42
43
|
- `balanced` — **Default.** Mix of stability fixes + feature development, 60/40 split (50 pts)
|
|
43
|
-
- `features` — Feature-focused: 80%
|
|
44
|
-
- `full` — Full-spectrum:
|
|
45
|
-
- `--priority
|
|
44
|
+
- `features` — Feature-focused: P0 crashes mandatory, then 80% of what that leaves on P3-P5 (50 pts)
|
|
45
|
+
- `full` — Full-spectrum: one pass over every priority, P0 first and smallest-first within each; budget raised to at least 60 (60 pts)
|
|
46
|
+
- `--priority PN` — Only pick items at priority PN or higher (P0 through PN), e.g. `--priority P2`
|
|
46
47
|
- `--lean` — Apply RS filtering: exclude items with RS < 1.5
|
|
47
48
|
- `--no-spec-check` — Skip spec coverage verification (NOT recommended — use only for pure bugfix batches)
|
|
48
49
|
|
|
@@ -133,13 +134,13 @@ This becomes the **spec gap backlog** — items that specs/ADRs promised but the
|
|
|
133
134
|
### `features` — Feature-Focused Sprint
|
|
134
135
|
- **Budget:** 50 pts
|
|
135
136
|
- **Mandatory pass:** All P0 items
|
|
136
|
-
- **Feature pass (80%):**
|
|
137
|
-
- **Stability pass (20%):**
|
|
137
|
+
- **Feature pass (80%):** 80% of what the P0 pass left, for P3-P5 (40 pts when there are no P0 items)
|
|
138
|
+
- **Stability pass (20%):** the rest of it, for P1-P2 quick wins (10 pts when there are no P0 items)
|
|
138
139
|
- **Spec coverage:** Feature items MUST map to spec requirements — reject unspecified feature work
|
|
139
140
|
|
|
140
141
|
### `full` — Full-Spectrum Marathon
|
|
141
142
|
- **Budget:** 60 pts
|
|
142
|
-
- **
|
|
143
|
+
- **One pass over every priority in priority order, smallest-first within each**
|
|
143
144
|
- **Spec coverage:** Full traceability — every item maps to a spec/ADR requirement or is flagged as unspecified
|
|
144
145
|
|
|
145
146
|
### Batch Selection Algorithm
|
|
@@ -220,7 +221,7 @@ This becomes the post-execution checklist for `/pan:focus-exec`.
|
|
|
220
221
|
|
|
221
222
|
## Phase 5: Output
|
|
222
223
|
|
|
223
|
-
|
|
224
|
+
Write the batch to `.planning/focus/batch-<YYYY-MM-DD>.json` yourself — `{date, mode, budget, allocated, items: [...]}`, each item `{id, title, priority, effort, points, tier, files}` with `tier` one of `MICRO`, `STANDARD`, `FULL` (`focus exec` and `focus classify-stages` group items by it, and an item without it lands in no wave); `focus exec`, `focus classify-stages` and `/pan:focus-exec` read an `items` or `batch` array. Do not hand this step to `pan-tools focus plan`: it ignores the scan and the spec mapping, batches only incomplete roadmap phases, pending todos and `.planning/patterns.md` entries, and overwrites the day's batch file:
|
|
224
225
|
|
|
225
226
|
```markdown
|
|
226
227
|
## Focus Batch — <date>
|
|
@@ -252,11 +253,11 @@ Produce a batch file at `.planning/focus/batch-<YYYY-MM-DD>.json` via `pan-tools
|
|
|
252
253
|
| NCA affordability | ADR-0018 SC-4 | Blocked by SC-1, SC-2 | After this batch |
|
|
253
254
|
|
|
254
255
|
### Dependency Order
|
|
255
|
-
|
|
256
|
+
~~~
|
|
256
257
|
#1 (P0 crash fix) → independent
|
|
257
258
|
#3 (categories) → #4 (keywords) → #5 (match types)
|
|
258
259
|
#2 (tests) → independent
|
|
259
|
-
|
|
260
|
+
~~~
|
|
260
261
|
|
|
261
262
|
### Post-Execution Verification Checklist
|
|
262
263
|
- [ ] SC-1: Category count >= 65 → `SELECT COUNT(*) FROM stx_category`
|
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
name: focus-scan
|
|
3
3
|
group: Focus
|
|
4
4
|
description: Deep-dive strategic work scan with prioritized items and Reality Score filtering
|
|
5
|
+
argument-hint: "[--focus <area>] [--quick] [--refresh] [--lean]"
|
|
5
6
|
allowed-tools:
|
|
6
7
|
- Read
|
|
8
|
+
- Write
|
|
7
9
|
- Bash
|
|
8
10
|
- Grep
|
|
9
11
|
- Glob
|
|
@@ -22,13 +24,13 @@ Survey the project for prioritized work items with evidence-based scoring. $ARGU
|
|
|
22
24
|
This command scans the **host project's source code** for work items — not PAN Wizard's own infrastructure.
|
|
23
25
|
|
|
24
26
|
**Exclude these directories from scanning:**
|
|
25
|
-
- `.claude/`, `.
|
|
27
|
+
- `.claude/`, `.codex/`, `.gemini/`, `.opencode/`, `.agents/`, and the Copilot runtime paths PAN installs into under `.github/` (`agents/`, `skills/`, `hooks/`, `copilot/`, `pan-wizard-core/`, `pan-local-patches/`, `mcp.json`, `package.json`, `pan-file-manifest.json`) — PAN runtime directories
|
|
26
28
|
- `.planning/` — PAN planning state (read for context, but never report PAN planning files as "issues")
|
|
27
29
|
- Any `pan-wizard-core/`, `pan-tools`, agent `.md`, or command `.md` files within PAN runtime directories
|
|
28
30
|
|
|
29
31
|
**These directories are PAN's own tooling installed into the project.** Do not report TODO/FIXME items found in PAN files. Do not flag PAN files as lacking test coverage. Do not suggest improvements to PAN's agents, commands, or core modules.
|
|
30
32
|
|
|
31
|
-
If a scan finding points to a file
|
|
33
|
+
If a scan finding points to a file in one of the PAN paths listed above — DROP IT. It is not the project's responsibility.
|
|
32
34
|
|
|
33
35
|
---
|
|
34
36
|
|
|
@@ -235,7 +237,7 @@ Gather items from:
|
|
|
235
237
|
## Phase 5: Scan Assembly
|
|
236
238
|
|
|
237
239
|
### 5.1 Output
|
|
238
|
-
|
|
240
|
+
Write the scan to `.planning/focus/scan-<YYYY-MM-DD>.md`, where `/pan:focus-plan` builds from it and `/pan:focus-exec` updates it (Stage 5.2). `pan-tools focus scan` does not take these items: it lists only incomplete roadmap phases that have a directory, pending todos and `.planning/patterns.md` entries.
|
|
239
241
|
|
|
240
242
|
### 5.2 Document Structure
|
|
241
243
|
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
name: focus-sync
|
|
3
3
|
group: Focus
|
|
4
4
|
description: Synchronize documentation after changes — check staleness and update counts
|
|
5
|
+
argument-hint: "[--readme | --docs | --arch | --all]"
|
|
5
6
|
allowed-tools:
|
|
6
7
|
- Read
|
|
7
8
|
- Bash
|
|
@@ -24,7 +25,7 @@ Synchronize project documentation across all files. $ARGUMENTS
|
|
|
24
25
|
This command synchronizes the **host project's documentation** — NOT PAN Wizard's own infrastructure files.
|
|
25
26
|
|
|
26
27
|
**NEVER sync, modify, or report staleness in these PAN directories:**
|
|
27
|
-
- `.claude/`, `.
|
|
28
|
+
- `.claude/`, `.codex/`, `.gemini/`, `.opencode/`, `.agents/`, and the Copilot runtime paths PAN installs into under `.github/` (`agents/`, `skills/`, `hooks/`, `copilot/`, `pan-wizard-core/`, `pan-local-patches/`, `mcp.json`, `package.json`, `pan-file-manifest.json`) — PAN runtime directories
|
|
28
29
|
- Any `pan-wizard-core/`, `pan-tools`, agent `.md`, or command `.md` files within PAN runtime directories
|
|
29
30
|
|
|
30
31
|
**These directories are PAN's own tooling.** Documentation sync applies to the project's README, docs, guides, and code comments — not to PAN's installed agents or command definitions.
|
|
@@ -91,7 +92,7 @@ CHANGELOG.md <- Version history
|
|
|
91
92
|
|
|
92
93
|
## Report
|
|
93
94
|
|
|
94
|
-
|
|
95
|
+
Report in this shape (`pan-tools focus sync` itself returns only JSON — `actuals` (counts of commands, agents and modules), `stale` / `current` entries for those counts, any `--tests` / `--suites` counts, renamed `/pan:` commands and the package.json-vs-CHANGELOG version, plus `stale_count` and `needs_sync`):
|
|
95
96
|
|
|
96
97
|
```
|
|
97
98
|
| Area | Status | Finding |
|
package/commands/pan/git.md
CHANGED
|
@@ -15,7 +15,7 @@ allowed-tools:
|
|
|
15
15
|
<objective>
|
|
16
16
|
Phase-aware git workflow with safety guardrails built in. Every subcommand that modifies history runs safety checks. Rollback uses PAN snapshot tags (`pan-rollback-*`), which `pan-tools rollback-snapshot <phase>` creates; no workflow creates them for you.
|
|
17
17
|
|
|
18
|
-
Works with any git repository — PAN
|
|
18
|
+
Works with any git repository — no PAN project (`.planning/`) needed, only the installed `pan-tools.cjs`.
|
|
19
19
|
</objective>
|
|
20
20
|
|
|
21
21
|
<subcommands>
|
|
@@ -59,19 +59,19 @@ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs git commit \
|
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
**Options:**
|
|
62
|
-
- `--type` — `feat | fix | docs | test | refactor | chore`
|
|
62
|
+
- `--type` — `feat | fix | docs | test | refactor | perf | chore`
|
|
63
63
|
- `--message` — Commit message body
|
|
64
64
|
- `--all` — Stage all changes before committing
|
|
65
65
|
- `--files f1 f2` — Stage specific files
|
|
66
66
|
- `--amend` — Amend last commit (no message needed)
|
|
67
|
-
- `--force` — Bypass deleted-file
|
|
67
|
+
- `--force` — Bypass the deleted-file block (not the sensitive-file block)
|
|
68
68
|
|
|
69
69
|
**Safety checks run automatically:**
|
|
70
70
|
|
|
71
71
|
| Check | Blocks on | Override |
|
|
72
72
|
|-------|-----------|---------|
|
|
73
|
-
| Deleted files |
|
|
74
|
-
| Sensitive files | `.env`, `.pem
|
|
73
|
+
| Deleted files | A deletion anywhere in the repository (`git status --porcelain`, staged or not) | `--force` |
|
|
74
|
+
| Sensitive files | A staged path ending `.env`, `.pem` or `.key`, or containing `credentials`, `secret`, `password` or `token` (PAN's own `.planning/metrics/tokens.jsonl` is exempt) | None: narrow `commit.sensitive_patterns` in `.planning/config.json`, or commit the file yourself |
|
|
75
75
|
|
|
76
76
|
**Output:** `{committed, hash, type, safety_checks}`
|
|
77
77
|
|
|
@@ -174,14 +174,14 @@ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs git diff --staged --file src/ap
|
|
|
174
174
|
### rollback — Revert to PAN Snapshot
|
|
175
175
|
|
|
176
176
|
```bash
|
|
177
|
-
# Rollback to
|
|
177
|
+
# Rollback to the last pan-rollback-* tag in name order — the newest only among one phase's snapshots (requires clean working tree)
|
|
178
178
|
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs git rollback
|
|
179
179
|
|
|
180
180
|
# Preview — does NOT reset, shows what would happen
|
|
181
181
|
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs git rollback --dry-run
|
|
182
182
|
|
|
183
183
|
# Rollback to specific tag
|
|
184
|
-
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs git rollback --tag pan-rollback-
|
|
184
|
+
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs git rollback --tag pan-rollback-3-20260415T101500
|
|
185
185
|
```
|
|
186
186
|
|
|
187
187
|
**Rollback workflow:**
|
|
@@ -219,5 +219,5 @@ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs git sync --remote upstream --br
|
|
|
219
219
|
</workflow>
|
|
220
220
|
|
|
221
221
|
<runtime_note>
|
|
222
|
-
All subcommands work with any git repository
|
|
222
|
+
All subcommands work with any git repository, whether or not it holds a PAN project (`.planning/`); they run the installed `pan-tools.cjs`. The only requirement is a valid git repo (`git init` or cloned).
|
|
223
223
|
</runtime_note>
|
package/commands/pan/health.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: pan:health
|
|
3
3
|
group: System
|
|
4
4
|
description: Diagnose planning directory health and optionally repair issues
|
|
5
|
-
argument-hint: "[--repair]"
|
|
5
|
+
argument-hint: "[--repair] [--standards] [--full] [--drift] [--links]"
|
|
6
6
|
allowed-tools:
|
|
7
7
|
- Read
|
|
8
8
|
- Bash
|
|
@@ -19,5 +19,5 @@ Validate `.planning/` directory integrity and report actionable issues. Checks f
|
|
|
19
19
|
|
|
20
20
|
<process>
|
|
21
21
|
Execute the health workflow from @~/.claude/pan-wizard-core/workflows/health.md end-to-end.
|
|
22
|
-
|
|
22
|
+
Pass the arguments to the workflow, which forwards `--repair`, `--standards`, `--full`, `--drift` and `--links` to `validate health`.
|
|
23
23
|
</process>
|
package/commands/pan/hud.md
CHANGED
|
@@ -16,10 +16,6 @@ It is a *view*, not a new source of truth: every panel aggregates state PAN alre
|
|
|
16
16
|
Default output is `.planning/hud.html`. Open it in any browser. Re-run any time for a fresh snapshot.
|
|
17
17
|
</objective>
|
|
18
18
|
|
|
19
|
-
<execution_context>
|
|
20
|
-
@~/.claude/pan-wizard-core/bin/lib/hud.cjs
|
|
21
|
-
</execution_context>
|
|
22
|
-
|
|
23
19
|
<usage>
|
|
24
20
|
|
|
25
21
|
```
|
|
@@ -34,10 +30,10 @@ pan-tools hud [--out <file>] [--open] [--stdout]
|
|
|
34
30
|
**JSON result shape** (default, when not `--stdout`):
|
|
35
31
|
```json
|
|
36
32
|
{
|
|
37
|
-
"path": "
|
|
33
|
+
"path": "/abs/path/to/project/.planning/hud.html",
|
|
38
34
|
"bytes": 18234,
|
|
39
35
|
"army_active": true,
|
|
40
|
-
"sections": ["mission", "command-stack", "campaign", "safety-harness", "worktrees", "roadmap", "telemetry", "requirements-quality", "activity"],
|
|
36
|
+
"sections": ["mission", "now-building", "command-stack", "campaign", "safety-harness", "worktrees", "roadmap", "telemetry", "requirements-quality", "activity"],
|
|
41
37
|
"opened": false
|
|
42
38
|
}
|
|
43
39
|
```
|
|
@@ -51,6 +47,7 @@ Panels render only when they have data — a plain (non-army) project still gets
|
|
|
51
47
|
| Panel | What it shows | Source |
|
|
52
48
|
|-------|---------------|--------|
|
|
53
49
|
| **Mission banner** | Project, core value, status, version/milestone + metric cards (progress, phase, requirements, spend) | `package.json`, `project.md`, `state.md`, phase scan, cost ledger |
|
|
50
|
+
| **Now building** | Current phase on a phase stepper, its pipeline stage (research → plan → execute → verify), and the army tasks in flight or the phase's plan/summary counts | phases on disk + army worktrees |
|
|
54
51
|
| **Command stack** *(army)* | Mission Control over the four squads with per-squad agent drill-down (active / idle, calls, tokens) | squad registry + cost ledger |
|
|
55
52
|
| **Campaign** *(army)* | Cadence, next-due, daily-budget bar, last run, run history | `schedule.json` |
|
|
56
53
|
| **Safety harness** *(army)* | Merge gate, abort switch (pause), active worktrees, daily budget, concurrency | config + pause file + worktrees + schedule |
|
|
@@ -61,7 +58,7 @@ Panels render only when they have data — a plain (non-army) project still gets
|
|
|
61
58
|
| **Requirements & quality** | Requirements done/open + last verification artifacts | `requirements.md`, phase `*-verification.md` / `*-uat.md` |
|
|
62
59
|
| **Recent activity** | Last commits (the army's committed output) | `git log` |
|
|
63
60
|
|
|
64
|
-
*(army)* panels appear only when a campaign is scheduled or army worktrees exist — graceful degradation per ADR-0035. The *(fallback)* **Planning activity** panel appears only when there is no phase/roadmap layout, so it fills the gap for focus-auto and imported projects instead of leaving a bare page. Telemetry shows an honest advisory (never a fabricated
|
|
61
|
+
*(army)* panels appear only when a campaign is scheduled or army worktrees exist — graceful degradation per ADR-0035. The *(fallback)* **Planning activity** panel appears only when there is no phase/roadmap layout, so it fills the gap for focus-auto and imported projects instead of leaving a bare page. Telemetry shows an honest advisory (never a fabricated zero-dollar total) when the cost ledger is poisoned or every record is unpriced.
|
|
65
62
|
|
|
66
63
|
</panels>
|
|
67
64
|
|
package/commands/pan/hygiene.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: pan:hygiene
|
|
3
3
|
group: System
|
|
4
|
-
description: Scan the project for PAN version drift and stale artifacts (legacy filenames, memory bloat, poisoned ledgers, trace debris) and apply safe cleanups
|
|
4
|
+
description: Scan the project for PAN version drift and stale artifacts (legacy filenames, memory bloat and stale entries, poisoned ledgers, trace debris, oversized planning files) and apply safe cleanups
|
|
5
5
|
argument-hint: "[--apply] [--trace-age-days N] [--all-tracks] [--track <name>]"
|
|
6
6
|
allowed-tools:
|
|
7
7
|
- Read
|
|
@@ -9,7 +9,14 @@ allowed-tools:
|
|
|
9
9
|
- AskUserQuestion
|
|
10
10
|
---
|
|
11
11
|
<objective>
|
|
12
|
-
Keep a PAN-managed project aligned with the latest PAN version and free of accumulated history debris. Detects:
|
|
12
|
+
Keep a PAN-managed project aligned with the latest PAN version and free of accumulated history debris. Detects:
|
|
13
|
+
- outdated runtime installs (per-runtime manifest version vs latest);
|
|
14
|
+
- legacy uppercase planning filenames and orphaned atomic-write .tmp files;
|
|
15
|
+
- per-agent memory logs past the compaction cap (`memory-bloat`), memory entries whose cited code is gone or that went unused past the expiry window (`memory-stale`), and files in `.planning/memory/` that are not read as memory (`memory-format`);
|
|
16
|
+
- planning files past their budget (`cache-context`): state.md, which every agent call re-reads, and roadmap.md and requirements.md, which only the roadmapper and milestone work read whole (phase agents read `roadmap slice`); state.md's settled history and roadmap.md's shipped phases can be archived;
|
|
17
|
+
- cost ledgers poisoned by pre-v3.12.4 telemetry, stale optimization trace sessions and reports, and stray fragment `.planning/` directories;
|
|
18
|
+
- a planning tree another tool writes into too (`shared-planning-tree`) or owns (`foreign-planning-tree`);
|
|
19
|
+
- Claude Code's own memory index past or near its load limit, or holding content where a one-line pointer belongs (`host-memory`). PAN only reports this one: it never writes the host's memory.
|
|
13
20
|
</objective>
|
|
14
21
|
|
|
15
22
|
<process>
|
|
@@ -28,7 +35,7 @@ Display the findings grouped by severity (critical → warn → info), labelling
|
|
|
28
35
|
|
|
29
36
|
**Always state which trees were scanned** — read `roots_scanned[]` and name them. If `summary.total` is 0, report "Project is clean and aligned" *together with* the list of trees that were read. A clean verdict without its scope is what let stale debris hide in an unscanned track; never report one without the other.
|
|
30
37
|
|
|
31
|
-
If
|
|
38
|
+
If the top-level `planning_root_exists` is `false`, or a `roots_scanned[]` entry has `planning_exists: false`, say so plainly — that is a mistyped `--track`, not a clean tree.
|
|
32
39
|
|
|
33
40
|
## 2. Version drift (manual remediation)
|
|
34
41
|
|
|
@@ -36,7 +43,7 @@ If any `version-alignment` findings exist, list the outdated runtimes and show t
|
|
|
36
43
|
|
|
37
44
|
```
|
|
38
45
|
Re-run the installer from the project root to align all runtimes:
|
|
39
|
-
|
|
46
|
+
npx pan-wizard@latest --claude --codex --gemini --opencode --copilot --local
|
|
40
47
|
(use the flags matching the runtimes reported in installs[])
|
|
41
48
|
```
|
|
42
49
|
|
|
@@ -58,11 +65,11 @@ Then ask the user (AskUserQuestion, header "Apply fixes", options: "Apply safe f
|
|
|
58
65
|
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs hygiene clean --all-tracks --apply
|
|
59
66
|
```
|
|
60
67
|
|
|
61
|
-
Safe fixes are: lowercase renames of legacy planning filenames, deletion of aged .tmp orphans, memory-log compaction, poisoned-ledger quarantine (
|
|
68
|
+
Safe fixes are: lowercase renames of legacy planning filenames, deletion of aged .tmp orphans, memory-log compaction, **memory pruning** (`prune-memory`: stale and expired entries move to `.planning/memory/archive/<agent>.md`), poisoned-ledger quarantine (renamed in place; only the newest quarantined copy is kept, older ones are deleted), pruning of trace sessions **and optimization reports** past retention (newest 5 of each always kept), **state.md compaction** (`compact-state`) — settled history is archived to `state-history.md` so it stops being re-read into every agent call — and **roadmap compaction** (`compact-roadmap`): shipped phases' sections move to `roadmap-history.md`, leaving a stub that `roadmap get-phase` reads back through. None of these deletes anything you wrote: the ledger is renamed, and each archive is written before the file it came from is rewritten. Each fix is applied inside its own tree's scope, so a track's debris is cleaned in that track. Pass through `--trace-age-days N` if provided. With `--track <name>`, use it **in place of** `--all-tracks` in both commands: given both, `--all-tracks` wins and every tree is cleaned.
|
|
62
69
|
|
|
63
70
|
## 4. Report
|
|
64
71
|
|
|
65
|
-
Summarize: the trees scanned, fixes executed / failed / left manual (attributed per track), plus the installer command if version drift remains. If a `cache-context` finding appeared, state the
|
|
72
|
+
Summarize: the trees scanned, fixes executed / failed / left manual (attributed per track), plus the installer command if version drift remains. If a `cache-context` finding appeared, state the token cost its detail names and who pays it: state.md is re-read on **every** agent call, the project's largest recurring expense, while roadmap.md and requirements.md cost only when the roadmapper or milestone work reads them whole. If a `host-memory` finding appeared, name the index and the lines it flags so the user can tidy them: Claude Code loads only the head of that index, and PAN never edits it. Recommend re-running `/pan:hygiene` after the installer to confirm alignment.
|
|
66
73
|
|
|
67
74
|
</process>
|
|
68
75
|
|
|
@@ -70,6 +77,6 @@ Summarize: the trees scanned, fixes executed / failed / left manual (attributed
|
|
|
70
77
|
- [ ] Scan run and findings presented by severity
|
|
71
78
|
- [ ] Version drift reported with the exact installer command (never auto-run)
|
|
72
79
|
- [ ] Safe fixes applied only with --apply or explicit user confirmation
|
|
73
|
-
- [ ] Nothing user-authored deleted — quarantine
|
|
80
|
+
- [ ] Nothing user-authored deleted — the ledger quarantine is a rename (older quarantined copies, PAN's own data, are removed), and memory compaction archives what it drops
|
|
74
81
|
- [ ] Final summary states executed/failed/manual counts
|
|
75
82
|
</success_criteria>
|
|
@@ -16,14 +16,13 @@ allowed-tools:
|
|
|
16
16
|
Retrieve, refine, or consolidate project knowledge. Three modes:
|
|
17
17
|
|
|
18
18
|
- **ask** — answer a natural-language question with inline citations grounded in `.planning/` + `docs/`.
|
|
19
|
-
- **discuss** — multi-turn refinement of a phase's context. Session state persists across invocations
|
|
19
|
+
- **discuss** — multi-turn refinement of a phase's context. Session state persists across invocations.
|
|
20
20
|
- **playbook** — aggregate all agents' memory (E-4 layer) into `.planning/playbook.md`, organized by category (Conventions / Gotchas / Decisions / Tool choices / Anti-patterns / Recurring gaps).
|
|
21
21
|
|
|
22
22
|
Consolidates Spec B v1's X-3 converse + X-6 teach + X-10 explain into one command.
|
|
23
23
|
</objective>
|
|
24
24
|
|
|
25
25
|
<execution_context>
|
|
26
|
-
@~/.claude/pan-wizard-core/bin/lib/knowledge.cjs
|
|
27
26
|
@~/.claude/agents/pan-knowledge.md
|
|
28
27
|
@~/.claude/pan-wizard-core/templates/playbook.md
|
|
29
28
|
</execution_context>
|
|
@@ -54,10 +53,10 @@ Consolidates Spec B v1's X-3 converse + X-6 teach + X-10 explain into one comman
|
|
|
54
53
|
2. `pan-tools knowledge discuss <phase> --subcmd append --role user --content "<topic>"` persists the user turn.
|
|
55
54
|
3. Spawn `pan-knowledge` with `<mode>discuss</mode>`, session history, phase context, and the new turn.
|
|
56
55
|
4. Agent responds.
|
|
57
|
-
5. `pan-tools knowledge discuss <phase> --subcmd append --role agent --content "<response>" --cites "a.md,b.md"` persists the
|
|
58
|
-
6. If after ≥3 substantive turns the agent offered to emit `context.md`, user
|
|
56
|
+
5. Write the agent's response to a file, then `pan-tools knowledge discuss <phase> --subcmd append --role agent --content "$(cat <response-file>)" --cites "a.md,b.md"` persists it — a reply pasted between the quotes breaks the shell line at its first `"`, `$` or backtick.
|
|
57
|
+
6. If after ≥3 substantive turns the agent offered to emit `context.md`, the user accepts in another `/pan:knowledge discuss <phase>` turn and the agent writes it (there is no commit subcommand).
|
|
59
58
|
|
|
60
|
-
**Session persistence:** `.planning/conversations/<phase>/session.json` —
|
|
59
|
+
**Session persistence:** `.planning/conversations/<phase>/session.json` — `{phase, turns: [...], created, last_updated}`, each turn with ts/role/content/cites.
|
|
61
60
|
|
|
62
61
|
### `playbook`
|
|
63
62
|
|
|
@@ -66,12 +65,12 @@ Consolidates Spec B v1's X-3 converse + X-6 teach + X-10 explain into one comman
|
|
|
66
65
|
```
|
|
67
66
|
|
|
68
67
|
**Flow:**
|
|
69
|
-
1. `pan-tools knowledge playbook` reads
|
|
68
|
+
1. `pan-tools knowledge playbook` reads every agent log that `memory list` names in `.planning/memory/`, clusters entries by category, writes `.planning/playbook.md` directly.
|
|
70
69
|
2. Optionally spawn `pan-knowledge` with `<mode>playbook</mode>` to polish (dedupe contradictions, consolidate similar entries). Skip the polish step if the draft looks clean.
|
|
71
70
|
|
|
72
71
|
**Output:** `.planning/playbook.md` — team-readable summary of accumulated lessons.
|
|
73
72
|
|
|
74
|
-
**Auto-invocation:** `/pan:milestone-done`
|
|
73
|
+
**Auto-invocation:** none — no workflow runs it (`/pan:milestone-done` has no playbook step). Run it by hand any time.
|
|
75
74
|
|
|
76
75
|
</modes>
|
|
77
76
|
|
|
@@ -83,7 +82,7 @@ Consolidates Spec B v1's X-3 converse + X-6 teach + X-10 explain into one comman
|
|
|
83
82
|
|
|
84
83
|
**Bug investigation:** `/pan:knowledge ask "why did we add the retry in phase 4?"` — faster than grepping for historical context.
|
|
85
84
|
|
|
86
|
-
**Before milestone-done:** run `/pan:knowledge playbook` to
|
|
85
|
+
**Before milestone-done:** run `/pan:knowledge playbook` to collect the lessons the agent logs hold. PAN no longer writes those logs on its own (ADR-0036, amended `2026-10-04`): they hold what someone recorded with `memory append`, `memory record` or `/pan:retro` with `--write-memory`, or an older report applied, so on a project without such entries the playbook is empty.
|
|
87
86
|
|
|
88
87
|
</workflow>
|
|
89
88
|
|
|
@@ -106,8 +105,8 @@ The agent should NEVER fabricate citations. The retrieval layer's `sources` list
|
|
|
106
105
|
|
|
107
106
|
| Runtime | ask | discuss | playbook |
|
|
108
107
|
|---------|-----|---------|----------|
|
|
109
|
-
| Claude Code | Full, thinking enabled | Full
|
|
110
|
-
| OpenCode | Full | Full
|
|
108
|
+
| Claude Code | Full, thinking enabled | Full | Full |
|
|
109
|
+
| OpenCode | Full | Full | Full |
|
|
111
110
|
| Gemini | Full | Full | Full |
|
|
112
111
|
| Codex | Full | Full | Full |
|
|
113
112
|
| Copilot | Full | Full | Full |
|
package/commands/pan/learn.md
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
name: pan:learn
|
|
3
3
|
group: Self-Improvement
|
|
4
4
|
description: Analyze trace sessions or harvested experiments via pan-optimizer; generate ranked optimization reports
|
|
5
|
+
argument-hint: "[--session <id> | --sessions <n> | --experiment <slug>] [--apply]"
|
|
5
6
|
allowed-tools:
|
|
6
7
|
- Read
|
|
7
8
|
- Bash
|
|
@@ -26,8 +27,8 @@ Analyze the most recent trace session and generate an optimization report.
|
|
|
26
27
|
**Flags:**
|
|
27
28
|
- `--session <id>` — analyze a specific session instead of the most recent
|
|
28
29
|
- `--sessions <n>` — pool the last n sessions into one analysis, so recommendations rest on failures that recur across runs
|
|
29
|
-
- `--experiment <slug>` *(v3.7.0+, W3)* — analyze a harvested experiment instead of the current project's traces
|
|
30
|
-
- `--apply` —
|
|
30
|
+
- `--experiment <slug>` *(v3.7.0+, W3)* — analyze a harvested experiment instead of the current project's traces: the workflow runs its `pan-tools` steps with `--cwd` set to the harvest folder (the `harvest_path` `/pan:experiment harvest <slug>` printed, `<source-repo>/experiments/<slug>/` by default), so the analysis and the optimizer's report land in that folder's `.planning/optimization/reports/`. Used by the self-improvement loop. Run `/pan:experiment harvest <slug>` first.
|
|
31
|
+
- `--apply` — record the report's suggestions right after generating it (equivalent to running `/pan:optimize apply` immediately after)
|
|
31
32
|
|
|
32
33
|
**What it does:**
|
|
33
34
|
|
|
@@ -47,28 +48,30 @@ Analyze the most recent trace session and generate an optimization report.
|
|
|
47
48
|
- Tool failures and correction loops (error events)
|
|
48
49
|
- Topics the model had to infer without context (gap events)
|
|
49
50
|
- Repeated research on the same topic (redundancy events)
|
|
50
|
-
-
|
|
51
|
+
- Missing knowledge an agent logged (memory_miss events)
|
|
51
52
|
- Unexpected outcomes (surprise events)
|
|
52
53
|
|
|
53
54
|
**Output:**
|
|
54
55
|
|
|
55
56
|
The optimization report in `.planning/optimization/reports/` contains:
|
|
56
57
|
- Ranked error patterns with fix recommendations
|
|
57
|
-
-
|
|
58
|
+
- Lessons the agents lacked, each with where it belongs: the project's instructions (CLAUDE.md or AGENTS.md, outside PAN's section), a test, or a comment at the cited code
|
|
58
59
|
- Redundancy analysis with token waste estimates
|
|
59
60
|
- Prompt improvement suggestions (require human review before applying)
|
|
60
61
|
- Workflow gap suggestions (require human review)
|
|
61
|
-
- An `## Auto-Apply Actions` JSON block
|
|
62
|
+
- An `## Auto-Apply Actions` JSON block, which `/pan:optimize apply` records in `.planning/optimization/suggestions.md`
|
|
62
63
|
- A circular optimization score (0–100)
|
|
63
64
|
|
|
65
|
+
Nothing in the report reaches an agent until a person writes it where the agents read. PAN's workflows do not load `.planning/memory/` into agents.
|
|
66
|
+
|
|
64
67
|
**Example:**
|
|
65
68
|
```
|
|
66
69
|
/pan:learn
|
|
67
70
|
→ Session sess_20260421T180000: 47 events (8 errors, 12 gaps, 3 redundancies)
|
|
68
71
|
→ Report: .planning/optimization/reports/sess_20260421T180000-opt-report.md
|
|
69
72
|
→ Optimization score: 72/100
|
|
70
|
-
→ Top finding:
|
|
71
|
-
→
|
|
73
|
+
→ Top finding: L1 — Express middleware order inferred 5 times (belongs in CLAUDE.md)
|
|
74
|
+
→ Lessons: 3
|
|
72
75
|
→ Needs review: 2 prompt improvements, 1 workflow gap
|
|
73
76
|
```
|
|
74
77
|
|
package/commands/pan/links.md
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
name: pan:links
|
|
3
3
|
group: Validation
|
|
4
4
|
description: Validate the doc-code link graph — inline wiki-style refs, source-comment anchors, and require-code-mention contracts (ADR-0027, v3.8.0+)
|
|
5
|
+
argument-hint: "[--strict] [--doc-root <path>]... [--source-root <path>]... [--raw]"
|
|
5
6
|
allowed-tools:
|
|
6
7
|
- Bash
|
|
7
8
|
- Read
|
|
@@ -10,7 +11,7 @@ allowed-tools:
|
|
|
10
11
|
|
|
11
12
|
# /pan:links
|
|
12
13
|
|
|
13
|
-
Validate the doc-code link graph. Walks `docs/`, `pan-wizard-core
|
|
14
|
+
Validate the doc-code link graph. Walks `docs/`, `commands/`, `agents/` and `pan-wizard-core/`'s workflows, templates, references and learnings for inline `[[<id>]]` references, and `pan-wizard-core/`, `bin/`, `hooks/` and `scripts/` for `// @pan: <id>` source-comment anchors. Reports broken refs, stale anchors, and uncovered backlink contracts.
|
|
14
15
|
|
|
15
16
|
> **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
17
|
|
|
@@ -28,6 +29,8 @@ Validate the doc-code link graph. Walks `docs/`, `pan-wizard-core/`, `commands/`
|
|
|
28
29
|
- `--source-root <path>` — override default source roots. Repeatable.
|
|
29
30
|
- `--raw` — human-readable output instead of JSON.
|
|
30
31
|
|
|
32
|
+
**Run:** `node ~/.claude/pan-wizard-core/bin/pan-tools.cjs links validate [--strict] [--doc-root <path>]... [--source-root <path>]... [--raw]` (`validate` may be left out when a flag comes first).
|
|
33
|
+
|
|
31
34
|
**What it does:**
|
|
32
35
|
|
|
33
36
|
Three sequential passes share one walk pair:
|
|
@@ -59,7 +59,7 @@ The CLI returns `{mode, total_tokens, file_count, languages}`:
|
|
|
59
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
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
|
-
Record the chosen mode + telemetry in
|
|
62
|
+
Record the chosen mode + telemetry in a `.planning/codebase/overview.md` you write yourself. The map-codebase workflow has no single-shot branch — it always spawns the sharded mappers and writes no overview.md — so in `single-shot` mode spawn the one agent in place of its spawn step.
|
|
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. On a model with a smaller window, 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>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: pan:mcp-bridge
|
|
3
3
|
group: External tools
|
|
4
4
|
description: Discover available MCP tools and recommend which ones apply to a phase. Discovery-only; auto-invocation deferred.
|
|
5
|
-
argument-hint: "list | recommend <phase> | cache [--servers <json>] [--runtime <name>]"
|
|
5
|
+
argument-hint: "list | recommend <phase> [--max N] [--min-score N] | cache [--servers <json>] [--runtime <name>]"
|
|
6
6
|
allowed-tools:
|
|
7
7
|
- Read
|
|
8
8
|
- Bash
|
|
@@ -12,12 +12,10 @@ allowed-tools:
|
|
|
12
12
|
<objective>
|
|
13
13
|
Surface Model Context Protocol (MCP) tools visible to the host runtime and recommend which ones might apply to a specific phase plan.
|
|
14
14
|
|
|
15
|
-
Reduced scope from Spec B v1's X-7: **discovery and recommendation only**. Auto-injection of MCP tools into planner context and auto-invocation from executor agents are deliberately deferred
|
|
15
|
+
Reduced scope from Spec B v1's X-7: **discovery and recommendation only**. Auto-injection of MCP tools into planner context and auto-invocation from executor agents are deliberately deferred and still unscheduled (the v3.5 target passed without them). This kept v3.3 narrow and avoids coupling PAN to Claude Code's MCP schema stability.
|
|
16
16
|
</objective>
|
|
17
17
|
|
|
18
|
-
<
|
|
19
|
-
@~/.claude/pan-wizard-core/bin/lib/bridge.cjs
|
|
20
|
-
</execution_context>
|
|
18
|
+
Each subcommand runs `node ~/.claude/pan-wizard-core/bin/pan-tools.cjs bridge <list|recommend|cache> [flags]`. The CLI verb is `bridge`, not `mcp-bridge`: `pan-tools mcp-bridge` is an unknown command.
|
|
21
19
|
|
|
22
20
|
<subcommands>
|
|
23
21
|
|
|
@@ -44,7 +42,7 @@ Show cached MCP tools with server grouping and schemas.
|
|
|
44
42
|
}
|
|
45
43
|
```
|
|
46
44
|
|
|
47
|
-
When `source: "empty"`,
|
|
45
|
+
When `source: "empty"`, nothing has seeded the cache yet: no hook or host writes it, only `cache --servers` (or an external script). See the `cache` subcommand for manual seeding.
|
|
48
46
|
|
|
49
47
|
### `recommend <phase>`
|
|
50
48
|
|
|
@@ -85,20 +83,20 @@ Scoring is naive keyword frequency with word boundaries — not semantic embeddi
|
|
|
85
83
|
Write or inspect the MCP tools cache at `.planning/bridge/available-tools.json`.
|
|
86
84
|
|
|
87
85
|
```
|
|
88
|
-
# Inspect current cache (same as `list`
|
|
86
|
+
# Inspect current cache (prints the same JSON as `list`)
|
|
89
87
|
/pan:mcp-bridge cache
|
|
90
88
|
|
|
91
89
|
# Seed cache from scripted discovery (for testing or external pipeline)
|
|
92
90
|
/pan:mcp-bridge cache --runtime claude --servers '[{"name":"linear","tools":[{"name":"linear.updateTicket","description":"Update ticket"}]}]'
|
|
93
91
|
```
|
|
94
92
|
|
|
95
|
-
|
|
93
|
+
Nothing else writes this file: no hook or installer step populates it, so `list` and `recommend` see only what this command (or an external script) has recorded.
|
|
96
94
|
|
|
97
95
|
</subcommands>
|
|
98
96
|
|
|
99
97
|
<workflow>
|
|
100
98
|
|
|
101
|
-
**New to a project with MCP tools?** Run `/pan:mcp-bridge list` to see what's available. If empty,
|
|
99
|
+
**New to a project with MCP tools?** Run `/pan:mcp-bridge list` to see what's available. If empty, nothing has seeded the cache: record each server with its tools, `/pan:mcp-bridge cache --servers '[{"name":"<server>","tools":[{"name":"<tool>","description":"…"}]}]'`, taking the tool names and descriptions from the MCP tools your session has loaded. A server recorded without `tools` adds no tool to `list` (only `server_count` counts it, and `source` then reads `cache`) and nothing to `recommend`, and the host runtime's MCP config names only the servers and how to start them. Each runtime keeps that config somewhere different: Claude Code in `.mcp.json` at the project root (project scope) or `~/.claude.json` (user and local scopes), OpenCode in `opencode.json`, Copilot in `.github/mcp.json`, Codex in its own config, Gemini in its settings file.
|
|
102
100
|
|
|
103
101
|
**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
102
|
|
|
@@ -108,11 +106,11 @@ Normally the host runtime writes this file. The CLI path exists for test fixture
|
|
|
108
106
|
|
|
109
107
|
<caveats>
|
|
110
108
|
|
|
111
|
-
**Discovery is a cache, not a live probe.**
|
|
109
|
+
**Discovery is a cache, not a live probe.** Only `cache --servers` (or an external script) populates `.planning/bridge/available-tools.json`; no hook or host writes it. PAN does not query MCP servers directly — that would require runtime-specific HTTP or IPC integration this command deliberately avoids.
|
|
112
110
|
|
|
113
111
|
**Keyword scoring is crude.** "Postgres" and "PostgreSQL" are different tokens; `postgresql` in a plan won't match a `postgres.query` tool unless the plan also says "postgres." Tune your plan language or expand tool descriptions to improve matches.
|
|
114
112
|
|
|
115
|
-
**
|
|
113
|
+
**No runtime is special.** Each runtime PAN installs into reads MCP servers from its own config (see the workflow section above); the cache schema is generic, so whatever lists a runtime's servers can populate the same file.
|
|
116
114
|
|
|
117
115
|
**No automatic invocation.** This command never calls MCP tools. It tells you what's available and what might apply. The actual invocation happens via the host runtime's normal tool-use flow (Claude Code's tool calls, etc.) when the executor agent decides to use a recommended tool.
|
|
118
116
|
|
|
@@ -122,23 +120,23 @@ Normally the host runtime writes this file. The CLI path exists for test fixture
|
|
|
122
120
|
|
|
123
121
|
| Runtime | list | recommend | cache |
|
|
124
122
|
|---------|------|-----------|-------|
|
|
125
|
-
| Claude Code | Full | Full | Full
|
|
126
|
-
| OpenCode |
|
|
127
|
-
| Gemini CLI |
|
|
128
|
-
| Codex CLI |
|
|
129
|
-
| Copilot CLI |
|
|
123
|
+
| Claude Code | Full once seeded | Full once seeded | Full |
|
|
124
|
+
| OpenCode | Full once seeded | Full once seeded | Full |
|
|
125
|
+
| Gemini CLI | Full once seeded | Full once seeded | Full |
|
|
126
|
+
| Codex CLI | Full once seeded | Full once seeded | Full |
|
|
127
|
+
| Copilot CLI | Full once seeded | Full once seeded | Full |
|
|
130
128
|
|
|
131
|
-
On
|
|
129
|
+
On every runtime, `list` reports zero tools (`source: "empty"`) and `recommend` an empty `recommendations` list with a `reason` until `cache --servers` (or an external script) populates the cache; no host or hook writes it.
|
|
132
130
|
|
|
133
131
|
</runtime_compatibility>
|
|
134
132
|
|
|
135
133
|
<future_scope>
|
|
136
134
|
|
|
137
|
-
Explicitly deferred from v3.3 (documented in ADR-
|
|
135
|
+
Explicitly deferred from v3.3 (documented in ADR-0024 / Spec B v2 notes):
|
|
138
136
|
|
|
139
|
-
1. **Auto-inject recommended tools into planner context** — requires a stable MCP schema contract and a plan-template extension.
|
|
140
|
-
2. **Auto-invoke MCP tools from executor agent** — requires permission-gating and per-tool safety review.
|
|
141
|
-
3. **Cross-runtime tool discovery** —
|
|
137
|
+
1. **Auto-inject recommended tools into planner context** — requires a stable MCP schema contract and a plan-template extension. Unscheduled.
|
|
138
|
+
2. **Auto-invoke MCP tools from executor agent** — requires permission-gating and per-tool safety review. Unscheduled.
|
|
139
|
+
3. **Cross-runtime tool discovery** — filling the cache automatically from each runtime's own MCP config and servers. No timeline; needs ecosystem signal.
|
|
142
140
|
|
|
143
141
|
Until those land, this command is the minimum viable integration: you see what's there, you get suggestions, you decide manually.
|
|
144
142
|
|