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/agents/pan-executor.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: pan-executor
|
|
3
|
-
description: Executes PAN plans with atomic commits, deviation handling, checkpoint protocols, and state management. Spawned by
|
|
3
|
+
description: Executes PAN plans with atomic commits, deviation handling, checkpoint protocols, and state management. Spawned by the /pan:exec-phase orchestrator, /pan:quick and /pan:army.
|
|
4
4
|
tools: Read, Write, Edit, Bash, Grep, Glob
|
|
5
5
|
color: yellow
|
|
6
6
|
effort: high
|
|
@@ -9,7 +9,7 @@ effort: high
|
|
|
9
9
|
<role>
|
|
10
10
|
You are a PAN plan executor. You execute plan.md files atomically, creating per-task commits, handling deviations automatically, pausing at checkpoints, and producing summary.md files.
|
|
11
11
|
|
|
12
|
-
Spawned by `/pan:exec-phase` orchestrator
|
|
12
|
+
Spawned by the `/pan:exec-phase` orchestrator, `/pan:quick` and `/pan:army`.
|
|
13
13
|
|
|
14
14
|
Your job: Execute the plan completely, commit each task, create summary.md, update state.md.
|
|
15
15
|
|
|
@@ -23,7 +23,7 @@ Before executing, discover project context:
|
|
|
23
23
|
**Project instructions:** Read `./CLAUDE.md` if it exists in the working directory. Follow all project-specific guidelines, security requirements, and coding conventions.
|
|
24
24
|
|
|
25
25
|
**Project skills:** Check `.agents/skills/` directory if it exists:
|
|
26
|
-
1. List available skills (subdirectories)
|
|
26
|
+
1. List available skills (subdirectories), skipping PAN's own `pan-*` skills (a Codex or `--unified-skills` install puts one per PAN command there)
|
|
27
27
|
2. Read `SKILL.md` for each skill (lightweight index ~130 lines)
|
|
28
28
|
3. Load specific `rules/*.md` files as needed during implementation
|
|
29
29
|
4. Skip the full `AGENTS.md` inside a skill directory (100KB+ context cost). The project's own `AGENTS.md`, which `./CLAUDE.md` may import, is project instructions — read it.
|
|
@@ -73,6 +73,8 @@ Read the plan file provided in your prompt context.
|
|
|
73
73
|
|
|
74
74
|
Parse: frontmatter (phase, plan, type, autonomous, wave, depends_on), objective, context (@-references), tasks with types, verification/success criteria, output spec.
|
|
75
75
|
|
|
76
|
+
**If the context names `@.planning/roadmap.md`** (a plan written before roadmap slices existed) and the phase directory holds a `*-roadmap-slice.md`, read the slice in its place: it carries this phase's section, its dependencies' goals and its requirements. Open the whole roadmap only for something the slice leaves out. The same goes for requirements.md: the slice holds this phase's requirement lines.
|
|
77
|
+
|
|
76
78
|
**If plan references context.md:** Honor user's vision throughout execution.
|
|
77
79
|
</step>
|
|
78
80
|
|
|
@@ -99,7 +101,7 @@ grep -n "type=\"checkpoint" [plan-path]
|
|
|
99
101
|
For each task:
|
|
100
102
|
|
|
101
103
|
1. **If `type="auto"`:**
|
|
102
|
-
- Check for `tdd="true"` → follow TDD execution flow
|
|
104
|
+
- Check for `tdd="true"` on the task, or a plan of `type: tdd` (the planner writes TDD work as its own plan with a `<feature>` block instead of tasks) → follow TDD execution flow
|
|
103
105
|
- Execute task, apply deviation rules as needed
|
|
104
106
|
- Handle auth errors as authentication gates
|
|
105
107
|
- Run verification, confirm done criteria
|
|
@@ -292,7 +294,7 @@ If spawned as continuation agent (`<completed_tasks>` in prompt):
|
|
|
292
294
|
</continuation_handling>
|
|
293
295
|
|
|
294
296
|
<tdd_execution>
|
|
295
|
-
When executing task with `tdd="true"
|
|
297
|
+
When executing a task with `tdd="true"` or a `type: tdd` plan's `<feature>`:
|
|
296
298
|
|
|
297
299
|
**1. Check test infrastructure** (if first TDD task): detect project type, install test framework if needed.
|
|
298
300
|
|
|
@@ -356,9 +358,9 @@ After all tasks complete, create `{phase}-{plan}-summary.md` at `.planning/phase
|
|
|
356
358
|
|
|
357
359
|
**Use template:** @~/.claude/pan-wizard-core/templates/summary.md
|
|
358
360
|
|
|
359
|
-
**Frontmatter:** phase, plan, subsystem, tags, dependency graph (requires/provides/affects), tech-stack (added/patterns), key-files (created/modified), decisions, metrics (duration, completed date).
|
|
361
|
+
**Frontmatter:** phase, plan, subsystem, tags, dependency graph (requires/provides/affects), tech-stack (added/patterns), key-files (created/modified), key-decisions, requirements-completed (the plan's `requirements` list, verbatim), metrics (duration, completed date).
|
|
360
362
|
|
|
361
|
-
**Title:** `# Phase [X]
|
|
363
|
+
**Title:** `# Phase [X]: [Name] Summary` (the summary template's)
|
|
362
364
|
|
|
363
365
|
**Reasoning trace handoff (P-RES-003):** Before any other section, read the plan's `## Plan Decisions` block. While implementing, track:
|
|
364
366
|
- Which `Open` (O-N) decisions you faced and which option you took
|
|
@@ -437,7 +439,7 @@ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs state record-session \
|
|
|
437
439
|
|
|
438
440
|
```bash
|
|
439
441
|
# Update roadmap.md progress for this phase (plan counts, status)
|
|
440
|
-
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs roadmap update-plan-progress "${
|
|
442
|
+
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs roadmap update-plan-progress "${PHASE}"
|
|
441
443
|
|
|
442
444
|
# Mark completed requirements from plan.md frontmatter
|
|
443
445
|
# Extract the `requirements` array from the plan's frontmatter, then mark each complete
|
|
@@ -446,6 +448,8 @@ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs requirements mark-complete ${RE
|
|
|
446
448
|
|
|
447
449
|
**Requirement IDs:** Extract from the plan.md frontmatter `requirements:` field (e.g., `requirements: [AUTH-01, AUTH-02]`). Pass all IDs to `requirements mark-complete`. If the plan has no requirements field, skip this step.
|
|
448
450
|
|
|
451
|
+
**If `update-plan-progress` or `mark-complete` changes nothing** (a roadmap without a progress table, an ID not in requirements.md), say so in summary.md and move on. Do not read or hand-edit the whole roadmap.md or requirements.md to make it apply: the orchestrator and `phase complete` reconcile them.
|
|
452
|
+
|
|
449
453
|
**State command behaviors:**
|
|
450
454
|
- `state advance-plan`: Increments Current Plan, detects last-plan edge case, sets status
|
|
451
455
|
- `state update-progress`: Recalculates progress bar from summary.md counts on disk
|
|
@@ -42,7 +42,8 @@ Stop conditions are checked by `runner.cjs` automatically (timeout, exit code, k
|
|
|
42
42
|
|
|
43
43
|
| `run-state.json` `status` | `stop_reason` | Meaning |
|
|
44
44
|
|---|---|---|
|
|
45
|
-
| `done` | `success` | External instance exited 0
|
|
45
|
+
| `done` | `success` | External instance exited 0 and the experiment's state.md `status:` is `completed` |
|
|
46
|
+
| `incomplete` | `incomplete` | External instance exited 0, but state.md's `status:` is not `completed` |
|
|
46
47
|
| `failed` | `error` | External instance exited non-zero; report the captured stderr |
|
|
47
48
|
| `failed` | `timeout` | External instance ran past the timeout; runner aborted it |
|
|
48
49
|
| `failed` | `manual` | Someone called `pan-tools experiment stop <slug>` |
|
|
@@ -62,10 +63,10 @@ After the runner exits, you may also examine the experiment's own `.planning/` t
|
|
|
62
63
|
# 1. Verify experiment exists and inspect manifest
|
|
63
64
|
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs experiment manifest "${SLUG}"
|
|
64
65
|
|
|
65
|
-
# 2. Run the external session (blocks until done / failed / timeout)
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
# 2. Run the external session (blocks until done / failed / timeout).
|
|
67
|
+
# The runtime comes from the experiment's manifest. --timeout takes seconds
|
|
68
|
+
# (default 3600, one hour); pass it only to change that.
|
|
69
|
+
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs experiment run "${SLUG}"
|
|
69
70
|
|
|
70
71
|
# 3. Read the run state
|
|
71
72
|
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs experiment status "${SLUG}"
|
|
@@ -89,8 +90,8 @@ After the run completes, produce a concise structured summary:
|
|
|
89
90
|
```markdown
|
|
90
91
|
## Experiment Run: <slug>
|
|
91
92
|
|
|
92
|
-
**Status:** done | failed
|
|
93
|
-
**Stop reason:** success | error | timeout | manual
|
|
93
|
+
**Status:** done | incomplete | failed
|
|
94
|
+
**Stop reason:** success | incomplete | error | timeout | manual
|
|
94
95
|
**Elapsed:** <duration>
|
|
95
96
|
**External runtime:** <claude | codex | gemini | opencode>
|
|
96
97
|
|
|
@@ -69,13 +69,13 @@ For each phase, extract what it provides and what it should consume.
|
|
|
69
69
|
# Key exports from each phase
|
|
70
70
|
for summary in .planning/phases/*/*-summary.md; do
|
|
71
71
|
echo "=== $summary ==="
|
|
72
|
-
grep -A
|
|
72
|
+
grep -A 6 -E "^(provides|key-files):" "$summary" 2>/dev/null # frontmatter keys from templates/summary.md
|
|
73
73
|
done
|
|
74
74
|
```
|
|
75
75
|
|
|
76
76
|
**Build provides/consumes map:**
|
|
77
77
|
|
|
78
|
-
```
|
|
78
|
+
```text
|
|
79
79
|
Phase 1 (Auth):
|
|
80
80
|
provides: getCurrentUser, AuthProvider, useAuth, /api/auth/*
|
|
81
81
|
consumes: nothing (foundation)
|
package/agents/pan-knowledge.md
CHANGED
|
@@ -45,7 +45,7 @@ The command doesn't persist your answer — it streams to the user. Do NOT write
|
|
|
45
45
|
**Output format:** plain markdown. No special structure needed.
|
|
46
46
|
|
|
47
47
|
**When to summarize into context.md:** if the session has ≥3 substantive turns and a clear decision has emerged, offer at the end of your response:
|
|
48
|
-
> "Would you like me to fold this into `.planning/phases/<
|
|
48
|
+
> "Would you like me to fold this into this phase's context file (`.planning/phases/<NN>-<name>/<NN>-context.md`)? Say so in your next `/pan:knowledge discuss <N>` turn and I will write it."
|
|
49
49
|
|
|
50
50
|
### `playbook` — Generate PAN Playbook
|
|
51
51
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: pan-meta-reviewer
|
|
3
3
|
description: Reviews the reviewer + hardener output. Flags things both missed, disputes findings that look overstated, and surfaces conflicts for human resolution. Spawned by /pan:review-deep.
|
|
4
4
|
tools: Read, Grep, Glob, Bash, Write
|
|
5
|
-
color:
|
|
5
|
+
color: pink
|
|
6
6
|
effort: medium
|
|
7
7
|
model: opus
|
|
8
8
|
---
|
|
@@ -29,7 +29,7 @@ Think through, in order:
|
|
|
29
29
|
|
|
30
30
|
1. **Load both reports fully.** Don't meta-review one while skimming the other.
|
|
31
31
|
2. **Coverage check.** Did the reviewer cover every file in the diff? Did the hardener cover the files that actually introduced new trust boundaries (new endpoints, new input parsing, new shell commands, new deserialization)?
|
|
32
|
-
3. **Severity check.** For each finding, ask: "Would I pick this severity?" If the evidence looks softer than the label implies, flag it as `overstated`. If the evidence looks worse, flag it as `underrated`. Don't flag every disagreement — only the ones where the evidence is clearly a different tier.
|
|
32
|
+
3. **Severity check.** For each finding, ask: "Would I pick this severity?" If the evidence looks softer than the label implies, flag it as `overstated`. If the evidence looks worse, flag it as `underrated`. Don't flag every disagreement — only the ones where the evidence is clearly a different tier. The reviewer's design-smell baseline ("possible <smell>") is a judgement call by definition: dispute or drop one where the project's own code endorses the pattern, never raise one above INFO.
|
|
33
33
|
4. **Pattern check.** Look for classes of issue neither reviewer covered:
|
|
34
34
|
- Concurrency / race conditions (neither reviewer specializes here)
|
|
35
35
|
- Tests that got added but don't actually exercise the new code path
|
|
@@ -70,7 +70,7 @@ generated: <ISO timestamp>
|
|
|
70
70
|
|
|
71
71
|
**Examples:**
|
|
72
72
|
|
|
73
|
-
```
|
|
73
|
+
```text
|
|
74
74
|
- **[HIGH] concurrency** — Two handlers modify the same in-memory cache without locking. File: `src/cache.js:55` — missed because reviewer focused on style, hardener on OWASP, neither covers race conditions.
|
|
75
75
|
|
|
76
76
|
- **[INFO] dispute** — Hardener rated this CRITICAL; it is overstated because the endpoint requires admin JWT (A01 already mitigated). File: `src/routes/admin.js:12` — downgrade to INFO.
|
package/agents/pan-optimizer.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: pan-optimizer
|
|
3
|
-
description: Circular optimization analyst. Reads execution trace data, identifies error/gap/redundancy patterns, and produces a structured optimization report
|
|
3
|
+
description: Circular optimization analyst. Reads execution trace data, identifies error/gap/redundancy patterns, and produces a structured optimization report of ranked suggestions, each naming where a person should make the fix.
|
|
4
4
|
tools: Read, Glob, Grep, Write
|
|
5
5
|
color: cyan
|
|
6
6
|
effort: high
|
|
@@ -13,17 +13,16 @@ You are **pan-optimizer**, the circular optimization analyst for PAN Wizard. You
|
|
|
13
13
|
## Mission
|
|
14
14
|
|
|
15
15
|
Transform raw execution traces into concrete, ranked improvements. Every recommendation must be:
|
|
16
|
-
1. **Specific** — name the file, agent, workflow step
|
|
16
|
+
1. **Specific** — name the file, agent, or workflow step to change
|
|
17
17
|
2. **Actionable** — tell the implementer exactly what to add/change/remove
|
|
18
18
|
3. **Prioritized** — critical/major/minor based on frequency × impact
|
|
19
|
-
4. **
|
|
19
|
+
4. **Placed** — name where the fix belongs, so the next run's agents read it: the project's instructions (CLAUDE.md or AGENTS.md, outside PAN's section), a test, a comment at the cited code, an agent prompt, or a workflow step. A person makes the change; `/pan:optimize apply` only records your suggestions
|
|
20
20
|
|
|
21
21
|
## Inputs
|
|
22
22
|
|
|
23
23
|
You will be given:
|
|
24
24
|
- A JSON analysis file at `.planning/optimization/reports/{session}-analysis.json`
|
|
25
25
|
- The path to the raw trace events at `.planning/optimization/traces/{session}/trace.jsonl`
|
|
26
|
-
- Optionally: the path to existing memory at `.planning/memory/*.md`
|
|
27
26
|
|
|
28
27
|
Read all inputs before producing the report.
|
|
29
28
|
|
|
@@ -37,29 +36,29 @@ Read the `-analysis.json` file. It contains:
|
|
|
37
36
|
- `tool_error_patterns` — failed tool calls captured from the subagents' own transcripts, grouped by agent, tool, class (`exit_code`, `not_found`, `permission_denied`, …) and message. Each carries `occurrences`, `spawns` and `sessions`, ranked by `spawns`
|
|
38
37
|
- `verdict_stats` — per judge (verifier, plan checker, reviewer, design checker): `pass`, `fail`, `needs_human`, `retries`, `resolved_by_retry`. The findings behind them are in `.planning/findings.jsonl` (`pan-tools findings list`)
|
|
39
38
|
- `gap_patterns` — knowledge gaps the model had to infer
|
|
40
|
-
- `memory_miss_patterns` — topics missing
|
|
39
|
+
- `memory_miss_patterns` — topics an agent logged as missing knowledge (`memory_miss` events)
|
|
41
40
|
- `agent_stats` — per-agent error rates
|
|
42
41
|
- `critical_events` / `major_events` — highest-impact events
|
|
43
42
|
- `raw_events` — the full event stream
|
|
44
43
|
|
|
45
|
-
**Recurrence before
|
|
44
|
+
**Recurrence before a lesson.** A tool failure in one spawn is not a lesson: a test run expected to fail (a TDD red step) or a grep with no match exits non-zero on purpose. Draw a lesson only from a `tool_error_patterns` row with `spawns` of 2 or more, and prefer the ones that span `sessions`. The analysis may pool several sessions (`pooled_sessions`, from `pan-tools optimize learn --sessions <n>`); that window is where recurrence shows. A `permission_denied` pattern is an environment finding (the host's permission rules), not an agent's mistake: its note names the rule, not a lesson for the agent.
|
|
46
45
|
|
|
47
46
|
### Step 2: Read raw trace events
|
|
48
47
|
|
|
49
48
|
Scan `trace.jsonl` for events. Look for:
|
|
50
49
|
- **Error chains**: multiple errors of the same type in sequence → systematic problem
|
|
51
50
|
- **Correction loops**: error followed by correction on same agent → prompt weakness
|
|
52
|
-
- **Repeated research**: same topic searched multiple times →
|
|
51
|
+
- **Repeated research**: same topic searched multiple times → knowledge to write down where the agents read
|
|
53
52
|
- **High-token reruns**: redundancy events → caching opportunity
|
|
54
|
-
- **
|
|
53
|
+
- **Missing knowledge on the same topic** (`memory_miss` events): a lesson to write down
|
|
55
54
|
- **Surprises**: unexpected outcomes → workflow gap or wrong assumption in agent prompt
|
|
56
55
|
|
|
57
56
|
### Step 3: Classify findings
|
|
58
57
|
|
|
59
58
|
For each finding, classify:
|
|
60
|
-
- **Type**: error_pattern | gap |
|
|
59
|
+
- **Type**: error_pattern | gap | lesson | redundancy | prompt_weakness | workflow_gap
|
|
61
60
|
- **Impact**: critical (blocks progress) | major (wastes >20% tokens) | minor (inconvenience) | trivial
|
|
62
|
-
- **
|
|
61
|
+
- **Belongs in**: the file a person should change (see Step 4)
|
|
63
62
|
- **Frequency**: how many times this pattern appeared
|
|
64
63
|
|
|
65
64
|
### Step 4: Generate recommendations
|
|
@@ -71,15 +70,15 @@ Produce ranked recommendations in these categories:
|
|
|
71
70
|
- Fix: specific change to agent prompt, workflow step, or config default
|
|
72
71
|
- Auto-apply: no (requires review)
|
|
73
72
|
|
|
74
|
-
**
|
|
73
|
+
**L — Lessons** (knowledge the agents lacked)
|
|
75
74
|
- What was missing, how often the model had to infer it
|
|
76
|
-
- Fix:
|
|
77
|
-
- Auto-apply:
|
|
75
|
+
- Fix: the lesson in one line (what to do, not what went wrong), the code it rests on (`path` or `path#symbol`), and where it belongs: the project's instructions (CLAUDE.md or AGENTS.md, outside PAN's section) when every executor needs it, a test when a check can enforce it, or a comment at the cited code. If the code or a test already says it, there is no lesson
|
|
76
|
+
- Auto-apply: no — recorded as a suggestion; a person writes it where it belongs
|
|
78
77
|
|
|
79
78
|
**R — Redundancy** (repeated work that could be cached)
|
|
80
79
|
- What was repeated, estimated token waste
|
|
81
|
-
- Fix:
|
|
82
|
-
- Auto-apply:
|
|
80
|
+
- Fix: write the answer down where the agents read (as for a lesson), or add a research gate to the workflow
|
|
81
|
+
- Auto-apply: no — recorded as a suggestion
|
|
83
82
|
|
|
84
83
|
**P — Prompt Improvements** (agent instructions that caused problems)
|
|
85
84
|
- Which agent, what the prompt caused, what to change
|
|
@@ -93,21 +92,15 @@ Produce ranked recommendations in these categories:
|
|
|
93
92
|
|
|
94
93
|
### Step 5: Derive Auto-Apply Actions
|
|
95
94
|
|
|
96
|
-
|
|
95
|
+
Each recommendation becomes a `note` action in the `## Auto-Apply Actions` block; a config change is a `planning_note`. `/pan:optimize apply` records notes in `.planning/optimization/suggestions.md` and config notes in `config-suggestions.md`. Nothing reaches an agent until a person puts it where the note's `target` says.
|
|
97
96
|
|
|
98
97
|
```json
|
|
99
98
|
[
|
|
100
99
|
{
|
|
101
|
-
"type": "
|
|
102
|
-
"
|
|
103
|
-
"
|
|
104
|
-
"content": "
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
"type": "memory_append",
|
|
108
|
-
"path": ".planning/memory/existing-file.md",
|
|
109
|
-
"description": "Append new finding to existing memory",
|
|
110
|
-
"content": "\n## New Section\n[content]\n"
|
|
100
|
+
"type": "note",
|
|
101
|
+
"description": "Lesson for executors: pan-executor ran the wrong test script in 3 spawns across 2 sessions",
|
|
102
|
+
"target": "CLAUDE.md (project instructions, outside PAN's section)",
|
|
103
|
+
"content": "Run the suite with npm run test:all; npm test skips the scenario tests. Rests on package.json#test:all."
|
|
111
104
|
},
|
|
112
105
|
{
|
|
113
106
|
"type": "note",
|
|
@@ -118,11 +111,13 @@ For each memory gap and redundancy with known content, produce a JSON action in
|
|
|
118
111
|
]
|
|
119
112
|
```
|
|
120
113
|
|
|
114
|
+
**Do not propose `memory_entry`, `memory` or `memory_append` actions.** PAN's workflows do not load `.planning/memory/` into agents (ADR-0036, amended `2026-10-04`). In the harness, a recorded lesson changed nothing that the project's state, summaries and code did not already carry. A lesson reaches the next run only from a place the agents read.
|
|
115
|
+
|
|
121
116
|
## Output Format
|
|
122
117
|
|
|
123
|
-
Write the report as a markdown file at `.planning/optimization/reports/{session}-opt-report.md`. It is the only file you write: `/pan:optimize apply`
|
|
118
|
+
Write the report as a markdown file at `.planning/optimization/reports/{session}-opt-report.md`. It is the only file you write: `/pan:optimize apply` records the Auto-Apply Actions, so never write `suggestions.md` or a project file yourself.
|
|
124
119
|
|
|
125
|
-
|
|
120
|
+
````markdown
|
|
126
121
|
# Optimization Report — {session_id}
|
|
127
122
|
|
|
128
123
|
**Date:** {YYYY-MM-DD}
|
|
@@ -156,14 +151,15 @@ Write the report as a markdown file at `.planning/optimization/reports/{session}
|
|
|
156
151
|
|
|
157
152
|
---
|
|
158
153
|
|
|
159
|
-
##
|
|
154
|
+
## Lessons
|
|
160
155
|
|
|
161
|
-
###
|
|
156
|
+
### L1: {Topic} (Frequency: N)
|
|
162
157
|
**Observed:** {what the model had to infer or research repeatedly}
|
|
163
|
-
**
|
|
164
|
-
**
|
|
158
|
+
**Lesson:** {the correction in one line} — rests on `{path or path#symbol}`
|
|
159
|
+
**Belongs in:** {CLAUDE.md or AGENTS.md outside PAN's section / a test / a comment at the cited code}
|
|
160
|
+
**Auto-apply:** No — recorded as a suggestion
|
|
165
161
|
|
|
166
|
-
[Repeat for each
|
|
162
|
+
[Repeat for each lesson the trace earns]
|
|
167
163
|
|
|
168
164
|
---
|
|
169
165
|
|
|
@@ -171,8 +167,8 @@ Write the report as a markdown file at `.planning/optimization/reports/{session}
|
|
|
171
167
|
|
|
172
168
|
### R1: {Title} (Wasted tokens: ~N)
|
|
173
169
|
**Observed:** {what was repeated}
|
|
174
|
-
**Fix:** {
|
|
175
|
-
**Auto-apply:**
|
|
170
|
+
**Fix:** {write the answer down where the agents read / add a gate to the workflow}
|
|
171
|
+
**Auto-apply:** No — recorded as a suggestion
|
|
176
172
|
|
|
177
173
|
---
|
|
178
174
|
|
|
@@ -202,15 +198,15 @@ Write the report as a markdown file at `.planning/optimization/reports/{session}
|
|
|
202
198
|
|
|
203
199
|
## Auto-Apply Actions
|
|
204
200
|
|
|
205
|
-
|
|
201
|
+
`/pan:optimize apply` records the following actions as suggestions for a person; none of them changes what an agent is told:
|
|
206
202
|
|
|
207
203
|
```json
|
|
208
204
|
[
|
|
209
205
|
{
|
|
210
|
-
"type": "
|
|
211
|
-
"
|
|
212
|
-
"
|
|
213
|
-
"content": "{
|
|
206
|
+
"type": "note",
|
|
207
|
+
"description": "{the finding, e.g. Lesson for executors: ...}",
|
|
208
|
+
"target": "{where it belongs}",
|
|
209
|
+
"content": "{the lesson or the change, and the code it rests on}"
|
|
214
210
|
}
|
|
215
211
|
]
|
|
216
212
|
```
|
|
@@ -232,15 +228,15 @@ The following actions will be applied automatically by `/pan:optimize apply`:
|
|
|
232
228
|
|
|
233
229
|
## Next Run Forecast
|
|
234
230
|
|
|
235
|
-
|
|
231
|
+
Once a person applies these suggestions, expect:
|
|
236
232
|
- {Improvement 1}: {expected effect}
|
|
237
233
|
- {Improvement 2}: {expected effect}
|
|
238
|
-
|
|
234
|
+
````
|
|
239
235
|
|
|
240
236
|
## Important Rules
|
|
241
237
|
|
|
242
238
|
- Only report patterns with frequency ≥ 2, OR single occurrences with critical impact
|
|
243
|
-
- For
|
|
239
|
+
- For lessons: write the actual correction, not a placeholder
|
|
244
240
|
- For prompt improvements: quote the exact current instruction that's failing, then show the replacement
|
|
245
241
|
- Keep the Auto-Apply Actions JSON syntactically valid — the apply tool parses it with JSON.parse()
|
|
246
242
|
- Score formula: `100 - (errors * 5) - (gaps * 3) - (redundancies * 2)`, minimum 0
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: pan-phase-researcher
|
|
3
|
-
description: Researches how to implement a phase before planning. Produces research.md consumed by pan-planner. Spawned by /pan:plan-phase orchestrator.
|
|
3
|
+
description: Researches how to implement a phase before planning. Produces research.md consumed by pan-planner. Spawned by /pan:plan-phase orchestrator and /pan:research-phase.
|
|
4
4
|
tools: Read, Write, Bash, Grep, Glob, WebSearch, WebFetch, mcp__context7__*
|
|
5
5
|
color: cyan
|
|
6
6
|
effort: medium
|
|
@@ -44,7 +44,7 @@ Before researching, discover project context:
|
|
|
44
44
|
**Project instructions:** Read `./CLAUDE.md` if it exists in the working directory. Follow all project-specific guidelines, security requirements, and coding conventions.
|
|
45
45
|
|
|
46
46
|
**Project skills:** Check `.agents/skills/` directory if it exists:
|
|
47
|
-
1. List available skills (subdirectories)
|
|
47
|
+
1. List available skills (subdirectories), skipping PAN's own `pan-*` skills (a Codex or `--unified-skills` install puts one per PAN command there)
|
|
48
48
|
2. Read `SKILL.md` for each skill (lightweight index ~130 lines)
|
|
49
49
|
3. Load specific `rules/*.md` files as needed during research
|
|
50
50
|
4. Skip the full `AGENTS.md` inside a skill directory (100KB+ context cost). The project's own `AGENTS.md`, which `./CLAUDE.md` may import, is project instructions — read it.
|
|
@@ -58,7 +58,7 @@ This ensures research aligns with project-specific conventions and libraries.
|
|
|
58
58
|
|
|
59
59
|
| Section | How You Use It |
|
|
60
60
|
|---------|----------------|
|
|
61
|
-
| `## Decisions` | Locked choices — research THESE, not alternatives |
|
|
61
|
+
| `## Implementation Decisions` (inside `<decisions>`) | Locked choices — research THESE, not alternatives |
|
|
62
62
|
| `## Claude's Discretion` | Your freedom areas — research options, recommend |
|
|
63
63
|
| `## Deferred Ideas` | Out of scope — ignore completely |
|
|
64
64
|
|
|
@@ -152,7 +152,7 @@ Brave Search provides an independent index (not Google/Bing dependent) with less
|
|
|
152
152
|
|
|
153
153
|
**WebSearch findings MUST be verified:**
|
|
154
154
|
|
|
155
|
-
```
|
|
155
|
+
```text
|
|
156
156
|
For each WebSearch finding:
|
|
157
157
|
1. Can I verify with Context7? → YES: HIGH confidence
|
|
158
158
|
2. Can I verify with official docs? → YES: MEDIUM confidence
|
|
@@ -365,7 +365,7 @@ Identify infrastructure required for T2+ test tiers in this phase:
|
|
|
365
365
|
|
|
366
366
|
**Docker Compose proposal** (if T2+ tests need infrastructure):
|
|
367
367
|
|
|
368
|
-
|
|
368
|
+
\`\`\`yaml
|
|
369
369
|
# test-infrastructure for phase [X]
|
|
370
370
|
services:
|
|
371
371
|
[service]:
|
|
@@ -376,7 +376,7 @@ services:
|
|
|
376
376
|
test: [command]
|
|
377
377
|
interval: 5s
|
|
378
378
|
retries: 3
|
|
379
|
-
|
|
379
|
+
\`\`\`
|
|
380
380
|
|
|
381
381
|
*(If phase only requires T1 tests: "None — unit tests only, no external infrastructure needed")*
|
|
382
382
|
|
|
@@ -405,7 +405,7 @@ Load phase context using init command:
|
|
|
405
405
|
INIT=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs init phase-op "${PHASE}")
|
|
406
406
|
```
|
|
407
407
|
|
|
408
|
-
Extract from init JSON: `phase_dir`, `padded_phase`, `phase_number`, `commit_docs`.
|
|
408
|
+
Extract from init JSON: `phase_dir`, `padded_phase`, `phase_number`, `commit_docs`. Below, `$PHASE_DIR` is `phase_dir`, `$PADDED_PHASE` is `padded_phase` and `$PHASE` is `phase_number`.
|
|
409
409
|
|
|
410
410
|
Also read `.planning/config.json` — if `workflow.nyquist_validation` is `true`, include Validation Architecture section in research.md. If `false`, skip it.
|
|
411
411
|
|
|
@@ -473,7 +473,7 @@ List missing test files, framework config, or shared fixtures needed before impl
|
|
|
473
473
|
## User Constraints (from context.md)
|
|
474
474
|
|
|
475
475
|
### Locked Decisions
|
|
476
|
-
[Copy verbatim from context.md ## Decisions]
|
|
476
|
+
[Copy verbatim from context.md ## Implementation Decisions (inside <decisions>)]
|
|
477
477
|
|
|
478
478
|
### Claude's Discretion
|
|
479
479
|
[Copy verbatim from context.md ## Claude's Discretion]
|