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
|
@@ -11,7 +11,7 @@ Read state.md before any operation to load project context.
|
|
|
11
11
|
|
|
12
12
|
@~/.claude/pan-wizard-core/references/guardrails.md
|
|
13
13
|
|
|
14
|
-
> **Also see:** `~/.claude/pan-wizard-core/learnings/universal/` — AI-derived patterns from prior experiments. **Don't skim the whole folder.** Run `pan-tools learn topics-for --agent executor --token-budget 5000 --raw` to load
|
|
14
|
+
> **Also see:** `~/.claude/pan-wizard-core/learnings/universal/` — AI-derived patterns from prior experiments. **Don't skim the whole folder.** Run `pan-tools learn topics-for --agent executor --cue "<phase goal; the files it touches>" --token-budget 5000 --raw` to load the topics that match this task, within the budget; if none matches, it falls back to the topics tagged relevant for execution. Per P-RES-002 (distractor-density research), reading every topic degrades reasoning even at modest token counts. Files appear here over time as `pan-tools learn promote` adds findings.
|
|
15
15
|
</required_reading>
|
|
16
16
|
|
|
17
17
|
## Re-Read Checkpoints
|
|
@@ -20,7 +20,7 @@ Context compaction may have dropped earlier sections. Re-read the relevant secti
|
|
|
20
20
|
|
|
21
21
|
| Before this step | Re-read | Why |
|
|
22
22
|
|------------------|---------|-----|
|
|
23
|
-
| Spawning a subagent | This workflow's `<step name="
|
|
23
|
+
| Spawning a subagent | This workflow's `<step name="execute_waves">` block | Wave/segment routing is easy to misremember after compaction |
|
|
24
24
|
| Writing code in a plan | `references/tdd.md` + plan file | Conventions and the plan's tasks drift across long sessions |
|
|
25
25
|
| Committing | `references/guardrails.md` | Pre-commit shortcuts (silent model swaps, scope creep) are tempting under pressure |
|
|
26
26
|
| Marking phase complete | `workflows/verify-phase.md` | Completion criteria are easy to misremember |
|
|
@@ -34,12 +34,24 @@ Load all context in one call:
|
|
|
34
34
|
INIT=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs init execute-phase "${PHASE_ARG}")
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
Parse JSON for: `executor_model`, `verifier_model`, `reviewer_model`, `commit_docs`, `parallelization`, `branching_strategy`, `branch_name`, `phase_found`, `phase_dir`, `phase_number`, `phase_name`, `phase_slug`, `plans`, `incomplete_plans`, `plan_count`, `incomplete_count`, `state_exists`, `roadmap_exists`, `phase_req_ids`.
|
|
37
|
+
Parse JSON for: `executor_model`, `verifier_model`, `reviewer_model`, `commit_docs`, `parallelization`, `branching_strategy`, `branch_name`, `phase_found`, `phase_dir`, `phase_number`, `phase_name`, `phase_slug`, `plans`, `incomplete_plans`, `plan_count`, `incomplete_count`, `state_exists`, `roadmap_exists`, `phase_req_ids`, `verifier_enabled`, `plan_check`, `plan_drift`. In the shell steps below, `$PHASE_DIR` (and `$phase_dir`) is `phase_dir` and `$PHASE_NUMBER` is `phase_number`.
|
|
38
38
|
|
|
39
39
|
**If `phase_found` is false:** Error — phase directory not found.
|
|
40
40
|
**If `plan_count` is 0:** Error — no plans found in phase.
|
|
41
41
|
**If `state_exists` is false but `.planning/` exists:** Offer reconstruct or continue.
|
|
42
42
|
|
|
43
|
+
**The plans must be the plans that passed the plan check** (`plan_check.status`):
|
|
44
|
+
|
|
45
|
+
| Status | Action |
|
|
46
|
+
|---|---|
|
|
47
|
+
| `ok`, `disabled` | Continue |
|
|
48
|
+
| `legacy` | Continue, and say: "the plan check predates plan hashing, so it cannot show these plans are unchanged" |
|
|
49
|
+
| `stale` | Stop: "The plans changed after they passed the plan check. Re-plan with `/pan:plan-phase {N} --skip-research`, which checks the new plans." Continue only if the user gives a reason, and record it: `pan-tools optimize trace log --type decision --category plan_check_overridden --description "<reason>"` |
|
|
50
|
+
| `failed` | Stop: "The last plan check found issues." Same override |
|
|
51
|
+
| `missing` | Stop: "No plan check is recorded for this phase." This includes plans made with `/pan:plan-phase --skip-verify` or with `workflow.plan_check` off after the fact. Same override |
|
|
52
|
+
|
|
53
|
+
**Drift.** For each `plan_drift` entry, tell the executor of that plan, in its prompt, which of its `files_modified` changed since it was planned (`files`), so it re-reads them before editing. An entry with `error` means its `planned_commit` is unknown: say so and continue.
|
|
54
|
+
|
|
43
55
|
When `parallelization` is false, plans within a wave execute sequentially.
|
|
44
56
|
|
|
45
57
|
**Circular optimization — start trace session for this exec:**
|
|
@@ -49,6 +61,11 @@ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs optimize trace init \
|
|
|
49
61
|
--command "exec-phase" \
|
|
50
62
|
--phase "${PHASE_ARG}" 2>/dev/null || true
|
|
51
63
|
```
|
|
64
|
+
|
|
65
|
+
**The phase's roadmap slice** — what executing this phase needs from roadmap.md and requirements.md (a line per phase, this phase's section, its dependencies' goals, its requirement lines). Plans name it in their `<context>`; this writes it for plans made before it existed:
|
|
66
|
+
```bash
|
|
67
|
+
SLICE_PATH=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs roadmap slice "${phase_number}" --write --raw)
|
|
68
|
+
```
|
|
52
69
|
</step>
|
|
53
70
|
|
|
54
71
|
<step name="handle_branching">
|
|
@@ -70,42 +87,6 @@ From init JSON: `phase_dir`, `plan_count`, `incomplete_count`.
|
|
|
70
87
|
Report: "Found {plan_count} plans in {phase_dir} ({incomplete_count} incomplete)"
|
|
71
88
|
</step>
|
|
72
89
|
|
|
73
|
-
<step name="load_phase_memory">
|
|
74
|
-
**Load project memory before dispatching executors — prevents re-learning patterns already solved.**
|
|
75
|
-
|
|
76
|
-
```bash
|
|
77
|
-
ls .planning/memory/*.md 2>/dev/null
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
If `.planning/memory/` exists and contains `.md` files:
|
|
81
|
-
1. **Check the memory-load budget first** (ADR-0036 — keeps per-agent injection bounded as logs grow):
|
|
82
|
-
```bash
|
|
83
|
-
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs memory budget --raw
|
|
84
|
-
```
|
|
85
|
-
2. **Load, size-gated — whole-file is the default:**
|
|
86
|
-
- If `status` is `ok`: **read every file whole** (Read tool) and condense each entry to its rule(s) — 1–3 lines per file. This preserves the "apply every rule" contract for normal-sized logs.
|
|
87
|
-
- If `status` is `warning` or `critical` (a log has grown large): load a **cue-scoped** slice per agent instead of the whole log, using the phase objective + the files this phase touches as the cue:
|
|
88
|
-
```bash
|
|
89
|
-
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs memory select <agent> --cue "<phase objective; changed files>" --raw
|
|
90
|
-
```
|
|
91
|
-
Run once per agent that has a memory file. The returned `selected` entries are already recency-floored and token-budgeted (the newest lessons are always included). If `selected` is empty for an agent, **fall back to reading that file whole** — never silently drop an agent's memory.
|
|
92
|
-
3. Store the condensed rules as a `MEMORY_RULES` block for injection into executor prompts in execute_waves.
|
|
93
|
-
4. **Log memory priming to trace:**
|
|
94
|
-
```bash
|
|
95
|
-
MEMORY_COUNT=$(ls .planning/memory/*.md 2>/dev/null | wc -l | tr -d ' ')
|
|
96
|
-
if [ "$MEMORY_COUNT" -gt "0" ]; then
|
|
97
|
-
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs optimize trace log \
|
|
98
|
-
--type decision --category memory_primed \
|
|
99
|
-
--description "Loaded ${MEMORY_COUNT} memory entries before Wave 1 dispatch" \
|
|
100
|
-
--agent orchestrator --impact minor \
|
|
101
|
-
--context "{\"memory_count\":${MEMORY_COUNT}}" \
|
|
102
|
-
2>/dev/null || true
|
|
103
|
-
fi
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
If no memory files exist: skip (no trace event needed).
|
|
107
|
-
</step>
|
|
108
|
-
|
|
109
90
|
<step name="discover_and_group_plans">
|
|
110
91
|
Load plan inventory with wave grouping in one call:
|
|
111
92
|
|
|
@@ -115,7 +96,7 @@ PLAN_INDEX=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs phase-plan-index "
|
|
|
115
96
|
|
|
116
97
|
Parse JSON for: `phase`, `plans[]` (each with `id`, `wave`, `autonomous`, `objective`, `files_modified`, `task_count`, `has_summary`), `waves` (map of wave number → plan IDs), `incomplete`, `has_checkpoints`.
|
|
117
98
|
|
|
118
|
-
**Filtering:** Skip plans where `has_summary: true`. If `--gaps-only`: also skip
|
|
99
|
+
**Filtering:** Skip plans where `has_summary: true`. If `--gaps-only`: also skip plans whose frontmatter lacks `gap_closure: true` (`phase-plan-index` does not report it; `frontmatter get <plan> --field gap_closure` exits 1 when it is absent). If all filtered: "No matching incomplete plans" → exit.
|
|
119
100
|
|
|
120
101
|
**If `--gaps-only`:** this run is the fix round after a verification found gaps — a second attempt at work that failed once. Resolve the executor for that attempt and use it in place of `executor_model` for every spawn in this run:
|
|
121
102
|
|
|
@@ -197,10 +178,7 @@ Execute each wave in sequence. Within a wave: parallel if `PARALLELIZATION=true`
|
|
|
197
178
|
- .agents/skills/ (Project skills, if exists — list skills, read SKILL.md for each, follow relevant rules during implementation)
|
|
198
179
|
</files_to_read>
|
|
199
180
|
|
|
200
|
-
|
|
201
|
-
{MEMORY_RULES — insert condensed content of all .planning/memory/*.md files read in load_phase_memory step. If no memory files exist, omit this block entirely.}
|
|
202
|
-
Apply every rule in this block without exception. These are lessons from previous phases that the reviewer has already verified.
|
|
203
|
-
</project_memory>
|
|
181
|
+
If the plan's `<context>` names `@.planning/roadmap.md`, read `{slice_path}` in its place: it carries this phase's section, its dependencies' goals and its requirements, and the whole roadmap is the largest file in `.planning/` on a long project. Open the whole file only for something the slice leaves out.
|
|
204
182
|
|
|
205
183
|
<success_criteria>
|
|
206
184
|
- [ ] All tasks executed
|
|
@@ -224,6 +202,8 @@ Execute each wave in sequence. Within a wave: parallel if `PARALLELIZATION=true`
|
|
|
224
202
|
|
|
225
203
|
If ANY spot-check fails: report which plan failed, route to failure handler — ask "Retry plan?" or "Continue with remaining waves?"
|
|
226
204
|
|
|
205
|
+
**An executor that returned `## BLOCKED_SPEC_CONFLICT`** found a test it cannot satisfy without weakening it. It is not a failure to retry: show the user its Test, Requirement and Options and ask for a ruling. "Change the test" means a revised plan that declares the test file in `files_modified` (`/pan:plan-phase {N} --gaps` or an edit to the plan), then re-run that plan; "change the requirement" means updating the requirement and the plan. Never re-run the same plan unchanged: it would meet the same test. Declaring the file permits rewriting its expectations; deleting the test, skipping it or dropping assertions still fails `verify test-integrity`, so a ruling to do that also needs `phase complete --force --reason`.
|
|
206
|
+
|
|
227
207
|
If pass:
|
|
228
208
|
```
|
|
229
209
|
---
|
|
@@ -353,7 +333,7 @@ After all waves:
|
|
|
353
333
|
|
|
354
334
|
1. Record baseline test count:
|
|
355
335
|
```bash
|
|
356
|
-
TEST_BASELINE=$(npm test 2>&1 | grep -E "
|
|
336
|
+
TEST_BASELINE=$(npm test 2>&1 | grep -E "^(ℹ|#) tests" | awk '{print $NF}')
|
|
357
337
|
```
|
|
358
338
|
|
|
359
339
|
2. Invoke phase-tests workflow for the completed phase:
|
|
@@ -365,7 +345,8 @@ Read each summary.md to understand what was built.
|
|
|
365
345
|
Generate unit and integration tests for the new code.
|
|
366
346
|
Discover the project's existing test patterns, directories, frameworks, and helpers before writing tests.
|
|
367
347
|
Follow whatever conventions the project already uses.",
|
|
368
|
-
subagent_type="general-purpose"
|
|
348
|
+
subagent_type="general-purpose",
|
|
349
|
+
model="{executor_model}",
|
|
369
350
|
)
|
|
370
351
|
```
|
|
371
352
|
|
|
@@ -376,7 +357,7 @@ Alternatively, if the user's AI tool supports it, invoke the command directly:
|
|
|
376
357
|
|
|
377
358
|
3. Record new test count:
|
|
378
359
|
```bash
|
|
379
|
-
TEST_AFTER=$(npm test 2>&1 | grep -E "
|
|
360
|
+
TEST_AFTER=$(npm test 2>&1 | grep -E "^(ℹ|#) tests" | awk '{print $NF}')
|
|
380
361
|
```
|
|
381
362
|
|
|
382
363
|
4. Report:
|
|
@@ -387,6 +368,8 @@ TEST_AFTER=$(npm test 2>&1 | grep -E "^ℹ tests" | awk '{print $NF}')
|
|
|
387
368
|
- New tests: +$((TEST_AFTER - TEST_BASELINE))
|
|
388
369
|
```
|
|
389
370
|
|
|
371
|
+
`ℹ tests N` (spec reporter) and `# tests N` (TAP, Node's default for piped output before Node 23) are the summary lines of Node's built-in test runner, and both greps above match either. With any other runner both counts come back empty, so report the runner's own summary line instead of `+0`.
|
|
372
|
+
|
|
390
373
|
**If tests fail after generation:** Report failures but continue to next step. Test issues are caught by the verify-phase test gate.
|
|
391
374
|
</step>
|
|
392
375
|
|
|
@@ -399,11 +382,14 @@ TEST_AFTER=$(npm test 2>&1 | grep -E "^ℹ tests" | awk '{print $NF}')
|
|
|
399
382
|
```bash
|
|
400
383
|
# Read each summary.md and extract key-files.created + key-files.modified
|
|
401
384
|
for summary in "$PHASE_DIR"/*-summary.md; do
|
|
402
|
-
|
|
385
|
+
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs summary-extract "$summary" --fields key_files | node -e "let s='';process.stdin.on('data',d=>s+=d).on('end',()=>{const k=JSON.parse(s).key_files||{};for(const f of [...(k.created||[]),...(k.modified||[])])console.log(f)})"
|
|
403
386
|
done | sort -u > /tmp/review-files.txt
|
|
404
387
|
```
|
|
405
388
|
|
|
406
|
-
2.
|
|
389
|
+
2. Collect the reviewer's earlier open findings on this phase (empty on a first review), then spawn pan-reviewer:
|
|
390
|
+
```bash
|
|
391
|
+
OPEN_REVIEW_FINDINGS=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs findings list --phase "${PHASE_NUMBER}" --agent pan-reviewer --status open 2>/dev/null)
|
|
392
|
+
```
|
|
407
393
|
```
|
|
408
394
|
Task(
|
|
409
395
|
subagent_type="pan-reviewer",
|
|
@@ -425,6 +411,10 @@ Task(
|
|
|
425
411
|
Phase: ${PHASE_NUMBER} - ${PHASE_NAME}
|
|
426
412
|
Phase directory: ${phase_dir}
|
|
427
413
|
</context>
|
|
414
|
+
|
|
415
|
+
<open_findings>
|
|
416
|
+
${OPEN_REVIEW_FINDINGS}
|
|
417
|
+
</open_findings>
|
|
428
418
|
"
|
|
429
419
|
)
|
|
430
420
|
```
|
|
@@ -460,7 +450,7 @@ The fallback reads the word under `### Verdict` when the report carries no valid
|
|
|
460
450
|
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs findings dispose --phase "${PHASE_NUMBER}" --agent pan-reviewer --open --as deferred --reason "accepted at review: PASS_WITH_WARNINGS"
|
|
461
451
|
```
|
|
462
452
|
- **The user chooses "Continue anyway"** at `NEEDS_FIXES`: the same command with `--reason "continued past NEEDS_FIXES at the user's choice"`, then proceed to verification.
|
|
463
|
-
- **The user chooses "Fix before verification"**: apply the fixes, then run the review once more (steps 2–4). The
|
|
453
|
+
- **The user chooses "Fix before verification"**: apply the fixes, then run the review once more (steps 2–4). The re-review answers each earlier finding in its `resolutions`; the record closes the ones it answers `resolved` with evidence, and one it neither reports nor answers stays open.
|
|
464
454
|
|
|
465
455
|
5. **No separate trace logging.** The record logs `verdict_passed` or `verdict_failed` for the reviewer on every runtime. The `reviewer_correction` and `reviewer_warnings` trace calls that used to sit here read the error count from a shell variable nothing ever set.
|
|
466
456
|
|
|
@@ -525,8 +515,8 @@ fi
|
|
|
525
515
|
|
|
526
516
|
**2. Find parent UAT file:**
|
|
527
517
|
```bash
|
|
528
|
-
|
|
529
|
-
#
|
|
518
|
+
PARENT_DIR=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs find-phase "${PARENT_PHASE}" --raw)
|
|
519
|
+
# --raw prints the phase directory itself (empty when not found); find the UAT file in it
|
|
530
520
|
```
|
|
531
521
|
|
|
532
522
|
**If no parent UAT found:** Skip this step (gap-closure may have been triggered by verification.md instead).
|
|
@@ -556,21 +546,24 @@ mv .planning/debug/{slug}.md .planning/debug/resolved/
|
|
|
556
546
|
|
|
557
547
|
**6. Commit updated artifacts:**
|
|
558
548
|
```bash
|
|
559
|
-
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs commit "docs(phase-${PARENT_PHASE}): resolve UAT gaps and debug sessions after ${PHASE_NUMBER} gap closure" --files .planning/phases/*${PARENT_PHASE}*/*-uat.md .planning/debug/
|
|
549
|
+
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs commit "docs(phase-${PARENT_PHASE}): resolve UAT gaps and debug sessions after ${PHASE_NUMBER} gap closure" --files .planning/phases/*${PARENT_PHASE}*/*-uat.md .planning/debug/
|
|
560
550
|
```
|
|
561
551
|
</step>
|
|
562
552
|
|
|
563
553
|
<step name="verify_phase_goal">
|
|
564
554
|
Verify phase achieved its GOAL, not just completed tasks.
|
|
565
555
|
|
|
556
|
+
**If `verifier_enabled` is false** (`workflow.verifier: false`, set by `/pan:settings` or at project setup): skip this step. Say "verification skipped (workflow.verifier is off)" when you report the phase, and go to update_roadmap. `/pan:verify-phase {X}` still verifies on demand.
|
|
557
|
+
|
|
566
558
|
```
|
|
567
559
|
Task(
|
|
568
560
|
prompt="Verify phase {phase_number} goal achievement.
|
|
569
561
|
Phase directory: {phase_dir}
|
|
570
562
|
Phase goal: {goal from roadmap.md}
|
|
571
563
|
Phase requirement IDs: {phase_req_ids}
|
|
564
|
+
Roadmap slice: {slice_path} — this phase's section, its dependencies' goals and its requirement lines. Read it instead of roadmap.md and requirements.md.
|
|
572
565
|
Check must_haves against actual codebase.
|
|
573
|
-
Cross-reference requirement IDs from PLAN frontmatter against
|
|
566
|
+
Cross-reference requirement IDs from PLAN frontmatter against the slice's requirement lines — every ID MUST be accounted for.
|
|
574
567
|
Run the project's test suite as the test gate (the run_test_suite step of @~/.claude/pan-wizard-core/workflows/verify-phase.md) and record test_gate in the frontmatter.
|
|
575
568
|
Create verification.md.",
|
|
576
569
|
subagent_type="pan-verifier",
|
|
@@ -584,7 +577,7 @@ VERIF_FILE=$(ls "$PHASE_DIR"/*-verification.md 2>/dev/null | head -1)
|
|
|
584
577
|
VERIF_STATUS=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs findings record --phase "${PHASE_NUMBER}" --file "$VERIF_FILE" --raw 2>/dev/null) \
|
|
585
578
|
|| VERIF_STATUS=$(grep "^status:" "$VERIF_FILE" | cut -d: -f2 | tr -d ' ')
|
|
586
579
|
```
|
|
587
|
-
`findings record` reads the verdict from the verification frontmatter (`status`, `gaps`, `human_verification`, `unrequested`) and adds its findings to the ledger. A re-verification after a fix round is the next attempt: the gaps it
|
|
580
|
+
`findings record` reads the verdict from the verification frontmatter (`status`, `gaps`, `human_verification`, `unrequested`) and adds its findings to the ledger. A re-verification after a fix round is the next attempt: the gaps it lists under `re_verification.gaps_closed` are closed, a gap it neither reports nor answers stays open (listed in `unaddressed`), and the retry is logged. Recording the same file twice is a no-op, so verify-phase recording it too is safe. The grep fallback keeps the old reading when the record cannot parse the file.
|
|
588
581
|
|
|
589
582
|
**Trace logging happens in the record.** The record above logs the verification outcome (`verdict_passed`, `verdict_failed` or `verdict_needs_human`) here, after the verifier returns. That covers inline verification too, which is the reason P-1806 moved the trace call here (v3.7.8). No separate `optimize trace log` call is needed.
|
|
590
583
|
|
|
@@ -630,12 +623,26 @@ Gap closure cycle: `/pan:plan-phase {X} --gaps` reads verification.md → create
|
|
|
630
623
|
</step>
|
|
631
624
|
|
|
632
625
|
<step name="update_roadmap">
|
|
633
|
-
**Mark phase complete and update all tracking files
|
|
626
|
+
**Mark phase complete and update all tracking files.** `phase complete` runs the phase gate first, on every path (this step runs before `offer_next`, with or without `--no-transition`). The gate checks in code what this workflow used to ask for in prose: every plan has a summary, the verification passes (a failed test gate lowers it to gaps), human items have a recorded approval, the verification is fresh, reconcile finds no contradiction, no critical or high finding is left open, no stub was committed, and no test was weakened.
|
|
634
627
|
|
|
635
628
|
```bash
|
|
636
629
|
COMPLETION=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs phase complete "${PHASE_NUMBER}")
|
|
630
|
+
COMPLETION_EXIT=$?
|
|
637
631
|
```
|
|
638
632
|
|
|
633
|
+
| Result | Action |
|
|
634
|
+
|---|---|
|
|
635
|
+
| exit 1, `error: phase_gate_refused` (`workflow.phase_gate: enforce`) | The phase was NOT marked complete. Show each `gate.reasons` entry (`code`: `detail`) with its fix, and stop: no commit, no auto-advance. The user may complete anyway with a reason (below) |
|
|
636
|
+
| exit 0, `gate.ok` false (`warn`, the default) | The phase was marked complete. Show the reasons as warnings, run the rest of this step, and do NOT auto-advance (`offer_next` reads `GATE_OK`) |
|
|
637
|
+
| exit 0, `gate.ok` true | Continue |
|
|
638
|
+
|
|
639
|
+
**Completing past a refusal** is the user's decision, never yours, and needs their reason. It records a `decision` for every open finding the gate counted:
|
|
640
|
+
```bash
|
|
641
|
+
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs phase complete "${PHASE_NUMBER}" --force --reason "<the user's reason>"
|
|
642
|
+
```
|
|
643
|
+
|
|
644
|
+
Set `GATE_OK` to `gate.ok` from `COMPLETION` (`false` when the gate refused).
|
|
645
|
+
|
|
639
646
|
The CLI handles:
|
|
640
647
|
- Marking phase checkbox `[x]` with completion date
|
|
641
648
|
- Updating Progress table (Status → Complete, date)
|
|
@@ -665,18 +672,18 @@ The report files are appended to the completion commit's `--files` list (`$REPOR
|
|
|
665
672
|
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs commit "docs(phase-{X}): complete phase execution" --files .planning/roadmap.md .planning/state.md .planning/requirements.md {phase_dir}/*-verification.md $REPORT_FILES
|
|
666
673
|
```
|
|
667
674
|
|
|
668
|
-
|
|
669
|
-
```bash
|
|
670
|
-
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs optimize trace end 2>/dev/null || true
|
|
671
|
-
```
|
|
672
|
-
|
|
673
|
-
Log phase completion event:
|
|
675
|
+
Log phase completion event (before the session ends: `trace end` clears the active-session pointer, and a `trace log` after it lands in a separate day-scoped `sess_auto_*` session):
|
|
674
676
|
```bash
|
|
675
677
|
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs optimize trace log \
|
|
676
678
|
--type decision --category phase_complete \
|
|
677
|
-
--description "Phase ${PHASE_NUMBER} execution complete (${
|
|
679
|
+
--description "Phase ${PHASE_NUMBER} execution complete (${VERIF_STATUS:-verified})" \
|
|
678
680
|
--agent orchestrator --impact minor 2>/dev/null || true
|
|
679
681
|
```
|
|
682
|
+
|
|
683
|
+
**Circular optimization — finalize trace session:**
|
|
684
|
+
```bash
|
|
685
|
+
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs optimize trace end 2>/dev/null || true
|
|
686
|
+
```
|
|
680
687
|
</step>
|
|
681
688
|
|
|
682
689
|
<step name="offer_next">
|
|
@@ -690,14 +697,14 @@ Parse `--no-transition` flag from $ARGUMENTS.
|
|
|
690
697
|
**If `--no-transition` flag present:**
|
|
691
698
|
|
|
692
699
|
Execute-phase was spawned by plan-phase's auto-advance. Do NOT run transition.md.
|
|
693
|
-
|
|
700
|
+
If verification found gaps, or `GATE_OK` is false, return `## GAPS FOUND` with the phase, score and the gap summaries or the gate's reasons (plan-phase and discuss-phase stop the chain on it). After the gate passes, return completion status to parent:
|
|
694
701
|
|
|
695
702
|
```
|
|
696
703
|
## PHASE COMPLETE
|
|
697
704
|
|
|
698
705
|
Phase: ${PHASE_NUMBER} - ${PHASE_NAME}
|
|
699
706
|
Plans: ${completed_count}/${total_count}
|
|
700
|
-
Verification: {Passed |
|
|
707
|
+
Verification: {Passed | Skipped (workflow.verifier is off)}
|
|
701
708
|
|
|
702
709
|
[Include aggregate_results output]
|
|
703
710
|
```
|
|
@@ -706,37 +713,10 @@ STOP. Do not proceed to auto-advance or transition.
|
|
|
706
713
|
|
|
707
714
|
**If `--no-transition` flag is NOT present:**
|
|
708
715
|
|
|
709
|
-
**
|
|
710
|
-
|
|
711
|
-
If `workflow.verifier` is true in config, confirm the current phase has a passing verification:
|
|
712
|
-
|
|
713
|
-
```bash
|
|
714
|
-
VERIF=$(ls "$phase_dir"/*-verification.md 2>/dev/null | head -1)
|
|
715
|
-
VERIF_STATUS=""
|
|
716
|
-
if [ -n "$VERIF" ]; then
|
|
717
|
-
VERIF_STATUS=$(grep "^status:" "$VERIF" | awk '{print $2}')
|
|
718
|
-
fi
|
|
719
|
-
```
|
|
720
|
-
|
|
721
|
-
**Cross-check the written verdict against the mechanical signals (anti-rubber-stamp, ADR-0036).** The `status:` string above is authored by the verifier agent; `reconcile` re-derives the artifact/key-link checks from disk and exits non-zero when a claimed pass contradicts them:
|
|
722
|
-
```bash
|
|
723
|
-
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs verify reconcile "${PHASE_NUMBER}" --raw
|
|
724
|
-
RECONCILE_EXIT=$?
|
|
725
|
-
```
|
|
726
|
-
If `RECONCILE_EXIT` is non-zero:
|
|
727
|
-
```
|
|
728
|
-
⚠ Reconcile gate: Phase ${PHASE_NUMBER} verification says "passed" but the mechanical
|
|
729
|
-
checks disagree — artifacts fail substance checks or key-links are unwired.
|
|
730
|
-
This is a rubber-stamped verification. Do NOT auto-advance.
|
|
731
|
-
Re-run /pan:verify-phase and fix the failing artifacts/key-links.
|
|
732
|
-
```
|
|
733
|
-
STOP — do not auto-advance. Return to user.
|
|
734
|
-
|
|
735
|
-
If `VERIF_STATUS` is not `passed`:
|
|
716
|
+
**Gate check (before auto-advance).** The phase gate already ran inside `phase complete` (`update_roadmap`), and it covers the verification status, reconcile (anti-rubber-stamp, ADR-0036), freshness, open findings, stubs and test integrity. If `GATE_OK` is false:
|
|
736
717
|
```
|
|
737
|
-
⚠
|
|
738
|
-
|
|
739
|
-
Run /pan:verify-phase to verify this phase first.
|
|
718
|
+
⚠ Phase gate: Phase ${PHASE_NUMBER} may not advance — {each gate reason: code and detail}.
|
|
719
|
+
Fix the reasons (or close the gaps with /pan:plan-phase ${PHASE_NUMBER} --gaps), then re-run.
|
|
740
720
|
```
|
|
741
721
|
STOP — do not auto-advance. Return to user.
|
|
742
722
|
|
|
@@ -9,7 +9,7 @@ Read config.json for planning behavior settings.
|
|
|
9
9
|
@~/.claude/pan-wizard-core/references/git-integration.md
|
|
10
10
|
@~/.claude/pan-wizard-core/references/guardrails.md
|
|
11
11
|
|
|
12
|
-
> **Also see:** `~/.claude/pan-wizard-core/learnings/universal/` — AI-derived patterns from prior experiments. **Don't skim the whole folder.** Run `pan-tools learn topics-for --agent executor --token-budget 5000 --raw` to load
|
|
12
|
+
> **Also see:** `~/.claude/pan-wizard-core/learnings/universal/` — AI-derived patterns from prior experiments. **Don't skim the whole folder.** Run `pan-tools learn topics-for --agent executor --cue "<plan objective; the files it modifies>" --token-budget 5000 --raw` to load the topics that match this task, within the budget; if none matches, it falls back to the topics tagged relevant for execution. Per P-RES-002 (distractor-density research), reading every topic degrades reasoning even at modest token counts.
|
|
13
13
|
</required_reading>
|
|
14
14
|
|
|
15
15
|
## Re-Read Checkpoints
|
|
@@ -47,7 +47,8 @@ ls .planning/phases/XX-name/*-summary.md 2>/dev/null | sort
|
|
|
47
47
|
Find first PLAN without matching SUMMARY. Decimal phases supported (`01.1-hotfix/`):
|
|
48
48
|
|
|
49
49
|
```bash
|
|
50
|
-
PHASE=$(
|
|
50
|
+
PHASE=$(basename "$PLAN_PATH" | grep -oE '^[0-9]+(\.[0-9]+)?')
|
|
51
|
+
PLAN=$(basename "$PLAN_PATH" | grep -oE '^[0-9]+(\.[0-9]+)?-[0-9]+' | cut -d- -f2)
|
|
51
52
|
# config settings can be fetched via pan-tools config-get if needed
|
|
52
53
|
```
|
|
53
54
|
|
|
@@ -137,8 +138,8 @@ This IS the execution instructions. Follow exactly. If plan references context.m
|
|
|
137
138
|
|
|
138
139
|
<step name="previous_phase_check">
|
|
139
140
|
```bash
|
|
140
|
-
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs phases list --type summaries
|
|
141
|
-
# Extract the second-to-last summary from the JSON result
|
|
141
|
+
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs phases list --type summaries
|
|
142
|
+
# Extract the second-to-last summary from the JSON result's files[] (file names only, in phase order)
|
|
142
143
|
```
|
|
143
144
|
If previous SUMMARY has unresolved "Issues Encountered" or "Next Phase Readiness" blockers: AskUserQuestion(header="Previous Issues", options: "Proceed anyway" | "Address first" | "Review previous").
|
|
144
145
|
</step>
|
|
@@ -277,7 +278,7 @@ TASK_COMMITS+=("Task ${TASK_NUM}: ${TASK_COMMIT}")
|
|
|
277
278
|
<step name="checkpoint_protocol">
|
|
278
279
|
On `type="checkpoint:*"`: automate everything possible first. Checkpoints are for verification/decisions only.
|
|
279
280
|
|
|
280
|
-
Display: `CHECKPOINT: [Type]` box → Progress {X}/{Y} → Task name → type-specific content →
|
|
281
|
+
Display: `CHECKPOINT: [Type]` box → Progress {X}/{Y} → Task name → type-specific content → the action prompt line `→ [signal]`
|
|
281
282
|
|
|
282
283
|
| Type | Content | Resume signal |
|
|
283
284
|
|------|---------|---------------|
|
|
@@ -333,7 +334,7 @@ Create `{phase}-{plan}-summary.md` at `.planning/phases/XX-name/`. Use `~/.claud
|
|
|
333
334
|
|
|
334
335
|
**Frontmatter:** phase, plan, subsystem, tags | requires/provides/affects | tech-stack.added/patterns | key-files.created/modified | key-decisions | requirements-completed (**MUST** copy `requirements` array from plan.md frontmatter verbatim) | duration ($DURATION), completed ($PLAN_END_TIME date).
|
|
335
336
|
|
|
336
|
-
Title: `# Phase [X]
|
|
337
|
+
Title: `# Phase [X]: [Name] Summary` (the summary template's)
|
|
337
338
|
|
|
338
339
|
One-liner SUBSTANTIVE: "JWT auth with refresh rotation using jose library" not "Authentication implemented"
|
|
339
340
|
|
|
@@ -382,7 +383,7 @@ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs state record-session \
|
|
|
382
383
|
--resume-file "None"
|
|
383
384
|
```
|
|
384
385
|
|
|
385
|
-
Keep state.md under
|
|
386
|
+
Keep state.md under 100 lines (the state template's size constraint).
|
|
386
387
|
</step>
|
|
387
388
|
|
|
388
389
|
<step name="issues_review_gate">
|
|
@@ -11,13 +11,13 @@ Read all files referenced by the invoking prompt's execution_context before star
|
|
|
11
11
|
<step name="parse_args">
|
|
12
12
|
**Parse arguments:**
|
|
13
13
|
|
|
14
|
-
Check
|
|
14
|
+
Check which of `--repair`, `--standards`, `--full`, `--drift` and `--links` are present in the command arguments; `validate health` reads all five.
|
|
15
15
|
|
|
16
16
|
```
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
HEALTH_FLAGS=""
|
|
18
|
+
for flag in --repair --standards --full --drift --links; do
|
|
19
|
+
if arguments contain "$flag"; then HEALTH_FLAGS="$HEALTH_FLAGS $flag"; fi
|
|
20
|
+
done
|
|
21
21
|
```
|
|
22
22
|
</step>
|
|
23
23
|
|
|
@@ -25,7 +25,7 @@ fi
|
|
|
25
25
|
**Run health validation:**
|
|
26
26
|
|
|
27
27
|
```bash
|
|
28
|
-
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs validate health $
|
|
28
|
+
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs validate health $HEALTH_FLAGS
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
Parse JSON output:
|
|
@@ -84,7 +84,7 @@ Errors: N | Warnings: N | Info: N
|
|
|
84
84
|
```
|
|
85
85
|
## Errors
|
|
86
86
|
|
|
87
|
-
- [
|
|
87
|
+
- [E005] config.json: JSON parse error - <parser message>
|
|
88
88
|
Fix: Run /pan:health --repair to reset to defaults
|
|
89
89
|
|
|
90
90
|
- [E002] project.md not found
|
|
@@ -95,7 +95,7 @@ Errors: N | Warnings: N | Info: N
|
|
|
95
95
|
```
|
|
96
96
|
## Warnings
|
|
97
97
|
|
|
98
|
-
- [
|
|
98
|
+
- [W002] state.md references phase 5, but only phases 01, 02, 03 exist
|
|
99
99
|
Fix: Run /pan:health --repair to regenerate
|
|
100
100
|
|
|
101
101
|
- [W005] Phase directory "1-setup" doesn't follow NN-name format
|
|
@@ -165,8 +165,8 @@ Report final status.
|
|
|
165
165
|
| I003 | info | Focus-model or campaign tree — the phase-model checks do not apply | No |
|
|
166
166
|
| I004 | info | planning-with-files shares the tree — PAN leaves its files alone | No |
|
|
167
167
|
| I005 | info | The planning tree is gitignored while commit_docs is true — planning commits commit nothing | No |
|
|
168
|
-
| I006 | info | config.json holds keys PAN does not read (usually a typo); the fix names the nearest known key | No |
|
|
169
|
-
| STATE_REQ_DRIFT | warning | state.md complete but
|
|
168
|
+
| I006 | info | config.json holds keys PAN's code does not read (usually a typo); the fix names the nearest known key. It also lists `gates` and `safety` from templates/config.json: the `custom`-mode conditions in transition.md and execute-plan.md read `gates`; nothing reads `safety` (transition.md asks before skipping plans in every mode) | No |
|
|
169
|
+
| STATE_REQ_DRIFT | warning | state.md complete but requirements.md has unchecked boxes | Yes |
|
|
170
170
|
| STATE_ROADMAP_DRIFT | warning | state.md complete but roadmap.md has unchecked plan boxes | Yes |
|
|
171
171
|
| VERIFICATION_GATE_MISSING | warning | Phase has completed plans but no verification record | No |
|
|
172
172
|
|
|
@@ -176,7 +176,6 @@ Flag-gated codes:
|
|
|
176
176
|
|------|----------|------|-------------|------------|
|
|
177
177
|
| TESTS_FAIL | error | --full | Test run exited non-zero | No |
|
|
178
178
|
| BUILD_FAIL | error | --full | Build exited non-zero | No |
|
|
179
|
-
| MEM_BUDGET | warning / info | --full | Memory injection over budget | No |
|
|
180
179
|
| DRIFT_HIGH | warning | --drift | Drift verdict is high | No |
|
|
181
180
|
| DRIFT_MEDIUM | info | --drift | Drift verdict is medium | No |
|
|
182
181
|
| LINKS_ERR | warning | --links | Link graph has errors | No |
|
|
@@ -197,7 +196,9 @@ or behind the current position warns.
|
|
|
197
196
|
|--------|--------|------|
|
|
198
197
|
| createConfig | Create config.json with defaults | None |
|
|
199
198
|
| resetConfig | Delete + recreate config.json | Loses custom settings |
|
|
200
|
-
| regenerateState |
|
|
199
|
+
| regenerateState | Back up state.md to `state.md.bak-<timestamp>`, then create state.md from ROADMAP structure | Session history only in the backup |
|
|
200
|
+
| syncRequirements | Tick requirements.md boxes when state.md says every plan is done (STATE_REQ_DRIFT) | Edits requirements.md checkboxes |
|
|
201
|
+
| syncRoadmap | Tick roadmap.md plan boxes when state.md says every plan is done (STATE_ROADMAP_DRIFT) | Edits roadmap.md checkboxes |
|
|
201
202
|
|
|
202
203
|
**Not repairable (too risky):**
|
|
203
204
|
- project.md, roadmap.md content
|
|
@@ -119,7 +119,7 @@ The Focus workflow is a **scan → plan → exec → sync** pipeline. Each step
|
|
|
119
119
|
|
|
120
120
|
**Reality Score:** Every P3-P6 item gets scored: `RS = (User Value + Time Criticality + Risk Reduction) / Job Size`. Items below RS 3.0 get deferred, below 1.5 get dropped.
|
|
121
121
|
|
|
122
|
-
**Output:**
|
|
122
|
+
**Output:** the prioritized work list, returned by `pan-tools focus scan` as JSON (`/pan:focus-plan` collects the items again itself).
|
|
123
123
|
|
|
124
124
|
**Flags:**
|
|
125
125
|
- `--quick` — skip strategic analysis and validation phases
|
|
@@ -136,10 +136,10 @@ The Focus workflow is a **scan → plan → exec → sync** pipeline. Each step
|
|
|
136
136
|
**Modes:**
|
|
137
137
|
| Mode | Budget | Strategy |
|
|
138
138
|
|------|--------|----------|
|
|
139
|
-
| `bugfix` | 40 pts | P0→
|
|
139
|
+
| `bugfix` | 40 pts | One pass over P0→P4 in priority order, smallest first within a priority (P5–P6 excluded; no item-type filter) |
|
|
140
140
|
| `balanced` | 50 pts | 60% stability / 40% features (default) |
|
|
141
141
|
| `features` | 50 pts | 80% features, P0 crashes still mandatory |
|
|
142
|
-
| `full` | 60 pts |
|
|
142
|
+
| `full` | 60 pts | One pass over every priority in priority order (P0 first, smallest first within a priority) |
|
|
143
143
|
|
|
144
144
|
**Point system:** XS=1, S=2, M=4, L=10, XL=20 points.
|
|
145
145
|
|
|
@@ -183,8 +183,8 @@ The Focus workflow is a **scan → plan → exec → sync** pipeline. Each step
|
|
|
183
183
|
|
|
184
184
|
**Flags:**
|
|
185
185
|
- `--readme` — check README only
|
|
186
|
-
- `--
|
|
187
|
-
- `--
|
|
186
|
+
- `--docs` — verify documentation matches implementations
|
|
187
|
+
- `--arch` — verify architecture docs match actual structure
|
|
188
188
|
- `--all` — full sync + auto-fix
|
|
189
189
|
|
|
190
190
|
### Standalone: `/pan:focus-design <description>`
|
|
@@ -336,7 +336,7 @@ The Focus workflow is a **scan → plan → exec → sync** pipeline. Each step
|
|
|
336
336
|
|
|
337
337
|
**`/pan:new-project`** — One command: deep questioning → optional domain research (4 parallel agents) → requirements → roadmap. Creates `.planning/` with project.md, roadmap.md, state.md, config.json, requirements.md.
|
|
338
338
|
|
|
339
|
-
**`/pan:map-codebase`** — Analyze existing codebase before `/pan:new-project`. Creates `.planning/codebase/` with
|
|
339
|
+
**`/pan:map-codebase`** — Analyze existing codebase before `/pan:new-project`. Creates `.planning/codebase/` with its codebase documents (stack, architecture, structure, conventions, testing, integrations, concerns, relationships, best-practices).
|
|
340
340
|
|
|
341
341
|
**`/pan:discuss-phase <N>`** — Capture your vision for a phase before planning. Creates context.md.
|
|
342
342
|
|
|
@@ -394,7 +394,7 @@ The Focus workflow is a **scan → plan → exec → sync** pipeline. Each step
|
|
|
394
394
|
|
|
395
395
|
**Planning config** (`.planning/config.json`):
|
|
396
396
|
- `commit_docs: true` — commit planning artifacts to git (set `false` + add `.planning/` to `.gitignore` for private planning)
|
|
397
|
-
- `search_gitignored: false` — add `--no-ignore` to
|
|
397
|
+
- `search_gitignored: false` — reserved: read by `loadConfig` and reported by `init map-codebase`, but no workflow or agent acts on it (to search a gitignored `.planning/`, add `--no-ignore` to `rg` yourself)
|
|
398
398
|
|
|
399
399
|
---
|
|
400
400
|
|
|
@@ -409,10 +409,9 @@ The Focus workflow is a **scan → plan → exec → sync** pipeline. Each step
|
|
|
409
409
|
├── config.json # Workflow & gate configuration
|
|
410
410
|
├── focus/ # Focus batch files
|
|
411
411
|
│ └── batch-YYYY-MM-DD.json
|
|
412
|
-
├── superplan_*.md # Focus scan output
|
|
413
412
|
├── todos/
|
|
414
413
|
│ ├── pending/ # Todos waiting
|
|
415
|
-
│ └──
|
|
414
|
+
│ └── completed/ # Completed todos
|
|
416
415
|
├── debug/ # Active debug sessions
|
|
417
416
|
│ └── resolved/ # Archived resolved issues
|
|
418
417
|
├── milestones/ # Archived milestones
|
|
@@ -27,11 +27,13 @@ Use the most recent session unless `--session <id>` was specified.
|
|
|
27
27
|
|
|
28
28
|
If `--session <id>` was specified, use that session ID.
|
|
29
29
|
|
|
30
|
+
If `--experiment <slug>` was specified, set `EXP` to the harvest folder (the `harvest_path` `/pan:experiment harvest <slug>` printed, `<source-repo>/experiments/<slug>/` by default), add `--cwd "$EXP"` to every `pan-tools` call in this workflow, and read and write every `.planning/optimization/` path below under `$EXP/`.
|
|
31
|
+
|
|
30
32
|
## Step 2 — Generate local analysis
|
|
31
33
|
|
|
32
34
|
Run:
|
|
33
35
|
```
|
|
34
|
-
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs optimize learn [--session <id> | --sessions <n>]
|
|
36
|
+
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs optimize learn [--session <id> | --sessions <n>] # with no active session, pass --session <id> for the session Step 1 chose: a bare call errors "No trace session active"
|
|
35
37
|
```
|
|
36
38
|
|
|
37
39
|
This produces `.planning/optimization/reports/{session}-analysis.json`. With `--sessions <n>` it pools the last n sessions into `pooled-<n>-{session}-analysis.json`: a recommendation should explain failures that recur across runs, not one run's accident.
|
|
@@ -39,18 +41,18 @@ This produces `.planning/optimization/reports/{session}-analysis.json`. With `--
|
|
|
39
41
|
Read the output and note:
|
|
40
42
|
- `summary.errors` — how many error events
|
|
41
43
|
- `summary.gaps` — how many gap events
|
|
42
|
-
- `summary.memory_misses` — how many
|
|
44
|
+
- `summary.memory_misses` — how many times an agent logged missing knowledge (`memory_miss` events)
|
|
43
45
|
- `summary.wasted_tokens` — tokens wasted on redundancies
|
|
44
46
|
- `top_error_patterns` — most frequent error categories
|
|
45
47
|
- `top_tool_error_patterns` — failed tool calls captured from the subagents' own transcripts, ranked by how many spawns hit them
|
|
46
48
|
- `verdict_stats` — each judge's pass/fail counts, retries, and the retries that resolved a failure
|
|
47
|
-
- `top_memory_misses` — most
|
|
49
|
+
- `top_memory_misses` — the topics most often logged as missing
|
|
48
50
|
|
|
49
51
|
## Step 3 — Invoke pan-optimizer agent
|
|
50
52
|
|
|
51
53
|
Spawn the `pan-optimizer` agent with this instruction:
|
|
52
54
|
|
|
53
|
-
> Read the analysis at
|
|
55
|
+
> Read the analysis at `{analysis_path}` (the path `optimize learn` printed: `{session}-analysis.json`, or `pooled-<n>-{session}-analysis.json` with `--sessions`) and the raw trace at `.planning/optimization/traces/{session}/trace.jsonl`. Produce a full optimization report at `.planning/optimization/reports/{session}-opt-report.md` following the format in your agent definition.
|
|
54
56
|
|
|
55
57
|
Wait for the agent to complete. It will write the report to `.planning/optimization/reports/`.
|
|
56
58
|
|
|
@@ -61,9 +63,9 @@ Read `.planning/optimization/reports/{session}-opt-report.md`.
|
|
|
61
63
|
Present to the user:
|
|
62
64
|
1. **Score** — the circular optimization score (0–100)
|
|
63
65
|
2. **Top 3 findings** — the most impactful recommendations
|
|
64
|
-
3. **
|
|
65
|
-
4. **
|
|
66
|
-
5. **Next step** —
|
|
66
|
+
3. **Lessons** — how many, and where each belongs: the project's instructions (CLAUDE.md or AGENTS.md, outside PAN's section), a test, or a comment at the cited code
|
|
67
|
+
4. **Prompt and workflow changes** — how many, for human review
|
|
68
|
+
5. **Next step** — `/pan:optimize apply` records the suggestions in `.planning/optimization/suggestions.md`; a person makes the changes, because nothing in the report reaches an agent until it is written where the agents read
|
|
67
69
|
|
|
68
70
|
## Step 5 — Auto-apply (if --apply flag)
|
|
69
71
|
|
|
@@ -72,14 +74,14 @@ If the `--apply` flag was passed, immediately run:
|
|
|
72
74
|
node ~/.claude/pan-wizard-core/bin/pan-tools.cjs optimize apply
|
|
73
75
|
```
|
|
74
76
|
|
|
75
|
-
Show what was
|
|
77
|
+
Show what was recorded and where each suggestion belongs.
|
|
76
78
|
|
|
77
79
|
## Step 6 — Update the circular score baseline
|
|
78
80
|
|
|
79
81
|
After applying, tell the user what to watch in the next run:
|
|
80
|
-
- Which
|
|
81
|
-
- Which error patterns
|
|
82
|
-
- Prompt/workflow changes to consider
|
|
82
|
+
- Which lessons they wrote into the project's instructions, tests or code (the next trace should show fewer of those gaps and `memory_miss` events)
|
|
83
|
+
- Which error patterns a prompt or workflow change addressed
|
|
84
|
+
- Prompt/workflow changes still to consider
|
|
83
85
|
|
|
84
86
|
## Edge cases
|
|
85
87
|
|