pan-wizard 2.8.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.
Files changed (164) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +772 -0
  3. package/agents/pan-debugger.md +1246 -0
  4. package/agents/pan-document_code.md +965 -0
  5. package/agents/pan-executor.md +469 -0
  6. package/agents/pan-integration-checker.md +443 -0
  7. package/agents/pan-phase-researcher.md +572 -0
  8. package/agents/pan-plan-checker.md +763 -0
  9. package/agents/pan-planner.md +1297 -0
  10. package/agents/pan-project-researcher.md +647 -0
  11. package/agents/pan-research-synthesizer.md +239 -0
  12. package/agents/pan-reviewer.md +112 -0
  13. package/agents/pan-roadmapper.md +642 -0
  14. package/agents/pan-verifier.md +672 -0
  15. package/assets/pan-logo-2000-transparent.svg +30 -0
  16. package/assets/pan-logo-2000.svg +43 -0
  17. package/assets/terminal.svg +119 -0
  18. package/bin/install-lib.cjs +616 -0
  19. package/bin/install.js +1936 -0
  20. package/commands/pan/add-phase.md +44 -0
  21. package/commands/pan/assumptions.md +47 -0
  22. package/commands/pan/audit-deployment.md +378 -0
  23. package/commands/pan/debug.md +168 -0
  24. package/commands/pan/discord.md +19 -0
  25. package/commands/pan/discuss-phase.md +84 -0
  26. package/commands/pan/exec-phase.md +45 -0
  27. package/commands/pan/focus-auto.md +323 -0
  28. package/commands/pan/focus-design.md +816 -0
  29. package/commands/pan/focus-exec.md +316 -0
  30. package/commands/pan/focus-plan.md +101 -0
  31. package/commands/pan/focus-scan.md +272 -0
  32. package/commands/pan/focus-sync.md +104 -0
  33. package/commands/pan/health.md +23 -0
  34. package/commands/pan/help.md +23 -0
  35. package/commands/pan/insert-phase.md +33 -0
  36. package/commands/pan/map-codebase.md +72 -0
  37. package/commands/pan/milestone-audit.md +37 -0
  38. package/commands/pan/milestone-cleanup.md +19 -0
  39. package/commands/pan/milestone-done.md +137 -0
  40. package/commands/pan/milestone-gaps.md +35 -0
  41. package/commands/pan/milestone-new.md +45 -0
  42. package/commands/pan/new-project.md +43 -0
  43. package/commands/pan/patches.md +110 -0
  44. package/commands/pan/pause.md +39 -0
  45. package/commands/pan/phase-budget.md +23 -0
  46. package/commands/pan/phase-tests.md +42 -0
  47. package/commands/pan/plan-phase.md +46 -0
  48. package/commands/pan/profile.md +36 -0
  49. package/commands/pan/progress.md +25 -0
  50. package/commands/pan/quick.md +42 -0
  51. package/commands/pan/remove-phase.md +32 -0
  52. package/commands/pan/research-phase.md +190 -0
  53. package/commands/pan/resume.md +41 -0
  54. package/commands/pan/retro.md +33 -0
  55. package/commands/pan/settings.md +37 -0
  56. package/commands/pan/todo-add.md +48 -0
  57. package/commands/pan/todo-check.md +46 -0
  58. package/commands/pan/update.md +38 -0
  59. package/commands/pan/verify-phase.md +39 -0
  60. package/hooks/dist/pan-check-update.js +62 -0
  61. package/hooks/dist/pan-context-monitor.js +122 -0
  62. package/hooks/dist/pan-statusline.js +108 -0
  63. package/package.json +66 -0
  64. package/pan-wizard-core/bin/lib/codebase.cjs +746 -0
  65. package/pan-wizard-core/bin/lib/commands.cjs +1435 -0
  66. package/pan-wizard-core/bin/lib/config.cjs +611 -0
  67. package/pan-wizard-core/bin/lib/constants.cjs +696 -0
  68. package/pan-wizard-core/bin/lib/context-budget.cjs +150 -0
  69. package/pan-wizard-core/bin/lib/core.cjs +650 -0
  70. package/pan-wizard-core/bin/lib/focus.cjs +900 -0
  71. package/pan-wizard-core/bin/lib/frontmatter.cjs +442 -0
  72. package/pan-wizard-core/bin/lib/init.cjs +881 -0
  73. package/pan-wizard-core/bin/lib/milestone.cjs +276 -0
  74. package/pan-wizard-core/bin/lib/phase.cjs +1212 -0
  75. package/pan-wizard-core/bin/lib/roadmap.cjs +470 -0
  76. package/pan-wizard-core/bin/lib/state.cjs +1029 -0
  77. package/pan-wizard-core/bin/lib/template.cjs +314 -0
  78. package/pan-wizard-core/bin/lib/utils.cjs +171 -0
  79. package/pan-wizard-core/bin/lib/verify.cjs +1808 -0
  80. package/pan-wizard-core/bin/pan-tools.cjs +773 -0
  81. package/pan-wizard-core/references/checkpoints.md +776 -0
  82. package/pan-wizard-core/references/continuation-format.md +249 -0
  83. package/pan-wizard-core/references/decimal-phase-calculation.md +65 -0
  84. package/pan-wizard-core/references/git-integration.md +248 -0
  85. package/pan-wizard-core/references/git-planning-commit.md +38 -0
  86. package/pan-wizard-core/references/model-profile-resolution.md +34 -0
  87. package/pan-wizard-core/references/model-profiles.md +111 -0
  88. package/pan-wizard-core/references/phase-argument-parsing.md +61 -0
  89. package/pan-wizard-core/references/planning-config.md +196 -0
  90. package/pan-wizard-core/references/questioning.md +145 -0
  91. package/pan-wizard-core/references/tdd.md +263 -0
  92. package/pan-wizard-core/references/ui-brand.md +160 -0
  93. package/pan-wizard-core/references/verification-patterns.md +612 -0
  94. package/pan-wizard-core/templates/codebase/architecture.md +283 -0
  95. package/pan-wizard-core/templates/codebase/best-practices.md +133 -0
  96. package/pan-wizard-core/templates/codebase/concerns.md +325 -0
  97. package/pan-wizard-core/templates/codebase/conventions.md +307 -0
  98. package/pan-wizard-core/templates/codebase/integrations.md +305 -0
  99. package/pan-wizard-core/templates/codebase/relationships.md +124 -0
  100. package/pan-wizard-core/templates/codebase/stack.md +199 -0
  101. package/pan-wizard-core/templates/codebase/structure.md +298 -0
  102. package/pan-wizard-core/templates/codebase/testing.md +480 -0
  103. package/pan-wizard-core/templates/config.json +37 -0
  104. package/pan-wizard-core/templates/context.md +283 -0
  105. package/pan-wizard-core/templates/continue-here.md +78 -0
  106. package/pan-wizard-core/templates/debug-subagent-prompt.md +91 -0
  107. package/pan-wizard-core/templates/debug.md +164 -0
  108. package/pan-wizard-core/templates/discovery.md +146 -0
  109. package/pan-wizard-core/templates/milestone-archive.md +123 -0
  110. package/pan-wizard-core/templates/milestone.md +115 -0
  111. package/pan-wizard-core/templates/phase-prompt.md +593 -0
  112. package/pan-wizard-core/templates/planner-subagent-prompt.md +117 -0
  113. package/pan-wizard-core/templates/project.md +184 -0
  114. package/pan-wizard-core/templates/requirements.md +231 -0
  115. package/pan-wizard-core/templates/research-project/architecture.md +204 -0
  116. package/pan-wizard-core/templates/research-project/features.md +147 -0
  117. package/pan-wizard-core/templates/research-project/pitfalls.md +200 -0
  118. package/pan-wizard-core/templates/research-project/stack.md +120 -0
  119. package/pan-wizard-core/templates/research-project/summary.md +170 -0
  120. package/pan-wizard-core/templates/research.md +552 -0
  121. package/pan-wizard-core/templates/retrospective.md +54 -0
  122. package/pan-wizard-core/templates/roadmap.md +202 -0
  123. package/pan-wizard-core/templates/standards.md +24 -0
  124. package/pan-wizard-core/templates/state.md +176 -0
  125. package/pan-wizard-core/templates/summary-complex.md +59 -0
  126. package/pan-wizard-core/templates/summary-minimal.md +41 -0
  127. package/pan-wizard-core/templates/summary-standard.md +49 -0
  128. package/pan-wizard-core/templates/summary.md +249 -0
  129. package/pan-wizard-core/templates/uat.md +247 -0
  130. package/pan-wizard-core/templates/user-setup.md +311 -0
  131. package/pan-wizard-core/templates/validation.md +76 -0
  132. package/pan-wizard-core/templates/verification-report.md +322 -0
  133. package/pan-wizard-core/workflows/add-phase.md +111 -0
  134. package/pan-wizard-core/workflows/assumptions.md +178 -0
  135. package/pan-wizard-core/workflows/diagnose-issues.md +219 -0
  136. package/pan-wizard-core/workflows/discuss-phase.md +542 -0
  137. package/pan-wizard-core/workflows/exec-phase.md +572 -0
  138. package/pan-wizard-core/workflows/execute-plan.md +448 -0
  139. package/pan-wizard-core/workflows/health.md +156 -0
  140. package/pan-wizard-core/workflows/help.md +431 -0
  141. package/pan-wizard-core/workflows/insert-phase.md +129 -0
  142. package/pan-wizard-core/workflows/map-codebase.md +401 -0
  143. package/pan-wizard-core/workflows/milestone-audit.md +297 -0
  144. package/pan-wizard-core/workflows/milestone-cleanup.md +152 -0
  145. package/pan-wizard-core/workflows/milestone-gaps.md +274 -0
  146. package/pan-wizard-core/workflows/milestone-new.md +382 -0
  147. package/pan-wizard-core/workflows/new-project.md +1178 -0
  148. package/pan-wizard-core/workflows/pause.md +122 -0
  149. package/pan-wizard-core/workflows/phase-tests.md +388 -0
  150. package/pan-wizard-core/workflows/plan-phase.md +569 -0
  151. package/pan-wizard-core/workflows/profile.md +115 -0
  152. package/pan-wizard-core/workflows/progress.md +381 -0
  153. package/pan-wizard-core/workflows/quick.md +453 -0
  154. package/pan-wizard-core/workflows/remove-phase.md +154 -0
  155. package/pan-wizard-core/workflows/research-phase.md +73 -0
  156. package/pan-wizard-core/workflows/resume-project.md +306 -0
  157. package/pan-wizard-core/workflows/retro.md +121 -0
  158. package/pan-wizard-core/workflows/settings.md +213 -0
  159. package/pan-wizard-core/workflows/todo-add.md +157 -0
  160. package/pan-wizard-core/workflows/todo-check.md +176 -0
  161. package/pan-wizard-core/workflows/transition.md +544 -0
  162. package/pan-wizard-core/workflows/update.md +219 -0
  163. package/pan-wizard-core/workflows/verify-phase.md +301 -0
  164. package/scripts/build-hooks.js +43 -0
