@sienklogic/plan-build-run 2.0.2 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/dashboard/src/routes/pages.routes.js +11 -4
  2. package/dashboard/src/services/dashboard.service.js +81 -17
  3. package/dashboard/src/services/phase.service.js +30 -24
  4. package/dashboard/src/services/roadmap.service.js +3 -3
  5. package/dashboard/src/views/partials/phase-content.ejs +5 -4
  6. package/package.json +1 -1
  7. package/plugins/cursor-pbr/.cursor-plugin/plugin.json +1 -1
  8. package/plugins/cursor-pbr/CHANGELOG.md +15 -0
  9. package/plugins/cursor-pbr/README.md +118 -0
  10. package/plugins/cursor-pbr/agents/codebase-mapper.md +108 -0
  11. package/plugins/cursor-pbr/agents/debugger.md +168 -0
  12. package/plugins/cursor-pbr/agents/executor.md +236 -0
  13. package/plugins/cursor-pbr/agents/general.md +87 -0
  14. package/plugins/cursor-pbr/agents/integration-checker.md +87 -0
  15. package/plugins/cursor-pbr/agents/plan-checker.md +198 -0
  16. package/plugins/cursor-pbr/agents/planner.md +180 -0
  17. package/plugins/cursor-pbr/agents/researcher.md +162 -0
  18. package/plugins/cursor-pbr/agents/synthesizer.md +101 -0
  19. package/plugins/cursor-pbr/agents/verifier.md +193 -0
  20. package/plugins/cursor-pbr/assets/logo.svg +21 -0
  21. package/plugins/cursor-pbr/hooks/hooks.json +189 -7
  22. package/plugins/cursor-pbr/references/agent-anti-patterns.md +25 -0
  23. package/plugins/cursor-pbr/references/agent-interactions.md +135 -0
  24. package/plugins/cursor-pbr/references/agent-teams.md +55 -0
  25. package/plugins/cursor-pbr/references/checkpoints.md +158 -0
  26. package/plugins/cursor-pbr/references/common-bug-patterns.md +14 -0
  27. package/plugins/cursor-pbr/references/config-reference.md +442 -0
  28. package/plugins/cursor-pbr/references/continuation-format.md +213 -0
  29. package/plugins/cursor-pbr/references/deviation-rules.md +113 -0
  30. package/plugins/cursor-pbr/references/git-integration.md +227 -0
  31. package/plugins/cursor-pbr/references/integration-patterns.md +118 -0
  32. package/plugins/cursor-pbr/references/model-profiles.md +100 -0
  33. package/plugins/cursor-pbr/references/model-selection.md +32 -0
  34. package/plugins/cursor-pbr/references/pbr-rules.md +194 -0
  35. package/plugins/cursor-pbr/references/plan-authoring.md +182 -0
  36. package/plugins/cursor-pbr/references/plan-format.md +288 -0
  37. package/plugins/cursor-pbr/references/planning-config.md +214 -0
  38. package/plugins/cursor-pbr/references/questioning.md +215 -0
  39. package/plugins/cursor-pbr/references/reading-verification.md +128 -0
  40. package/plugins/cursor-pbr/references/stub-patterns.md +161 -0
  41. package/plugins/cursor-pbr/references/subagent-coordination.md +120 -0
  42. package/plugins/cursor-pbr/references/ui-formatting.md +462 -0
  43. package/plugins/cursor-pbr/references/verification-patterns.md +199 -0
  44. package/plugins/cursor-pbr/references/wave-execution.md +96 -0
  45. package/plugins/cursor-pbr/rules/pbr-workflow.mdc +48 -0
  46. package/plugins/cursor-pbr/setup.ps1 +78 -0
  47. package/plugins/cursor-pbr/setup.sh +83 -0
  48. package/plugins/cursor-pbr/skills/begin/SKILL.md +566 -0
  49. package/plugins/cursor-pbr/skills/begin/templates/PROJECT.md.tmpl +34 -0
  50. package/plugins/cursor-pbr/skills/begin/templates/REQUIREMENTS.md.tmpl +19 -0
  51. package/plugins/cursor-pbr/skills/begin/templates/STATE.md.tmpl +50 -0
  52. package/plugins/cursor-pbr/skills/begin/templates/config.json.tmpl +64 -0
  53. package/plugins/cursor-pbr/skills/begin/templates/researcher-prompt.md.tmpl +20 -0
  54. package/plugins/cursor-pbr/skills/begin/templates/roadmap-prompt.md.tmpl +31 -0
  55. package/plugins/cursor-pbr/skills/begin/templates/synthesis-prompt.md.tmpl +17 -0
  56. package/plugins/cursor-pbr/skills/build/SKILL.md +902 -0
  57. package/plugins/cursor-pbr/skills/config/SKILL.md +253 -0
  58. package/plugins/cursor-pbr/skills/continue/SKILL.md +159 -0
  59. package/plugins/cursor-pbr/skills/debug/SKILL.md +512 -0
  60. package/plugins/cursor-pbr/skills/debug/templates/continuation-prompt.md.tmpl +17 -0
  61. package/plugins/cursor-pbr/skills/debug/templates/initial-investigation-prompt.md.tmpl +28 -0
  62. package/plugins/cursor-pbr/skills/discuss/SKILL.md +344 -0
  63. package/plugins/cursor-pbr/skills/discuss/templates/CONTEXT.md.tmpl +62 -0
  64. package/plugins/cursor-pbr/skills/discuss/templates/decision-categories.md +10 -0
  65. package/plugins/cursor-pbr/skills/explore/SKILL.md +375 -0
  66. package/plugins/cursor-pbr/skills/health/SKILL.md +218 -0
  67. package/plugins/cursor-pbr/skills/health/templates/check-pattern.md.tmpl +31 -0
  68. package/plugins/cursor-pbr/skills/health/templates/output-format.md.tmpl +64 -0
  69. package/plugins/cursor-pbr/skills/help/SKILL.md +152 -0
  70. package/plugins/cursor-pbr/skills/import/SKILL.md +499 -0
  71. package/plugins/cursor-pbr/skills/milestone/SKILL.md +701 -0
  72. package/plugins/cursor-pbr/skills/milestone/templates/audit-report.md.tmpl +49 -0
  73. package/plugins/cursor-pbr/skills/milestone/templates/stats-file.md.tmpl +31 -0
  74. package/plugins/cursor-pbr/skills/note/SKILL.md +228 -0
  75. package/plugins/cursor-pbr/skills/pause/SKILL.md +246 -0
  76. package/plugins/cursor-pbr/skills/pause/templates/continue-here.md.tmpl +72 -0
  77. package/plugins/cursor-pbr/skills/plan/SKILL.md +648 -0
  78. package/plugins/cursor-pbr/skills/plan/templates/checker-prompt.md.tmpl +22 -0
  79. package/plugins/cursor-pbr/skills/plan/templates/gap-closure-prompt.md.tmpl +33 -0
  80. package/plugins/cursor-pbr/skills/plan/templates/planner-prompt.md.tmpl +39 -0
  81. package/plugins/cursor-pbr/skills/plan/templates/researcher-prompt.md.tmpl +20 -0
  82. package/plugins/cursor-pbr/skills/plan/templates/revision-prompt.md.tmpl +24 -0
  83. package/plugins/cursor-pbr/skills/quick/SKILL.md +351 -0
  84. package/plugins/cursor-pbr/skills/resume/SKILL.md +399 -0
  85. package/plugins/cursor-pbr/skills/review/SKILL.md +649 -0
  86. package/plugins/cursor-pbr/skills/review/templates/debugger-prompt.md.tmpl +61 -0
  87. package/plugins/cursor-pbr/skills/review/templates/gap-planner-prompt.md.tmpl +41 -0
  88. package/plugins/cursor-pbr/skills/review/templates/verifier-prompt.md.tmpl +116 -0
  89. package/plugins/cursor-pbr/skills/scan/SKILL.md +301 -0
  90. package/plugins/cursor-pbr/skills/scan/templates/mapper-prompt.md.tmpl +202 -0
  91. package/plugins/cursor-pbr/skills/setup/SKILL.md +250 -0
  92. package/plugins/cursor-pbr/skills/shared/commit-planning-docs.md +36 -0
  93. package/plugins/cursor-pbr/skills/shared/config-loading.md +103 -0
  94. package/plugins/cursor-pbr/skills/shared/context-budget.md +41 -0
  95. package/plugins/cursor-pbr/skills/shared/context-loader-task.md +87 -0
  96. package/plugins/cursor-pbr/skills/shared/digest-select.md +80 -0
  97. package/plugins/cursor-pbr/skills/shared/domain-probes.md +126 -0
  98. package/plugins/cursor-pbr/skills/shared/error-reporting.md +80 -0
  99. package/plugins/cursor-pbr/skills/shared/gate-prompts.md +389 -0
  100. package/plugins/cursor-pbr/skills/shared/phase-argument-parsing.md +46 -0
  101. package/plugins/cursor-pbr/skills/shared/progress-display.md +54 -0
  102. package/plugins/cursor-pbr/skills/shared/revision-loop.md +82 -0
  103. package/plugins/cursor-pbr/skills/shared/state-loading.md +63 -0
  104. package/plugins/cursor-pbr/skills/shared/state-update.md +162 -0
  105. package/plugins/cursor-pbr/skills/shared/universal-anti-patterns.md +34 -0
  106. package/plugins/cursor-pbr/skills/status/SKILL.md +362 -0
  107. package/plugins/cursor-pbr/skills/todo/SKILL.md +195 -0
  108. package/plugins/cursor-pbr/templates/CONTEXT.md.tmpl +53 -0
  109. package/plugins/cursor-pbr/templates/INTEGRATION-REPORT.md.tmpl +152 -0
  110. package/plugins/cursor-pbr/templates/RESEARCH-SUMMARY.md.tmpl +98 -0
  111. package/plugins/cursor-pbr/templates/ROADMAP.md.tmpl +41 -0
  112. package/plugins/cursor-pbr/templates/SUMMARY.md.tmpl +82 -0
  113. package/plugins/cursor-pbr/templates/VERIFICATION-DETAIL.md.tmpl +117 -0
  114. package/plugins/cursor-pbr/templates/continue-here.md.tmpl +74 -0
  115. package/plugins/cursor-pbr/templates/prompt-partials/phase-project-context.md.tmpl +38 -0
  116. package/plugins/pbr/agents/codebase-mapper.md +41 -206
  117. package/plugins/pbr/agents/debugger.md +65 -171
  118. package/plugins/pbr/agents/executor.md +90 -275
  119. package/plugins/pbr/agents/general.md +27 -97
  120. package/plugins/pbr/agents/integration-checker.md +35 -112
  121. package/plugins/pbr/agents/plan-checker.md +71 -164
  122. package/plugins/pbr/agents/planner.md +75 -246
  123. package/plugins/pbr/agents/researcher.md +63 -255
  124. package/plugins/pbr/agents/synthesizer.md +49 -174
  125. package/plugins/pbr/agents/verifier.md +75 -366
  126. package/plugins/pbr/hooks/hooks.json +14 -10
  127. package/plugins/pbr/scripts/auto-continue.js +20 -4
  128. package/plugins/pbr/scripts/check-dangerous-commands.js +1 -1
  129. package/plugins/pbr/scripts/check-phase-boundary.js +1 -1
  130. package/plugins/pbr/scripts/check-plan-format.js +3 -3
  131. package/plugins/pbr/scripts/check-roadmap-sync.js +3 -3
  132. package/plugins/pbr/scripts/check-skill-workflow.js +1 -1
  133. package/plugins/pbr/scripts/check-state-sync.js +2 -2
  134. package/plugins/pbr/scripts/check-subagent-output.js +1 -1
  135. package/plugins/pbr/scripts/check-summary-gate.js +198 -0
  136. package/plugins/pbr/scripts/context-budget-check.js +1 -1
  137. package/plugins/pbr/scripts/event-handler.js +2 -2
  138. package/plugins/pbr/scripts/event-logger.js +1 -1
  139. package/plugins/pbr/scripts/log-subagent.js +1 -1
  140. package/plugins/pbr/scripts/pbr-tools.js +1 -1
  141. package/plugins/pbr/scripts/post-write-dispatch.js +1 -1
  142. package/plugins/pbr/scripts/post-write-quality.js +1 -1
  143. package/plugins/pbr/scripts/pre-bash-dispatch.js +1 -1
  144. package/plugins/pbr/scripts/pre-write-dispatch.js +16 -3
  145. package/plugins/pbr/scripts/session-cleanup.js +1 -1
  146. package/plugins/pbr/scripts/status-line.js +1 -1
  147. package/plugins/pbr/scripts/suggest-compact.js +1 -1
  148. package/plugins/pbr/scripts/task-completed.js +1 -1
  149. package/plugins/pbr/scripts/track-context-budget.js +11 -6
  150. package/plugins/pbr/scripts/validate-commit.js +1 -1
  151. package/plugins/pbr/scripts/validate-task.js +1 -1
  152. package/plugins/cursor-pbr/agents/.gitkeep +0 -0
  153. package/plugins/cursor-pbr/references/.gitkeep +0 -0
  154. package/plugins/cursor-pbr/rules/.gitkeep +0 -0
  155. package/plugins/cursor-pbr/skills/.gitkeep +0 -0
  156. package/plugins/cursor-pbr/templates/.gitkeep +0 -0
