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,249 @@
1
+ # Summary Template
2
+
3
+ Template for `.planning/phases/XX-name/{phase}-{plan}-summary.md` - phase completion documentation.
4
+
5
+ ---
6
+
7
+ ## File Template
8
+
9
+ ```markdown
10
+ ---
11
+ phase: XX-name
12
+ plan: YY
13
+ subsystem: [primary category: auth, payments, ui, api, database, infra, testing, etc.]
14
+ tags: [searchable tech: jwt, stripe, react, postgres, prisma]
15
+
16
+ # Dependency graph
17
+ requires:
18
+ - phase: [prior phase this depends on]
19
+ provides: [what that phase built that this uses]
20
+ provides:
21
+ - [bullet list of what this phase built/delivered]
22
+ affects: [list of phase names or keywords that will need this context]
23
+
24
+ # Tech tracking
25
+ tech-stack:
26
+ added: [libraries/tools added in this phase]
27
+ patterns: [architectural/code patterns established]
28
+
29
+ key-files:
30
+ created: [important files created]
31
+ modified: [important files modified]
32
+
33
+ key-decisions:
34
+ - "Decision 1"
35
+ - "Decision 2"
36
+
37
+ patterns-established:
38
+ - "Pattern 1: description"
39
+ - "Pattern 2: description"
40
+
41
+ requirements-completed: [] # REQUIRED — Copy ALL requirement IDs from this plan's `requirements` frontmatter field.
42
+ test-tiers: [] # Optional — Test tiers exercised in this plan: [unit, integration, e2e, visual]
43
+
44
+ # Metrics
45
+ duration: Xmin
46
+ completed: YYYY-MM-DD
47
+ ---
48
+
49
+ # Phase [X]: [Name] Summary
50
+
51
+ **[Substantive one-liner describing outcome - NOT "phase complete" or "implementation finished"]**
52
+
53
+ ## Performance
54
+
55
+ - **Duration:** [time] (e.g., 23 min, 1h 15m)
56
+ - **Started:** [ISO timestamp]
57
+ - **Completed:** [ISO timestamp]
58
+ - **Tasks:** [count completed]
59
+ - **Files modified:** [count]
60
+
61
+ ## Accomplishments
62
+ - [Most important outcome]
63
+ - [Second key accomplishment]
64
+ - [Third if applicable]
65
+
66
+ ## Task Commits
67
+
68
+ Each task was committed atomically:
69
+
70
+ 1. **Task 1: [task name]** - `abc123f` (feat/fix/test/refactor)
71
+ 2. **Task 2: [task name]** - `def456g` (feat/fix/test/refactor)
72
+ 3. **Task 3: [task name]** - `hij789k` (feat/fix/test/refactor)
73
+
74
+ **Plan metadata:** `lmn012o` (docs: complete plan)
75
+
76
+ _Note: TDD tasks may have multiple commits (test → feat → refactor)_
77
+
78
+ ## Files Created/Modified
79
+ - `path/to/file.ts` - What it does
80
+ - `path/to/another.ts` - What it does
81
+
82
+ ## Decisions Made
83
+ [Key decisions with brief rationale, or "None - followed plan as specified"]
84
+
85
+ ## Deviations from Plan
86
+
87
+ [If no deviations: "None - plan executed exactly as written"]
88
+
89
+ [If deviations occurred:]
90
+
91
+ ### Auto-fixed Issues
92
+
93
+ **1. [Rule X - Category] Brief description**
94
+ - **Found during:** Task [N] ([task name])
95
+ - **Issue:** [What was wrong]
96
+ - **Fix:** [What was done]
97
+ - **Files modified:** [file paths]
98
+ - **Verification:** [How it was verified]
99
+ - **Committed in:** [hash] (part of task commit)
100
+
101
+ [... repeat for each auto-fix ...]
102
+
103
+ ---
104
+
105
+ **Total deviations:** [N] auto-fixed ([breakdown by rule])
106
+ **Impact on plan:** [Brief assessment - e.g., "All auto-fixes necessary for correctness/security. No scope creep."]
107
+
108
+ ## Issues Encountered
109
+ [Problems and how they were resolved, or "None"]
110
+
111
+ [Note: "Deviations from Plan" documents unplanned work that was handled automatically via deviation rules. "Issues Encountered" documents problems during planned work that required problem-solving.]
112
+
113
+ ## User Setup Required
114
+
115
+ [If USER-SETUP.md was generated:]
116
+ **External services require manual configuration.** See [{phase}-USER-SETUP.md](./{phase}-USER-SETUP.md) for:
117
+ - Environment variables to add
118
+ - Dashboard configuration steps
119
+ - Verification commands
120
+
121
+ [If no USER-SETUP.md:]
122
+ None - no external service configuration required.
123
+
124
+ ## Next Phase Readiness
125
+ [What's ready for next phase]
126
+ [Any blockers or concerns]
127
+
128
+ ---
129
+ *Phase: XX-name*
130
+ *Completed: [date]*
131
+ ```
132
+
133
+ <frontmatter_guidance>
134
+ **Purpose:** Enable automatic context assembly via dependency graph. Frontmatter makes summary metadata machine-readable so plan-phase can scan all summaries quickly and select relevant ones based on dependencies.
135
+
136
+ **Fast scanning:** Frontmatter is first ~25 lines, cheap to scan across all summaries without reading full content.
137
+
138
+ **Dependency graph:** `requires`/`provides`/`affects` create explicit links between phases, enabling transitive closure for context selection.
139
+
140
+ **Subsystem:** Primary categorization (auth, payments, ui, api, database, infra, testing) for detecting related phases.
141
+
142
+ **Tags:** Searchable technical keywords (libraries, frameworks, tools) for tech stack awareness.
143
+
144
+ **Key-files:** Important files for @context references in plan.md.
145
+
146
+ **Patterns:** Established conventions future phases should maintain.
147
+
148
+ **Population:** Frontmatter is populated during summary creation in execute-plan.md. See `<step name="create_summary">` for field-by-field guidance.
149
+ </frontmatter_guidance>
150
+
151
+ <one_liner_rules>
152
+ The one-liner MUST be substantive:
153
+
154
+ **Good:**
155
+ - "JWT auth with refresh rotation using jose library"
156
+ - "Prisma schema with User, Session, and Product models"
157
+ - "Dashboard with real-time metrics via Server-Sent Events"
158
+
159
+ **Bad:**
160
+ - "Phase complete"
161
+ - "Authentication implemented"
162
+ - "Foundation finished"
163
+ - "All tasks done"
164
+
165
+ The one-liner should tell someone what actually shipped.
166
+ </one_liner_rules>
167
+
168
+ <example>
169
+ ```markdown
170
+ # Phase 1: Foundation Summary
171
+
172
+ **JWT auth with refresh rotation using jose library, Prisma User model, and protected API middleware**
173
+
174
+ ## Performance
175
+
176
+ - **Duration:** 28 min
177
+ - **Started:** 2025-01-15T14:22:10Z
178
+ - **Completed:** 2025-01-15T14:50:33Z
179
+ - **Tasks:** 5
180
+ - **Files modified:** 8
181
+
182
+ ## Accomplishments
183
+ - User model with email/password auth
184
+ - Login/logout endpoints with httpOnly JWT cookies
185
+ - Protected route middleware checking token validity
186
+ - Refresh token rotation on each request
187
+
188
+ ## Files Created/Modified
189
+ - `prisma/schema.prisma` - User and Session models
190
+ - `src/app/api/auth/login/route.ts` - Login endpoint
191
+ - `src/app/api/auth/logout/route.ts` - Logout endpoint
192
+ - `src/middleware.ts` - Protected route checks
193
+ - `src/lib/auth.ts` - JWT helpers using jose
194
+
195
+ ## Decisions Made
196
+ - Used jose instead of jsonwebtoken (ESM-native, Edge-compatible)
197
+ - 15-min access tokens with 7-day refresh tokens
198
+ - Storing refresh tokens in database for revocation capability
199
+
200
+ ## Deviations from Plan
201
+
202
+ ### Auto-fixed Issues
203
+
204
+ **1. [Rule 2 - Missing Critical] Added password hashing with bcrypt**
205
+ - **Found during:** Task 2 (Login endpoint implementation)
206
+ - **Issue:** Plan didn't specify password hashing - storing plaintext would be critical security flaw
207
+ - **Fix:** Added bcrypt hashing on registration, comparison on login with salt rounds 10
208
+ - **Files modified:** src/app/api/auth/login/route.ts, src/lib/auth.ts
209
+ - **Verification:** Password hash test passes, plaintext never stored
210
+ - **Committed in:** abc123f (Task 2 commit)
211
+
212
+ **2. [Rule 3 - Blocking] Installed missing jose dependency**
213
+ - **Found during:** Task 4 (JWT token generation)
214
+ - **Issue:** jose package not in package.json, import failing
215
+ - **Fix:** Ran `npm install jose`
216
+ - **Files modified:** package.json, package-lock.json
217
+ - **Verification:** Import succeeds, build passes
218
+ - **Committed in:** def456g (Task 4 commit)
219
+
220
+ ---
221
+
222
+ **Total deviations:** 2 auto-fixed (1 missing critical, 1 blocking)
223
+ **Impact on plan:** Both auto-fixes essential for security and functionality. No scope creep.
224
+
225
+ ## Issues Encountered
226
+ - jsonwebtoken CommonJS import failed in Edge runtime - switched to jose (planned library change, worked as expected)
227
+
228
+ ## Next Phase Readiness
229
+ - Auth foundation complete, ready for feature development
230
+ - User registration endpoint needed before public launch
231
+
232
+ ---
233
+ *Phase: 01-foundation*
234
+ *Completed: 2025-01-15*
235
+ ```
236
+ </example>
237
+
238
+ <guidelines>
239
+ **Frontmatter:** MANDATORY - complete all fields. Enables automatic context assembly for future planning.
240
+
241
+ **One-liner:** Must be substantive. "JWT auth with refresh rotation using jose library" not "Authentication implemented".
242
+
243
+ **Decisions section:**
244
+ - Key decisions made during execution with rationale
245
+ - Extracted to state.md accumulated context
246
+ - Use "None - followed plan as specified" if no deviations
247
+
248
+ **After creation:** state.md updated with position, decisions, issues.
249
+ </guidelines>
@@ -0,0 +1,247 @@
1
+ # UAT Template
2
+
3
+ Template for `.planning/phases/XX-name/{phase_num}-uat.md` — persistent UAT session tracking.
4
+
5
+ ---
6
+
7
+ ## File Template
8
+
9
+ ```markdown
10
+ ---
11
+ status: testing | complete | diagnosed
12
+ phase: XX-name
13
+ source: [list of summary.md files tested]
14
+ started: [ISO timestamp]
15
+ updated: [ISO timestamp]
16
+ ---
17
+
18
+ ## Current Test
19
+ <!-- OVERWRITE each test - shows where we are -->
20
+
21
+ number: [N]
22
+ name: [test name]
23
+ expected: |
24
+ [what user should observe]
25
+ awaiting: user response
26
+
27
+ ## Tests
28
+
29
+ ### 1. [Test Name]
30
+ expected: [observable behavior - what user should see]
31
+ result: [pending]
32
+
33
+ ### 2. [Test Name]
34
+ expected: [observable behavior]
35
+ result: pass
36
+
37
+ ### 3. [Test Name]
38
+ expected: [observable behavior]
39
+ result: issue
40
+ reported: "[verbatim user response]"
41
+ severity: major
42
+
43
+ ### 4. [Test Name]
44
+ expected: [observable behavior]
45
+ result: skipped
46
+ reason: [why skipped]
47
+
48
+ ...
49
+
50
+ ## Summary
51
+
52
+ total: [N]
53
+ passed: [N]
54
+ issues: [N]
55
+ pending: [N]
56
+ skipped: [N]
57
+
58
+ ## Gaps
59
+
60
+ <!-- YAML format for plan-phase --gaps consumption -->
61
+ - truth: "[expected behavior from test]"
62
+ status: failed
63
+ reason: "User reported: [verbatim response]"
64
+ severity: blocker | major | minor | cosmetic
65
+ test: [N]
66
+ root_cause: "" # Filled by diagnosis
67
+ artifacts: [] # Filled by diagnosis
68
+ missing: [] # Filled by diagnosis
69
+ debug_session: "" # Filled by diagnosis
70
+ ```
71
+
72
+ ---
73
+
74
+ <section_rules>
75
+
76
+ **Frontmatter:**
77
+ - `status`: OVERWRITE - "testing" or "complete"
78
+ - `phase`: IMMUTABLE - set on creation
79
+ - `source`: IMMUTABLE - SUMMARY files being tested
80
+ - `started`: IMMUTABLE - set on creation
81
+ - `updated`: OVERWRITE - update on every change
82
+
83
+ **Current Test:**
84
+ - OVERWRITE entirely on each test transition
85
+ - Shows which test is active and what's awaited
86
+ - On completion: "[testing complete]"
87
+
88
+ **Tests:**
89
+ - Each test: OVERWRITE result field when user responds
90
+ - `result` values: [pending], pass, issue, skipped
91
+ - If issue: add `reported` (verbatim) and `severity` (inferred)
92
+ - If skipped: add `reason` if provided
93
+
94
+ **Summary:**
95
+ - OVERWRITE counts after each response
96
+ - Tracks: total, passed, issues, pending, skipped
97
+
98
+ **Gaps:**
99
+ - APPEND only when issue found (YAML format)
100
+ - After diagnosis: fill `root_cause`, `artifacts`, `missing`, `debug_session`
101
+ - This section feeds directly into /pan:plan-phase --gaps
102
+
103
+ </section_rules>
104
+
105
+ <diagnosis_lifecycle>
106
+
107
+ **After testing complete (status: complete), if gaps exist:**
108
+
109
+ 1. User runs diagnosis (from verify-work offer or manually)
110
+ 2. diagnose-issues workflow spawns parallel debug agents
111
+ 3. Each agent investigates one gap, returns root cause
112
+ 4. uat.md Gaps section updated with diagnosis:
113
+ - Each gap gets `root_cause`, `artifacts`, `missing`, `debug_session` filled
114
+ 5. status → "diagnosed"
115
+ 6. Ready for /pan:plan-phase --gaps with root causes
116
+
117
+ **After diagnosis:**
118
+ ```yaml
119
+ ## Gaps
120
+
121
+ - truth: "Comment appears immediately after submission"
122
+ status: failed
123
+ reason: "User reported: works but doesn't show until I refresh the page"
124
+ severity: major
125
+ test: 2
126
+ root_cause: "useEffect in CommentList.tsx missing commentCount dependency"
127
+ artifacts:
128
+ - path: "src/components/CommentList.tsx"
129
+ issue: "useEffect missing dependency"
130
+ missing:
131
+ - "Add commentCount to useEffect dependency array"
132
+ debug_session: ".planning/debug/comment-not-refreshing.md"
133
+ ```
134
+
135
+ </diagnosis_lifecycle>
136
+
137
+ <lifecycle>
138
+
139
+ **Creation:** When /pan:verify-phase starts new session
140
+ - Extract tests from summary.md files
141
+ - Set status to "testing"
142
+ - Current Test points to test 1
143
+ - All tests have result: [pending]
144
+
145
+ **During testing:**
146
+ - Present test from Current Test section
147
+ - User responds with pass confirmation or issue description
148
+ - Update test result (pass/issue/skipped)
149
+ - Update Summary counts
150
+ - If issue: append to Gaps section (YAML format), infer severity
151
+ - Move Current Test to next pending test
152
+
153
+ **On completion:**
154
+ - status → "complete"
155
+ - Current Test → "[testing complete]"
156
+ - Commit file
157
+ - Present summary with next steps
158
+
159
+ **Resume after /clear:**
160
+ 1. Read frontmatter → know phase and status
161
+ 2. Read Current Test → know where we are
162
+ 3. Find first [pending] result → continue from there
163
+ 4. Summary shows progress so far
164
+
165
+ </lifecycle>
166
+
167
+ <severity_guide>
168
+
169
+ Severity is INFERRED from user's natural language, never asked.
170
+
171
+ | User describes | Infer |
172
+ |----------------|-------|
173
+ | Crash, error, exception, fails completely, unusable | blocker |
174
+ | Doesn't work, nothing happens, wrong behavior, missing | major |
175
+ | Works but..., slow, weird, minor, small issue | minor |
176
+ | Color, font, spacing, alignment, visual, looks off | cosmetic |
177
+
178
+ Default: **major** (safe default, user can clarify if wrong)
179
+
180
+ </severity_guide>
181
+
182
+ <good_example>
183
+ ```markdown
184
+ ---
185
+ status: diagnosed
186
+ phase: 04-comments
187
+ source: 04-01-summary.md, 04-02-summary.md
188
+ started: 2025-01-15T10:30:00Z
189
+ updated: 2025-01-15T10:45:00Z
190
+ ---
191
+
192
+ ## Current Test
193
+
194
+ [testing complete]
195
+
196
+ ## Tests
197
+
198
+ ### 1. View Comments on Post
199
+ expected: Comments section expands, shows count and comment list
200
+ result: pass
201
+
202
+ ### 2. Create Top-Level Comment
203
+ expected: Submit comment via rich text editor, appears in list with author info
204
+ result: issue
205
+ reported: "works but doesn't show until I refresh the page"
206
+ severity: major
207
+
208
+ ### 3. Reply to a Comment
209
+ expected: Click Reply, inline composer appears, submit shows nested reply
210
+ result: pass
211
+
212
+ ### 4. Visual Nesting
213
+ expected: 3+ level thread shows indentation, left borders, caps at reasonable depth
214
+ result: pass
215
+
216
+ ### 5. Delete Own Comment
217
+ expected: Click delete on own comment, removed or shows [deleted] if has replies
218
+ result: pass
219
+
220
+ ### 6. Comment Count
221
+ expected: Post shows accurate count, increments when adding comment
222
+ result: pass
223
+
224
+ ## Summary
225
+
226
+ total: 6
227
+ passed: 5
228
+ issues: 1
229
+ pending: 0
230
+ skipped: 0
231
+
232
+ ## Gaps
233
+
234
+ - truth: "Comment appears immediately after submission in list"
235
+ status: failed
236
+ reason: "User reported: works but doesn't show until I refresh the page"
237
+ severity: major
238
+ test: 2
239
+ root_cause: "useEffect in CommentList.tsx missing commentCount dependency"
240
+ artifacts:
241
+ - path: "src/components/CommentList.tsx"
242
+ issue: "useEffect missing dependency"
243
+ missing:
244
+ - "Add commentCount to useEffect dependency array"
245
+ debug_session: ".planning/debug/comment-not-refreshing.md"
246
+ ```
247
+ </good_example>