pan-wizard 3.33.0 → 3.34.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 +23 -20
- package/agents/pan-conductor.md +17 -16
- package/agents/pan-counterfactual.md +2 -2
- package/agents/pan-debugger.md +27 -8
- package/agents/pan-design-checker.md +1 -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 +12 -8
- package/agents/pan-experiment-runner.md +8 -7
- package/agents/pan-integration-checker.md +2 -2
- package/agents/pan-knowledge.md +1 -1
- package/agents/pan-meta-reviewer.md +3 -3
- package/agents/pan-optimizer.md +39 -43
- package/agents/pan-phase-researcher.md +8 -8
- package/agents/pan-plan-checker.md +30 -28
- package/agents/pan-planner.md +54 -43
- package/agents/pan-previewer.md +1 -1
- package/agents/pan-project-researcher.md +11 -11
- package/agents/pan-release.md +1 -1
- package/agents/pan-research-synthesizer.md +2 -2
- package/agents/pan-reviewer.md +24 -2
- package/agents/pan-roadmapper.md +15 -14
- package/agents/pan-verifier.md +32 -24
- package/bin/install-lib.cjs +58 -23
- package/bin/install.js +47 -1
- 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 -4
- package/commands/pan/debug.md +10 -7
- package/commands/pan/design-phase.md +3 -3
- 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 +3 -2
- package/commands/pan/hygiene.md +14 -7
- package/commands/pan/knowledge.md +9 -9
- 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 +18 -18
- 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 +16 -14
- package/commands/pan/patches.md +2 -6
- package/commands/pan/pause.md +1 -1
- package/commands/pan/phase-tests.md +2 -1
- package/commands/pan/plan-phase.md +9 -19
- package/commands/pan/preview.md +1 -1
- 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 +2 -2
- package/commands/pan/research-phase.md +12 -11
- package/commands/pan/resume.md +9 -11
- package/commands/pan/retro.md +5 -3
- package/commands/pan/review-deep.md +7 -7
- package/commands/pan/settings.md +1 -1
- package/commands/pan/verify-phase.md +0 -11
- package/commands/pan/what-if.md +2 -2
- package/hooks/dist/pan-context-monitor.js +343 -44
- package/hooks/dist/pan-cost-logger.js +30 -0
- package/hooks/dist/pan-statusline.js +68 -22
- 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 +33 -4
- package/pan-wizard-core/bin/lib/config.cjs +2 -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 +9 -2
- 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 +178 -17
- package/pan-wizard-core/bin/lib/init.cjs +7 -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 +84 -16
- 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 +15 -13
- package/pan-wizard-core/bin/lib/preview.cjs +3 -1
- 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/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 +5 -2
- package/pan-wizard-core/bin/lib/verify.cjs +30 -28
- package/pan-wizard-core/bin/lib/whatif.cjs +5 -3
- package/pan-wizard-core/bin/pan-tools.cjs +101 -15
- package/pan-wizard-core/learnings/index.json +5 -5
- package/pan-wizard-core/opencode/pan-wizard.js +111 -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 +14 -9
- package/pan-wizard-core/references/phase-argument-parsing.md +7 -7
- package/pan-wizard-core/references/planning-config.md +4 -4
- package/pan-wizard-core/references/tdd.md +10 -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/continue-here.md +1 -1
- package/pan-wizard-core/templates/debug-subagent-prompt.md +3 -2
- 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 +29 -17
- package/pan-wizard-core/templates/planner-subagent-prompt.md +3 -5
- 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/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/discuss-phase.md +9 -8
- package/pan-wizard-core/workflows/exec-phase.md +26 -57
- 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 +17 -24
- package/pan-wizard-core/workflows/milestone-new.md +7 -6
- package/pan-wizard-core/workflows/new-project.md +9 -9
- 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 +31 -34
- package/pan-wizard-core/workflows/profile.md +2 -2
- package/pan-wizard-core/workflows/progress.md +5 -7
- package/pan-wizard-core/workflows/quick.md +5 -3
- 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 +1 -1
- package/pan-wizard-core/workflows/transition.md +12 -12
- package/pan-wizard-core/workflows/update.md +25 -17
- package/pan-wizard-core/workflows/verify-phase.md +17 -15
- 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-plugin.js +3 -1
- package/scripts/generate-skills-docs.py +13 -4
package/commands/pan/hud.md
CHANGED
|
@@ -34,10 +34,10 @@ pan-tools hud [--out <file>] [--open] [--stdout]
|
|
|
34
34
|
**JSON result shape** (default, when not `--stdout`):
|
|
35
35
|
```json
|
|
36
36
|
{
|
|
37
|
-
"path": "
|
|
37
|
+
"path": "/abs/path/to/project/.planning/hud.html",
|
|
38
38
|
"bytes": 18234,
|
|
39
39
|
"army_active": true,
|
|
40
|
-
"sections": ["mission", "command-stack", "campaign", "safety-harness", "worktrees", "roadmap", "telemetry", "requirements-quality", "activity"],
|
|
40
|
+
"sections": ["mission", "now-building", "command-stack", "campaign", "safety-harness", "worktrees", "roadmap", "telemetry", "requirements-quality", "activity"],
|
|
41
41
|
"opened": false
|
|
42
42
|
}
|
|
43
43
|
```
|
|
@@ -51,6 +51,7 @@ Panels render only when they have data — a plain (non-army) project still gets
|
|
|
51
51
|
| Panel | What it shows | Source |
|
|
52
52
|
|-------|---------------|--------|
|
|
53
53
|
| **Mission banner** | Project, core value, status, version/milestone + metric cards (progress, phase, requirements, spend) | `package.json`, `project.md`, `state.md`, phase scan, cost ledger |
|
|
54
|
+
| **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
55
|
| **Command stack** *(army)* | Mission Control over the four squads with per-squad agent drill-down (active / idle, calls, tokens) | squad registry + cost ledger |
|
|
55
56
|
| **Campaign** *(army)* | Cadence, next-due, daily-budget bar, last run, run history | `schedule.json` |
|
|
56
57
|
| **Safety harness** *(army)* | Merge gate, abort switch (pause), active worktrees, daily budget, concurrency | config + pause file + worktrees + schedule |
|
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,7 +16,7 @@ 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.
|
|
@@ -54,10 +54,10 @@ Consolidates Spec B v1's X-3 converse + X-6 teach + X-10 explain into one comman
|
|
|
54
54
|
2. `pan-tools knowledge discuss <phase> --subcmd append --role user --content "<topic>"` persists the user turn.
|
|
55
55
|
3. Spawn `pan-knowledge` with `<mode>discuss</mode>`, session history, phase context, and the new turn.
|
|
56
56
|
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
|
|
57
|
+
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.
|
|
58
|
+
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
59
|
|
|
60
|
-
**Session persistence:** `.planning/conversations/<phase>/session.json` —
|
|
60
|
+
**Session persistence:** `.planning/conversations/<phase>/session.json` — `{phase, turns: [...], created, last_updated}`, each turn with ts/role/content/cites.
|
|
61
61
|
|
|
62
62
|
### `playbook`
|
|
63
63
|
|
|
@@ -66,12 +66,12 @@ Consolidates Spec B v1's X-3 converse + X-6 teach + X-10 explain into one comman
|
|
|
66
66
|
```
|
|
67
67
|
|
|
68
68
|
**Flow:**
|
|
69
|
-
1. `pan-tools knowledge playbook` reads
|
|
69
|
+
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
70
|
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
71
|
|
|
72
72
|
**Output:** `.planning/playbook.md` — team-readable summary of accumulated lessons.
|
|
73
73
|
|
|
74
|
-
**Auto-invocation:** `/pan:milestone-done`
|
|
74
|
+
**Auto-invocation:** none — no workflow runs it (`/pan:milestone-done` has no playbook step). Run it by hand any time.
|
|
75
75
|
|
|
76
76
|
</modes>
|
|
77
77
|
|
|
@@ -83,7 +83,7 @@ Consolidates Spec B v1's X-3 converse + X-6 teach + X-10 explain into one comman
|
|
|
83
83
|
|
|
84
84
|
**Bug investigation:** `/pan:knowledge ask "why did we add the retry in phase 4?"` — faster than grepping for historical context.
|
|
85
85
|
|
|
86
|
-
**Before milestone-done:** run `/pan:knowledge playbook` to
|
|
86
|
+
**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
87
|
|
|
88
88
|
</workflow>
|
|
89
89
|
|
|
@@ -106,8 +106,8 @@ The agent should NEVER fabricate citations. The retrieval layer's `sources` list
|
|
|
106
106
|
|
|
107
107
|
| Runtime | ask | discuss | playbook |
|
|
108
108
|
|---------|-----|---------|----------|
|
|
109
|
-
| Claude Code | Full, thinking enabled | Full
|
|
110
|
-
| OpenCode | Full | Full
|
|
109
|
+
| Claude Code | Full, thinking enabled | Full | Full |
|
|
110
|
+
| OpenCode | Full | Full | Full |
|
|
111
111
|
| Gemini | Full | Full | Full |
|
|
112
112
|
| Codex | Full | Full | Full |
|
|
113
113
|
| 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,7 +12,7 @@ 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
18
|
<execution_context>
|
|
@@ -44,7 +44,7 @@ Show cached MCP tools with server grouping and schemas.
|
|
|
44
44
|
}
|
|
45
45
|
```
|
|
46
46
|
|
|
47
|
-
When `source: "empty"`,
|
|
47
|
+
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
48
|
|
|
49
49
|
### `recommend <phase>`
|
|
50
50
|
|
|
@@ -85,20 +85,20 @@ Scoring is naive keyword frequency with word boundaries — not semantic embeddi
|
|
|
85
85
|
Write or inspect the MCP tools cache at `.planning/bridge/available-tools.json`.
|
|
86
86
|
|
|
87
87
|
```
|
|
88
|
-
# Inspect current cache (same as `list`
|
|
88
|
+
# Inspect current cache (prints the same JSON as `list`)
|
|
89
89
|
/pan:mcp-bridge cache
|
|
90
90
|
|
|
91
91
|
# Seed cache from scripted discovery (for testing or external pipeline)
|
|
92
92
|
/pan:mcp-bridge cache --runtime claude --servers '[{"name":"linear","tools":[{"name":"linear.updateTicket","description":"Update ticket"}]}]'
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
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
96
|
|
|
97
97
|
</subcommands>
|
|
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,
|
|
101
|
+
**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
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
|
|
|
@@ -108,11 +108,11 @@ Normally the host runtime writes this file. The CLI path exists for test fixture
|
|
|
108
108
|
|
|
109
109
|
<caveats>
|
|
110
110
|
|
|
111
|
-
**Discovery is a cache, not a live probe.**
|
|
111
|
+
**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
112
|
|
|
113
113
|
**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
114
|
|
|
115
|
-
**
|
|
115
|
+
**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
116
|
|
|
117
117
|
**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
118
|
|
|
@@ -122,23 +122,23 @@ Normally the host runtime writes this file. The CLI path exists for test fixture
|
|
|
122
122
|
|
|
123
123
|
| Runtime | list | recommend | cache |
|
|
124
124
|
|---------|------|-----------|-------|
|
|
125
|
-
| Claude Code | Full | Full | Full
|
|
126
|
-
| OpenCode |
|
|
127
|
-
| Gemini CLI |
|
|
128
|
-
| Codex CLI |
|
|
129
|
-
| Copilot CLI |
|
|
125
|
+
| Claude Code | Full once seeded | Full once seeded | Full |
|
|
126
|
+
| OpenCode | Full once seeded | Full once seeded | Full |
|
|
127
|
+
| Gemini CLI | Full once seeded | Full once seeded | Full |
|
|
128
|
+
| Codex CLI | Full once seeded | Full once seeded | Full |
|
|
129
|
+
| Copilot CLI | Full once seeded | Full once seeded | Full |
|
|
130
130
|
|
|
131
|
-
On
|
|
131
|
+
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
132
|
|
|
133
133
|
</runtime_compatibility>
|
|
134
134
|
|
|
135
135
|
<future_scope>
|
|
136
136
|
|
|
137
|
-
Explicitly deferred from v3.3 (documented in ADR-
|
|
137
|
+
Explicitly deferred from v3.3 (documented in ADR-0024 / Spec B v2 notes):
|
|
138
138
|
|
|
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** —
|
|
139
|
+
1. **Auto-inject recommended tools into planner context** — requires a stable MCP schema contract and a plan-template extension. Unscheduled.
|
|
140
|
+
2. **Auto-invoke MCP tools from executor agent** — requires permission-gating and per-tool safety review. Unscheduled.
|
|
141
|
+
3. **Cross-runtime tool discovery** — filling the cache automatically from each runtime's own MCP config and servers. No timeline; needs ecosystem signal.
|
|
142
142
|
|
|
143
143
|
Until those land, this command is the minimum viable integration: you see what's there, you get suggestions, you decide manually.
|
|
144
144
|
|
|
@@ -46,6 +46,7 @@ The full milestone-done workflow is inlined in <process> below — there is no s
|
|
|
46
46
|
- Look for `.planning/v{{version}}-milestone-audit.md`
|
|
47
47
|
- If missing or stale: recommend `/pan:milestone-audit` first
|
|
48
48
|
- If audit status is `gaps_found`: recommend `/pan:milestone-gaps` first
|
|
49
|
+
- If audit status is `tech_debt`: present the debt; proceed on the user's say-so (it becomes accepted debt), or recommend `/pan:milestone-gaps` for a cleanup phase
|
|
49
50
|
- If audit status is `passed`: proceed to step 1
|
|
50
51
|
|
|
51
52
|
```markdown
|
|
@@ -87,6 +88,7 @@ The full milestone-done workflow is inlined in <process> below — there is no s
|
|
|
87
88
|
- Create `.planning/milestones/v{{version}}-roadmap.md`
|
|
88
89
|
- Extract full phase details from roadmap.md
|
|
89
90
|
- Fill milestone-archive.md template
|
|
91
|
+
- Add this milestone's entry to `.planning/milestones.md` from @~/.claude/pan-wizard-core/templates/milestone.md (create the file with that template's header if it does not exist)
|
|
90
92
|
- Update roadmap.md to one-line summary with link
|
|
91
93
|
|
|
92
94
|
5. **Archive requirements:**
|
|
@@ -104,7 +106,7 @@ The full milestone-done workflow is inlined in <process> below — there is no s
|
|
|
104
106
|
|
|
105
107
|
7. **Commit and tag:**
|
|
106
108
|
|
|
107
|
-
- Stage: milestones.md, project.md, roadmap.md, state.md, archive files
|
|
109
|
+
- Stage: milestones.md, project.md, roadmap.md, state.md, archive files, and the deleted requirements.md, and commit with `--force` (the user confirmed the milestone in step 1): `pan-tools commit` refuses any pending deletion, staged or not (`deleted_files_detected`), unless git pairs it with the archive as a rename
|
|
108
110
|
- Commit: `chore: archive v{{version}} milestone`
|
|
109
111
|
- Tag: `git tag -a v{{version}} -m "[milestone summary]"`
|
|
110
112
|
- Ask about pushing tag
|
|
@@ -116,10 +118,11 @@ The full milestone-done workflow is inlined in <process> below — there is no s
|
|
|
116
118
|
|
|
117
119
|
```bash
|
|
118
120
|
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs optimize trace end 2>/dev/null || true
|
|
119
|
-
|
|
121
|
+
# trace end cleared the active-session pointer, so pool the recent sessions
|
|
122
|
+
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs optimize learn --sessions 5 2>/dev/null || true
|
|
120
123
|
```
|
|
121
124
|
|
|
122
|
-
Present the optimization summary to the user and suggest `/pan:optimize apply` to
|
|
125
|
+
Present the optimization summary to the user and suggest `/pan:optimize apply` to record its suggestions, each naming where a person should make the change.
|
|
123
126
|
|
|
124
127
|
</process>
|
|
125
128
|
|
|
@@ -22,7 +22,7 @@ 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:design-phase [N]` → `/pan:plan-phase [N]`
|
|
25
|
+
**After:** `/pan:discuss-phase [N]` (then, optionally, `/pan:design-phase [N]`) → `/pan:plan-phase [N]` for the first phase.
|
|
26
26
|
|
|
27
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.
|
|
28
28
|
</objective>
|
|
@@ -12,7 +12,7 @@ allowed-tools:
|
|
|
12
12
|
---
|
|
13
13
|
<context>
|
|
14
14
|
**Flags:**
|
|
15
|
-
- `--auto` — Automatic mode.
|
|
15
|
+
- `--auto` — Automatic mode. Asks no questions: applies the auto-mode defaults (idea.md frontmatter can override them), then runs research → requirements → roadmap without interaction. Needs an idea document — an @ reference, or the idea pasted after the flag.
|
|
16
16
|
</context>
|
|
17
17
|
|
|
18
18
|
<objective>
|
|
@@ -26,7 +26,7 @@ Initialize a new project through unified flow: questioning → research (optiona
|
|
|
26
26
|
- `.planning/roadmap.md` — phase structure
|
|
27
27
|
- `.planning/state.md` — project memory
|
|
28
28
|
|
|
29
|
-
**After this command:** Run `/pan:plan-phase 1` to
|
|
29
|
+
**After this command:** Run `/pan:discuss-phase 1` to gather context, or `/pan:plan-phase 1` to plan directly. With `--auto` the workflow continues into `/pan:discuss-phase 1 --auto` itself.
|
|
30
30
|
</objective>
|
|
31
31
|
|
|
32
32
|
<execution_context>
|
|
@@ -68,23 +68,23 @@ Use this decision tree to select the correct path. Evaluate conditions top-to-bo
|
|
|
68
68
|
|
|
69
69
|
```
|
|
70
70
|
IF .planning/ already exists AND contains project.md:
|
|
71
|
-
→ WARN: "Project already initialized. Use /pan:
|
|
71
|
+
→ WARN: "Project already initialized. Use /pan:progress to continue."
|
|
72
72
|
→ STOP (do not overwrite existing project)
|
|
73
73
|
|
|
74
|
-
ELSE IF --auto flag AND @ reference
|
|
75
|
-
→ ASK
|
|
76
|
-
→ SKIP interactive questioning (use the
|
|
74
|
+
ELSE IF --auto flag AND an idea document provided (@ reference or pasted text):
|
|
75
|
+
→ ASK nothing: apply the auto-mode defaults (workflow step 2a; idea.md frontmatter can override them)
|
|
76
|
+
→ SKIP interactive questioning (use the document as project context)
|
|
77
77
|
→ RUN research automatically
|
|
78
|
-
→ GENERATE requirements from research +
|
|
78
|
+
→ GENERATE requirements from research + the document
|
|
79
79
|
→ GENERATE roadmap from requirements
|
|
80
80
|
→ No further interaction until complete
|
|
81
81
|
|
|
82
|
-
ELSE IF --auto flag WITHOUT
|
|
83
|
-
→ ERROR: "--auto requires an @
|
|
82
|
+
ELSE IF --auto flag WITHOUT an idea document:
|
|
83
|
+
→ ERROR: "--auto requires an idea document" (an @ reference, or the idea pasted after the flag)
|
|
84
84
|
→ STOP
|
|
85
85
|
|
|
86
86
|
ELSE (interactive mode — default):
|
|
87
|
-
→ RUN questioning flow (
|
|
87
|
+
→ RUN questioning flow (freeform deep questioning — references/questioning.md)
|
|
88
88
|
→ ASK: "Should I research the domain ecosystem?" (Y/N)
|
|
89
89
|
→ IF Y: spawn researchers → synthesize → continue
|
|
90
90
|
→ IF N: skip research → continue
|
package/commands/pan/optimize.md
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: pan:optimize
|
|
3
3
|
group: Self-Improvement
|
|
4
|
-
description: Manage the circular optimization loop —
|
|
4
|
+
description: Manage the circular optimization loop — record a report's suggestions, undo them, view stats, list reports, manage trace sessions
|
|
5
|
+
argument-hint: "apply [--report <file>] | revert <apply_id> | revert --last | list | stats | trace init|end|current|list"
|
|
5
6
|
allowed-tools:
|
|
6
7
|
- Read
|
|
7
8
|
- Write
|
|
@@ -13,7 +14,7 @@ allowed-tools:
|
|
|
13
14
|
|
|
14
15
|
# /pan:optimize
|
|
15
16
|
|
|
16
|
-
Manage the circular optimization loop:
|
|
17
|
+
Manage the circular optimization loop: record a report's suggestions, view stats, list reports.
|
|
17
18
|
|
|
18
19
|
**Usage:**
|
|
19
20
|
```
|
|
@@ -32,14 +33,15 @@ Manage the circular optimization loop: apply recommendations, view stats, list r
|
|
|
32
33
|
**Subcommands:**
|
|
33
34
|
|
|
34
35
|
### apply
|
|
35
|
-
|
|
36
|
+
Record the suggestions from the most recent (or specified) optimization report.
|
|
36
37
|
|
|
37
|
-
|
|
38
|
-
-
|
|
39
|
-
- Suggestions appended to `.planning/optimization/suggestions.md`
|
|
38
|
+
Recorded automatically:
|
|
39
|
+
- Suggestions appended to `.planning/optimization/suggestions.md`: lessons, prompt changes and workflow changes, each naming where it belongs
|
|
40
40
|
- Config notes appended to `.planning/optimization/config-suggestions.md`
|
|
41
|
+
- An older report's memory actions (`memory_entry`, `memory`, `memory_append`) still write to `.planning/memory/`, a `memory_entry` only if it passes the checks of the `memory record` command. The result warns that PAN's workflows do not load that folder into agents
|
|
41
42
|
|
|
42
|
-
|
|
43
|
+
A person makes every change the suggestions describe (never auto-applied):
|
|
44
|
+
- Lessons, written into the project's instructions (CLAUDE.md or AGENTS.md, outside PAN's section), a test, or a comment at the cited code
|
|
43
45
|
- Agent prompt changes
|
|
44
46
|
- Workflow step additions
|
|
45
47
|
- Structural changes to commands
|
|
@@ -47,7 +49,7 @@ Requires human review (never auto-applied):
|
|
|
47
49
|
After applying, the report lists what was applied and what still needs review, plus the `apply_id` that undoes it. Every apply is recorded action by action in `.planning/optimization/applied.jsonl`: the path, whether the file was created or appended to, the exact text, and a hash of the file after the write. Applying the same report a second time writes nothing: each action names the apply that already wrote it.
|
|
48
50
|
|
|
49
51
|
### revert
|
|
50
|
-
Undo one apply exactly: delete the
|
|
52
|
+
Undo one apply exactly: delete the files it created and cut the text it appended (`revert --last` for the newest).
|
|
51
53
|
|
|
52
54
|
Revert never destroys work someone did since:
|
|
53
55
|
- It refuses a file whose content changed after the apply. The comparison ignores line endings, so a CRLF checkout still matches.
|
|
@@ -63,12 +65,12 @@ List all optimization reports in `.planning/optimization/reports/`, most recent
|
|
|
63
65
|
Show cumulative optimization statistics:
|
|
64
66
|
- Total trace sessions run
|
|
65
67
|
- Total events traced
|
|
66
|
-
- Total errors
|
|
68
|
+
- Total errors seen (`total_errors_traced`; gaps and redundancies are not totalled)
|
|
67
69
|
- Total optimizations applied across all runs, the apply runs, the reverted runs, and the last `apply_id`
|
|
68
70
|
- Current active trace session (if any)
|
|
69
71
|
|
|
70
72
|
### trace init
|
|
71
|
-
Start a
|
|
73
|
+
Start a trace session before running a build — or join the active one: `trace init` reuses an unended session started within the last hour (`reused: true`, keeping that session's description) instead of opening a new one. The hook fires automatically on SubagentStop, but calling `trace init` first lets you attach a description to a new session.
|
|
72
74
|
|
|
73
75
|
```
|
|
74
76
|
/pan:optimize trace init --description "building express web server"
|
|
@@ -80,7 +82,7 @@ Start a new trace session before running a build. The hook fires automatically o
|
|
|
80
82
|
Finalize the current trace session (writes summary stats to session.json).
|
|
81
83
|
|
|
82
84
|
### trace current
|
|
83
|
-
Show the active trace session ID and event count.
|
|
85
|
+
Show the active trace session ID (`optimize trace current` returns only `session_id` and `active`; `trace list` carries each session's event count).
|
|
84
86
|
|
|
85
87
|
### trace list
|
|
86
88
|
List all trace sessions, most recent first.
|
|
@@ -98,14 +100,14 @@ List all trace sessions, most recent first.
|
|
|
98
100
|
│ ↓ │
|
|
99
101
|
│ /pan:learn ← analyze + report │
|
|
100
102
|
│ ↓ │
|
|
101
|
-
│ /pan:optimize apply ←
|
|
103
|
+
│ /pan:optimize apply ← record suggestions │
|
|
102
104
|
│ ↓ │
|
|
103
|
-
│
|
|
105
|
+
│ You make the changes ← instructions, tests, code │
|
|
104
106
|
│ ↑ │
|
|
105
107
|
│ └──────────────────────────────────────────┘
|
|
106
108
|
└─────────────────────────────────────────────────────┘
|
|
107
109
|
```
|
|
108
110
|
|
|
109
|
-
Each iteration
|
|
111
|
+
Each iteration puts what the last run lacked where the next run's agents read it: fewer repeated errors and gaps.
|
|
110
112
|
|
|
111
113
|
**See also:** `/pan:learn`, `/pan:exec-phase`
|
package/commands/pan/patches.md
CHANGED
|
@@ -23,12 +23,8 @@ After a PAN update wipes and reinstalls files, this command merges user's previo
|
|
|
23
23
|
Check for local patches directory:
|
|
24
24
|
|
|
25
25
|
```bash
|
|
26
|
-
#
|
|
26
|
+
# This install's own dir — the installer templates ~/.claude/ to it, local or global
|
|
27
27
|
PATCHES_DIR=~/.claude/pan-local-patches
|
|
28
|
-
# Local install fallback
|
|
29
|
-
if [ ! -d "$PATCHES_DIR" ]; then
|
|
30
|
-
PATCHES_DIR=~/.claude/pan-local-patches
|
|
31
|
-
fi
|
|
32
28
|
```
|
|
33
29
|
|
|
34
30
|
Read `backup-meta.json` from the patches directory.
|
|
@@ -61,7 +57,7 @@ Exit.
|
|
|
61
57
|
|
|
62
58
|
For each file in `backup-meta.json`:
|
|
63
59
|
|
|
64
|
-
1. **Read the backed-up version** (user's modified copy from `pan-local-patches/`)
|
|
60
|
+
1. **Read the backed-up version** (user's modified copy from `pan-local-patches/<file>`; a file listed in `backup-meta.json`'s `external_files` — a Codex skill under `../.agents/skills/` — is at `pan-local-patches/` + the path that map gives)
|
|
65
61
|
2. **Read the newly installed version** (current file after update)
|
|
66
62
|
3. **Compare and merge:**
|
|
67
63
|
|
package/commands/pan/pause.md
CHANGED
|
@@ -74,7 +74,7 @@ context:
|
|
|
74
74
|
The workflow handles all logic including:
|
|
75
75
|
1. Phase directory detection
|
|
76
76
|
2. State gathering with user clarifications
|
|
77
|
-
3. Handoff file writing with timestamp — **using the schema from `<handoff_schema
|
|
77
|
+
3. Handoff file writing with timestamp — **using the schema from `<handoff_schema>`, in place of the format in the workflow's write step and `templates/continue-here.md`** (`/pan:resume` parses this schema's fields)
|
|
78
78
|
4. Git commit
|
|
79
79
|
5. Confirmation with resume instructions
|
|
80
80
|
</process>
|
|
@@ -30,7 +30,8 @@ Output: Test files committed with message `test(phase-{N}): add unit and E2E tes
|
|
|
30
30
|
Phase: $ARGUMENTS
|
|
31
31
|
|
|
32
32
|
@.planning/state.md
|
|
33
|
-
|
|
33
|
+
|
|
34
|
+
This phase's goal and requirements, if the workflow needs them: `node ~/.claude/pan-wizard-core/bin/pan-tools.cjs roadmap slice <phase> --raw`, with only the phase number from $ARGUMENTS, since the instructions after it are free text that can break a shell line (the whole roadmap.md only for something it leaves out).
|
|
34
35
|
</context>
|
|
35
36
|
|
|
36
37
|
<process>
|