pan-wizard 2.9.0 → 2.9.1
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 +1 -1
- package/commands/pan/assumptions.md +38 -3
- package/commands/pan/audit-deployment.md +6 -0
- package/commands/pan/debug.md +71 -2
- package/commands/pan/exec-phase.md +90 -0
- package/commands/pan/focus-auto.md +181 -18
- package/commands/pan/focus-design.md +67 -2
- package/commands/pan/focus-exec.md +168 -46
- package/commands/pan/focus-scan.md +17 -5
- package/commands/pan/map-codebase.md +32 -6
- package/commands/pan/milestone-audit.md +23 -0
- package/commands/pan/new-project.md +64 -0
- package/commands/pan/pause.md +42 -1
- package/commands/pan/plan-phase.md +84 -0
- package/commands/pan/quick.md +15 -0
- package/commands/pan/resume.md +62 -2
- package/commands/pan/verify-phase.md +42 -0
- package/package.json +1 -1
- package/pan-wizard-core/bin/lib/constants.cjs +3 -1
- package/pan-wizard-core/bin/lib/focus.cjs +5 -0
- package/scripts/generate-skills-docs.py +560 -0
|
@@ -18,6 +18,18 @@ Execute items from the current focus batch with capacity-based sizing, full sess
|
|
|
18
18
|
|
|
19
19
|
**Goal:** One-command pipeline that starts a session, loads the planned batch, implements items with tier-based execution protocols, verifies the work, syncs documentation, and closes the session cleanly.
|
|
20
20
|
|
|
21
|
+
<completion_contract>
|
|
22
|
+
Execution is complete when ALL conditions are met:
|
|
23
|
+
1. All batch items processed (each marked DONE or FAILED with reason)
|
|
24
|
+
2. Full test suite passes with count >= Stage 1 baseline
|
|
25
|
+
3. Stage 6 pre-commit checklist passes (all 6 checks)
|
|
26
|
+
4. Commit created listing only VERIFIED items
|
|
27
|
+
5. Session recorded with before/after test counts and budget usage
|
|
28
|
+
6. Active scan file updated with item statuses
|
|
29
|
+
|
|
30
|
+
Execution FAILS if: test baseline cannot be established (Stage 1), or test count drops below baseline after all reverts.
|
|
31
|
+
</completion_contract>
|
|
32
|
+
|
|
21
33
|
---
|
|
22
34
|
|
|
23
35
|
## Pipeline Overview
|
|
@@ -46,13 +58,33 @@ Execute items from the current focus batch with capacity-based sizing, full sess
|
|
|
46
58
|
- Commit, record session, generate summary
|
|
47
59
|
```
|
|
48
60
|
|
|
61
|
+
<action_gating>
|
|
62
|
+
Each stage has a restricted set of appropriate actions. Using the wrong tool at the wrong stage causes regressions.
|
|
63
|
+
|
|
64
|
+
| Stage | Read | Grep/Glob | Edit/Write | Bash (tests) | Bash (git) |
|
|
65
|
+
|-------|------|-----------|------------|--------------|------------|
|
|
66
|
+
| 1. Session Start | YES | YES | NO | YES | YES |
|
|
67
|
+
| 2. Batch Loading | YES | YES | NO | NO | NO |
|
|
68
|
+
| 3. Execution | YES | YES | YES | YES | NO |
|
|
69
|
+
| 4. Verification | YES | YES | NO | YES | NO |
|
|
70
|
+
| 5. Doc Sync | YES | YES | YES | NO | NO |
|
|
71
|
+
| 6. Session End | YES | NO | YES | NO | YES |
|
|
72
|
+
|
|
73
|
+
**Key constraints:**
|
|
74
|
+
- Stage 1: NO Edit/Write — you are establishing baseline, not changing code
|
|
75
|
+
- Stage 2: Read-only — validating the batch, not modifying anything
|
|
76
|
+
- Stage 4: NO Edit/Write — you are verifying work, not doing more work. If tests fail, go back to Stage 3 to fix.
|
|
77
|
+
- Stage 5: Edit docs only — no code changes during doc sync
|
|
78
|
+
- Stage 6: Git operations + session recording only — all work must be done
|
|
79
|
+
</action_gating>
|
|
80
|
+
|
|
49
81
|
---
|
|
50
82
|
|
|
51
|
-
##
|
|
83
|
+
## Project Scope Boundary
|
|
52
84
|
|
|
53
|
-
This command executes work on the **host project's source code** —
|
|
85
|
+
This command executes work on the **host project's source code** — not on PAN Wizard's own infrastructure.
|
|
54
86
|
|
|
55
|
-
**
|
|
87
|
+
**Do not read, modify, or fix files in these PAN directories:**
|
|
56
88
|
- `.claude/`, `.github/copilot-instructions.md`, `.opencode/`, `.gemini/`, `.codex/` — PAN runtime directories
|
|
57
89
|
- Any `pan-wizard-core/`, `pan-tools`, agent `.md`, or command `.md` files within PAN runtime directories
|
|
58
90
|
|
|
@@ -60,9 +92,22 @@ This command executes work on the **host project's source code** — NOT on PAN
|
|
|
60
92
|
|
|
61
93
|
---
|
|
62
94
|
|
|
63
|
-
##
|
|
95
|
+
## Execute All Stages Sequentially
|
|
96
|
+
|
|
97
|
+
When `/pan:focus-exec` is invoked, run all 6 stages in order. Do not skip stages or stop between them unless tests regress.
|
|
98
|
+
|
|
99
|
+
<stage_dependencies>
|
|
100
|
+
Stage 1 → Stage 2: Baseline MUST exist before batch loads (regression detection requires it)
|
|
101
|
+
Stage 2 → Stage 3: Batch MUST be validated before execution begins (prevents working on stale/empty batches)
|
|
102
|
+
Stage 3 → Stage 4: All items MUST be processed before verification (partial verification produces false confidence)
|
|
103
|
+
Stage 4 → Stage 5: Tests MUST pass before doc sync (don't document broken code)
|
|
104
|
+
Stage 5 → Stage 6: Docs MUST be updated before commit (commit captures the complete state)
|
|
64
105
|
|
|
65
|
-
|
|
106
|
+
HARD STOP conditions (do not proceed to next stage):
|
|
107
|
+
- Stage 1: Test suite fails → fix tests before proceeding
|
|
108
|
+
- Stage 2: No batch file found → tell user to run /pan:focus-plan
|
|
109
|
+
- Stage 4: Test count below baseline → revert last changes, re-verify
|
|
110
|
+
</stage_dependencies>
|
|
66
111
|
|
|
67
112
|
**Flags:**
|
|
68
113
|
- `--budget N` — Override capacity budget in points (default: 50, min: 5, max: 100)
|
|
@@ -86,34 +131,54 @@ When `/pan:focus-exec` is invoked, run ALL 6 stages in order. Do NOT skip stages
|
|
|
86
131
|
|
|
87
132
|
---
|
|
88
133
|
|
|
89
|
-
## AI Behavioral Rules
|
|
134
|
+
## AI Behavioral Rules
|
|
90
135
|
|
|
91
|
-
### Rule 1: Read Before You Write
|
|
92
|
-
Before changing
|
|
136
|
+
### Rule 1: Read Before You Write
|
|
137
|
+
Before changing any file, read it first. Understand context, callers, and invariants.
|
|
93
138
|
|
|
94
|
-
|
|
95
|
-
|
|
139
|
+
**Violation example:**
|
|
140
|
+
```
|
|
141
|
+
BAD: Rename parameter `opts` → `options` in utils.cjs without reading callers
|
|
142
|
+
→ 3 callers in api.cjs, workers.cjs break silently
|
|
143
|
+
GOOD: Grep for "utils\." → read all 3 callers → confirm param name is safe to change → edit
|
|
144
|
+
```
|
|
96
145
|
|
|
97
|
-
### Rule
|
|
146
|
+
### Rule 2: Understand the Root Cause
|
|
147
|
+
Do not apply surface-level patches. Trace the code path, identify the actual defect.
|
|
148
|
+
|
|
149
|
+
**Violation example:**
|
|
150
|
+
```
|
|
151
|
+
BAD: Test fails with "Cannot read property 'name' of undefined"
|
|
152
|
+
→ Add `if (!obj) return null` at the crash site
|
|
153
|
+
→ Root cause: caller passes wrong argument order — still broken
|
|
154
|
+
GOOD: Trace the call chain → find caller passes (id, name) but function expects (name, id) → fix caller
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Rule 3: One Change, One Test
|
|
98
158
|
Every code change must be tested before moving to the next item.
|
|
99
159
|
|
|
100
160
|
Test cadence by tier:
|
|
101
161
|
- **MICRO (XS/S):** Run specific test after implementing. Batch up to 3 independent items before smoke.
|
|
102
|
-
- **STANDARD (M):** Full test suite after
|
|
103
|
-
- **FULL (L/XL):** Build hooks + full test suite after
|
|
104
|
-
|
|
105
|
-
### Rule 4: Don't Invent — Follow the Plan
|
|
106
|
-
Implement exactly what the batch says.
|
|
107
|
-
|
|
108
|
-
|
|
162
|
+
- **STANDARD (M):** Full test suite after each item.
|
|
163
|
+
- **FULL (L/XL):** Build hooks + full test suite after each item.
|
|
164
|
+
|
|
165
|
+
### Rule 4: Don't Invent — Follow the Plan
|
|
166
|
+
Implement exactly what the batch says. Do not:
|
|
167
|
+
- Add features not in the batch item
|
|
168
|
+
- Refactor surrounding code that isn't broken
|
|
169
|
+
- Add comments or docstrings to unchanged files
|
|
170
|
+
- Create abstractions for one-time operations
|
|
171
|
+
- Add error handling for scenarios that cannot happen
|
|
172
|
+
|
|
173
|
+
### Rule 5: Cross-Platform Awareness
|
|
109
174
|
- Use platform-agnostic path APIs (no hardcoded separators)
|
|
110
175
|
- Follow the project's module format conventions (discover from existing code)
|
|
111
176
|
- Use file-based input for shell-sensitive content when needed
|
|
112
177
|
|
|
113
|
-
### Rule 6: Revert Fast, Don't Dig Deep
|
|
178
|
+
### Rule 6: Revert Fast, Don't Dig Deep
|
|
114
179
|
If a fix doesn't work within 5 minutes, revert and move on. Failed items carry forward.
|
|
115
180
|
|
|
116
|
-
### Rule 7: Verify Understanding Before
|
|
181
|
+
### Rule 7: Verify Understanding Before Coding
|
|
117
182
|
For M/L/XL items, state your understanding before writing code:
|
|
118
183
|
```
|
|
119
184
|
Item P2-3 — Add tests for billing module
|
|
@@ -123,11 +188,19 @@ Files: billing.ts, tests/billing.test.ts
|
|
|
123
188
|
Confidence: HIGH
|
|
124
189
|
```
|
|
125
190
|
|
|
126
|
-
### Rule 8: Preserve Existing Test Expectations
|
|
191
|
+
### Rule 8: Preserve Existing Test Expectations
|
|
127
192
|
Never change an existing test's expected output to match broken code.
|
|
128
193
|
|
|
129
|
-
### Rule 9: Commit Messages Must Be Accurate
|
|
130
|
-
List
|
|
194
|
+
### Rule 9: Commit Messages Must Be Accurate
|
|
195
|
+
List only items that are verified (passed tests). Include actual test counts.
|
|
196
|
+
|
|
197
|
+
### Rule 10: Vary Approach for Similar Items
|
|
198
|
+
When a batch contains 3+ items of the same type (e.g., "add null check to X", "add null check to Y"), deliberately vary your approach to avoid tunnel vision:
|
|
199
|
+
- Item 1: Fix as planned
|
|
200
|
+
- Item 2: Before fixing, re-read the module's error handling pattern — does the same fix apply or does this module handle errors differently?
|
|
201
|
+
- Item 3+: Check if the first fixes introduced a pattern that should be extracted (shared helper) or if each case is genuinely independent
|
|
202
|
+
|
|
203
|
+
This catches emergent interactions: 5 "add try-catch" fixes might reveal the module needs a centralized error boundary, not 5 scattered try-catches.
|
|
131
204
|
|
|
132
205
|
---
|
|
133
206
|
|
|
@@ -185,9 +258,10 @@ Display the execution batch to user, then continue automatically.
|
|
|
185
258
|
```
|
|
186
259
|
1. STATE UNDERSTANDING (Rule 7)
|
|
187
260
|
2. READ target files + test files
|
|
188
|
-
3.
|
|
189
|
-
4.
|
|
190
|
-
5.
|
|
261
|
+
3. STATE INTENT — "I will modify [files], adding [what], to achieve [goal]"
|
|
262
|
+
4. IMPLEMENT across necessary files
|
|
263
|
+
5. TEST — full test suite
|
|
264
|
+
6. CONFIRM — pass -> DONE | regresses -> REVERT -> FAILED
|
|
191
265
|
```
|
|
192
266
|
|
|
193
267
|
#### FULL Items (L/XL)
|
|
@@ -195,20 +269,55 @@ Display the execution batch to user, then continue automatically.
|
|
|
195
269
|
1. STATE UNDERSTANDING (detailed)
|
|
196
270
|
2. READ WIDELY — target files, callers, tests, related code
|
|
197
271
|
3. DESIGN — outline approach before coding
|
|
198
|
-
4.
|
|
199
|
-
5.
|
|
200
|
-
6.
|
|
201
|
-
7.
|
|
272
|
+
4. STATE INTENT — "I will modify [files]. Risk: [what could break]"
|
|
273
|
+
5. IMPLEMENT in logical chunks
|
|
274
|
+
6. BUILD — build hooks if hooks changed
|
|
275
|
+
7. TEST — full test suite
|
|
276
|
+
8. CONFIRM — all pass -> DONE | fail -> investigate (15 min max) -> REVERT -> FAILED
|
|
202
277
|
```
|
|
203
278
|
|
|
204
279
|
### 3.2 Failure Handling
|
|
205
|
-
- Build breaks: fix typo or revert (5 min limit)
|
|
206
|
-
- Test regression: identify cause, one fix attempt, else revert
|
|
207
|
-
- **Never let a failed item block other items**
|
|
208
280
|
|
|
209
|
-
|
|
281
|
+
Classify every error before acting. The classification determines the recovery protocol.
|
|
282
|
+
|
|
283
|
+
**RECOVERABLE (retry with analysis, max 3 attempts):**
|
|
284
|
+
- Test failure after code change — read the error output, fix the root cause, re-test
|
|
285
|
+
- File not found — search for moved/renamed paths via Grep/Glob
|
|
286
|
+
- Build failure from syntax error — fix the typo, rebuild
|
|
287
|
+
- Merge conflict in a non-critical file — attempt auto-resolution
|
|
288
|
+
|
|
289
|
+
**UNRECOVERABLE (halt the item, mark FAILED, move to next):**
|
|
290
|
+
- Same test failure persists after 3 fix attempts — revert all changes for this item
|
|
291
|
+
- Permission or auth error on a critical path — cannot proceed without user action
|
|
292
|
+
- State corruption (malformed JSON in planning files) — stop, report to user
|
|
293
|
+
- Persistent build failure unrelated to current item — stop execution, report
|
|
294
|
+
- Test regression in unrelated code — revert, flag for investigation
|
|
295
|
+
|
|
296
|
+
**Never let a failed item block other items.** Mark it FAILED with the error classification and move on.
|
|
297
|
+
|
|
298
|
+
### 3.3 Failure Pattern Detection
|
|
299
|
+
When marking an item FAILED, check if its error matches a previous failure in this batch:
|
|
300
|
+
- Same error type or root cause category
|
|
301
|
+
- Same file or module involved
|
|
302
|
+
|
|
303
|
+
If a pattern repeats (2+ items fail the same way), log it in the session record:
|
|
304
|
+
```
|
|
305
|
+
FAILURE PATTERN: {description} — Items {ID1}, {ID2} — Root cause: {cause}
|
|
306
|
+
Suggested avoidance: {what to check before similar items}
|
|
307
|
+
```
|
|
308
|
+
Before executing remaining items, check if they match the pattern. If so, skip with reason "matches known failure pattern" rather than burning budget on predictable failures.
|
|
309
|
+
|
|
310
|
+
### 3.4 Progress Tracking
|
|
210
311
|
Update progress tracker after each item with status and budget tracking.
|
|
211
312
|
|
|
313
|
+
**Attention anchor — emit after each item completes:**
|
|
314
|
+
```
|
|
315
|
+
Item {N}/{total} {DONE|FAILED} | Budget: {used}/{budget} pts | Tests: {baseline} → {current}
|
|
316
|
+
Remaining: {count} items [{IDs with sizes}]
|
|
317
|
+
Next: {next item ID} — {title} ({tier})
|
|
318
|
+
```
|
|
319
|
+
This prevents lost-in-the-middle drift in large batches where the agent forgets budget limits or remaining items.
|
|
320
|
+
|
|
212
321
|
---
|
|
213
322
|
|
|
214
323
|
## Stage 4: Verification
|
|
@@ -254,17 +363,30 @@ Edit the active scan file:
|
|
|
254
363
|
|
|
255
364
|
## Stage 6: Session End
|
|
256
365
|
|
|
257
|
-
### 6.1 Commit
|
|
366
|
+
### 6.1 Pre-Commit Verification Checklist
|
|
367
|
+
|
|
368
|
+
Before committing, run through ALL checks. Do not commit until every check passes.
|
|
369
|
+
|
|
370
|
+
1. Every modified file was read before editing (no blind writes)
|
|
371
|
+
2. `git diff --stat` contains only files related to batch items (no stray changes)
|
|
372
|
+
3. Full test suite passes — count matches or exceeds baseline from Stage 1
|
|
373
|
+
4. No `TODO`, `FIXME`, or `HACK` introduced without a matching batch item tracking it
|
|
374
|
+
5. Commit message lists only items that are VERIFIED (tests ran, tests passed)
|
|
375
|
+
6. No secrets, credentials, or `.env` files staged
|
|
376
|
+
|
|
377
|
+
If any check fails: fix the issue and re-run all checks. Only proceed to commit when all 6 pass.
|
|
378
|
+
|
|
379
|
+
### 6.2 Commit Changes
|
|
258
380
|
Unless `--no-commit`:
|
|
259
381
|
1. Stage modified files (specific paths, not `git add -A`)
|
|
260
382
|
2. Create commit with accurate message listing verified items
|
|
261
383
|
3. Verify commit succeeded
|
|
262
384
|
|
|
263
|
-
### 6.
|
|
385
|
+
### 6.3 Record Session
|
|
264
386
|
- Record session summary (items completed, tests before/after, budget used)
|
|
265
387
|
- Append error patterns if any failures occurred
|
|
266
388
|
|
|
267
|
-
### 6.
|
|
389
|
+
### 6.4 Final Report
|
|
268
390
|
|
|
269
391
|
```markdown
|
|
270
392
|
## /pan:focus-exec Complete
|
|
@@ -293,15 +415,15 @@ Run `/pan:focus-scan` to regenerate the scan.
|
|
|
293
415
|
|
|
294
416
|
## NEVER DO
|
|
295
417
|
|
|
296
|
-
- Skip reading files before editing them (Rule 1)
|
|
297
|
-
- Apply symptom patches instead of root cause fixes (Rule 2)
|
|
298
|
-
- Batch implement without testing between items (Rule 3)
|
|
299
|
-
- Expand scope beyond the batch item (Rule 4)
|
|
300
|
-
- Ignore cross-platform path issues (Rule 5)
|
|
301
|
-
- Spend more than 5 minutes debugging a single failure (Rule 6)
|
|
302
|
-
- Start coding without stating understanding for M+ items (Rule 7)
|
|
303
|
-
- Change test expectations to match broken code (Rule 8)
|
|
304
|
-
- Claim items are fixed without running tests (Rule 9)
|
|
418
|
+
- Skip reading files before editing them — blind edits break callers, miss invariants, and create regressions (Rule 1)
|
|
419
|
+
- Apply symptom patches instead of root cause fixes — surface patches recur and erode trust in the codebase (Rule 2)
|
|
420
|
+
- Batch implement without testing between items — a silent failure in item 2 corrupts items 3-5 before you detect it (Rule 3)
|
|
421
|
+
- Expand scope beyond the batch item — unplanned changes bypass the budget system and risk compounding failures (Rule 4)
|
|
422
|
+
- Ignore cross-platform path issues — hardcoded separators break on Windows or vice versa (Rule 5)
|
|
423
|
+
- Spend more than 5 minutes debugging a single failure — diminishing returns; revert preserves budget for remaining items (Rule 6)
|
|
424
|
+
- Start coding without stating understanding for M+ items — misunderstanding the problem wastes the entire implementation (Rule 7)
|
|
425
|
+
- Change test expectations to match broken code — this hides bugs instead of fixing them (Rule 8)
|
|
426
|
+
- Claim items are fixed without running tests — unverified claims erode the entire verification pipeline (Rule 9)
|
|
305
427
|
|
|
306
428
|
## ALWAYS DO
|
|
307
429
|
|
|
@@ -17,11 +17,11 @@ Survey the project for prioritized work items with evidence-based scoring. $ARGU
|
|
|
17
17
|
|
|
18
18
|
---
|
|
19
19
|
|
|
20
|
-
##
|
|
20
|
+
## Project Scope Boundary
|
|
21
21
|
|
|
22
|
-
This command scans the **host project's source code** for work items —
|
|
22
|
+
This command scans the **host project's source code** for work items — not PAN Wizard's own infrastructure.
|
|
23
23
|
|
|
24
|
-
**
|
|
24
|
+
**Exclude these directories from scanning:**
|
|
25
25
|
- `.claude/`, `.github/copilot-instructions.md`, `.opencode/`, `.gemini/`, `.codex/` — PAN runtime directories
|
|
26
26
|
- `.planning/` — PAN planning state (read for context, but never report PAN planning files as "issues")
|
|
27
27
|
- Any `pan-wizard-core/`, `pan-tools`, agent `.md`, or command `.md` files within PAN runtime directories
|
|
@@ -32,9 +32,21 @@ If a scan finding points to a file inside `.claude/`, `.github/`, `.opencode/`,
|
|
|
32
32
|
|
|
33
33
|
---
|
|
34
34
|
|
|
35
|
-
##
|
|
35
|
+
## Tool Selection Priority
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
Use the simplest sufficient tool for each scanning operation:
|
|
38
|
+
1. **Grep** — for finding patterns (TODO, FIXME, error-prone code) across the codebase
|
|
39
|
+
2. **Glob** — for discovering files by name pattern (test files, config files, modules)
|
|
40
|
+
3. **Read** — for examining specific files identified by Grep/Glob
|
|
41
|
+
4. **Bash** — only for commands that dedicated tools cannot do (git log, test runners)
|
|
42
|
+
|
|
43
|
+
Do not read entire files when Grep can find the relevant lines. Do not use Bash for searches that Grep handles.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Execute All Phases Automatically
|
|
48
|
+
|
|
49
|
+
When `/pan:focus-scan` is invoked, execute all phases without stopping. Do not ask questions between phases or skip phases. The output is a prioritized work list with Reality Score filtering.
|
|
38
50
|
|
|
39
51
|
**Flags:**
|
|
40
52
|
- `--focus <area>` — Weight items toward a specific area (e.g., `--focus commands`, `--focus hooks`, `--focus tests`)
|
|
@@ -49,16 +49,42 @@ Check for .planning/state.md - loads context if project already initialized
|
|
|
49
49
|
- Trivial codebases (<5 files)
|
|
50
50
|
</when_to_use>
|
|
51
51
|
|
|
52
|
+
<tool_priority>
|
|
53
|
+
Each mapper agent should use the simplest sufficient tool:
|
|
54
|
+
1. Glob — discover files by pattern (find all .ts files, config files, test files)
|
|
55
|
+
2. Grep — search for patterns across the codebase (imports, exports, function names)
|
|
56
|
+
3. Read — examine specific files found by Glob/Grep
|
|
57
|
+
4. Bash — only for git history or commands dedicated tools cannot handle
|
|
58
|
+
</tool_priority>
|
|
59
|
+
|
|
60
|
+
<progressive_context>
|
|
61
|
+
The orchestrator loads context in layers — NOT everything upfront. Mapper agents receive only what they need.
|
|
62
|
+
|
|
63
|
+
**Orchestrator layers (before spawning agents):**
|
|
64
|
+
1. **Manifest** — package.json/Cargo.toml, project identity, entry points
|
|
65
|
+
2. **Structure** — top-level directory listing, file count by extension, test presence
|
|
66
|
+
3. **Git summary** — recent commits (10), contributors, branch info
|
|
67
|
+
|
|
68
|
+
**Per-agent context (each agent loads its own):**
|
|
69
|
+
- Each agent starts with: project manifest + directory structure + its focus area description
|
|
70
|
+
- Each agent discovers its own details via Glob/Grep/Read within its focus area
|
|
71
|
+
- Agents do NOT receive other agents' output (parallel, independent)
|
|
72
|
+
|
|
73
|
+
**Why:** Loading the entire codebase into the orchestrator before spawning agents wastes orchestrator context. Each agent has a fresh 200k window — let them explore independently. The orchestrator only needs enough context to spawn correctly and verify outputs exist.
|
|
74
|
+
</progressive_context>
|
|
75
|
+
|
|
52
76
|
<process>
|
|
53
77
|
1. Check if .planning/codebase/ already exists (offer to refresh or skip)
|
|
54
78
|
2. Create .planning/codebase/ directory structure
|
|
55
|
-
3. Spawn
|
|
56
|
-
- Agent 1: tech focus → writes
|
|
57
|
-
- Agent 2: arch focus → writes
|
|
58
|
-
- Agent 3: quality focus → writes
|
|
59
|
-
- Agent 4: concerns focus → writes
|
|
79
|
+
3. Spawn 6 parallel pan-document_code agents:
|
|
80
|
+
- Agent 1: tech focus → writes stack.md, integrations.md
|
|
81
|
+
- Agent 2: arch focus → writes architecture.md, structure.md
|
|
82
|
+
- Agent 3: quality focus → writes conventions.md, testing.md
|
|
83
|
+
- Agent 4: concerns focus → writes concerns.md
|
|
84
|
+
- Agent 5: relationships focus → writes relationships.md
|
|
85
|
+
- Agent 6: practices focus → writes best-practices.md
|
|
60
86
|
4. Wait for agents to complete, collect confirmations (NOT document contents)
|
|
61
|
-
5. Verify all
|
|
87
|
+
5. Verify all 9 documents exist with line counts
|
|
62
88
|
6. Commit codebase map
|
|
63
89
|
7. Offer next steps (typically: /pan:new-project or /pan:plan-phase)
|
|
64
90
|
</process>
|
|
@@ -31,6 +31,29 @@ Glob: .planning/phases/*/*-summary.md
|
|
|
31
31
|
Glob: .planning/phases/*/*-verification.md
|
|
32
32
|
</context>
|
|
33
33
|
|
|
34
|
+
<citation_requirement>
|
|
35
|
+
Every coverage judgment in the audit MUST cite evidence from the codebase.
|
|
36
|
+
|
|
37
|
+
**Before writing any requirement as "covered" or "not covered", verify by reading the code.**
|
|
38
|
+
|
|
39
|
+
**Grounding rules:**
|
|
40
|
+
- "Covered" requires: file:line where the requirement is implemented + verification.md or test evidence
|
|
41
|
+
- "Partially covered" requires: file:line showing what exists + specific gap description with expected location
|
|
42
|
+
- "Not covered" requires: grep showing the expected functionality doesn't exist (show the search and empty result)
|
|
43
|
+
- Cross-phase integration claims require: file:line in phase A's output + file:line in phase B's consumer
|
|
44
|
+
|
|
45
|
+
**Anti-pattern:**
|
|
46
|
+
```
|
|
47
|
+
BAD: "Requirement R3 is covered — the billing module handles this"
|
|
48
|
+
→ Which file? Which function? How do you know?
|
|
49
|
+
GOOD: "Requirement R3 is covered — generateInvoice() at src/billing.ts:42 implements line-item
|
|
50
|
+
calculation. Verified in phase-2-verification.md (line 18). Integration: called from
|
|
51
|
+
src/api/orders.ts:156 (phase 3)."
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Do not trust summary files at face value. If a verification.md says "all tests pass" but you haven't confirmed the test count, that claim is ungrounded. Spot-check at least 2 verification files by running the actual tests.
|
|
55
|
+
</citation_requirement>
|
|
56
|
+
|
|
34
57
|
<process>
|
|
35
58
|
Execute the audit-milestone workflow from @~/.claude/pan-wizard-core/workflows/milestone-audit.md end-to-end.
|
|
36
59
|
Preserve all workflow gates (scope determination, verification reading, integration check, requirements coverage, routing).
|
|
@@ -37,6 +37,70 @@ Initialize a new project through unified flow: questioning → research (optiona
|
|
|
37
37
|
@~/.claude/pan-wizard-core/templates/requirements.md
|
|
38
38
|
</execution_context>
|
|
39
39
|
|
|
40
|
+
<progressive_context>
|
|
41
|
+
Load context in layers — do NOT read everything upfront. Each layer builds on the previous.
|
|
42
|
+
|
|
43
|
+
**Layer 1: Manifest (always load first)**
|
|
44
|
+
- package.json / Cargo.toml / pyproject.toml — project identity, deps, scripts
|
|
45
|
+
- .planning/ existence check — is this a fresh start or existing project?
|
|
46
|
+
- README.md first 50 lines — what the project claims to be
|
|
47
|
+
|
|
48
|
+
**Layer 2: Structure (load during questioning)**
|
|
49
|
+
- Directory tree (Glob top-level patterns) — understand project shape
|
|
50
|
+
- Entry points — main files, index files, server files
|
|
51
|
+
- Test infrastructure — test framework, test directory
|
|
52
|
+
|
|
53
|
+
**Layer 3: Hotspots (load during research, if research is enabled)**
|
|
54
|
+
- Most-changed files (git log --name-only) — where active work happens
|
|
55
|
+
- Largest files — complexity centers
|
|
56
|
+
- Import graph roots — most-depended-on modules
|
|
57
|
+
|
|
58
|
+
**Layer 4: Baselines (load only when generating requirements/roadmap)**
|
|
59
|
+
- Test count + pass rate
|
|
60
|
+
- Build status
|
|
61
|
+
- Dependency audit (outdated, vulnerable)
|
|
62
|
+
|
|
63
|
+
**Why layered:** Loading everything at Layer 1 wastes 40-60% of context on information not needed until later. For greenfield projects, Layers 3-4 are empty and should be skipped entirely.
|
|
64
|
+
</progressive_context>
|
|
65
|
+
|
|
66
|
+
<routing_decision_tree>
|
|
67
|
+
Use this decision tree to select the correct path. Evaluate conditions top-to-bottom; take the FIRST match.
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
IF .planning/ already exists AND contains project.md:
|
|
71
|
+
→ WARN: "Project already initialized. Use /pan:resume to continue."
|
|
72
|
+
→ STOP (do not overwrite existing project)
|
|
73
|
+
|
|
74
|
+
ELSE IF --auto flag AND @ reference document provided:
|
|
75
|
+
→ ASK config questions only (commit_docs, model_profile)
|
|
76
|
+
→ SKIP interactive questioning (use the @ document as project context)
|
|
77
|
+
→ RUN research automatically
|
|
78
|
+
→ GENERATE requirements from research + @ document
|
|
79
|
+
→ GENERATE roadmap from requirements
|
|
80
|
+
→ No further interaction until complete
|
|
81
|
+
|
|
82
|
+
ELSE IF --auto flag WITHOUT @ reference:
|
|
83
|
+
→ ERROR: "--auto requires an @ referenced idea document"
|
|
84
|
+
→ STOP
|
|
85
|
+
|
|
86
|
+
ELSE (interactive mode — default):
|
|
87
|
+
→ RUN questioning flow (5-area deep questioning)
|
|
88
|
+
→ ASK: "Should I research the domain ecosystem?" (Y/N)
|
|
89
|
+
→ IF Y: spawn researchers → synthesize → continue
|
|
90
|
+
→ IF N: skip research → continue
|
|
91
|
+
→ PRESENT requirements for approval
|
|
92
|
+
→ PRESENT roadmap for approval
|
|
93
|
+
→ COMMIT if commit_docs=true
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**Research routing:**
|
|
97
|
+
```
|
|
98
|
+
IF user says research: spawn pan-project-researcher agents
|
|
99
|
+
IF user declines research: skip directly to requirements generation
|
|
100
|
+
IF codebase already has substantial code: suggest skipping research (existing code IS the context)
|
|
101
|
+
```
|
|
102
|
+
</routing_decision_tree>
|
|
103
|
+
|
|
40
104
|
<process>
|
|
41
105
|
Execute the new-project workflow from @~/.claude/pan-wizard-core/workflows/new-project.md end-to-end.
|
|
42
106
|
Preserve all workflow gates (validation, approvals, commits, routing).
|
package/commands/pan/pause.md
CHANGED
|
@@ -27,13 +27,54 @@ Routes to the pause-work workflow which handles:
|
|
|
27
27
|
State and phase progress are gathered in-workflow with targeted reads.
|
|
28
28
|
</context>
|
|
29
29
|
|
|
30
|
+
<handoff_schema>
|
|
31
|
+
The `.continue-here.md` file MUST contain ALL of the following sections. Missing sections cause resume failures.
|
|
32
|
+
|
|
33
|
+
```yaml
|
|
34
|
+
# Required fields for .continue-here.md
|
|
35
|
+
session_id: "{date}-{slug}" # Unique session identifier
|
|
36
|
+
paused_at: "{ISO-8601 timestamp}" # When work was paused
|
|
37
|
+
phase: "{phase number and name}" # Current phase being worked on
|
|
38
|
+
plan: "{plan file path}" # Which plan was active
|
|
39
|
+
|
|
40
|
+
position:
|
|
41
|
+
last_completed_task: "{task ID}" # Last task that was fully done
|
|
42
|
+
next_task: "{task ID}" # What to do next
|
|
43
|
+
wave: "{wave number, if applicable}"
|
|
44
|
+
|
|
45
|
+
progress:
|
|
46
|
+
tasks_done: [{id, title, status}] # All completed tasks this session
|
|
47
|
+
tasks_remaining: [{id, title}] # What's left in the plan
|
|
48
|
+
test_baseline: "{N passing}" # Test count when session started
|
|
49
|
+
test_current: "{N passing}" # Test count at pause time
|
|
50
|
+
|
|
51
|
+
decisions:
|
|
52
|
+
- "{decision made and why}" # Choices that affect remaining work
|
|
53
|
+
|
|
54
|
+
blockers:
|
|
55
|
+
- "{blocker description}" # Anything preventing progress
|
|
56
|
+
|
|
57
|
+
context:
|
|
58
|
+
files_modified: ["{paths}"] # Files changed this session
|
|
59
|
+
key_findings: ["{findings}"] # Non-obvious discoveries
|
|
60
|
+
next_action: "{specific action}" # Exact first step on resume
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**Why every field matters:**
|
|
64
|
+
- `position` → resume agent knows WHERE to start (not re-reading the whole plan)
|
|
65
|
+
- `progress` → resume agent knows test baseline (detects regressions vs pre-existing)
|
|
66
|
+
- `decisions` → resume agent won't re-debate settled questions
|
|
67
|
+
- `blockers` → resume agent can flag to user immediately instead of rediscovering
|
|
68
|
+
- `context.next_action` → resume agent's first action is productive, not exploratory
|
|
69
|
+
</handoff_schema>
|
|
70
|
+
|
|
30
71
|
<process>
|
|
31
72
|
**Follow the pause-work workflow** from `@~/.claude/pan-wizard-core/workflows/pause.md`.
|
|
32
73
|
|
|
33
74
|
The workflow handles all logic including:
|
|
34
75
|
1. Phase directory detection
|
|
35
76
|
2. State gathering with user clarifications
|
|
36
|
-
3. Handoff file writing with timestamp
|
|
77
|
+
3. Handoff file writing with timestamp — **using the schema from `<handoff_schema>`**
|
|
37
78
|
4. Git commit
|
|
38
79
|
5. Confirmation with resume instructions
|
|
39
80
|
</process>
|
|
@@ -40,6 +40,90 @@ Phase number: $ARGUMENTS (optional — auto-detects next unplanned phase if omit
|
|
|
40
40
|
Normalize phase input in step 2 before any directory lookups.
|
|
41
41
|
</context>
|
|
42
42
|
|
|
43
|
+
<reflexion_loop>
|
|
44
|
+
During the plan-checker verification iteration:
|
|
45
|
+
1. Read the plan-checker's critique carefully
|
|
46
|
+
2. For each identified gap: verify it is a genuine gap by re-reading the relevant requirement
|
|
47
|
+
3. Do not blindly accept all critiques — some may be false positives from missing context
|
|
48
|
+
4. Revise the plan to address genuine gaps only
|
|
49
|
+
5. Maximum 2 revision iterations (plan → check → revise → check → final)
|
|
50
|
+
This prevents over-revision while ensuring real gaps are closed.
|
|
51
|
+
</reflexion_loop>
|
|
52
|
+
|
|
53
|
+
<completion_contract>
|
|
54
|
+
Planning is complete when ALL conditions are met:
|
|
55
|
+
1. At least one plan.md file created in the phase directory
|
|
56
|
+
2. Plan-checker passed (or max 2 revision iterations exhausted with final approval)
|
|
57
|
+
3. Each plan contains: objective, task breakdown with estimates, dependency ordering, and key file links
|
|
58
|
+
4. Research.md exists (unless --skip-research was used)
|
|
59
|
+
5. User presented with results and next-step options
|
|
60
|
+
|
|
61
|
+
Planning FAILS if: phase not found in roadmap, or planner agent returns empty/malformed output after retries.
|
|
62
|
+
</completion_contract>
|
|
63
|
+
|
|
64
|
+
<common_mistakes>
|
|
65
|
+
Avoid these planning anti-patterns:
|
|
66
|
+
```
|
|
67
|
+
BAD: Plan has 25 tasks for a single phase → too granular, executor loses context
|
|
68
|
+
GOOD: 5-8 tasks per plan, each with clear scope and testable outcome
|
|
69
|
+
|
|
70
|
+
BAD: Task says "Implement the feature" with no file links or acceptance criteria
|
|
71
|
+
→ Executor guesses at scope, misses edge cases
|
|
72
|
+
GOOD: Task says "Add retry logic to api/client.ts:fetchData() — 3 retries with exponential backoff, tested by tests/client.test.ts"
|
|
73
|
+
|
|
74
|
+
BAD: Plan-checker flags a gap → blindly add a task without re-reading the requirement
|
|
75
|
+
→ False positive becomes unnecessary work
|
|
76
|
+
GOOD: Re-read the requirement → confirm the gap is real → then add the task
|
|
77
|
+
```
|
|
78
|
+
</common_mistakes>
|
|
79
|
+
|
|
80
|
+
<routing_decision_tree>
|
|
81
|
+
Use this decision tree to select the correct path. Evaluate conditions top-to-bottom; take the FIRST match.
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
IF --gaps flag is set:
|
|
85
|
+
→ SKIP research (gap closure uses verification.md instead)
|
|
86
|
+
→ READ verification.md for the phase
|
|
87
|
+
→ PLAN with gap context
|
|
88
|
+
→ VERIFY (unless --skip-verify)
|
|
89
|
+
|
|
90
|
+
ELSE IF --prd <file> flag is set:
|
|
91
|
+
→ SKIP discuss-phase entirely
|
|
92
|
+
→ PARSE PRD file into context.md
|
|
93
|
+
→ SKIP research (PRD provides requirements)
|
|
94
|
+
→ PLAN from parsed requirements
|
|
95
|
+
→ VERIFY (unless --skip-verify)
|
|
96
|
+
|
|
97
|
+
ELSE IF --skip-research flag is set:
|
|
98
|
+
→ SKIP research
|
|
99
|
+
→ PLAN directly (must have roadmap context)
|
|
100
|
+
→ VERIFY (unless --skip-verify)
|
|
101
|
+
|
|
102
|
+
ELSE IF research.md already exists AND --research NOT set:
|
|
103
|
+
→ SKIP research (reuse existing)
|
|
104
|
+
→ PLAN using existing research.md
|
|
105
|
+
→ VERIFY (unless --skip-verify)
|
|
106
|
+
|
|
107
|
+
ELSE (default path):
|
|
108
|
+
→ RUN research (spawn pan-phase-researcher)
|
|
109
|
+
→ PLAN from research results
|
|
110
|
+
→ VERIFY (unless --skip-verify)
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**Verification loop routing:**
|
|
114
|
+
```
|
|
115
|
+
IF --skip-verify:
|
|
116
|
+
→ Present plan, done
|
|
117
|
+
|
|
118
|
+
ELSE:
|
|
119
|
+
→ Spawn pan-plan-checker
|
|
120
|
+
→ IF checker PASSES: done
|
|
121
|
+
→ IF checker finds gaps (iteration 1): revise plan, re-check
|
|
122
|
+
→ IF checker finds gaps (iteration 2): final revision, present with caveats
|
|
123
|
+
→ Max 2 revision iterations
|
|
124
|
+
```
|
|
125
|
+
</routing_decision_tree>
|
|
126
|
+
|
|
43
127
|
<process>
|
|
44
128
|
Execute the plan-phase workflow from @~/.claude/pan-wizard-core/workflows/plan-phase.md end-to-end.
|
|
45
129
|
Preserve all workflow gates (validation, research, planning, verification loop, routing).
|
package/commands/pan/quick.md
CHANGED
|
@@ -39,4 +39,19 @@ Context files are resolved inside the workflow (`init quick`) and delegated via
|
|
|
39
39
|
<process>
|
|
40
40
|
Execute the quick workflow from @~/.claude/pan-wizard-core/workflows/quick.md end-to-end.
|
|
41
41
|
Preserve all workflow gates (validation, task description, planning, execution, state updates, commits).
|
|
42
|
+
|
|
43
|
+
**Scope Containment:**
|
|
44
|
+
Implement only what was asked. Do not refactor surrounding code, add unrelated improvements, or create abstractions for one-time fixes.
|
|
45
|
+
|
|
46
|
+
**State Intent Before Implementing:**
|
|
47
|
+
Before coding, state: "I will modify [files], adding [what], to achieve [goal]."
|
|
48
|
+
|
|
49
|
+
**Pre-Commit Verification Checklist — apply before the final commit:**
|
|
50
|
+
1. Every modified file was read before editing
|
|
51
|
+
2. `git diff --stat` contains only files related to the task
|
|
52
|
+
3. Tests pass (run the project's test suite)
|
|
53
|
+
4. Commit message accurately describes the verified change
|
|
54
|
+
5. No secrets or credentials staged
|
|
55
|
+
|
|
56
|
+
If any check fails: fix and re-verify before committing.
|
|
42
57
|
</process>
|