pan-wizard 3.32.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 +18 -17
- 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 +16 -16
- package/agents/pan-executor.md +15 -11
- package/agents/pan-experiment-runner.md +15 -17
- package/agents/pan-hardener.md +15 -15
- package/agents/pan-integration-checker.md +2 -2
- package/agents/pan-knowledge.md +2 -2
- package/agents/pan-meta-reviewer.md +5 -5
- package/agents/pan-optimizer.md +40 -44
- package/agents/pan-phase-researcher.md +10 -10
- package/agents/pan-plan-checker.md +36 -30
- package/agents/pan-planner.md +77 -53
- package/agents/pan-previewer.md +1 -1
- package/agents/pan-project-researcher.md +21 -78
- 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 +20 -62
- package/agents/pan-verifier.md +53 -30
- package/bin/install-lib.cjs +228 -38
- package/bin/install.js +86 -15
- package/commands/pan/army.md +16 -12
- 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 +11 -10
- package/commands/pan/focus-auto.md +33 -27
- package/commands/pan/focus-design.md +9 -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 +7 -7
- package/commands/pan/focus-plan.md +12 -11
- package/commands/pan/focus-scan.md +7 -10
- 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 +5 -5
- package/commands/pan/mcp-bridge.md +18 -18
- package/commands/pan/milestone-done.md +7 -5
- 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 +4 -3
- package/commands/pan/plan-phase.md +9 -19
- package/commands/pan/preview.md +1 -1
- package/commands/pan/profile.md +4 -4
- 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 +14 -15
- package/commands/pan/resume.md +9 -11
- package/commands/pan/retro.md +5 -3
- package/commands/pan/review-deep.md +10 -10
- package/commands/pan/settings.md +1 -1
- package/commands/pan/todo-add.md +2 -2
- package/commands/pan/todo-check.md +2 -2
- 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-state-reinject.js +140 -15
- 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 +48 -7
- 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 +126 -5
- package/pan-wizard-core/bin/lib/config.cjs +112 -1
- package/pan-wizard-core/bin/lib/constants.cjs +29 -15
- package/pan-wizard-core/bin/lib/context-budget.cjs +12 -9
- package/pan-wizard-core/bin/lib/core.cjs +77 -23
- package/pan-wizard-core/bin/lib/cost-rebuild.cjs +13 -1
- package/pan-wizard-core/bin/lib/cost.cjs +149 -10
- 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 +15 -4
- 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 +12 -5
- 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 +67 -15
- package/pan-wizard-core/bin/lib/preview.cjs +3 -1
- package/pan-wizard-core/bin/lib/review-deep.cjs +2 -2
- 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 +47 -31
- package/pan-wizard-core/bin/lib/template.cjs +11 -4
- package/pan-wizard-core/bin/lib/verdict.cjs +54 -4
- package/pan-wizard-core/bin/lib/verify-drift.cjs +14 -5
- 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 +74 -4
- package/pan-wizard-core/bin/lib/verify.cjs +117 -35
- package/pan-wizard-core/bin/lib/whatif.cjs +5 -3
- package/pan-wizard-core/bin/pan-tools.cjs +111 -17
- package/pan-wizard-core/learnings/index.json +5 -5
- package/pan-wizard-core/mcp/server.cjs +18 -9
- package/pan-wizard-core/opencode/pan-wizard.js +111 -0
- package/pan-wizard-core/references/checkpoints.md +7 -5
- 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/verdict-contract.md +2 -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/discovery.md +1 -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 -18
- 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 +54 -4
- 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 +34 -60
- package/pan-wizard-core/workflows/execute-plan.md +8 -7
- package/pan-wizard-core/workflows/health.md +13 -11
- 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 +10 -10
- 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 +10 -8
- 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 +24 -17
- 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-agent-plugin.js +19 -5
- package/scripts/build-plugin.js +3 -1
- package/scripts/generate-skills-docs.py +13 -4
- package/scripts/test-surface.cjs +4 -0
|
@@ -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
|
|
@@ -32,7 +33,7 @@ allowed-tools:
|
|
|
32
33
|
|
|
33
34
|
- Building production user features. Use `/pan:new-project` and `/pan:exec-phase` directly.
|
|
34
35
|
- Validating a single-file change. The experiment loop is heavy — use `npm test` and `/pan:quick`.
|
|
35
|
-
- Inside the PAN source repo. The command **refuses** to scaffold experiments inside
|
|
36
|
+
- Inside the PAN source repo. The command **refuses** to scaffold experiments inside PAN's source repository, wherever it is cloned. The experiment root defaults to `~/pan-experiments/`.
|
|
36
37
|
|
|
37
38
|
---
|
|
38
39
|
|
|
@@ -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 }`.
|
|
@@ -208,7 +209,7 @@ pan-tools experiment manifest md-lint
|
|
|
208
209
|
|
|
209
210
|
## Safety guards
|
|
210
211
|
|
|
211
|
-
- **Never inside source repo.** `newExperiment` refuses to write
|
|
212
|
+
- **Never inside source repo.** `newExperiment` refuses to write inside PAN's source repository, wherever it is cloned. Mirrors `bin/install.js` `PAN_SOURCE_ROOT` guard.
|
|
212
213
|
- **No clobber.** Refuses to scaffold over an existing experiment folder of the same slug.
|
|
213
214
|
- **Slug validation.** Lowercase + digits + hyphens, max 40 chars. Rejects uppercase, spaces, special characters.
|
|
214
215
|
- **Idea path validation.** Errors if the `--idea` file doesn't exist.
|
|
@@ -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>
|
|
@@ -88,7 +90,8 @@ Wait for the user's reply before proceeding. Do not guess or pick a default cate
|
|
|
88
90
|
|
|
89
91
|
```
|
|
90
92
|
/pan:focus-auto [--source scan|backlog] [--category CAT] [--mode MODE] [--budget N]
|
|
91
|
-
[--max-cycles N] [--total-budget N] [--
|
|
93
|
+
[--max-cycles N] [--total-budget N] [--enforce-budget] [--verify-reserve F]
|
|
94
|
+
[--continue] [--stop] [--status]
|
|
92
95
|
[--dry-run] [--deep-review]
|
|
93
96
|
[--parallel-research] [--parallel-verify] [--clean-seal]
|
|
94
97
|
```
|
|
@@ -124,6 +127,7 @@ Wait for the user's reply before proceeding. Do not guess or pick a default cate
|
|
|
124
127
|
| optimize | P1-P4 | balanced | 50 |
|
|
125
128
|
| prompts | P0-P6 | balanced | 100 |
|
|
126
129
|
| security | P0-P2 | bugfix | 40 |
|
|
130
|
+
| distill | P1-P5 | balanced | 50 |
|
|
127
131
|
|
|
128
132
|
## Backlog source (`--source backlog`, ADR-0031)
|
|
129
133
|
|
|
@@ -131,7 +135,7 @@ When `--source backlog` is set, work is selected from the **curated planning sur
|
|
|
131
135
|
|
|
132
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.
|
|
133
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.
|
|
134
|
-
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.
|
|
135
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).
|
|
136
140
|
|
|
137
141
|
## Concurrency model (when `--parallel-research` / `--parallel-verify`, ADR-0031)
|
|
@@ -162,7 +166,8 @@ The proven shape is **parallel read-only research → exactly ONE serial impleme
|
|
|
162
166
|
- Skip to Phase 2 (Main Loop)
|
|
163
167
|
4. If no `--category` was provided, you already displayed the menu in FIRST ACTION above. Use SELECTED_CATEGORY from the user's reply.
|
|
164
168
|
5. Initialize new run using the category from step 4:
|
|
165
|
-
- Run `pan-tools focus auto --category <SELECTED_CATEGORY> [--mode MODE] [--budget N] [--max-cycles N] [--total-budget N] [--dry-run]
|
|
169
|
+
- Run `pan-tools focus auto --category <SELECTED_CATEGORY> [--source scan|backlog] [--mode MODE] [--budget N] [--max-cycles N] [--total-budget N] [--enforce-budget] [--verify-reserve F] [--deep-review] [--parallel-research] [--parallel-verify] [--clean-seal] [--dry-run]`,
|
|
170
|
+
passing on every one of these flags the user gave: the tooling reads each of them, and a flag left off here never takes effect
|
|
166
171
|
- If `--dry-run`: display the plan, STOP
|
|
167
172
|
- Record the run state
|
|
168
173
|
|
|
@@ -185,7 +190,7 @@ Phase 2 (each cycle): Scan → Plan → Exec → Commit is strictly sequential w
|
|
|
185
190
|
HARD STOP conditions:
|
|
186
191
|
- Phase 1 fails (tests broken): Do not enter main loop — report and exit
|
|
187
192
|
- Any cycle: test count drops below baseline after revert → stop campaign, preserve state
|
|
188
|
-
-
|
|
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
|
|
189
194
|
</phase_dependencies>
|
|
190
195
|
|
|
191
196
|
### Phase 2: Main Loop
|
|
@@ -241,7 +246,7 @@ For P3-P6 items, compute Reality Score: `RS = (UV + TC + RR) / JS`
|
|
|
241
246
|
- RS >= 3.0 = DO, RS 1.5-2.9 = DEFER, RS < 1.5 = BACKLOG
|
|
242
247
|
|
|
243
248
|
**2.1.4 Filter by Category**
|
|
244
|
-
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).
|
|
245
250
|
|
|
246
251
|
**2.1.5 Write Scan**
|
|
247
252
|
Write scan results to `.planning/focus/scan-<YYYY-MM-DD>-<category>.md` with:
|
|
@@ -256,10 +261,10 @@ Create a capacity-budgeted batch from the scan items found in Step 2.1.
|
|
|
256
261
|
**Capacity Points:** XS=1, S=2, M=4, L=10, XL=20
|
|
257
262
|
|
|
258
263
|
**Allocation by Mode:**
|
|
259
|
-
- `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).
|
|
260
265
|
- `balanced`: 60% stability (P0-P2), 40% features (P3-P6)
|
|
261
266
|
- `features`: P0 mandatory, then 80% on P3-P5, 20% on P1-P2 quick wins
|
|
262
|
-
- `full`:
|
|
267
|
+
- `full`: One pass over every priority in priority order (P0 first), smallest-first within each
|
|
263
268
|
|
|
264
269
|
**Execution Tiers:** XS/S = MICRO, M = STANDARD, L/XL = FULL
|
|
265
270
|
Select items fitting within the cycle's `budget_per_cycle`. Order: MICRO first, then STANDARD, then FULL.
|
|
@@ -351,8 +356,9 @@ Check the response for stop conditions:
|
|
|
351
356
|
- `zero_completed`: No items completed in this cycle — go to Phase 3
|
|
352
357
|
- `diminishing_returns`: Optimize only — cycle efficiency < 30% of previous cycle — go to Phase 3
|
|
353
358
|
- `prompts_complete`: Prompts only — all prompts in document executed — go to Phase 3
|
|
354
|
-
- `security_complete`: Security only —
|
|
355
|
-
- `
|
|
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
|
|
356
362
|
- `null`: Continue to next cycle
|
|
357
363
|
|
|
358
364
|
#### Step 2.5: Inter-Cycle Context Management
|
|
@@ -418,7 +424,7 @@ Then continue immediately to the next cycle (back to Step 2.1).
|
|
|
418
424
|
| Layer | Mechanism | Action |
|
|
419
425
|
|-------|-----------|--------|
|
|
420
426
|
| Per-cycle budget | `--budget N` per cycle | Limits single-cycle damage |
|
|
421
|
-
| Cumulative budget | `--total-budget N` |
|
|
427
|
+
| Cumulative budget | `--total-budget N` | Advisory by default (tracked and surfaced); stops the run only when enforced (`--enforce-budget` / config `budget.enforce`) |
|
|
422
428
|
| Verify reserve | `--verify-reserve F` | Holds back a budget fraction so the final re-verification isn't starved — stops new work early under enforcement (`budget_reserve_reached`) and spends the reserve on the clean re-verify in Phase 3 |
|
|
423
429
|
| Iteration limit | `--max-cycles N` | Hard stop on loop count |
|
|
424
430
|
| Regression circuit breaker | tests_after < tests_before | Immediate stop, status=stopped |
|
|
@@ -487,7 +493,7 @@ Alternative format — checklist style:
|
|
|
487
493
|
5. If tests pass: mark the prompt as complete (`- [x]`), commit, move to next prompt
|
|
488
494
|
6. If tests fail: one fix attempt, then revert and mark prompt as FAILED, move to next prompt
|
|
489
495
|
7. Each prompt = one batch item. Budget: 1 prompt per cycle unless prompt is trivial (XS)
|
|
490
|
-
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
|
|
491
497
|
|
|
492
498
|
**Key rules:**
|
|
493
499
|
- Execute prompts in document order — NEVER skip ahead or reorder
|
|
@@ -524,7 +530,7 @@ When a specification document is found that doesn't have a matching micro-prompt
|
|
|
524
530
|
|
|
525
531
|
## Security Category — Execution Details
|
|
526
532
|
|
|
527
|
-
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.
|
|
528
534
|
|
|
529
535
|
### Scan approach (Step 2.1)
|
|
530
536
|
|
|
@@ -534,12 +540,12 @@ Three passes per cycle:
|
|
|
534
540
|
|
|
535
541
|
| OWASP | Grep pattern | Priority |
|
|
536
542
|
|-------|-------------|---------|
|
|
537
|
-
|
|
|
538
|
-
|
|
|
543
|
+
| A05 Injection | `eval(`, `execSync(`, `` `SELECT.*\${ ``, `child_process.exec(` | P0 |
|
|
544
|
+
| A04 Crypto | `createHash\(['"]md5\|sha1`, `Math\.random\(\)` near auth/token | P0 |
|
|
539
545
|
| A01 Access | Route without auth middleware, IDOR (raw `req.params.id` to DB) | P1 |
|
|
540
|
-
|
|
|
546
|
+
| A02 Misconfig | `origin:\s*['"]?\*`, `Access-Control-Allow-Origin: \*`, stack in response | P1 |
|
|
541
547
|
| A07 Auth | No session expiry, credentials in URL params | P1 |
|
|
542
|
-
|
|
|
548
|
+
| A06 Design | Missing rate-limit on auth/payment endpoints | P2 |
|
|
543
549
|
| A09 Logging | Security events (`login`, `payment`, `admin`) with no log call nearby | P2 |
|
|
544
550
|
|
|
545
551
|
**Pass 2 — Structural check (always runs):**
|
|
@@ -548,7 +554,7 @@ Three passes per cycle:
|
|
|
548
554
|
- Check for prototype pollution risk: `Object.assign(req.body)` or spread from untrusted input into a stored object
|
|
549
555
|
|
|
550
556
|
**Pass 3 — Semantic depth (Agent tool, for M/L items only):**
|
|
551
|
-
When a pattern match needs code-path confirmation, spawn
|
|
557
|
+
When a pattern match needs code-path confirmation, spawn the `pan-hardener` subagent:
|
|
552
558
|
> "Read [file]. Confirm whether [line N] is reachable from an unauthenticated request path and whether the input is sanitized before use."
|
|
553
559
|
|
|
554
560
|
Use the confirmation to decide whether to include the item at P0/P1 or drop it as a false positive.
|
|
@@ -578,9 +584,9 @@ Treat each security item as a STANDARD or FULL item regardless of effort estimat
|
|
|
578
584
|
|
|
579
585
|
### Stop condition
|
|
580
586
|
|
|
581
|
-
`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.
|
|
582
588
|
|
|
583
|
-
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.
|
|
584
590
|
|
|
585
591
|
---
|
|
586
592
|
|
|
@@ -596,7 +602,7 @@ The `distill` category targets **AI-generated code bloat** with a 5-pass pipelin
|
|
|
596
602
|
| 2 | **AST-style analysis** — single-instance factories, deep nesting | Free | review |
|
|
597
603
|
| 3 | **Cross-file graph** — repeated 5+ line blocks, unreferenced exports | Free | review |
|
|
598
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 |
|
|
599
|
-
| 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 |
|
|
600
606
|
|
|
601
607
|
### Safety Tiers
|
|
602
608
|
|
|
@@ -620,7 +626,7 @@ Default threshold: **2.0x**. If a cycle's ratio exceeds threshold, the bloat bud
|
|
|
620
626
|
|
|
621
627
|
### Stop condition
|
|
622
628
|
|
|
623
|
-
`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.
|
|
624
630
|
|
|
625
631
|
### CLI
|
|
626
632
|
|
|
@@ -630,7 +636,7 @@ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs distill analyze [--touched-loc
|
|
|
630
636
|
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs distill report
|
|
631
637
|
```
|
|
632
638
|
|
|
633
|
-
`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.
|
|
634
640
|
|
|
635
641
|
<failure_pattern_capture>
|
|
636
642
|
When the same failure pattern appears in 2+ items within a campaign, capture it for future runs.
|
|
@@ -669,7 +675,7 @@ This prevents the campaign from burning budget on items that will predictably fa
|
|
|
669
675
|
- Continue after a test regression — a test count decrease means code was broken; continuing compounds the damage
|
|
670
676
|
- Expand scope beyond what the scan found — scope creep in an autonomous loop compounds unpredictably across cycles
|
|
671
677
|
- Run more cycles than --max-cycles — the limit exists to cap total cost and prevent runaway loops
|
|
672
|
-
- Spend more points than --total-budget
|
|
678
|
+
- Spend more points than --total-budget when the budget is enforced (`--enforce-budget` or config `budget.enforce: true`) — the enforced cap is the user's cost control mechanism
|
|
673
679
|
- Skip recording cycle results via --update — unrecorded cycles break resume, status, and stop-condition checks
|
|
674
680
|
- Change test expectations to match broken code — this hides bugs instead of fixing them
|
|
675
681
|
- Use `git add -A` or `git add .` — bulk staging can accidentally commit secrets, build artifacts, or unrelated changes
|
|
@@ -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.
|
|
@@ -1073,6 +1074,8 @@ Output a complete summary with:
|
|
|
1073
1074
|
|
|
1074
1075
|
## NEVER DO
|
|
1075
1076
|
|
|
1077
|
+
These rules and ALWAYS DO below apply to the phases your mode actually runs. Anything the Mode + Phase Matrix or a modifier skips (a whole phase, or the parts a lite phase leaves out) is not a violation.
|
|
1078
|
+
|
|
1076
1079
|
- Design without proving the problem exists (Phase 0 demand evidence is mandatory)
|
|
1077
1080
|
- Skip competitive research — must be best-of-breed
|
|
1078
1081
|
- Copy a tool's design without understanding WHY they made that choice
|
|
@@ -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
|