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,7 +2,7 @@
|
|
|
2
2
|
name: pan:design-phase
|
|
3
3
|
group: Phase Lifecycle
|
|
4
4
|
description: Design a roadmap phase before planning — architecture, ADR, threat-lite, machine-checkable criteria — verified by an independent checker
|
|
5
|
-
argument-hint: "
|
|
5
|
+
argument-hint: "<phase> [--spike] [--skip-design] [--redesign]"
|
|
6
6
|
agent: pan-designer
|
|
7
7
|
allowed-tools:
|
|
8
8
|
- Read
|
|
@@ -53,16 +53,16 @@ ELSE (default):
|
|
|
53
53
|
1. **Validate phase** — error if the phase number is missing or not in `roadmap.md`.
|
|
54
54
|
2. **Prime context** — resolve the phase directory; gather `{phase}-context.md`, `{phase}-research.md`, and the phase boundary from `roadmap.md`.
|
|
55
55
|
3. **Design** — spawn `pan-designer` with a `<files_to_read>` block (context, research, roadmap boundary, `CLAUDE.md`). It fills in `templates/design.md` at the `phase` tier (`spike` if `--spike`).
|
|
56
|
-
4. **Verify (reflexion loop)** — spawn `pan-design-checker` with the drafted design + the boundary source:
|
|
56
|
+
4. **Verify (reflexion loop)** — spawn `pan-design-checker` with the drafted design + the boundary source, plus an `<open_findings>` block holding `pan-tools findings list --phase {phase} --agent pan-design-checker --status open` (empty on the first check):
|
|
57
57
|
- If it PASSES → done.
|
|
58
58
|
- If it finds gaps (iteration 1) → `pan-designer` revises (address genuine gaps only), re-check.
|
|
59
59
|
- If it finds gaps (iteration 2) → final revision, record remaining gaps as caveats.
|
|
60
|
-
- **Max 2 revision iterations** (design → check → revise → check → final
|
|
60
|
+
- **Max 2 revision iterations** (design → check → revise → check → final revision, not re-checked). `plan-phase` also caps its loop at 2 revisions, but checks a third time after the second.
|
|
61
61
|
- **Record each check.** Save the checker's returned text verbatim to `{phase_dir}/{padded_phase}-design-check.md` with the Write tool. Record it and branch on the verdict it prints (`PASS` or `GAPS`):
|
|
62
62
|
```bash
|
|
63
63
|
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs findings record --phase "{phase}" --agent pan-design-checker --file "{phase_dir}/{padded_phase}-design-check.md" --raw
|
|
64
64
|
```
|
|
65
|
-
A re-check is the next attempt and closes the
|
|
65
|
+
A re-check is the next attempt. It answers each earlier gap in `resolutions`, and the record closes the ones answered `resolved` with evidence; a gap it neither reports nor answers stays open. When the final iteration still has gaps, record them as the caveats they are before writing the design:
|
|
66
66
|
```bash
|
|
67
67
|
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs findings dispose --phase "{phase}" --agent pan-design-checker --open --as deferred --reason "design caveat after 2 revision iterations"
|
|
68
68
|
```
|
|
@@ -81,5 +81,5 @@ Design FAILS if: phase not found in roadmap, or the designer returns empty/malfo
|
|
|
81
81
|
</completion_contract>
|
|
82
82
|
|
|
83
83
|
<handoff>
|
|
84
|
-
`{phase}-design.md` is an **optional upstream input** to `/pan:plan-phase`, consumed by `pan-planner`
|
|
84
|
+
`{phase}-design.md` is an **optional upstream input** to `/pan:plan-phase`, consumed by `pan-planner` like `{phase}-context.md` — except that the plan-phase workflow does not list it in the planner's or checker's `<files_to_read>`, so both use it only when they find it in the phase directory. `pan-plan-checker` verifies the plan conforms to it (Design Conformance dimension). A phase without a design.md still plans — the design step strengthens planning, it does not gate it.
|
|
85
85
|
</handoff>
|
|
@@ -33,6 +33,8 @@ Extract implementation decisions that downstream agents need — researcher and
|
|
|
33
33
|
<context>
|
|
34
34
|
Phase number: $ARGUMENTS (required)
|
|
35
35
|
|
|
36
|
+
**`--auto`** (or `workflow.auto_advance: true`): no questions — the workflow writes a minimal context.md from the roadmap goal, idea.md, project.md and requirements.md, then spawns plan-phase with `--auto`; the interactive steps below are skipped.
|
|
37
|
+
|
|
36
38
|
Context files are resolved in-workflow using `init phase-op` and roadmap/state tool calls.
|
|
37
39
|
</context>
|
|
38
40
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: pan:exec-phase
|
|
3
3
|
group: Phase Lifecycle
|
|
4
4
|
description: Execute all plans in a phase with wave-based parallelization
|
|
5
|
-
argument-hint: "<phase-number> [--gaps-only] [--skip-tests] [--skip-review] [--fast]"
|
|
5
|
+
argument-hint: "<phase-number> [--gaps-only] [--skip-tests] [--skip-review] [--fast] [--deep-review] [--hierarchical] [--auto]"
|
|
6
6
|
allowed-tools:
|
|
7
7
|
- Read
|
|
8
8
|
- Write
|
|
@@ -31,38 +31,36 @@ Context budget: ~15% orchestrator, 100% fresh per subagent.
|
|
|
31
31
|
Execution is complete when ALL conditions are met:
|
|
32
32
|
1. Every plan in the phase has been dispatched to a subagent
|
|
33
33
|
2. All subagents have returned (success or failure)
|
|
34
|
-
3.
|
|
34
|
+
3. The verifier's test gate ran the suite (or verification was skipped because `workflow.verifier` is off)
|
|
35
35
|
4. All verified tasks committed with accurate commit messages
|
|
36
36
|
5. state.md updated with phase progress
|
|
37
37
|
6. Failed tasks (if any) logged with error classification and root cause
|
|
38
38
|
|
|
39
|
-
Execution FAILS if:
|
|
39
|
+
Execution FAILS if: a plan fails and the user stops the run, or state corruption is detected.
|
|
40
40
|
</completion_contract>
|
|
41
41
|
|
|
42
42
|
<wave_dependencies>
|
|
43
|
-
Discovery →
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
Final Verify → State Update: state.md MUST only be updated after verification passes
|
|
43
|
+
Discovery → Waves: executors commit each task themselves; the workflow's generate_tests step and the verifier's test gate run the suite (the orchestrator does not commit waves)
|
|
44
|
+
Wave N → Wave N+1: Each wave waits for the previous wave's executors to return; their summaries are spot-checked (summary.md, commits, no `## Self-Check: FAILED`) before the next wave starts
|
|
45
|
+
All Waves → Verify: the verifier's test gate judges the suite; a failed gate is a gap for `/pan:plan-phase <N> --gaps`, not a revert
|
|
46
|
+
Verify → Phase complete: `phase complete` runs only after verification passes (or a `human_needed` verdict is approved), or after the "verification skipped" report when `workflow.verifier` is off
|
|
48
47
|
|
|
49
48
|
HARD STOP conditions (do not proceed to next wave):
|
|
50
|
-
- Baseline capture fails (test suite broken before we start) → STOP, report to user
|
|
51
|
-
- Wave N test count drops below baseline after 3 retries → revert wave, mark all wave tasks FAILED, continue to next wave
|
|
52
49
|
- State corruption detected (malformed state.md or plan files) → STOP execution entirely, report to user
|
|
53
|
-
-
|
|
50
|
+
- A plan failed and the user chose "Stop?" → partial completion report; if they continue, never run a plan that depends on a failed one (`phase-plan-index --failed`)
|
|
54
51
|
</wave_dependencies>
|
|
55
52
|
|
|
56
53
|
<context>
|
|
57
54
|
Phase: $ARGUMENTS
|
|
58
55
|
|
|
59
56
|
**Flags:**
|
|
60
|
-
- `--gaps-only` — Execute only gap closure plans (plans with `gap_closure: true` in frontmatter). Use after
|
|
57
|
+
- `--gaps-only` — Execute only gap closure plans (plans with `gap_closure: true` in frontmatter). Use after `/pan:plan-phase <N> --gaps` creates fix plans.
|
|
61
58
|
- `--skip-tests` — Skip automatic test generation after execution completes.
|
|
62
59
|
- `--skip-review` — Skip automatic code review after execution completes.
|
|
63
60
|
- `--fast` — Skip both test generation and code review (implies `--skip-tests --skip-review`).
|
|
64
61
|
- `--deep-review` — After the normal code review, run the deep review inline: the `/pan:review-deep` process, a security audit by pan-hardener plus a cross-check by pan-meta-reviewer, merged into `.planning/reviews/<N>/deep-review.md`. It builds on the normal review, so it is skipped with `--skip-review` or `--fast`. Recommended for phases touching auth, payment, PII, migrations, or public APIs. Costs roughly 3× a normal review.
|
|
65
|
-
- `--hierarchical` (v3.4+, Claude Code only — needs native sub-agent spawning) — Spawn `pan-conductor` as a top-level orchestrator that decomposes the phase and spawns executor/reviewer/verifier sub-agents in sequence. `pan-conductor`
|
|
62
|
+
- `--hierarchical` (v3.4+, Claude Code only — needs native sub-agent spawning) — Spawn `pan-conductor` as a top-level orchestrator that decomposes the phase and spawns executor/reviewer/verifier sub-agents in sequence. `pan-conductor` carries no `model:` and is spawned without one, so it runs on the model you launched the session with under every profile. Bounded by safety harness: max 2 nesting levels, 12 spawns per phase, budget ceiling, `.planning/orchestration/abort` kill-switch. On runtimes that cannot spawn nested agents, this flag is a no-op with a warning and falls back to flat exec. Use only for large phases (≥4 autonomous plans) where wall-clock reduction justifies the ~20-30% orchestration tax.
|
|
63
|
+
- `--auto` — Autonomous chain: sets `workflow.auto_advance`, and once verification passes with no gaps runs the transition to the next phase instead of stopping at a menu. `/pan:plan-phase --auto` passes `--auto --no-transition`, which stops after verification and the roadmap update and returns `PHASE COMPLETE`, or returns `GAPS FOUND` (no roadmap update) when verification finds gaps.
|
|
66
64
|
|
|
67
65
|
Context files are resolved inside the workflow via `pan-tools init execute-phase` and per-subagent `<files_to_read>` blocks.
|
|
68
66
|
</context>
|
|
@@ -73,34 +71,20 @@ Each execution stage has a restricted set of appropriate actions. Using the wron
|
|
|
73
71
|
| Stage | Read | Grep/Glob | Edit/Write | Bash (tests) | Bash (git) | Agent |
|
|
74
72
|
|-------|------|-----------|------------|--------------|------------|-------|
|
|
75
73
|
| Discovery (find plans) | YES | YES | NO | NO | NO | NO |
|
|
76
|
-
| Baseline capture | YES | NO | NO | YES | YES | NO |
|
|
77
74
|
| Wave execution | YES | YES | YES | YES | NO | YES |
|
|
78
75
|
| Wave verification | YES | YES | NO | YES | NO | NO |
|
|
79
|
-
| Wave commit | NO | NO | NO | NO | YES | NO |
|
|
80
76
|
| Final verification | YES | YES | NO | YES | NO | NO |
|
|
81
77
|
| State update | YES | NO | YES | NO | YES | NO |
|
|
82
78
|
|
|
83
79
|
**Key constraints:**
|
|
84
80
|
- Discovery: read-only — do not modify files while figuring out what to execute
|
|
85
|
-
- Baseline: run tests + git status only — no code changes before baseline is captured
|
|
86
81
|
- Wave verification: NO Edit/Write — you are checking work, not doing more work
|
|
87
|
-
-
|
|
82
|
+
- Commits: each executor commits its own tasks; the orchestrator makes no wave commits, and commits the phase's tracking files after `phase complete`
|
|
88
83
|
</action_gating>
|
|
89
84
|
|
|
90
|
-
<cache_priming>
|
|
91
|
-
**Before Discovery, prime the prompt cache once per invocation.** All subagents spawned within the next 5 minutes will hit the cache instead of re-sending the full context.
|
|
92
|
-
|
|
93
|
-
Run once:
|
|
94
|
-
```
|
|
95
|
-
pan-tools cache prime --summary
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
This returns `{blocks: [{path, bytes, cache}], total_bytes, sha}` for the cacheable set (project.md, requirements.md, roadmap.md, state.md, standards.md). The `sha` is stable across identical inputs, so repeated calls within the phase hit cached reads.
|
|
99
|
-
|
|
100
|
-
When spawning subagents for wave execution, include the cacheable block paths in each agent's system-context so a host runtime that supports prompt caching (Claude Code does) can mark them `cache_control: ephemeral`. Where prompt caching is unavailable, this step is a no-op — nothing breaks, just no savings.
|
|
101
|
-
</cache_priming>
|
|
102
|
-
|
|
103
85
|
<process>
|
|
86
|
+
**With `--hierarchical` on Claude Code:** run the workflow below, but in place of its wave execution, code review and `verify_phase_goal` spawn, spawn `pan-conductor` (`subagent_type="pan-conductor"`) with the phase number and the other flags: it runs the executors, the reviewer and the verifier itself, under its safety harness. When it returns, route on the verification its verifier wrote, as `verify_phase_goal` does, and carry on with the steps after it. On any other runtime, print `--hierarchical is not supported on <runtime>. Falling back to flat exec.` and run the workflow unchanged.
|
|
87
|
+
|
|
104
88
|
Execute the execute-phase workflow from @~/.claude/pan-wizard-core/workflows/exec-phase.md end-to-end.
|
|
105
89
|
Preserve all workflow gates (wave execution, checkpoint handling, verification, state updates, routing).
|
|
106
90
|
|
|
@@ -111,25 +95,25 @@ Preserve all workflow gates (wave execution, checkpoint handling, verification,
|
|
|
111
95
|
|
|
112
96
|
**Attention Anchor — emit after each wave completes:**
|
|
113
97
|
```
|
|
114
|
-
Wave {N}/{total} complete |
|
|
98
|
+
Wave {N}/{total} complete | Plans: {done}/{total} | Failed: {plan IDs, or none}
|
|
115
99
|
Remaining waves: {list of wave numbers with task counts}
|
|
116
100
|
Next: Wave {N+1} — {task count} tasks [{task IDs}]
|
|
117
101
|
```
|
|
118
|
-
This prevents drift in multi-wave phases where the agent loses track of which waves remain and
|
|
102
|
+
This prevents drift in multi-wave phases where the agent loses track of which waves remain and which plans failed.
|
|
119
103
|
|
|
120
104
|
**Task tracking:** where your runtime offers a todo or task-tracking tool, you may keep the wave list in it. Do not depend on one: some runtimes offer none on their newest models (Claude Code gates its task tools behind `CLAUDE_CODE_ENABLE_TODO_TOOLS=1` there). The attention anchor above, the wave summaries and state.md are the record either way.
|
|
121
105
|
|
|
122
106
|
**State Intent Before Implementing (M+ tasks):**
|
|
123
107
|
For each STANDARD or FULL task, state before coding: "I will modify [files], adding [what], to achieve [goal]. Risk: [what could break]."
|
|
124
108
|
|
|
125
|
-
**Pre-Commit Verification Checklist —
|
|
109
|
+
**Pre-Commit Verification Checklist — the executors commit each task themselves (there is no wave commit); check their work against it when a wave returns:**
|
|
126
110
|
1. Every modified file was read before editing
|
|
127
|
-
2.
|
|
128
|
-
3.
|
|
111
|
+
2. The wave's commits touch only files related to its tasks
|
|
112
|
+
3. No summary carries `## Self-Check: FAILED` (the suite as a whole is judged by the verifier's test gate)
|
|
129
113
|
4. Commit message lists only tasks that are verified (tests ran, tests passed)
|
|
130
|
-
5. No secrets or credentials
|
|
114
|
+
5. No secrets or credentials in the wave's commits
|
|
131
115
|
|
|
132
|
-
If any check fails:
|
|
116
|
+
If any check fails: treat that plan as failed and route it as the workflow's spot-check does ("Retry plan?" or "Continue with remaining waves?").
|
|
133
117
|
|
|
134
118
|
**Error Recovery Classification — apply when any task fails:**
|
|
135
119
|
- RECOVERABLE (retry up to 3 times): test failure after code change, build syntax error, file not found (search for moved path)
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
name: experiment
|
|
3
3
|
group: Self-Improvement
|
|
4
4
|
description: Manage external experiments — scaffold, run, harvest, promote findings back to PAN
|
|
5
|
+
argument-hint: "new <slug> --idea <path> [--runtime r] [--root path] [--budget n] | list [--root path] | manifest <slug> | run <slug> [--timeout sec] [--prompt text] | status <slug> | stop <slug> | harvest <slug> [--source-root path] [--force] | prune <slug> [--hard]"
|
|
5
6
|
allowed-tools:
|
|
6
7
|
- Read
|
|
7
8
|
- Write
|
|
@@ -47,7 +48,7 @@ Scaffold a new experiment folder. Creates:
|
|
|
47
48
|
├── .planning/
|
|
48
49
|
│ ├── idea.md ← copied from --idea path
|
|
49
50
|
│ └── experiment.json ← manifest (slug, runtime, created_at, etc.)
|
|
50
|
-
└── .claude/ (or .codex/, .gemini/, .opencode/, .github/) ← PAN install for chosen runtime
|
|
51
|
+
└── .claude/ (or .codex/, .gemini/, .opencode/, .github/) ← PAN install for chosen runtime — only when pan-tools runs from a source checkout (beside `bin/install.js`); the installed copy skips it and records `installer_skipped` in experiment.json
|
|
51
52
|
```
|
|
52
53
|
|
|
53
54
|
**Flags:**
|
|
@@ -57,7 +58,7 @@ Scaffold a new experiment folder. Creates:
|
|
|
57
58
|
| `--idea <path>` | required | Path to the idea.md doc; copied into the experiment |
|
|
58
59
|
| `--runtime <r>` | `claude` | Which AI coding runtime to install: claude / codex / gemini / opencode / copilot |
|
|
59
60
|
| `--root <path>` | `~/pan-experiments/` | Override the experiment root directory |
|
|
60
|
-
| `--budget <pts>` |
|
|
61
|
+
| `--budget <pts>` | none | Optional budget cap, saved to the manifest (the runner does not enforce it) |
|
|
61
62
|
| `--skip-installer` | `false` | Don't run the PAN installer (dev-only) |
|
|
62
63
|
|
|
63
64
|
**Slug rules:** lowercase letters, digits, hyphens. Max 40 chars. No leading/trailing hyphen.
|
|
@@ -73,7 +74,7 @@ Enumerate all experiments under the root. Returns `{ experiments: [...], count }
|
|
|
73
74
|
| Flag | Default | Purpose |
|
|
74
75
|
|------|---------|---------|
|
|
75
76
|
| `--root <path>` | `~/pan-experiments/` | Override the root |
|
|
76
|
-
| `--raw` | `false` |
|
|
77
|
+
| `--raw` | `false` | No effect: `list` always prints JSON |
|
|
77
78
|
|
|
78
79
|
### `/pan:experiment manifest <slug>`
|
|
79
80
|
|
|
@@ -98,12 +99,12 @@ Spawn the external AI runtime against the experiment folder. **Synchronous** —
|
|
|
98
99
|
| Flag | Default | Purpose |
|
|
99
100
|
|------|---------|---------|
|
|
100
101
|
| `--timeout <sec>` | `3600` (60 min) | Hard timeout in seconds; runner sends SIGTERM at deadline |
|
|
101
|
-
| `--prompt <text>` | `/pan:new-project --auto @.planning/idea.md` | Prompt passed to the external runtime |
|
|
102
|
+
| `--prompt <text>` | `/pan:new-project --auto @.planning/idea.md` — the Claude Code / Gemini form; pass the runtime's own for Codex (`$pan-new-project …`) or OpenCode (`/pan-new-project …`) | Prompt passed to the external runtime |
|
|
102
103
|
| `--root <path>` | `~/pan-experiments/` | Override the experiment root |
|
|
103
104
|
|
|
104
|
-
**Returns:** `{ status: "done"\|"failed", stop_reason: "success"\|"
|
|
105
|
+
**Returns:** `{ experiment_id, status: "done"\|"incomplete"\|"failed", stop_reason: "success"\|"incomplete"\|"error"\|"timeout", exit_code, elapsed_ms, started_at, ended_at }` — `incomplete` is an exit 0 whose state.md does not show the milestone completed. Run-state is also persisted to `<experiment>/.planning/run-state.json`.
|
|
105
106
|
|
|
106
|
-
**Runtime support:** claude / codex / gemini / opencode (via `RUNTIME_RUNNERS` adapter map in `runner.cjs`). GitHub Copilot CLI is **unsupported** for the `run` subcommand — no
|
|
107
|
+
**Runtime support:** claude / codex / gemini / opencode (via `RUNTIME_RUNNERS` adapter map in `runner.cjs`). GitHub Copilot CLI is **unsupported** for the `run` subcommand — the runner has no Copilot adapter yet (`copilot -p` does run a prompt headless). Copilot users can still scaffold and harvest manually.
|
|
107
108
|
|
|
108
109
|
**Billing note (Claude runtime):** headless `claude -p` runs bill against the **Claude Agent SDK credit pool** — a monthly allotment separate from your interactive subscription limits (Anthropic split the two effective June 15, 2026). Experiment runs do not consume interactive-session quota, but heavy experimentation can exhaust the SDK pool independently. Note: the CLI `experiment run` does not capture a metrics envelope — the `billing_pool: "agent_sdk"` tagging is produced only via the runner module's capture-metrics API, not from the command line, so CLI run-state has no `metrics` key to reconcile against.
|
|
109
110
|
|
|
@@ -140,7 +141,7 @@ A `harvest.json` manifest is written at the destination capturing source path, t
|
|
|
140
141
|
| Flag | Default | Purpose |
|
|
141
142
|
|------|---------|---------|
|
|
142
143
|
| `--root <path>` | `~/pan-experiments/` | Override the experiment root |
|
|
143
|
-
| `--source-root <path>` | PAN source
|
|
144
|
+
| `--source-root <path>` | the root of the PAN copy running pan-tools: a source checkout, or the runtime's config dir (e.g. `.claude/`) for an installed copy | Override harvest destination |
|
|
144
145
|
| `--force` | `false` | Overwrite an existing harvest at the destination |
|
|
145
146
|
|
|
146
147
|
**Returns:** `{ experiment_id, harvest_path, harvested_paths: [...], total_bytes, harvested_at, pan_version }`. On conflict without `--force`, returns `{ error }`.
|
|
@@ -222,4 +223,4 @@ pan-tools experiment manifest md-lint
|
|
|
222
223
|
|
|
223
224
|
## Runtime support
|
|
224
225
|
|
|
225
|
-
Works in all 5 runtimes (Claude / Codex / Gemini / OpenCode / Copilot). The W2 external runner (subprocess invocation of the external session) supports Claude / Codex / Gemini / OpenCode; GitHub Copilot CLI
|
|
226
|
+
Works in all 5 runtimes (Claude / Codex / Gemini / OpenCode / Copilot). The W2 external runner (subprocess invocation of the external session) supports Claude / Codex / Gemini / OpenCode; GitHub Copilot CLI has no runner adapter yet and is opt-out for the `run` subcommand.
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
name: focus-auto
|
|
3
3
|
group: Focus
|
|
4
4
|
description: Continuous scan-plan-exec loop with purpose-driven categories and a layered safety harness
|
|
5
|
+
argument-hint: "[--source scan|backlog] [--category CAT] [--mode MODE] [--budget N] [--max-cycles N] [--total-budget N] [--enforce-budget] [--verify-reserve F] [--continue] [--stop] [--status] [--dry-run] [--deep-review] [--parallel-research] [--parallel-verify] [--clean-seal]"
|
|
5
6
|
allowed-tools:
|
|
6
7
|
- Read
|
|
7
8
|
- Write
|
|
@@ -23,7 +24,7 @@ Run purpose-driven improvement campaigns with a single command. The auto-runner
|
|
|
23
24
|
This command runs improvement campaigns on the **host project's source code** — not on PAN Wizard's own infrastructure.
|
|
24
25
|
|
|
25
26
|
**Exclude these directories from scanning and execution:**
|
|
26
|
-
- `.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
|
|
27
28
|
- Any `pan-wizard-core/`, `pan-tools`, agent `.md`, or command `.md` files within PAN runtime directories
|
|
28
29
|
|
|
29
30
|
**These directories are PAN's own tooling installed into the project.** Do not scan PAN files for TODOs, do not report PAN files as lacking coverage, do not modify PAN agents/commands/core as part of a campaign. If a scan finding or batch item targets a PAN infrastructure file — DROP IT.
|
|
@@ -35,9 +36,10 @@ A campaign is complete when ANY stop condition is met:
|
|
|
35
36
|
1. Max cycles reached (--max-cycles, default 10)
|
|
36
37
|
2. Total budget exhausted (--total-budget) — **advisory by default**: tracked and surfaced but does NOT stop the run unless `--enforce-budget` (or config `budget.enforce: true`) is set
|
|
37
38
|
3. Scan returns zero items for the selected category
|
|
38
|
-
4.
|
|
39
|
-
5.
|
|
40
|
-
|
|
39
|
+
4. User sends /pan:focus-auto --stop
|
|
40
|
+
5. Category-specific completion (e.g., prompts_remaining === 0)
|
|
41
|
+
|
|
42
|
+
The context monitor's notes are not a stop condition: they give no figure and ask for a checkpoint. On the critical note, bring the scan file up to date (items completed and failed) before the next step, then carry on with the cycle. Record it with `focus auto --update` only at its end (Step 2.4): `--update` closes a cycle and runs the stop checks, so a mid-cycle call with nothing done ends the run as `zero_completed`. After the host compacts, re-read the campaign with `focus auto --status`: PAN's state re-injection carries state.md's position, not the campaign's. If the session ends instead, `focus auto --continue` resumes only a stopped run or one with no cycle recorded yet: run `/pan:focus-auto --stop`, then `--continue`.
|
|
41
43
|
|
|
42
44
|
Each cycle is complete when: scan → plan → exec → commit succeeds, OR a safety harness triggers and the cycle is cleanly aborted with state preserved.
|
|
43
45
|
</completion_contract>
|
|
@@ -133,7 +135,7 @@ When `--source backlog` is set, work is selected from the **curated planning sur
|
|
|
133
135
|
|
|
134
136
|
1. **Read the backlog once** at Phase 0: actionable items are unchecked rows in `roadmap.md` (phase/plan checkboxes) and unmet `requirements.md` REQ rows. Skip anything struck, completed, or marked blocked.
|
|
135
137
|
2. **Score from the CURRENT document — never a hardcoded ID list.** For each item, derive `RS = (UserValue + TimeCriticality + RiskReduction) / Effort` (1–5 each; Effort from the row's size tag). Sort by wave/priority ascending → RS descending → effort ascending. This re-derives the order from whatever the roadmap says today, so it never goes stale.
|
|
136
|
-
3. **Pop the top survivor each cycle**; re-rank only if a landing changed a dependency. The same budget/cycle
|
|
138
|
+
3. **Pop the top survivor each cycle**; re-rank only if a landing changed a dependency. The same budget/cycle stops and safety harness apply unchanged.
|
|
137
139
|
4. The backlog ranker reads only PAN's planning files — it embeds **no** project-specific item IDs, test counts, or build commands. A project with no actionable backlog items is a clean stop (`scan returns zero items` equivalent).
|
|
138
140
|
|
|
139
141
|
## Concurrency model (when `--parallel-research` / `--parallel-verify`, ADR-0031)
|
|
@@ -188,7 +190,7 @@ Phase 2 (each cycle): Scan → Plan → Exec → Commit is strictly sequential w
|
|
|
188
190
|
HARD STOP conditions:
|
|
189
191
|
- Phase 1 fails (tests broken): Do not enter main loop — report and exit
|
|
190
192
|
- Any cycle: test count drops below baseline after revert → stop campaign, preserve state
|
|
191
|
-
-
|
|
193
|
+
- The context monitor's critical note is not a stop: bring the scan file up to date before the next step, then carry on; record the cycle (`focus auto --update`) only at its end, since `--update` closes the cycle and runs the stop checks
|
|
192
194
|
</phase_dependencies>
|
|
193
195
|
|
|
194
196
|
### Phase 2: Main Loop
|
|
@@ -244,7 +246,7 @@ For P3-P6 items, compute Reality Score: `RS = (UV + TC + RR) / JS`
|
|
|
244
246
|
- RS >= 3.0 = DO, RS 1.5-2.9 = DEFER, RS < 1.5 = BACKLOG
|
|
245
247
|
|
|
246
248
|
**2.1.4 Filter by Category**
|
|
247
|
-
Only keep items within the run's category priority range (see Category Defaults table). Drop items outside the range. If 0 items match: go to Phase 3 (Campaign End).
|
|
249
|
+
Only keep items within the run's category priority range (see Category Defaults table). Drop items outside the range. If 0 items match: record the empty cycle with Step 2.4's update, `focus auto --update --items-completed 0 --items-failed 0 --points-used 0 --tests-before <N> --tests-after <N>` (`<N>` is the current test count: the last recorded cycle's `tests_after`, or the Phase 1 baseline before the first cycle), so the run ends with its stop reason — `zero_completed`, or `security_complete` / `distill_complete` for those categories (`max_cycles` if this was the run's last cycle) — then go to Phase 3 (Campaign End).
|
|
248
250
|
|
|
249
251
|
**2.1.5 Write Scan**
|
|
250
252
|
Write scan results to `.planning/focus/scan-<YYYY-MM-DD>-<category>.md` with:
|
|
@@ -259,10 +261,10 @@ Create a capacity-budgeted batch from the scan items found in Step 2.1.
|
|
|
259
261
|
**Capacity Points:** XS=1, S=2, M=4, L=10, XL=20
|
|
260
262
|
|
|
261
263
|
**Allocation by Mode:**
|
|
262
|
-
- `bugfix`: All budget on P0 mandatory, then P1, then P2-P4 smallest-first
|
|
264
|
+
- `bugfix`: All budget on P0 mandatory, then P1, then P2-P4 smallest-first; no separate feature pass (P3-P4 are taken in priority order, P5-P6 left out).
|
|
263
265
|
- `balanced`: 60% stability (P0-P2), 40% features (P3-P6)
|
|
264
266
|
- `features`: P0 mandatory, then 80% on P3-P5, 20% on P1-P2 quick wins
|
|
265
|
-
- `full`:
|
|
267
|
+
- `full`: One pass over every priority in priority order (P0 first), smallest-first within each
|
|
266
268
|
|
|
267
269
|
**Execution Tiers:** XS/S = MICRO, M = STANDARD, L/XL = FULL
|
|
268
270
|
Select items fitting within the cycle's `budget_per_cycle`. Order: MICRO first, then STANDARD, then FULL.
|
|
@@ -354,9 +356,9 @@ Check the response for stop conditions:
|
|
|
354
356
|
- `zero_completed`: No items completed in this cycle — go to Phase 3
|
|
355
357
|
- `diminishing_returns`: Optimize only — cycle efficiency < 30% of previous cycle — go to Phase 3
|
|
356
358
|
- `prompts_complete`: Prompts only — all prompts in document executed — go to Phase 3
|
|
357
|
-
- `security_complete`: Security only —
|
|
358
|
-
- `distill_complete`: Distill only — scan
|
|
359
|
-
- `
|
|
359
|
+
- `security_complete`: Security only — the cycle recorded zero completed items (how an empty scan ends the run; for this category it replaces `zero_completed`) — go to Phase 3
|
|
360
|
+
- `distill_complete`: Distill only — the cycle recorded zero completed items (how an empty scan ends the run; for this category it replaces `zero_completed`) — go to Phase 3
|
|
361
|
+
- `weekly_limit`: Claude Code's 7-day usage window reached `cost.weekly_limit_stop_pct` (default 90%; read by `pan-tools cost limits`) — the run is stopped, not completed: go to Phase 3, and resume with `--continue` once the window has room
|
|
360
362
|
- `null`: Continue to next cycle
|
|
361
363
|
|
|
362
364
|
#### Step 2.5: Inter-Cycle Context Management
|
|
@@ -491,7 +493,7 @@ Alternative format — checklist style:
|
|
|
491
493
|
5. If tests pass: mark the prompt as complete (`- [x]`), commit, move to next prompt
|
|
492
494
|
6. If tests fail: one fix attempt, then revert and mark prompt as FAILED, move to next prompt
|
|
493
495
|
7. Each prompt = one batch item. Budget: 1 prompt per cycle unless prompt is trivial (XS)
|
|
494
|
-
8. Record
|
|
496
|
+
8. Record the count with `--prompts-remaining N` on the cycle's `focus auto --update` — at 0, `prompts_complete` fires; without the flag the count is null and it never fires
|
|
495
497
|
|
|
496
498
|
**Key rules:**
|
|
497
499
|
- Execute prompts in document order — NEVER skip ahead or reorder
|
|
@@ -528,7 +530,7 @@ When a specification document is found that doesn't have a matching micro-prompt
|
|
|
528
530
|
|
|
529
531
|
## Security Category — Execution Details
|
|
530
532
|
|
|
531
|
-
The security category scans for OWASP Top 10 (2025) violations and STRIDE threats, then fixes them cycle by cycle until the scan
|
|
533
|
+
The security category scans for OWASP Top 10 (2025) violations and STRIDE threats, then fixes them cycle by cycle until the scan finds no P0-P2 (critical, high or medium) items or a cycle completes nothing.
|
|
532
534
|
|
|
533
535
|
### Scan approach (Step 2.1)
|
|
534
536
|
|
|
@@ -552,7 +554,7 @@ Three passes per cycle:
|
|
|
552
554
|
- Check for prototype pollution risk: `Object.assign(req.body)` or spread from untrusted input into a stored object
|
|
553
555
|
|
|
554
556
|
**Pass 3 — Semantic depth (Agent tool, for M/L items only):**
|
|
555
|
-
When a pattern match needs code-path confirmation, spawn
|
|
557
|
+
When a pattern match needs code-path confirmation, spawn the `pan-hardener` subagent:
|
|
556
558
|
> "Read [file]. Confirm whether [line N] is reachable from an unauthenticated request path and whether the input is sanitized before use."
|
|
557
559
|
|
|
558
560
|
Use the confirmation to decide whether to include the item at P0/P1 or drop it as a false positive.
|
|
@@ -582,9 +584,9 @@ Treat each security item as a STANDARD or FULL item regardless of effort estimat
|
|
|
582
584
|
|
|
583
585
|
### Stop condition
|
|
584
586
|
|
|
585
|
-
`security_complete` fires when the scan
|
|
587
|
+
`security_complete` fires when a security cycle records zero completed items — `--update` cannot see the scan, so this is how an empty scan ends the run. A cycle whose items all failed reports it too: for this category it replaces `zero_completed`. P2 items (medium) the scan still finds are worked like any other, so they keep the campaign running.
|
|
586
588
|
|
|
587
|
-
A security campaign that ends with `security_complete`
|
|
589
|
+
A security campaign that ends with `security_complete` had a cycle that completed nothing: if its scan was empty, no critical or high OWASP violations were found in the scanned files; if its items failed, they are still open. Medium/low items can be addressed in subsequent targeted passes or documented as accepted risk.
|
|
588
590
|
|
|
589
591
|
---
|
|
590
592
|
|
|
@@ -600,7 +602,7 @@ The `distill` category targets **AI-generated code bloat** with a 5-pass pipelin
|
|
|
600
602
|
| 2 | **AST-style analysis** — single-instance factories, deep nesting | Free | review |
|
|
601
603
|
| 3 | **Cross-file graph** — repeated 5+ line blocks, unreferenced exports | Free | review |
|
|
602
604
|
| 4 | **LLM judgment** — pan-distiller agent receives ONLY flagged spans (max 50 lines context per finding); validates pattern, refines tier, proposes minimal rewrite | LLM tokens | safe / review / risky |
|
|
603
|
-
| 5 | **Cross-session memory** — compares findings to `.planning/memory/distill-patterns.md`; flags **
|
|
605
|
+
| 5 | **Cross-session memory** — compares findings to `.planning/memory/distill-patterns.md`; flags **recurring** patterns (detected in an earlier session — the file records detections, not fixes) | Free | metadata |
|
|
604
606
|
|
|
605
607
|
### Safety Tiers
|
|
606
608
|
|
|
@@ -624,7 +626,7 @@ Default threshold: **2.0x**. If a cycle's ratio exceeds threshold, the bloat bud
|
|
|
624
626
|
|
|
625
627
|
### Stop condition
|
|
626
628
|
|
|
627
|
-
`distill_complete` fires when
|
|
629
|
+
`distill_complete` fires when a distill cycle records zero completed items — how an empty scan ends the run, and also what a cycle whose items all failed reports, since for this category it replaces `zero_completed`. After an empty scan the codebase is fully distilled for the patterns the deterministic + AST + graph passes detect; after a cycle whose items all failed, those findings are still open.
|
|
628
630
|
|
|
629
631
|
### CLI
|
|
630
632
|
|
|
@@ -634,7 +636,7 @@ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs distill analyze [--touched-loc
|
|
|
634
636
|
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs distill report
|
|
635
637
|
```
|
|
636
638
|
|
|
637
|
-
`scan` returns findings. `analyze` adds bloat budget + regressed
|
|
639
|
+
`scan` returns findings. `analyze` adds bloat budget + recurring-pattern detection (its `regressed` list: findings already recorded in an earlier session). `report` writes findings to `.planning/memory/distill-patterns.md` for the next session.
|
|
638
640
|
|
|
639
641
|
<failure_pattern_capture>
|
|
640
642
|
When the same failure pattern appears in 2+ items within a campaign, capture it for future runs.
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
name: focus-design
|
|
3
3
|
group: Focus
|
|
4
4
|
description: Strategic 10-phase feature investigation, design, and specification pipeline
|
|
5
|
+
argument-hint: "<feature description> [--full | --internal | --outward | --spike] [--gate] [--audit] [--mvp]"
|
|
5
6
|
allowed-tools:
|
|
6
7
|
- Read
|
|
7
8
|
- Write
|
|
@@ -31,7 +32,7 @@ Research, design, and specify a new feature with strategic analysis. $ARGUMENTS
|
|
|
31
32
|
This command investigates and designs features for the **host project** — NOT for PAN Wizard itself.
|
|
32
33
|
|
|
33
34
|
**NEVER investigate, design for, or reference these PAN infrastructure directories as part of the project:**
|
|
34
|
-
- `.claude/`, `.
|
|
35
|
+
- `.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
|
|
35
36
|
- `.planning/` — PAN planning state (read for context, but don't treat as project source code)
|
|
36
37
|
- Any `pan-wizard-core/`, `pan-tools`, agent `.md`, or command `.md` files within those directories
|
|
37
38
|
|
|
@@ -148,7 +149,7 @@ Use case: Quick prototyping, time-boxed exploration, "should we even try this?"
|
|
|
148
149
|
|
|
149
150
|
**Modifiers (layer on top of any mode):**
|
|
150
151
|
- `--gate` — Pause after Phase 3 (Strategy) for user review before proceeding to design
|
|
151
|
-
- `--audit` — Add Phase 2.5 reality check of existing implementation (not available with `--spike
|
|
152
|
+
- `--audit` — Add Phase 2.5 reality check of existing implementation (not available with `--internal` or `--spike`, which skip Phase 2.5)
|
|
152
153
|
- `--mvp` — Stop after generating the v0 (MVP) task list — skip v1/v2 layers
|
|
153
154
|
|
|
154
155
|
### Scope Calibration (Auto-Detection)
|
|
@@ -195,7 +196,7 @@ Present the suggested mode and rationale. If the user hasn't specified, use the
|
|
|
195
196
|
### 0.1 Problem Statement
|
|
196
197
|
Write a crisp, one-paragraph problem statement answering:
|
|
197
198
|
- What user pain or limitation does this address?
|
|
198
|
-
- Why does it matter NOW for the target users (
|
|
199
|
+
- Why does it matter NOW for the project's target users (as the project's own docs describe them)?
|
|
199
200
|
- What is the cost of NOT doing this?
|
|
200
201
|
|
|
201
202
|
### 0.2 Demand Evidence (MANDATORY)
|
|
@@ -400,7 +401,7 @@ Based on Phase 0.8 investigation and Phase 1 reconnaissance findings, ask 2-4 IN
|
|
|
400
401
|
|
|
401
402
|
## Phase 2: Competitive Intelligence
|
|
402
403
|
|
|
403
|
-
**Research how the best
|
|
404
|
+
**Research how the best tools in the feature's domain solve this problem.**
|
|
404
405
|
|
|
405
406
|
### 2.1 Deep-Dive Research (6+ Tools)
|
|
406
407
|
Select competitor tools relevant to the FEATURE DOMAIN, not a fixed list. Use web search for each.
|
|
@@ -707,9 +708,9 @@ or architectural constraints from Phase 3.5]
|
|
|
707
708
|
[How does this fit into the existing system? Include the dependency map from Phase 1.4
|
|
708
709
|
and the layer violation check from Phase 3.5.2. Show which modules are touched.]
|
|
709
710
|
|
|
710
|
-
|
|
711
|
+
~~~
|
|
711
712
|
[Dependency diagram or integration flow from Phase 1.4 / 3.5.6]
|
|
712
|
-
|
|
713
|
+
~~~
|
|
713
714
|
|
|
714
715
|
### Interface Contract
|
|
715
716
|
[The output schema or API contract from Phase 3.5.3 — exact format, not just description.
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
name: focus-doc-audit
|
|
3
3
|
group: Focus
|
|
4
4
|
description: Multi-dimensional document audit — accuracy, freshness, links, cross-consistency, and structural quality
|
|
5
|
+
argument-hint: "[file|directory] [--deep] [--links] [--fix] [--all] [--score-only] [--min-score N] [--format markdown|json|checklist]"
|
|
5
6
|
allowed-tools:
|
|
6
7
|
- Read
|
|
7
8
|
- Write
|
|
@@ -28,7 +29,7 @@ Audit project documentation for accuracy, freshness, broken links, structural qu
|
|
|
28
29
|
This command audits the **host project's documentation** — NOT PAN Wizard's own infrastructure files.
|
|
29
30
|
|
|
30
31
|
**NEVER audit, modify, or report issues in these PAN directories:**
|
|
31
|
-
- `.claude/`, `.
|
|
32
|
+
- `.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
|
|
32
33
|
- `.planning/` — PAN planning state (read for context, never audit as project docs)
|
|
33
34
|
- Any `pan-wizard-core/`, `pan-tools`, agent `.md`, or command `.md` files within PAN runtime directories
|
|
34
35
|
|
|
@@ -316,7 +317,7 @@ For all audited documents, extract overlapping claims and check for contradictio
|
|
|
316
317
|
When documents disagree, determine which is correct:
|
|
317
318
|
|
|
318
319
|
```
|
|
319
|
-
Config files > README > CLAUDE.md > docs/ > CHANGELOG
|
|
320
|
+
Config files > README > CLAUDE.md > inline comments > docs/ > CHANGELOG
|
|
320
321
|
```
|
|
321
322
|
|
|
322
323
|
The document closer to code is more likely correct.
|
|
@@ -499,7 +500,7 @@ Score = (Accuracy × 0.25) + (Freshness × 0.15) + (Completeness × 0.15) +
|
|
|
499
500
|
| Actionability | 82% | INSTALL.md (70%) | CONTRIBUTING.md (95%) |
|
|
500
501
|
| Readability | 88% | — | — |
|
|
501
502
|
|
|
502
|
-
**Recommended priority:** Fix docs/API.md (Grade
|
|
503
|
+
**Recommended priority:** Fix docs/API.md (Grade D) → Fix CONTRIBUTING.md (Grade C) → Update INSTALL.md freshness
|
|
503
504
|
```
|
|
504
505
|
|
|
505
506
|
---
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
name: focus-drift-walking
|
|
3
3
|
group: Focus
|
|
4
4
|
description: Deep documentation-code drift detection, CLAUDE.md alignment, and auto-repair across all project directories
|
|
5
|
+
argument-hint: "[--create] [--audit] [--repair] [--report] [--dir <path>] [--depth N] [--severity critical|high|medium|low|info] [--format markdown|json|checklist] [--quick]"
|
|
5
6
|
allowed-tools:
|
|
6
7
|
- Read
|
|
7
8
|
- Write
|
|
@@ -27,7 +28,7 @@ Walk every directory in the project, detect drift between documentation and code
|
|
|
27
28
|
This command walks the **host project's directories and documentation** — NOT PAN Wizard's own infrastructure.
|
|
28
29
|
|
|
29
30
|
**ALWAYS EXCLUDE these directories from walking:**
|
|
30
|
-
- `.claude/`, `.
|
|
31
|
+
- `.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
|
|
31
32
|
- `.planning/` — PAN planning state (read for context, never report as drift)
|
|
32
33
|
- Any `pan-wizard-core/`, `pan-tools`, agent `.md`, or command `.md` files within PAN runtime directories
|
|
33
34
|
- Build output directories: `build/`, `dist/`, `out/`, `target/`, `bin/`, `obj/`, `node_modules/`, `.git/`, `__pycache__/`, `.next/`, `.nuxt/`
|
|
@@ -49,7 +50,7 @@ When `/pan:focus-drift-walking` is invoked, execute ALL phases for the selected
|
|
|
49
50
|
- `--report` — Dry run: detect and report drift without modifying anything
|
|
50
51
|
- `--dir <path>` — Target a specific directory subtree only
|
|
51
52
|
- `--depth <n>` — Limit walk depth (default: unlimited)
|
|
52
|
-
- `--severity <level>` — Filter report: `critical`, `
|
|
53
|
+
- `--severity <level>` — Filter report: `critical`, `high`, `medium`, `low`, `info` (default: all)
|
|
53
54
|
- `--format <type>` — Output format: `markdown` (default), `json`, `checklist`
|
|
54
55
|
- `--quick` — Skip Phase 4 (deep semantic analysis) and Phase 7 (cross-project sync)
|
|
55
56
|
|
|
@@ -503,7 +504,7 @@ When root docs and sub-docs disagree:
|
|
|
503
504
|
|
|
504
505
|
- Walk build output directories (`build/`, `dist/`, `node_modules/`, `target/`, `obj/`, `__pycache__/`, `.git/`)
|
|
505
506
|
- Report PAN infrastructure files as project drift
|
|
506
|
-
- Auto-fix purpose statements, architecture descriptions, or
|
|
507
|
+
- Auto-fix purpose statements, architecture descriptions, conventions, dependency directions or build commands — even `--repair` only flags these (Phase 6.2)
|
|
507
508
|
- Create documentation for trivial directories (< 3 source files)
|
|
508
509
|
- Include secrets, credentials, or API keys in any generated documentation
|
|
509
510
|
- Guess at file contents — always read and verify
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
name: focus-exec
|
|
3
3
|
group: Focus
|
|
4
4
|
description: Automated batch execution pipeline with 6 stages, behavioral rules, 3 execution tiers
|
|
5
|
+
argument-hint: "[--budget N] [--mode bugfix|balanced|features|full] [--priority P0-P6] [--dry-run] [--no-commit] [--continue] [--deep-review]"
|
|
5
6
|
allowed-tools:
|
|
6
7
|
- Read
|
|
7
8
|
- Write
|
|
@@ -85,7 +86,7 @@ Each stage has a restricted set of appropriate actions. Using the wrong tool at
|
|
|
85
86
|
This command executes work on the **host project's source code** — not on PAN Wizard's own infrastructure.
|
|
86
87
|
|
|
87
88
|
**Do not read, modify, or fix files in these PAN directories:**
|
|
88
|
-
- `.claude/`, `.
|
|
89
|
+
- `.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
|
|
89
90
|
- Any `pan-wizard-core/`, `pan-tools`, agent `.md`, or command `.md` files within PAN runtime directories
|
|
90
91
|
|
|
91
92
|
**These directories are PAN's own tooling installed into the project.** If a batch item targets a PAN infrastructure file, SKIP it with reason "PAN infrastructure — out of scope." Never modify PAN's agents, commands, core modules, or dispatcher as part of project work.
|
|
@@ -116,7 +117,7 @@ HARD STOP conditions (do not proceed to next stage):
|
|
|
116
117
|
- `--dry-run` — Run Stages 1-2 only (show what WOULD be executed)
|
|
117
118
|
- `--no-commit` — Skip the commit step in Stage 6
|
|
118
119
|
- `--continue` — Resume a previously interrupted execution
|
|
119
|
-
- `--deep-review` (v3.4+) — After each high-stakes item's execution, run
|
|
120
|
+
- `--deep-review` (v3.4+) — After each high-stakes item's execution, run the deep pass on that item's changed files: spawn pan-hardener (`<output_path>` `.planning/reviews/<item-id>/hardener.md`), then pan-meta-reviewer on its report (`.planning/reviews/<item-id>/meta.md`), and merge with `pan-tools review-deep merge <item-id> --hardener-file … --meta-file …` (no first-pass review, so no `--reviewer-file`; `/pan:review-deep` itself needs a phase). Slows the campaign by roughly 3× per item that triggers the deep pass; use for batches touching auth/payment/migrations.
|
|
120
121
|
|
|
121
122
|
---
|
|
122
123
|
|
|
@@ -161,7 +162,7 @@ Every code change must be tested before moving to the next item.
|
|
|
161
162
|
Test cadence by tier:
|
|
162
163
|
- **MICRO (XS/S):** Run specific test after implementing. Batch up to 3 independent items before smoke.
|
|
163
164
|
- **STANDARD (M):** Full test suite after each item.
|
|
164
|
-
- **FULL (L/XL):**
|
|
165
|
+
- **FULL (L/XL):** The project's build step (if it has one) + full test suite after each item.
|
|
165
166
|
|
|
166
167
|
### Rule 4: Don't Invent — Follow the Plan
|
|
167
168
|
Implement exactly what the batch says. Do not:
|
|
@@ -210,8 +211,7 @@ This catches emergent interactions: 5 "add try-catch" fixes might reveal the mod
|
|
|
210
211
|
1. **Check Project Status** — git status, recent commits
|
|
211
212
|
2. **Test Baseline** — run test suite, record current counts
|
|
212
213
|
3. **Create rollback snapshot** — git tag for safety
|
|
213
|
-
4. **
|
|
214
|
-
5. **Report** — Output session start summary
|
|
214
|
+
4. **Report** — Output session start summary
|
|
215
215
|
|
|
216
216
|
**Circular optimization — init trace:**
|
|
217
217
|
```bash
|
|
@@ -286,7 +286,7 @@ Display the execution batch to user, then continue automatically.
|
|
|
286
286
|
3. DESIGN — outline approach before coding
|
|
287
287
|
4. STATE INTENT — "I will modify [files]. Risk: [what could break]"
|
|
288
288
|
5. IMPLEMENT in logical chunks
|
|
289
|
-
6. BUILD — build
|
|
289
|
+
6. BUILD — run the project's build step if the item changed what it builds
|
|
290
290
|
7. TEST — full test suite
|
|
291
291
|
8. CONFIRM — all pass -> DONE | fail -> investigate (15 min max) -> REVERT -> FAILED
|
|
292
292
|
```
|