@@ -0,0 +1,512 @@
1
+ ---
2
+ name: debug
3
+ description: "Systematic debugging with hypothesis testing. Persistent across sessions."
4
+ argument-hint: "[issue description]"
5
+ ---
6
+
7
+ ## Step 0 — Immediate Output
8
+
9
+ **Before ANY tool calls**, display this banner:
10
+
11
+ ```
12
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
13
+ PLAN-BUILD-RUN ► DEBUGGING
14
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
15
+ ```
16
+
17
+ Then proceed to Step 1.
18
+
19
+ # /pbr:debug — Systematic Debugging
20
+
21
+ You are running the **debug** skill. Your job is to run a structured, hypothesis-driven debugging session that persists across conversations. You track every hypothesis, test, and finding in a debug file so work is never lost.
22
+
23
+ This skill **spawns Task(subagent_type: "pbr:debugger")** for investigation work.
24
+
25
+ ---
26
+
27
+ ## Context Budget
28
+
29
+ Reference: `skills/shared/context-budget.md` for the universal orchestrator rules.
30
+
31
+ Additionally for this skill:
32
+ - **Never** perform investigation work yourself — delegate ALL analysis to the debugger subagent
33
+ - **Minimize** reading debug file content — read only the latest hypothesis and result section
34
+ - **Delegate** all code reading, hypothesis testing, and fix attempts to the debugger subagent
35
+
36
+ ---
37
+
38
+ ## Core Principle
39
+
40
+ **Debug systematically, not randomly.** Every investigation step must have a hypothesis, a test, and a recorded result. No "let me just try this" — every action has a reason and is documented.
41
+
42
+ ---
43
+
44
+ ## Flow
45
+
46
+ ### Step 1: Ensure Debug Directory Exists
47
+
48
+ Before any file operations, ensure both directories exist by running:
49
+
50
+ ```bash
51
+ mkdir -p .planning/debug
52
+ ```
53
+
54
+ This handles the case where neither `.planning/` nor `.planning/debug/` exist yet (debug can be run before other skills that create `.planning/`). Do NOT skip this step — writing files to a non-existent directory will fail.
55
+
56
+ ### Step 2: Check for Active Debug Sessions
57
+
58
+ **Load depth profile:** Run `node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js config resolve-depth` to get `debug.max_hypothesis_rounds`. If the command fails (no config.json or CLI error), default to 5 rounds. Initialize a round counter at 0. This counter increments each time a continuation debugger is spawned.
59
+
60
+ Scan `.planning/debug/` for existing debug files:
61
+
62
+ ```
63
+ .planning/debug/
64
+ {NNN}-{slug}.md # Each debug session is a file
65
+ ```
66
+
67
+ Read each file's frontmatter to check status:
68
+ - `status: active` — session is in progress
69
+ - `status: resolved` — session is complete
70
+ - `status: stale` — session was abandoned
71
+
72
+ **If active sessions found:**
73
+
74
+ Use the **debug-session-select** pattern from `skills/shared/gate-prompts.md`:
75
+ question: "Found active debug sessions. Which would you like?"
76
+
77
+ Generate options dynamically from active sessions:
78
+ - Each active session becomes an option: label "#{NNN}: {title}", description "Started {date}, last: {last hypothesis}"
79
+ - Always include "New session" as the last option: description "Start a fresh debug investigation"
80
+ - If more than 3 active sessions exist, show only the 3 most recent plus "New session" (max 4 options)
81
+
82
+ Handle responses:
83
+ - If user selects an existing session: go to **Resume Flow** (Step 3b)
84
+ - If user selects "New session": go to **New Session Flow** (Step 3a)
85
+ - If user types a session number not in the list: look it up and resume it
86
+
87
+ **If no active sessions found:**
88
+ - Go to **New Session Flow** (Step 3a)
89
+
90
+ ### Step 3a: New Session Flow
91
+
92
+ #### Gather Symptoms
93
+
94
+ If `$ARGUMENTS` is provided and descriptive:
95
+ - Use it as the initial issue description
96
+ - Still ask targeted follow-up questions
97
+
98
+ If `$ARGUMENTS` is empty or minimal:
99
+ - Ask the user for symptoms
100
+
101
+ **Symptom gathering questions** (ask as plain text — these are freeform, do NOT use AskUserQuestion):
102
+
103
+ 1. **Expected behavior**: "What should happen?"
104
+ 2. **Actual behavior**: "What actually happens? Include error messages if any."
105
+ 3. **Reproduction**: "How do you trigger this? Steps to reproduce?"
106
+ 4. **Onset**: "When did this start? Did anything change recently (new code, dependency update, config change)?"
107
+ 5. **Scope**: "Does this affect everything or just specific cases? Any patterns?"
108
+
109
+ **Optional follow-ups** (ask if relevant):
110
+ - "What have you already tried?"
111
+ - "Does this happen in all environments (dev, prod, test)?"
112
+ - "Any relevant log output?"
113
+
114
+ #### Generate Session ID
115
+
116
+ 1. Scan `.planning/debug/` for existing files
117
+ 2. Extract NNN prefixes
118
+ 3. Next number = highest + 1 (start at 001)
119
+ 4. Generate slug from issue title (same rules as quick task slugs)
120
+
121
+ #### Create Debug File
122
+
123
+ Create `.planning/debug/{NNN}-{slug}.md`:
124
+
125
+ ```markdown
126
+ ---
127
+ id: "{NNN}"
128
+ title: "{issue title}"
129
+ status: active
130
+ created: "{ISO date}"
131
+ updated: "{ISO date}"
132
+ severity: "{critical|high|medium|low}"
133
+ category: "{runtime|build|test|config|integration|unknown}"
134
+ ---
135
+
136
+ # Debug Session: {title}
137
+
138
+ ## Symptoms
139
+
140
+ **Expected:** {expected behavior}
141
+ **Actual:** {actual behavior}
142
+ **Reproduction:** {steps}
143
+ **Onset:** {when it started}
144
+ **Scope:** {affected areas}
145
+
146
+ ## Environment
147
+
148
+ - OS: {detected or reported}
149
+ - Runtime: {node version, python version, etc.}
150
+ - Relevant config: {any config that matters}
151
+
152
+ ## Investigation Log
153
+
154
+ ### Round 1 (automated)
155
+
156
+ {This section is filled by debugger}
157
+
158
+ ## Hypotheses
159
+
160
+ | # | Hypothesis | Status | Evidence |
161
+ |---|-----------|--------|----------|
162
+ | 1 | {hypothesis} | {testing/confirmed/rejected} | {evidence} |
163
+
164
+ ## Root Cause
165
+
166
+ {Filled when found}
167
+
168
+ ## Fix Applied
169
+
170
+ {Filled when fixed}
171
+
172
+ ## Timeline
173
+
174
+ - {ISO date}: Session created
175
+ ```
176
+
177
+ #### Spawn Debugger
178
+
179
+ Display to the user: `◐ Spawning debugger...`
180
+
181
+ Spawn `Task(subagent_type: "pbr:debugger")` with the prompt template.
182
+
183
+ Read `skills/debug/templates/initial-investigation-prompt.md.tmpl` for the spawn prompt. Fill in the `{NNN}`, `{slug}`, and symptom placeholders with values from the debug file created above.
184
+
185
+ ### Step 3b: Resume Flow
186
+
187
+ 1. Read the debug file content
188
+ 2. Parse the investigation log and hypotheses table
189
+ 3. Display to user:
190
+
191
+ ```
192
+ Resuming debug session #{NNN}: {title}
193
+
194
+ Last state:
195
+ - Hypotheses tested: {N}
196
+ - Confirmed: {list or "none yet"}
197
+ - Rejected: {list}
198
+ - Current lead: {most promising hypothesis}
199
+
200
+ Continuing investigation...
201
+ ```
202
+
203
+ 4. **Increment the round counter** (resuming counts as a new round). Display to the user: `◐ Spawning debugger (resuming session #{NNN}, round {N})...`
204
+
205
+ Spawn `Task(subagent_type: "pbr:debugger")` with the continuation prompt template.
206
+
207
+ Read `skills/debug/templates/continuation-prompt.md.tmpl` for the spawn prompt. Fill in the `{NNN}`, `{slug}`, and `{paste investigation log...}` placeholders with data from the debug file.
208
+
209
+ ### Step 4: Handle Debugger Results
210
+
211
+ When the debugger agent completes, display: `✓ Debug session complete — {N} hypotheses tested` (read the hypothesis count from the debug file's Hypotheses table).
212
+
213
+ The debugger returns one of four outcomes:
214
+
215
+ #### ROOT CAUSE FOUND + FIX
216
+
217
+ ```
218
+ Root cause identified: {cause}
219
+ Fix applied: {description}
220
+ Commit: {hash}
221
+ ```
222
+
223
+ Actions:
224
+ 1. Update debug file:
225
+ - Set `status: resolved`
226
+ - Fill "Root Cause" section
227
+ - Fill "Fix Applied" section
228
+ - Add timeline entry
229
+ 2. Update STATE.md if it has a Debug Sessions section
230
+ 3. Report to user with branded output:
231
+
232
+ ```
233
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
234
+ PLAN-BUILD-RUN ► BUG RESOLVED ✓
235
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
236
+
237
+ **Session #{NNN}:** {title}
238
+ **Root cause:** {cause}
239
+ **Fix:** {description}
240
+ **Commit:** {hash}
241
+
242
+ ───────────────────────────────────────────────────────────────
243
+
244
+ ## ▶ Next Up
245
+
246
+ **Continue your workflow** — the bug is fixed
247
+
248
+ `/pbr:status`
249
+
250
+ <sub>`/clear` first → fresh context window</sub>
251
+
252
+ ───────────────────────────────────────────────────────────────
253
+
254
+ **Also available:**
255
+ - `/pbr:continue` — execute next logical step
256
+ - `/pbr:review {N}` — verify the current phase
257
+
258
+ ───────────────────────────────────────────────────────────────
259
+ ```
260
+
261
+ #### ROOT CAUSE FOUND (no fix)
262
+
263
+ Used when the debugger was invoked with `find_root_cause_only` or when the fix is too complex for auto-application.
264
+
265
+ ```
266
+ Root cause identified: {cause}
267
+ Suggested fix: {approach}
268
+ ```
269
+
270
+ Actions:
271
+ 1. Update debug file:
272
+ - Set `status: resolved`
273
+ - Fill "Root Cause" section
274
+ - Add suggested fix to notes
275
+ 2. Suggest next steps to user:
276
+
277
+ ```
278
+ ───────────────────────────────────────────────────────────────
279
+
280
+ ## ▶ Next Up
281
+
282
+ **Apply the fix** — root cause identified, fix needed
283
+
284
+ `/pbr:quick {fix description}`
285
+
286
+ <sub>`/clear` first → fresh context window</sub>
287
+
288
+ ───────────────────────────────────────────────────────────────
289
+
290
+ **Also available:**
291
+ - `/pbr:plan` — for complex fixes that need planning
292
+ - `/pbr:status` — see project status
293
+
294
+ ───────────────────────────────────────────────────────────────
295
+ ```
296
+
297
+ #### CHECKPOINT
298
+
299
+ The debugger found something but needs user input or more investigation.
300
+
301
+ ```
302
+ Investigation progress:
303
+ - Tested: {hypotheses tested}
304
+ - Found: {key finding}
305
+ - Need: {what's needed to continue}
306
+ ```
307
+
308
+ Actions:
309
+ 1. Update debug file with findings so far
310
+ 2. Present checkpoint to user
311
+ 3. Use the **debug-checkpoint** pattern from `skills/shared/gate-prompts.md`:
312
+ question: "Investigation has reached a checkpoint. How should we proceed?"
313
+
314
+ Handle responses:
315
+ - "Continue": **Increment the round counter** (e.g., round 1 becomes round 2). Then display `◐ Spawning debugger (continuing investigation, round {N})...` and spawn another `Task(subagent_type: "pbr:debugger")` with updated context from the debug file
316
+ - "More info": **Increment the round counter.** Ask the user freeform what additional context they have, then update the debug file and spawn another debugger
317
+ - "New approach": **Increment the round counter.** Ask the user freeform what alternative angle to try, then update hypotheses and spawn another debugger
318
+
319
+ #### INCONCLUSIVE
320
+
321
+ The debugger exhausted its hypotheses without finding the root cause.
322
+
323
+ ```
324
+ Investigation exhausted:
325
+ - Tested: {all hypotheses}
326
+ - Rejected: {list}
327
+ - Remaining unknowns: {list}
328
+ ```
329
+
330
+ Actions:
331
+ 1. Update debug file with all findings
332
+ 2. Report to user:
333
+ - What was tested and eliminated
334
+ - What remains unknown
335
+ - Suggested next investigation approaches:
336
+ - Different reproduction steps
337
+ - Log-level debugging
338
+ - Environment comparison
339
+ - Bisect (git bisect to find the breaking commit)
340
+ - External help (stack overflow, docs)
341
+ 3. Keep session active for future resumption
342
+
343
+ ---
344
+
345
+ ## Debugger Investigation Protocol
346
+
347
+ The debugger agent follows this protocol internally:
348
+
349
+ ### Hypothesis-Driven Investigation
350
+
351
+ ```
352
+ 1. OBSERVE: Read error messages, logs, code around the failure point
353
+ 2. HYPOTHESIZE: "The most likely cause is X because Y"
354
+ 3. PREDICT: "If X is the cause, then test Z should show W"
355
+ 4. TEST: Execute test Z
356
+ 5. EVALUATE:
357
+ - Result matches prediction → hypothesis supported → investigate deeper
358
+ - Result contradicts → hypothesis rejected → try next hypothesis
359
+ - Result is unexpected → new information → form new hypothesis
360
+ ```
361
+
362
+ ### Investigation Techniques
363
+
364
+ | Technique | When to Use |
365
+ |-----------|------------|
366
+ | **Stack trace analysis** | Error with stack trace available |
367
+ | **Code path tracing** | Logic error, wrong behavior |
368
+ | **Log injection** | Need to see runtime values |
369
+ | **Binary search** | Know it worked before, need to find when it broke |
370
+ | **Isolation** | Complex system, need to narrow scope |
371
+ | **Comparison** | Works in one case, fails in another |
372
+ | **Dependency audit** | Recent dependency changes |
373
+ | **Config diff** | Works in one environment, not another |
374
+
375
+ ### Evidence Quality
376
+
377
+ | Quality | Description | Action |
378
+ |---------|-------------|--------|
379
+ | **Strong** | Directly proves/disproves hypothesis | Record and move on |
380
+ | **Moderate** | Suggests but doesn't prove | Record, seek corroboration |
381
+ | **Weak** | Tangentially related | Note but don't base decisions on it |
382
+ | **Misleading** | Red herring | Record as eliminated, explain why |
383
+
384
+ ### Hypothesis Round Limit
385
+
386
+ The maximum number of investigation rounds is controlled by the depth profile's `debug.max_hypothesis_rounds` setting:
387
+ - `quick`: 3 rounds (fast, surface-level investigation)
388
+ - `standard`: 5 rounds (default)
389
+ - `comprehensive`: 10 rounds (deep investigation)
390
+
391
+ The orchestrator tracks the round count. Before spawning each continuation debugger (Step 4 "CHECKPOINT" -> "Continue"), increment the round counter. If the counter reaches the limit:
392
+ - Do NOT spawn another debugger
393
+ - Present to user: "Debug session has reached the hypothesis round limit ({N} rounds for {depth} mode). Options:"
394
+
395
+ Use AskUserQuestion:
396
+ question: "Reached {N}-round hypothesis limit. How should we proceed?"
397
+ header: "Debug Limit"
398
+ options:
399
+ - label: "Extend" description: "Allow {N} more rounds (doubles the limit)"
400
+ - label: "Wrap up" description: "Record findings so far and close the session"
401
+ - label: "Escalate" description: "Save context for manual debugging"
402
+
403
+ - If "Extend": double the limit and continue
404
+ - If "Wrap up": update debug file status to `stale`, record all findings, suggest next steps
405
+ - If "Escalate": write a detailed handoff document to the debug file with all hypotheses, evidence, and suggested manual investigation steps
406
+
407
+ ---
408
+
409
+ ## Debug File Management
410
+
411
+ ### Lifecycle
412
+
413
+ ```
414
+ active → resolved (root cause found and fixed)
415
+ active → stale (abandoned — no updates for 7+ days)
416
+ active → active (resumed after pause)
417
+ ```
418
+
419
+ ### Staleness Detection
420
+
421
+ When scanning for active sessions, check the `updated` date. If more than 7 days old:
422
+ - Mark as `stale` in status
423
+ - Still offer to resume, but warn: "This session is {N} days old. Context may have changed."
424
+
425
+ ### Cleanup
426
+
427
+ Old resolved debug files can accumulate. They serve as a knowledge base for similar issues. Do NOT auto-delete them.
428
+
429
+ ---
430
+
431
+ ## State Integration
432
+
433
+ Update STATE.md Debug Sessions section (create if needed):
434
+
435
+ ```markdown
436
+ ### Debug Sessions
437
+
438
+ | # | Issue | Status | Root Cause |
439
+ |---|-------|--------|------------|
440
+ | 001 | Login timeout | resolved | DB connection pool exhausted |
441
+ | 002 | CSS not loading | active | investigating |
442
+ ```
443
+
444
+ ---
445
+
446
+ ## Git Integration
447
+
448
+ Reference: `skills/shared/commit-planning-docs.md` for the standard commit pattern.
449
+
450
+ If `planning.commit_docs: true` in config.json:
451
+ - New session: `docs(planning): open debug session {NNN} - {slug}`
452
+ - Resolution: `docs(planning): resolve debug session {NNN} - {root cause summary}`
453
+ - Fix commits use standard format: `fix({scope}): {description}`
454
+
455
+ ---
456
+
457
+ ## Edge Cases
458
+
459
+ ### User provides a stack trace or error in arguments
460
+ - Parse it as the "Actual behavior" symptom
461
+ - Extract key information: error type, file, line number
462
+ - Use this to form initial hypotheses immediately
463
+
464
+ ### Debugger agent fails
465
+ If the debugger Task() fails or returns an error, display:
466
+ ```
467
+ ╔══════════════════════════════════════════════════════════════╗
468
+ ║ ERROR ║
469
+ ╚══════════════════════════════════════════════════════════════╝
470
+
471
+ Debugger agent failed for session #{NNN}.
472
+
473
+ **To fix:**
474
+ - Check the debug file at `.planning/debug/{NNN}-{slug}.md` for partial findings
475
+ - Re-run with `/pbr:debug` to resume the session
476
+ - If the issue persists, try a fresh session with different symptom details
477
+ ```
478
+
479
+ ### Issue is in a dependency (not user code)
480
+ - Document which dependency and version
481
+ - Check if there's a known issue (search patterns in node_modules, site-packages, etc.)
482
+ - Suggest: update dependency, pin version, or work around
483
+
484
+ ### Issue is intermittent
485
+ - Note intermittency in symptoms
486
+ - Suggest: run multiple times, add timing/logging, check for race conditions
487
+ - Investigation must account for non-deterministic reproduction
488
+
489
+ ### Multiple issues interacting
490
+ - If investigation reveals multiple separate issues, split into separate debug sessions
491
+ - Create additional debug files
492
+ - Track each independently
493
+
494
+ ### Fix would be a breaking change
495
+ - Report the root cause but DO NOT auto-apply the fix
496
+ - Present the trade-offs to the user
497
+ - Let the user decide how to proceed
498
+
499
+ ---
500
+
501
+ ## Anti-Patterns
502
+
503
+ 1. **DO NOT** skip hypothesis formation — every test must have a reason
504
+ 2. **DO NOT** make random changes hoping something works
505
+ 3. **DO NOT** ignore failed hypotheses — record why they failed
506
+ 4. **DO NOT** exceed the depth profile's `debug.max_hypothesis_rounds` limit without user confirmation (default: 5 for standard mode)
507
+ 5. **DO NOT** fix the symptom instead of the root cause
508
+ 6. **DO NOT** auto-apply fixes for breaking changes
509
+ 7. **DO NOT** delete debug files — they're a knowledge base
510
+ 8. **DO NOT** combine multiple bugs into one debug session
511
+ 9. **DO NOT** skip updating the debug file after each investigation round
512
+ 10. **DO NOT** start a new session when an active one covers the same issue
@@ -0,0 +1,17 @@
1
+ <\!-- canonical: ../../../../pbr/skills/debug/templates/continuation-prompt.md.tmpl -->
2
+ <!-- Source: skills/debug/SKILL.md | Purpose: Spawn prompt for continuation debugger investigation -->
3
+ You are debugger. Continue investigating the following issue.
4
+
5
+ Debug file: .planning/debug/{NNN}-{slug}.md
6
+ Mode: continuation
7
+
8
+ Previous findings:
9
+ {paste investigation log and hypotheses from the debug file}
10
+
11
+ Instructions:
12
+ 1. Read the debug file for full context
13
+ 2. Review what's already been tested
14
+ 3. Formulate NEW hypotheses based on prior findings
15
+ 4. Continue systematic investigation
16
+ 5. Update the debug file
17
+ 6. Return: ROOT_CAUSE_FOUND, CHECKPOINT, or INCONCLUSIVE
@@ -0,0 +1,28 @@
1
+ <\!-- canonical: ../../../../pbr/skills/debug/templates/initial-investigation-prompt.md.tmpl -->
2
+ <!-- Source: skills/debug/SKILL.md | Purpose: Spawn prompt for initial debugger investigation -->
3
+ You are debugger. Investigate the following issue systematically.
4
+
5
+ Debug file: .planning/debug/{NNN}-{slug}.md
6
+ Mode: initial_investigation
7
+
8
+ Symptoms:
9
+ - Expected: {expected}
10
+ - Actual: {actual}
11
+ - Reproduction: {steps}
12
+ - Onset: {onset}
13
+ - Scope: {scope}
14
+
15
+ Instructions:
16
+ 1. Read the debug file for full context
17
+ 2. Formulate 2-3 initial hypotheses based on symptoms
18
+ 3. For each hypothesis:
19
+ a. State what you're testing and why
20
+ b. Design a specific test (command, code inspection, log check)
21
+ c. Execute the test
22
+ d. Record the result (confirmed, rejected, inconclusive)
23
+ 4. Update the debug file with findings
24
+ 5. Return one of:
25
+ - ROOT_CAUSE_FOUND: {cause} + FIX: {what to change}
26
+ - ROOT_CAUSE_FOUND: {cause} (if find_root_cause_only mode)
27
+ - CHECKPOINT: {what was found, what to investigate next}
28
+ - INCONCLUSIVE: {findings so far, suggested next approaches}