@@ -0,0 +1,316 @@
1
+ ---
2
+ name: focus-exec
3
+ group: Focus
4
+ description: Automated batch execution pipeline with 6 stages, 9 behavioral rules, 3 execution tiers
5
+ allowed-tools:
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - Bash
10
+ - Grep
11
+ - Glob
12
+ - Agent
13
+ ---
14
+
15
+ # /pan:focus-exec — Automated Batch Execution Pipeline
16
+
17
+ Execute items from the current focus batch with capacity-based sizing, full session lifecycle, and verification. $ARGUMENTS
18
+
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
+
21
+ ---
22
+
23
+ ## Pipeline Overview
24
+
25
+ ```
26
+ /pan:focus-exec
27
+
28
+ Stage 1: SESSION START
29
+ - Check project status, record baseline
30
+
31
+ Stage 2: BATCH LOADING + VALIDATION
32
+ - Read batch file, validate items, confirm budget
33
+
34
+ Stage 3: EXECUTION (tier-based)
35
+ - Implement items with read->understand->code
36
+ - Build + test cadence per tier
37
+
38
+ Stage 4: VERIFICATION
39
+ - Verify all implemented items actually work
40
+ - Full test suite must pass
41
+
42
+ Stage 5: DOCUMENTATION SYNC
43
+ - Update docs, README, CHANGELOG
44
+
45
+ Stage 6: SESSION END
46
+ - Commit, record session, generate summary
47
+ ```
48
+
49
+ ---
50
+
51
+ ## CRITICAL: Project Scope Boundary
52
+
53
+ This command executes work on the **host project's source code** — NOT on PAN Wizard's own infrastructure.
54
+
55
+ **NEVER read, modify, or "fix" files in these PAN directories:**
56
+ - `.claude/`, `.github/copilot-instructions.md`, `.opencode/`, `.gemini/`, `.codex/` — PAN runtime directories
57
+ - Any `pan-wizard-core/`, `pan-tools`, agent `.md`, or command `.md` files within PAN runtime directories
58
+
59
+ **These directories are PAN's own tooling installed into the project.** If a batch item targets a PAN infrastructure file, SKIP it with reason "PAN infrastructure — out of scope." Never modify PAN's agents, commands, core modules, or dispatcher as part of project work.
60
+
61
+ ---
62
+
63
+ ## MANDATORY: Execute ALL Stages Sequentially
64
+
65
+ When `/pan:focus-exec` is invoked, run ALL 6 stages in order. Do NOT skip stages. Do NOT stop between stages unless a critical failure occurs (tests regress).
66
+
67
+ **Flags:**
68
+ - `--budget N` — Override capacity budget in points (default: 50, min: 5, max: 100)
69
+ - `--mode MODE` — Execution mode (bugfix/balanced/features/full)
70
+ - `--priority P0-P6` — Only pick items from these priority tiers
71
+ - `--dry-run` — Run Stages 1-2 only (show what WOULD be executed)
72
+ - `--no-commit` — Skip the commit step in Stage 6
73
+ - `--continue` — Resume a previously interrupted execution
74
+
75
+ ---
76
+
77
+ ## Capacity Budget System
78
+
79
+ | Size | Points | Per Session | Meaning |
80
+ |------|--------|-------------|---------|
81
+ | **XS** | 1 | Up to 40 | Config tweak, typo fix |
82
+ | **S** | 2 | Up to 20 | Single-file bug fix, add tests |
83
+ | **M** | 4 | Up to 10 | Multi-file feature, new test suite |
84
+ | **L** | 10 | Up to 4 | Multi-module change, new command |
85
+ | **XL** | 20 | Up to 2 | New subsystem, major refactor |
86
+
87
+ ---
88
+
89
+ ## AI Behavioral Rules (ALL 9 MANDATORY)
90
+
91
+ ### Rule 1: Read Before You Write (MANDATORY)
92
+ Before changing ANY file, read it first. Understand context, callers, and invariants.
93
+
94
+ ### Rule 2: Understand the Root Cause (MANDATORY)
95
+ Do NOT apply surface-level patches. Trace the code path, identify the actual defect.
96
+
97
+ ### Rule 3: One Change, One Test (MANDATORY)
98
+ Every code change must be tested before moving to the next item.
99
+
100
+ Test cadence by tier:
101
+ - **MICRO (XS/S):** Run specific test after implementing. Batch up to 3 independent items before smoke.
102
+ - **STANDARD (M):** Full test suite after EACH item.
103
+ - **FULL (L/XL):** Build hooks + full test suite after EACH item.
104
+
105
+ ### Rule 4: Don't Invent — Follow the Plan (MANDATORY)
106
+ Implement exactly what the batch says. No scope creep.
107
+
108
+ ### Rule 5: Cross-Platform Awareness (MANDATORY)
109
+ - Use platform-agnostic path APIs (no hardcoded separators)
110
+ - Follow the project's module format conventions (discover from existing code)
111
+ - Use file-based input for shell-sensitive content when needed
112
+
113
+ ### Rule 6: Revert Fast, Don't Dig Deep (MANDATORY)
114
+ If a fix doesn't work within 5 minutes, revert and move on. Failed items carry forward.
115
+
116
+ ### Rule 7: Verify Understanding Before Committing (MANDATORY)
117
+ For M/L/XL items, state your understanding before writing code:
118
+ ```
119
+ Item P2-3 — Add tests for billing module
120
+ Understanding: billing module has 3 exported functions. Need to test
121
+ generateInvoice, processPayment, and getBalance edge cases.
122
+ Files: billing.ts, tests/billing.test.ts
123
+ Confidence: HIGH
124
+ ```
125
+
126
+ ### Rule 8: Preserve Existing Test Expectations (MANDATORY)
127
+ Never change an existing test's expected output to match broken code.
128
+
129
+ ### Rule 9: Commit Messages Must Be Accurate (MANDATORY)
130
+ List ONLY items that are actually VERIFIED (passed tests). Include actual test counts.
131
+
132
+ ---
133
+
134
+ ## Stage 1: Session Start
135
+
136
+ 1. **Check Project Status** — git status, recent commits
137
+ 2. **Test Baseline** — run test suite, record current counts
138
+ 3. **Create rollback snapshot** — git tag for safety
139
+ 4. **Report** — Output session start summary
140
+
141
+ **Record baseline:**
142
+ ```
143
+ baseline_version: <from package.json>
144
+ baseline_tests: <N/N passing>
145
+ baseline_build: <pass/fail>
146
+ baseline_commit: <current HEAD>
147
+ ```
148
+
149
+ **Failure Gate:** If tests fail, STOP. Fix tests before proceeding.
150
+
151
+ ---
152
+
153
+ ## Stage 2: Batch Loading + Validation
154
+
155
+ ### 2.1 Find Active Batch
156
+ Search for: `.planning/focus/batch-*.json`
157
+ Pick the newest. If none exists, tell user to run `/pan:focus-plan` first.
158
+
159
+ ### 2.2 Read and Validate the Batch
160
+ Extract all items: ID, Title, Priority, Effort, Points, Tier, Files.
161
+ Verify total points within budget.
162
+
163
+ ### 2.3 Show Batch Table
164
+ Display the execution batch to user, then continue automatically.
165
+
166
+ ---
167
+
168
+ ## Stage 3: Execution
169
+
170
+ ### 3.0 Pre-Execution Setup
171
+ 1. Cache project facts — do NOT re-read later
172
+ 2. Create/update progress tracker with the batch table
173
+
174
+ ### 3.1 Process Items by Tier
175
+
176
+ #### MICRO Items (XS/S)
177
+ ```
178
+ 1. READ target file(s)
179
+ 2. IMPLEMENT the fix
180
+ 3. TEST — run specific test file
181
+ 4. CONFIRM — pass -> DONE | fail -> one fix attempt -> REVERT -> FAILED
182
+ ```
183
+
184
+ #### STANDARD Items (M)
185
+ ```
186
+ 1. STATE UNDERSTANDING (Rule 7)
187
+ 2. READ target files + test files
188
+ 3. IMPLEMENT across necessary files
189
+ 4. TEST — full test suite
190
+ 5. CONFIRM — pass -> DONE | regresses -> REVERT -> FAILED
191
+ ```
192
+
193
+ #### FULL Items (L/XL)
194
+ ```
195
+ 1. STATE UNDERSTANDING (detailed)
196
+ 2. READ WIDELY — target files, callers, tests, related code
197
+ 3. DESIGN — outline approach before coding
198
+ 4. IMPLEMENT in logical chunks
199
+ 5. BUILD — build hooks if hooks changed
200
+ 6. TEST — full test suite
201
+ 7. CONFIRM — all pass -> DONE | fail -> investigate (15 min max) -> REVERT -> FAILED
202
+ ```
203
+
204
+ ### 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
+
209
+ ### 3.3 Progress Tracking
210
+ Update progress tracker after each item with status and budget tracking.
211
+
212
+ ---
213
+
214
+ ## Stage 4: Verification
215
+
216
+ ### 4.1 Full Suite Verification
217
+ Run full test suite. All tests must pass. Compare against Stage 1 baseline.
218
+
219
+ ### 4.2 Build Verification (if applicable)
220
+ Build hooks or compile step if applicable. All must pass.
221
+
222
+ ### 4.3 Verification Report
223
+ ```markdown
224
+ ## Verification Report
225
+
226
+ ### Item Results
227
+ | # | ID | Title | Tests | Verdict |
228
+ |---|----|-------|-------|---------|
229
+ | 1 | P0-1 | Fix crash | pass | VERIFIED |
230
+ | 2 | P2-3 | Add tests | pass | VERIFIED |
231
+
232
+ ### Regression Check
233
+ | Test Suite | Before | After | Delta |
234
+ |------------|--------|-------|-------|
235
+ | Tests | N/N | M/M | +K |
236
+ | Build | pass | pass | -- |
237
+ ```
238
+
239
+ ---
240
+
241
+ ## Stage 5: Documentation Sync
242
+
243
+ ### 5.1 Update Docs
244
+ - Update README.md if public API changed
245
+ - Update CHANGELOG.md with new entries
246
+ - Update command/workflow files if behavior changed
247
+
248
+ ### 5.2 Update Scan
249
+ Edit the active scan file:
250
+ - Mark completed items with completed status
251
+ - Mark failed items with failed status and reason
252
+
253
+ ---
254
+
255
+ ## Stage 6: Session End
256
+
257
+ ### 6.1 Commit Changes
258
+ Unless `--no-commit`:
259
+ 1. Stage modified files (specific paths, not `git add -A`)
260
+ 2. Create commit with accurate message listing verified items
261
+ 3. Verify commit succeeded
262
+
263
+ ### 6.2 Record Session
264
+ - Record session summary (items completed, tests before/after, budget used)
265
+ - Append error patterns if any failures occurred
266
+
267
+ ### 6.3 Final Report
268
+
269
+ ```markdown
270
+ ## /pan:focus-exec Complete
271
+
272
+ | Stage | Status |
273
+ |-------|--------|
274
+ | 1. Session Start | Baseline: N/N tests |
275
+ | 2. Batch Loading | Mode: balanced, N items |
276
+ | 3. Execution | N/M items completed |
277
+ | 4. Verification | All verified |
278
+ | 5. Doc Sync | Updated N docs |
279
+ | 6. Session End | Committed |
280
+
281
+ ### Results
282
+ - **Budget:** X/50 points used
283
+ - **Items completed:** N (X pts)
284
+ - **Items failed:** K (Y pts returned)
285
+ - **Tests:** Before N -> After M (+K new)
286
+
287
+ ### Resume
288
+ Run `/pan:focus-exec --continue` for remaining items.
289
+ Run `/pan:focus-scan` to regenerate the scan.
290
+ ```
291
+
292
+ ---
293
+
294
+ ## NEVER DO
295
+
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)
305
+
306
+ ## ALWAYS DO
307
+
308
+ - Read before write, understand before implement
309
+ - Test after every item
310
+ - Stay within budget and plan scope
311
+ - Use platform-agnostic paths, file-based input for shell-sensitive content
312
+ - Revert fast when stuck
313
+ - Record baseline test counts BEFORE making changes
314
+ - Save progress after each item
315
+ - Record session at end
316
+ - Report results with before/after comparison and budget usage
@@ -0,0 +1,101 @@
1
+ ---
2
+ name: focus-plan
3
+ group: Focus
4
+ description: Create capacity-budgeted work batch with 4 execution modes
5
+ allowed-tools:
6
+ - Read
7
+ - Bash
8
+ - Grep
9
+ - Glob
10
+ ---
11
+
12
+ # /pan:focus-plan — Capacity-Budgeted Work Batch Planner
13
+
14
+ Create a capacity-budgeted work batch from focus-scan results. $ARGUMENTS
15
+
16
+ **Goal:** Select a right-sized batch of work items that fits within the session's point budget, ordered for maximum impact with minimum risk.
17
+
18
+ ---
19
+
20
+ ## CRITICAL: Project Scope Boundary
21
+
22
+ This command plans work batches for the **host project** — NOT for PAN Wizard's own infrastructure.
23
+
24
+ **NEVER include items targeting these PAN directories:**
25
+ - `.claude/`, `.github/copilot-instructions.md`, `.opencode/`, `.gemini/`, `.codex/` — PAN runtime directories
26
+ - Any `pan-wizard-core/`, `pan-tools`, agent `.md`, or command `.md` files within PAN runtime directories
27
+
28
+ If a scan item points to a PAN infrastructure file, DROP it from the batch. PAN's files are not the project's responsibility.
29
+
30
+ ---
31
+
32
+ ## MANDATORY: Run focus-scan first
33
+
34
+ If no recent scan exists, run `/pan:focus-scan` automatically before proceeding.
35
+
36
+ **Flags:**
37
+ - `--budget N` — Override capacity budget in points (default: 50, min: 5, max: 100)
38
+ - `--mode MODE` — Execution mode. Default: `balanced`
39
+ - `bugfix` — P0->P1->smallest-first, no feature work (40 pts)
40
+ - `balanced` — **Default.** Mix of stability fixes + feature development, 60/40 split (50 pts)
41
+ - `features` — Feature-focused: 80% budget on P3-P5, P0 crashes still mandatory (50 pts)
42
+ - `full` — Full-spectrum: enhanced budget, all priorities equally weighted (60 pts)
43
+ - `--priority P0-P6` — Only pick items from these priority tiers
44
+ - `--lean` — Apply RS filtering: exclude items with RS < 1.5
45
+
46
+ ---
47
+
48
+ ## Capacity Budget System
49
+
50
+ | Size | Points | Per Session | Meaning |
51
+ |------|--------|-------------|---------|
52
+ | **XS** | 1 | Up to 40 | Config tweak, typo fix |
53
+ | **S** | 2 | Up to 20 | Single-file bug fix, add tests |
54
+ | **M** | 4 | Up to 10 | Multi-file feature, new test suite |
55
+ | **L** | 10 | Up to 4 | Multi-module change, new command |
56
+ | **XL** | 20 | Up to 2 | New subsystem, major refactor |
57
+
58
+ ---
59
+
60
+ ## Execution Modes
61
+
62
+ ### `bugfix` — Stability-First
63
+ - **Budget:** 40 pts
64
+ - **Algorithm:** P0 mandatory -> P1 -> P2-P4 smallest-first
65
+ - **Feature allocation:** None
66
+
67
+ ### `balanced` — Mix of Fixes + Features (DEFAULT)
68
+ - **Budget:** 50 pts
69
+ - **Stability pass (60%):** 30 pts for P0-P2
70
+ - **Feature pass (40%):** 20 pts for P3-P6
71
+
72
+ ### `features` — Feature-Focused Sprint
73
+ - **Budget:** 50 pts
74
+ - **Mandatory pass:** All P0 items
75
+ - **Feature pass (80%):** 40 pts for P3-P5
76
+ - **Stability pass (20%):** 10 pts for P1-P2 quick wins
77
+
78
+ ### `full` — Full-Spectrum Marathon
79
+ - **Budget:** 60 pts
80
+ - **All priorities weighted equally, largest-impact-first**
81
+
82
+ ---
83
+
84
+ ## Output
85
+
86
+ Produce a batch file at `.planning/focus/batch-<YYYY-MM-DD>.json` via `pan-tools focus plan`:
87
+
88
+ ```markdown
89
+ ## Focus Batch — <date>
90
+ **Mode:** balanced | **Budget:** 50 pts | **Allocated:** N pts
91
+
92
+ | # | ID | Title | Priority | Size | Pts | Tier | Track |
93
+ |---|----|-------|----------|------|-----|------|-------|
94
+ | 1 | P0-1 | Fix crash in state cmd | P0 | S | 2 | MICRO | Stability |
95
+ | 2 | P2-3 | Add tests for milestone | P2 | M | 4 | STANDARD | Stability |
96
+ | 3 | P3-1 | Add --json flag to phase | P3 | M | 4 | STANDARD | Feature |
97
+
98
+ Execution Order: MICRO first, then STANDARD, then FULL
99
+ ```
100
+
101
+ Ready for `/pan:focus-exec`.
@@ -0,0 +1,272 @@
1
+ ---
2
+ name: focus-scan
3
+ group: Focus
4
+ description: Deep-dive strategic work scan with prioritized items and Reality Score filtering
5
+ allowed-tools:
6
+ - Read
7
+ - Bash
8
+ - Grep
9
+ - Glob
10
+ ---
11
+
12
+ # /pan:focus-scan — Deep-Dive Strategic Work Scan
13
+
14
+ Survey the project for prioritized work items with evidence-based scoring. $ARGUMENTS
15
+
16
+ **Goal:** Produce a comprehensive, evidence-based prioritized work list by deep-diving into ALL project files, code, and test results. Every item must link to source files and be actionable.
17
+
18
+ ---
19
+
20
+ ## CRITICAL: Project Scope Boundary
21
+
22
+ This command scans the **host project's source code** for work items — NOT PAN Wizard's own infrastructure.
23
+
24
+ **ALWAYS EXCLUDE these directories from scanning:**
25
+ - `.claude/`, `.github/copilot-instructions.md`, `.opencode/`, `.gemini/`, `.codex/` — PAN runtime directories
26
+ - `.planning/` — PAN planning state (read for context, but never report PAN planning files as "issues")
27
+ - Any `pan-wizard-core/`, `pan-tools`, agent `.md`, or command `.md` files within PAN runtime directories
28
+
29
+ **These directories are PAN's own tooling installed into the project.** Do not report TODO/FIXME items found in PAN files. Do not flag PAN files as lacking test coverage. Do not suggest improvements to PAN's agents, commands, or core modules.
30
+
31
+ If a scan finding points to a file inside `.claude/`, `.github/`, `.opencode/`, `.gemini/`, or `.codex/` — DROP IT. It is not the project's responsibility.
32
+
33
+ ---
34
+
35
+ ## MANDATORY: Execute ALL Phases Automatically
36
+
37
+ When `/pan:focus-scan` is invoked, execute ALL phases without stopping. Do NOT ask questions between phases. Do NOT skip phases. The output is a prioritized work list with Reality Score filtering.
38
+
39
+ **Flags:**
40
+ - `--focus <area>` — Weight items toward a specific area (e.g., `--focus commands`, `--focus hooks`, `--focus tests`)
41
+ - `--quick` — Skip Phase 2 (strategic context) and Phase 6 (validation protocol)
42
+ - `--refresh` — Force re-read all files even if recently cached
43
+ - `--lean` — Apply aggressive Reality Score filtering: DROP items with RS < 1.5, DEFER items with RS < 3.0
44
+
45
+ ---
46
+
47
+ ## Phase 0: Orientation & Baseline Snapshot
48
+
49
+ ### 0.1 Read Current State
50
+ Read these files to establish baseline:
51
+
52
+ **Core Status:**
53
+ - `package.json` — Version, description, entry points
54
+ - `README.md` — Public documentation
55
+
56
+ **Project Structure:**
57
+ - All core modules in the project's source directories
58
+ - All command definitions
59
+ - All agent definitions
60
+ - All workflow definitions
61
+ - All hook source files
62
+
63
+ **Planning State:**
64
+ - `.planning/state.md` — Current state
65
+ - `.planning/roadmap.md` — Phase progress
66
+ - `.planning/config.json` — Project configuration
67
+ - `.planning/patterns.md` — Known error patterns (if exists)
68
+
69
+ ### 0.2 Scan for Real Issues
70
+ Run targeted code searches to find actual problems:
71
+
72
+ ```
73
+ Search for: "TODO", "FIXME", "HACK", "STUB", "stub"
74
+ In: source directories, hooks, tests
75
+ ```
76
+
77
+ Cross-reference found issues with documented items — flag any UNDOCUMENTED issues as new findings.
78
+
79
+ ### 0.3 Check Test Results
80
+ ```bash
81
+ npm test 2>&1
82
+ ```
83
+ Record: total tests, passing, failing, suites.
84
+
85
+ ### 0.4 Baseline Snapshot Table
86
+
87
+ ```markdown
88
+ | Metric | Value | Notes |
89
+ |--------|-------|-------|
90
+ | Version | X.Y.Z | |
91
+ | Tests | N/N | M suites |
92
+ | Build | OK/FAIL | |
93
+ | Commands | N | |
94
+ | Phases | N total, M incomplete | |
95
+ | TODOs Found | N | |
96
+ | Error Patterns | N | |
97
+ ```
98
+
99
+ ---
100
+
101
+ ## Phase 1: Priority Classification
102
+
103
+ ### Priority Framework (STRICT ORDER)
104
+
105
+ | Priority | Focus | Criteria |
106
+ |----------|-------|----------|
107
+ | **P0: CRASH/ERROR** | Runtime errors, uncaught exceptions | Any command that throws or produces wrong output |
108
+ | **P1: WRONG RESULTS** | Silent data corruption, incorrect output | Commands that succeed but produce bad data |
109
+ | **P2: TEST GAPS** | Missing test coverage | Features without tests or low assertion density |
110
+ | **P3: INCOMPLETE FEATURES** | Partially implemented commands or workflows | Commands that exist but lack full functionality |
111
+ | **P4: NEW FEATURES** | Net-new functionality from roadmap | Features not yet started |
112
+ | **P5: TOOLING** | Developer experience improvements | Hooks, CLI UX, error messages |
113
+ | **P6: DOCUMENTATION** | Docs sync, reference updates | Documentation-only changes |
114
+
115
+ ### Classification Rules
116
+ - **Crashes before correctness** — A thrown error is always higher priority than wrong output
117
+ - **Correctness before coverage** — Wrong results are worse than missing tests
118
+ - **Quick wins first within each tier** — S-effort items before L-effort items
119
+
120
+ ---
121
+
122
+ ## Phase 2: Strategic Context (skip with --quick)
123
+
124
+ ### 2.1 Read Strategy Documents
125
+ - `README.md` — What's the public-facing story?
126
+ - User guide / docs — What's documented for users?
127
+ - `CHANGELOG.md` — What's the recent trajectory?
128
+
129
+ ### 2.2 Strategic Alignment Check
130
+ For each P4+ item, note whether it:
131
+ - Is on the critical path to the next milestone
132
+ - Enables other high-value work (dependency unblocking)
133
+ - Has been deferred multiple times
134
+
135
+ ---
136
+
137
+ ## Phase 2.5: Feature Reality Check (Market-Fit Scoring)
138
+
139
+ Every feature-tier item (P3-P6) must pass a reality check.
140
+
141
+ ### Reality Score (RS)
142
+
143
+ ```
144
+ RS = (User Value + Time Criticality + Risk Reduction) / Job Size
145
+ ```
146
+
147
+ #### User Value (UV): 1-5
148
+ | Score | Meaning |
149
+ |-------|---------|
150
+ | 5 | Core workflow feature — every user needs this |
151
+ | 4 | Common usage — most projects need it |
152
+ | 3 | Significant audience — power users need it |
153
+ | 2 | Niche audience — specific use case |
154
+ | 1 | Academic / completion-only |
155
+
156
+ #### Time Criticality (TC): 1-5
157
+ | Score | Meaning |
158
+ |-------|---------|
159
+ | 5 | Blocks users from adopting the tool |
160
+ | 4 | Competitive table-stakes — other tools have it |
161
+ | 3 | Unlocks a significant new use case |
162
+ | 2 | Nice to have, users can work around |
163
+ | 1 | No urgency |
164
+
165
+ #### Risk Reduction (RR): 1-5
166
+ | Score | Meaning |
167
+ |-------|---------|
168
+ | 5 | Removes a crash or correctness bug |
169
+ | 4 | Unblocks 3+ downstream features |
170
+ | 3 | Unblocks 1-2 features |
171
+ | 2 | Incremental improvement |
172
+ | 1 | Polish / docs |
173
+
174
+ #### Job Size (JS)
175
+ | Effort | JS Value |
176
+ |--------|----------|
177
+ | XS | 1 |
178
+ | S | 2 |
179
+ | M | 3 |
180
+ | L | 5 |
181
+ | XL | 8 |
182
+
183
+ ```
184
+ RS >= 3.0 -> DO — Include in next sessions
185
+ RS 1.5-2.9 -> DEFER — Include as deferred
186
+ RS < 1.5 -> BACKLOG — Move to backlog appendix
187
+ ```
188
+
189
+ ---
190
+
191
+ ## Phase 3: Item Collection & Deduplication
192
+
193
+ ### 3.1 Collect ALL Items
194
+ Gather items from:
195
+
196
+ 1. **Test failures** — each failure = 1 item
197
+ 2. **TODO/FIXME scan** — each finding = 1 item
198
+ 3. **Missing test coverage** — each uncovered module = 1 item
199
+ 4. **Incomplete commands** — each gap = 1 item
200
+ 5. **Missing features** — from roadmap/README promises
201
+ 6. **Documentation gaps** — each stale/missing doc = 1 item
202
+ 7. **Error pattern prevention** — from patterns.md
203
+
204
+ ### 3.2 Deduplicate
205
+ - Same file + same issue = same item
206
+ - Same feature described differently = same item
207
+
208
+ ---
209
+
210
+ ## Phase 4: Effort Estimation
211
+
212
+ | Size | Time | Lines Changed | Files |
213
+ |------|------|---------------|-------|
214
+ | XS | < 15 min | < 20 | 1 |
215
+ | S | 15-60 min | 20-100 | 1-2 |
216
+ | M | 1-4 hours | 100-500 | 2-5 |
217
+ | L | 4-8 hours | 500-2000 | 5-10 |
218
+ | XL | 8+ hours | 2000+ | 10+ |
219
+
220
+ ---
221
+
222
+ ## Phase 5: Scan Assembly
223
+
224
+ ### 5.1 Output
225
+ Return JSON via `pan-tools focus scan` with all items, or write to `.planning/focus/` for persistence.
226
+
227
+ ### 5.2 Document Structure
228
+
229
+ The scan output includes:
230
+ - Status Snapshot table
231
+ - Items grouped by priority tier (P0-P6)
232
+ - Each item: ID, title, symptom, root cause, fix guidance, files, effort
233
+ - Summary statistics (items by priority x effort)
234
+ - Recommended execution order (quick wins -> core fixes -> feature work)
235
+ - Feature Reality Check table (RS scores for P3-P6 items)
236
+ - Deferred items with rationale
237
+
238
+ ---
239
+
240
+ ## Phase 6: Validation Protocol (skip with --quick)
241
+
242
+ ### 6.1 Cross-Check Completeness
243
+ Verify the scan covers:
244
+ - [ ] All failing tests (if any)
245
+ - [ ] All TODO/FIXME items from code scan
246
+ - [ ] All modules without test coverage
247
+ - [ ] All commands listed in README but not implemented
248
+ - [ ] All error patterns that need prevention
249
+
250
+ ### 6.2 Sanity Check
251
+ - No item should appear twice
252
+ - Every P0-P2 item should have a specific file path
253
+ - Deferred items should have clear "revisit when" criteria
254
+
255
+ ---
256
+
257
+ ## NEVER DO
258
+
259
+ - Skip reading source files — the scan must be evidence-based
260
+ - List items without file paths (for code items)
261
+ - Create items with vague descriptions
262
+ - Include items that are already complete
263
+ - Include P3-P6 feature items without an RS score
264
+
265
+ ## ALWAYS DO
266
+
267
+ - Deep-dive into actual code (grep for TODOs, read modules)
268
+ - Cross-reference tests against implementations
269
+ - Link every item to its source file
270
+ - Provide specific fix guidance
271
+ - Score every P3-P6 item with the RS formula
272
+ - Sort the Feature Reality Check table by RS descending