@sienklogic/plan-build-run 2.50.0 → 2.52.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 (210) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/package.json +4 -2
  3. package/plugins/copilot-pbr/agents/audit.agent.md +2 -5
  4. package/plugins/copilot-pbr/agents/codebase-mapper.agent.md +1 -4
  5. package/plugins/copilot-pbr/agents/debugger.agent.md +1 -4
  6. package/plugins/copilot-pbr/agents/dev-sync.agent.md +6 -9
  7. package/plugins/copilot-pbr/agents/executor.agent.md +1 -4
  8. package/plugins/copilot-pbr/agents/general.agent.md +1 -4
  9. package/plugins/copilot-pbr/agents/integration-checker.agent.md +1 -4
  10. package/plugins/copilot-pbr/agents/plan-checker.agent.md +1 -4
  11. package/plugins/copilot-pbr/agents/planner.agent.md +1 -4
  12. package/plugins/copilot-pbr/agents/researcher.agent.md +1 -4
  13. package/plugins/copilot-pbr/agents/synthesizer.agent.md +1 -4
  14. package/plugins/copilot-pbr/agents/verifier.agent.md +2 -4
  15. package/plugins/copilot-pbr/commands/audit.md +5 -0
  16. package/plugins/copilot-pbr/commands/begin.md +5 -0
  17. package/plugins/copilot-pbr/commands/build.md +5 -0
  18. package/plugins/copilot-pbr/commands/config.md +5 -0
  19. package/plugins/copilot-pbr/commands/continue.md +5 -0
  20. package/plugins/copilot-pbr/commands/dashboard.md +5 -0
  21. package/plugins/copilot-pbr/commands/debug.md +5 -0
  22. package/plugins/copilot-pbr/commands/discuss.md +5 -0
  23. package/plugins/copilot-pbr/commands/do.md +5 -0
  24. package/plugins/copilot-pbr/commands/explore.md +5 -0
  25. package/plugins/copilot-pbr/commands/health.md +5 -0
  26. package/plugins/copilot-pbr/commands/help.md +5 -0
  27. package/plugins/copilot-pbr/commands/import.md +5 -0
  28. package/plugins/copilot-pbr/commands/milestone.md +5 -0
  29. package/plugins/copilot-pbr/commands/note.md +5 -0
  30. package/plugins/copilot-pbr/commands/pause.md +5 -0
  31. package/plugins/copilot-pbr/commands/plan.md +5 -0
  32. package/plugins/copilot-pbr/commands/quick.md +5 -0
  33. package/plugins/copilot-pbr/commands/resume.md +5 -0
  34. package/plugins/copilot-pbr/commands/review.md +5 -0
  35. package/plugins/copilot-pbr/commands/scan.md +5 -0
  36. package/plugins/copilot-pbr/commands/setup.md +5 -0
  37. package/plugins/copilot-pbr/commands/status.md +5 -0
  38. package/plugins/copilot-pbr/commands/statusline.md +5 -0
  39. package/plugins/copilot-pbr/commands/todo.md +5 -0
  40. package/plugins/copilot-pbr/plugin.json +1 -1
  41. package/plugins/copilot-pbr/references/agent-anti-patterns.md +0 -1
  42. package/plugins/copilot-pbr/references/agent-teams.md +0 -1
  43. package/plugins/copilot-pbr/references/common-bug-patterns.md +0 -1
  44. package/plugins/copilot-pbr/references/config-reference.md +0 -1
  45. package/plugins/copilot-pbr/references/continuation-format.md +0 -1
  46. package/plugins/copilot-pbr/references/deviation-rules.md +0 -1
  47. package/plugins/copilot-pbr/references/git-integration.md +0 -1
  48. package/plugins/copilot-pbr/references/integration-patterns.md +0 -1
  49. package/plugins/copilot-pbr/references/model-profiles.md +0 -1
  50. package/plugins/copilot-pbr/references/model-selection.md +0 -1
  51. package/plugins/copilot-pbr/references/pbr-rules.md +0 -1
  52. package/plugins/copilot-pbr/references/plan-authoring.md +0 -1
  53. package/plugins/copilot-pbr/references/plan-format.md +0 -1
  54. package/plugins/copilot-pbr/references/reading-verification.md +0 -1
  55. package/plugins/copilot-pbr/references/stub-patterns.md +0 -1
  56. package/plugins/copilot-pbr/references/wave-execution.md +0 -1
  57. package/plugins/copilot-pbr/skills/begin/SKILL.md +74 -52
  58. package/plugins/copilot-pbr/skills/build/SKILL.md +79 -93
  59. package/plugins/copilot-pbr/skills/config/SKILL.md +7 -0
  60. package/plugins/copilot-pbr/skills/continue/SKILL.md +31 -24
  61. package/plugins/copilot-pbr/skills/dashboard/SKILL.md +8 -7
  62. package/plugins/copilot-pbr/skills/debug/SKILL.md +11 -0
  63. package/plugins/copilot-pbr/skills/discuss/SKILL.md +2 -0
  64. package/plugins/copilot-pbr/skills/do/SKILL.md +2 -0
  65. package/plugins/copilot-pbr/skills/explore/SKILL.md +7 -1
  66. package/plugins/copilot-pbr/skills/health/SKILL.md +2 -0
  67. package/plugins/copilot-pbr/skills/help/SKILL.md +6 -0
  68. package/plugins/copilot-pbr/skills/import/SKILL.md +9 -0
  69. package/plugins/copilot-pbr/skills/milestone/SKILL.md +20 -196
  70. package/plugins/copilot-pbr/skills/note/SKILL.md +2 -0
  71. package/plugins/copilot-pbr/skills/pause/SKILL.md +5 -0
  72. package/plugins/copilot-pbr/skills/plan/SKILL.md +87 -119
  73. package/plugins/copilot-pbr/skills/quick/SKILL.md +13 -8
  74. package/plugins/copilot-pbr/skills/resume/SKILL.md +4 -0
  75. package/plugins/copilot-pbr/skills/review/SKILL.md +85 -47
  76. package/plugins/copilot-pbr/skills/scan/SKILL.md +6 -0
  77. package/plugins/copilot-pbr/skills/setup/SKILL.md +2 -0
  78. package/plugins/copilot-pbr/skills/shared/commit-planning-docs.md +0 -1
  79. package/plugins/copilot-pbr/skills/shared/config-loading.md +0 -1
  80. package/plugins/copilot-pbr/skills/shared/context-budget.md +0 -1
  81. package/plugins/copilot-pbr/skills/shared/context-loader-task.md +0 -1
  82. package/plugins/copilot-pbr/skills/shared/digest-select.md +0 -1
  83. package/plugins/copilot-pbr/skills/shared/domain-probes.md +0 -1
  84. package/plugins/copilot-pbr/skills/shared/gate-prompts.md +0 -1
  85. package/plugins/copilot-pbr/skills/shared/phase-argument-parsing.md +0 -1
  86. package/plugins/copilot-pbr/skills/shared/revision-loop.md +0 -1
  87. package/plugins/copilot-pbr/skills/shared/state-update.md +0 -1
  88. package/plugins/copilot-pbr/skills/shared/universal-anti-patterns.md +1 -2
  89. package/plugins/copilot-pbr/skills/status/SKILL.md +35 -26
  90. package/plugins/copilot-pbr/skills/test/SKILL.md +2 -2
  91. package/plugins/copilot-pbr/skills/todo/SKILL.md +2 -0
  92. package/plugins/copilot-pbr/templates/CONTEXT.md.tmpl +0 -1
  93. package/plugins/copilot-pbr/templates/INTEGRATION-REPORT.md.tmpl +0 -1
  94. package/plugins/copilot-pbr/templates/RESEARCH-SUMMARY.md.tmpl +0 -1
  95. package/plugins/copilot-pbr/templates/ROADMAP.md.tmpl +0 -1
  96. package/plugins/copilot-pbr/templates/SUMMARY.md.tmpl +0 -1
  97. package/plugins/copilot-pbr/templates/VERIFICATION-DETAIL.md.tmpl +0 -1
  98. package/plugins/copilot-pbr/templates/continue-here.md.tmpl +0 -1
  99. package/plugins/copilot-pbr/templates/prompt-partials/phase-project-context.md.tmpl +0 -1
  100. package/plugins/cursor-pbr/.cursor-plugin/plugin.json +1 -1
  101. package/plugins/cursor-pbr/agents/audit.md +1 -1
  102. package/plugins/cursor-pbr/agents/codebase-mapper.md +1 -1
  103. package/plugins/cursor-pbr/agents/debugger.md +1 -1
  104. package/plugins/cursor-pbr/agents/dev-sync.md +6 -6
  105. package/plugins/cursor-pbr/agents/executor.md +1 -1
  106. package/plugins/cursor-pbr/agents/general.md +1 -1
  107. package/plugins/cursor-pbr/agents/integration-checker.md +2 -2
  108. package/plugins/cursor-pbr/agents/plan-checker.md +2 -2
  109. package/plugins/cursor-pbr/agents/planner.md +1 -1
  110. package/plugins/cursor-pbr/agents/researcher.md +2 -2
  111. package/plugins/cursor-pbr/agents/synthesizer.md +1 -1
  112. package/plugins/cursor-pbr/agents/verifier.md +3 -2
  113. package/plugins/cursor-pbr/commands/audit.md +5 -0
  114. package/plugins/cursor-pbr/commands/begin.md +5 -0
  115. package/plugins/cursor-pbr/commands/build.md +5 -0
  116. package/plugins/cursor-pbr/commands/config.md +5 -0
  117. package/plugins/cursor-pbr/commands/continue.md +5 -0
  118. package/plugins/cursor-pbr/commands/dashboard.md +5 -0
  119. package/plugins/cursor-pbr/commands/debug.md +5 -0
  120. package/plugins/cursor-pbr/commands/discuss.md +5 -0
  121. package/plugins/cursor-pbr/commands/do.md +5 -0
  122. package/plugins/cursor-pbr/commands/explore.md +5 -0
  123. package/plugins/cursor-pbr/commands/health.md +5 -0
  124. package/plugins/cursor-pbr/commands/help.md +5 -0
  125. package/plugins/cursor-pbr/commands/import.md +5 -0
  126. package/plugins/cursor-pbr/commands/milestone.md +5 -0
  127. package/plugins/cursor-pbr/commands/note.md +5 -0
  128. package/plugins/cursor-pbr/commands/pause.md +5 -0
  129. package/plugins/cursor-pbr/commands/plan.md +5 -0
  130. package/plugins/cursor-pbr/commands/quick.md +5 -0
  131. package/plugins/cursor-pbr/commands/resume.md +5 -0
  132. package/plugins/cursor-pbr/commands/review.md +5 -0
  133. package/plugins/cursor-pbr/commands/scan.md +5 -0
  134. package/plugins/cursor-pbr/commands/setup.md +5 -0
  135. package/plugins/cursor-pbr/commands/status.md +5 -0
  136. package/plugins/cursor-pbr/commands/statusline.md +5 -0
  137. package/plugins/cursor-pbr/commands/todo.md +5 -0
  138. package/plugins/cursor-pbr/hooks/hooks.json +4 -10
  139. package/plugins/cursor-pbr/references/agent-anti-patterns.md +0 -1
  140. package/plugins/cursor-pbr/references/agent-teams.md +0 -1
  141. package/plugins/cursor-pbr/references/common-bug-patterns.md +0 -1
  142. package/plugins/cursor-pbr/references/config-reference.md +0 -1
  143. package/plugins/cursor-pbr/references/continuation-format.md +0 -1
  144. package/plugins/cursor-pbr/references/deviation-rules.md +0 -1
  145. package/plugins/cursor-pbr/references/git-integration.md +0 -1
  146. package/plugins/cursor-pbr/references/integration-patterns.md +0 -1
  147. package/plugins/cursor-pbr/references/model-profiles.md +0 -1
  148. package/plugins/cursor-pbr/references/model-selection.md +0 -1
  149. package/plugins/cursor-pbr/references/pbr-rules.md +0 -1
  150. package/plugins/cursor-pbr/references/plan-authoring.md +0 -1
  151. package/plugins/cursor-pbr/references/plan-format.md +0 -1
  152. package/plugins/cursor-pbr/references/reading-verification.md +0 -1
  153. package/plugins/cursor-pbr/references/stub-patterns.md +0 -1
  154. package/plugins/cursor-pbr/references/wave-execution.md +0 -1
  155. package/plugins/cursor-pbr/skills/begin/SKILL.md +74 -52
  156. package/plugins/cursor-pbr/skills/build/SKILL.md +81 -93
  157. package/plugins/cursor-pbr/skills/config/SKILL.md +5 -0
  158. package/plugins/cursor-pbr/skills/continue/SKILL.md +31 -24
  159. package/plugins/cursor-pbr/skills/dashboard/SKILL.md +8 -7
  160. package/plugins/cursor-pbr/skills/debug/SKILL.md +8 -0
  161. package/plugins/cursor-pbr/skills/discuss/SKILL.md +2 -0
  162. package/plugins/cursor-pbr/skills/do/SKILL.md +2 -0
  163. package/plugins/cursor-pbr/skills/explore/SKILL.md +5 -1
  164. package/plugins/cursor-pbr/skills/health/SKILL.md +2 -0
  165. package/plugins/cursor-pbr/skills/help/SKILL.md +6 -0
  166. package/plugins/cursor-pbr/skills/import/SKILL.md +7 -0
  167. package/plugins/cursor-pbr/skills/milestone/SKILL.md +20 -196
  168. package/plugins/cursor-pbr/skills/note/SKILL.md +2 -0
  169. package/plugins/cursor-pbr/skills/pause/SKILL.md +4 -0
  170. package/plugins/cursor-pbr/skills/plan/SKILL.md +87 -119
  171. package/plugins/cursor-pbr/skills/quick/SKILL.md +13 -8
  172. package/plugins/cursor-pbr/skills/resume/SKILL.md +4 -0
  173. package/plugins/cursor-pbr/skills/review/SKILL.md +85 -47
  174. package/plugins/cursor-pbr/skills/scan/SKILL.md +5 -0
  175. package/plugins/cursor-pbr/skills/setup/SKILL.md +2 -0
  176. package/plugins/cursor-pbr/skills/shared/commit-planning-docs.md +0 -1
  177. package/plugins/cursor-pbr/skills/shared/config-loading.md +0 -1
  178. package/plugins/cursor-pbr/skills/shared/context-budget.md +0 -1
  179. package/plugins/cursor-pbr/skills/shared/context-loader-task.md +0 -1
  180. package/plugins/cursor-pbr/skills/shared/digest-select.md +0 -1
  181. package/plugins/cursor-pbr/skills/shared/domain-probes.md +0 -1
  182. package/plugins/cursor-pbr/skills/shared/gate-prompts.md +0 -1
  183. package/plugins/cursor-pbr/skills/shared/phase-argument-parsing.md +0 -1
  184. package/plugins/cursor-pbr/skills/shared/revision-loop.md +0 -1
  185. package/plugins/cursor-pbr/skills/shared/state-update.md +0 -1
  186. package/plugins/cursor-pbr/skills/shared/universal-anti-patterns.md +1 -2
  187. package/plugins/cursor-pbr/skills/status/SKILL.md +35 -26
  188. package/plugins/cursor-pbr/skills/test/SKILL.md +2 -2
  189. package/plugins/cursor-pbr/skills/todo/SKILL.md +2 -0
  190. package/plugins/cursor-pbr/templates/CONTEXT.md.tmpl +0 -1
  191. package/plugins/cursor-pbr/templates/INTEGRATION-REPORT.md.tmpl +0 -1
  192. package/plugins/cursor-pbr/templates/RESEARCH-SUMMARY.md.tmpl +0 -1
  193. package/plugins/cursor-pbr/templates/ROADMAP.md.tmpl +0 -1
  194. package/plugins/cursor-pbr/templates/SUMMARY.md.tmpl +0 -1
  195. package/plugins/cursor-pbr/templates/VERIFICATION-DETAIL.md.tmpl +0 -1
  196. package/plugins/cursor-pbr/templates/continue-here.md.tmpl +0 -1
  197. package/plugins/cursor-pbr/templates/prompt-partials/phase-project-context.md.tmpl +0 -1
  198. package/plugins/pbr/.claude-plugin/plugin.json +1 -1
  199. package/plugins/pbr/scripts/context-budget-check.js +13 -1
  200. package/plugins/pbr/scripts/lib/core.js +53 -1
  201. package/plugins/pbr/scripts/pbr-tools.js +49 -3
  202. package/plugins/pbr/scripts/progress-tracker.js +13 -3
  203. package/plugins/pbr/scripts/session-cleanup.js +6 -0
  204. package/plugins/pbr/scripts/suggest-compact.js +13 -1
  205. package/plugins/pbr/skills/begin/SKILL.md +13 -13
  206. package/plugins/pbr/skills/build/SKILL.md +48 -31
  207. package/plugins/pbr/skills/milestone/SKILL.md +10 -10
  208. package/plugins/pbr/skills/plan/SKILL.md +9 -9
  209. package/plugins/pbr/skills/quick/SKILL.md +3 -3
  210. package/plugins/pbr/skills/review/SKILL.md +6 -6
@@ -3,16 +3,18 @@ name: begin
3
3
  description: "Start a new project. Deep questioning, research, requirements, and roadmap."
4
4
  ---
5
5
 
6
+ **STOP — DO NOT READ THIS FILE. You are already reading it. This prompt was injected into your context by Claude Code's plugin system. Using the Read tool on this SKILL.md file wastes ~7,600 tokens. Begin executing Step 1 immediately.**
7
+
6
8
  # /pbr:begin — Project Initialization
7
9
 
8
- You are the orchestrator for `/pbr:begin`. This skill initializes a new Plan-Build-Run project through deep questioning, optional research, requirements scoping, and roadmap generation. Your job is to stay lean — delegate heavy work to agents and keep the user's main context window clean.
10
+ You are the orchestrator for `/pbr:begin`. This skill initializes a new Plan-Build-Run project through deep questioning, optional research, requirements scoping, and roadmap generation. Your job is to stay lean — delegate heavy work to Task() agents and keep the user's main context window clean.
9
11
 
10
12
  ## Context Budget
11
13
 
12
14
  Reference: `skills/shared/context-budget.md` for the universal orchestrator rules.
13
15
 
14
16
  Additionally for this skill:
15
- - **Minimize** reading agent output — read only summaries, not full research docs
17
+ - **Minimize** reading subagent output — read only summaries, not full research docs
16
18
  - **Delegate** all analysis work to agents — the orchestrator routes, it doesn't analyze
17
19
 
18
20
  ## Step 0 — Immediate Output
@@ -36,7 +38,7 @@ Then proceed to Step 1.
36
38
 
37
39
  ## Orchestration Flow
38
40
 
39
- Execute these steps in order. Each step specifies whether it runs inline (in your context) or is delegated to an agent.
41
+ Execute these steps in order. Each step specifies whether it runs inline (in your context) or is delegated to a subagent.
40
42
 
41
43
  ---
42
44
 
@@ -118,7 +120,7 @@ Have a natural conversation to understand the user's vision. Do NOT present a fo
118
120
 
119
121
  ### Step 3: Workflow Preferences (inline)
120
122
 
121
- After understanding the project, configure the Plan-Build-Run workflow. Present preferences sequentially with conversational bridging (e.g., "Great. Next...") to keep the flow natural.
123
+ After understanding the project, configure the Plan-Build-Run workflow. Use AskUserQuestion for each preference below. Present them sequentially with conversational bridging (e.g., "Great. Next...") to keep the flow natural.
122
124
 
123
125
  **3a. Mode:**
124
126
  Use the **toggle-confirm** pattern from `skills/shared/gate-prompts.md`:
@@ -165,7 +167,7 @@ Use the **yes-no** pattern from `skills/shared/gate-prompts.md`:
165
167
 
166
168
  **After gathering preferences:**
167
169
 
168
- **CRITICAL: You MUST create the .planning/ directory and write config.json NOW. Do not proceed without this.**
170
+ **CRITICAL (no hook): You MUST create the .planning/ directory and write config.json NOW. Do not proceed without this.**
169
171
 
170
172
  1. Read the config template from `skills/begin/templates/config.json.tmpl`
171
173
  2. Apply the user's choices to the template
@@ -174,7 +176,7 @@ Use the **yes-no** pattern from `skills/shared/gate-prompts.md`:
174
176
 
175
177
  **IMPORTANT**: This step MUST happen BEFORE research (Step 5) because depth controls how many researchers to spawn.
176
178
 
177
- **CRITICAL: Write .active-skill NOW.** Write the text "begin" to `.planning/.active-skill` using the Write tool. Verify the file exists before proceeding.
179
+ **CRITICAL (hook-enforced): Write .active-skill NOW.** Write the text "begin" to `.planning/.active-skill` using the Write tool. Verify the file exists before proceeding.
178
180
 
179
181
  ---
180
182
 
@@ -208,9 +210,9 @@ Use the **yes-no** pattern from `skills/shared/gate-prompts.md`:
208
210
 
209
211
  ### Step 5: Research (delegated to agents)
210
212
 
211
- Spawn parallel agents for research. Each researcher writes to `.planning/research/`.
213
+ Spawn parallel Task() agents for research. Each researcher writes to `.planning/research/`.
212
214
 
213
- **CRITICAL: Create .planning/research/ directory NOW before spawning researchers. Do NOT skip this step.**
215
+ **CRITICAL (no hook): Create .planning/research/ directory NOW before spawning researchers. Do NOT skip this step.**
214
216
 
215
217
  **Learnings injection (opt-in):** Before spawning researchers, check if global learnings exist:
216
218
 
@@ -231,13 +233,19 @@ If the command succeeds AND returns a non-empty JSON array:
231
233
 
232
234
  If no learnings exist or the command fails: skip injection silently.
233
235
 
234
- **For each research topic, invoke the @researcher agent:**
236
+ **For each research topic, spawn a Task():**
235
237
 
236
- Invoke `@researcher` with the research prompt constructed from the template.
238
+ ```
239
+ Task({
240
+ subagent_type: "pbr:researcher",
241
+ // After researcher: check for ## RESEARCH COMPLETE or ## RESEARCH BLOCKED
242
+ prompt: <see researcher prompt template below>
243
+ })
244
+ ```
237
245
 
238
- **NOTE**: The `@researcher` agent is defined in `agents/researcher.md`. Do NOT inline the agent definition — it wastes main context.
246
+ **NOTE**: The `pbr:researcher` subagent type auto-loads the agent definition from `agents/researcher.md`. Do NOT inline the agent definition — it wastes main context.
239
247
 
240
- **Path resolution**: Before constructing any agent prompt, resolve plugin root to its absolute path. Use the resolved absolute path for any pbr-tools.js or template references included in the prompt.
248
+ **Path resolution**: Before constructing any agent prompt, resolve `${PLUGIN_ROOT}` to its absolute path. Do not pass the variable literally in prompts — Task() contexts may not expand it. Use the resolved absolute path for any pbr-tools.js or template references included in the prompt.
241
249
 
242
250
  #### Researcher Prompt Template
243
251
 
@@ -246,9 +254,10 @@ For each researcher, construct the prompt by reading the template and filling in
246
254
  Read `skills/begin/templates/researcher-prompt.md.tmpl` for the prompt structure.
247
255
 
248
256
  **Prepend this block to the researcher prompt before sending:**
257
+
249
258
  ```
250
259
  <files_to_read>
251
- CRITICAL: Read these files BEFORE any other action:
260
+ CRITICAL (no hook): Read these files BEFORE any other action:
252
261
  1. .planning/REQUIREMENTS.md — scoped requirements (if exists)
253
262
  {if learnings_temp_path exists}2. {learnings_temp_path} — cross-project learnings (tech stack patterns from past PBR projects){/if}
254
263
  </files_to_read>
@@ -292,28 +301,34 @@ If `{learnings_temp_path}` was produced in the learnings injection step above, r
292
301
  - What security concerns exist?
293
302
 
294
303
  **Parallelization:**
295
- - Spawn ALL researchers in parallel when possible
296
- - Before spawning, display to the user: `Spawning {N} researchers in parallel...`
297
- - When each completes: "{topic} researcher complete ({duration})"
298
- - When all complete: "All {N} researchers finished. Proceeding to synthesis."
304
+ - Spawn ALL researchers in parallel (multiple Task() calls in one response)
305
+ - Use `run_in_background: true` for each researcher
306
+ - Before spawning, display to the user: `◐ Spawning {N} researchers in parallel...`
307
+ - While waiting, display progress to the user:
308
+ - After spawning: list of topics being researched
309
+ - Periodically (every ~30s): check `TaskOutput` with `block: false` for each agent and report status
310
+ - When each completes: "✓ {topic} researcher complete ({duration})"
311
+ - When all complete: "All {N} researchers finished. Proceeding to synthesis."
299
312
  - Wait for all to complete before proceeding
300
313
 
301
- **After each researcher completes**, check the agent output for a completion marker:
302
- - If `## RESEARCH COMPLETE` is present: researcher finished successfully, proceed
303
- - If `## RESEARCH BLOCKED` is present: warn the user that research could not complete, ask if they want to proceed with limited context or stop
304
- - If neither marker is present: warn that researcher may not have completed successfully, but proceed if output files exist on disk
305
-
306
314
  ---
307
315
 
308
- ### Step 6: Synthesis (delegated to agent)
316
+ ### Step 6: Synthesis (delegated to subagent)
317
+
318
+ After all researchers complete, display to the user: `◐ Spawning synthesizer...`
309
319
 
310
- After all researchers complete, display to the user: `Spawning synthesizer...`
320
+ Spawn a synthesis agent:
311
321
 
312
- Invoke the `@synthesizer` agent with the synthesis prompt.
322
+ ```
323
+ Task({
324
+ subagent_type: "pbr:synthesizer",
325
+ prompt: <synthesis prompt>
326
+ })
327
+ ```
313
328
 
314
- **NOTE**: The `@synthesizer` agent is defined in `agents/synthesizer.md`. Do NOT inline it.
329
+ **NOTE**: The `pbr:synthesizer` subagent type auto-loads the agent definition. Do NOT inline it. The agent definition specifies `model: sonnet` — do not override it.
315
330
 
316
- **Path resolution**: Before constructing the agent prompt, resolve plugin root to its absolute path. Do not pass the variable literally in prompts.
331
+ **Path resolution**: Before constructing the agent prompt, resolve `${PLUGIN_ROOT}` to its absolute path. Do not pass the variable literally in prompts — Task() contexts may not expand it.
317
332
 
318
333
  #### Synthesis Prompt Template
319
334
 
@@ -322,7 +337,7 @@ Read `skills/begin/templates/synthesis-prompt.md.tmpl` for the prompt structure.
322
337
  **Prepend this block to the synthesizer prompt before sending:**
323
338
  ```
324
339
  <files_to_read>
325
- CRITICAL: Read these files BEFORE any other action:
340
+ CRITICAL (no hook): Read these files BEFORE any other action:
326
341
  1. .planning/research/*.md — all research output files from Step 5
327
342
  </files_to_read>
328
343
  ```
@@ -390,7 +405,7 @@ Each requirement must be:
390
405
 
391
406
  **7e. Write REQUIREMENTS.md:**
392
407
 
393
- **CRITICAL: Write REQUIREMENTS.md NOW. The roadmap planner depends on this file.**
408
+ **CRITICAL (no hook): Write REQUIREMENTS.md NOW. The roadmap planner depends on this file.**
394
409
 
395
410
  Read the template from `skills/begin/templates/REQUIREMENTS.md.tmpl` and write `.planning/REQUIREMENTS.md` with:
396
411
  - All v1 requirements grouped by category
@@ -400,15 +415,23 @@ Read the template from `skills/begin/templates/REQUIREMENTS.md.tmpl` and write `
400
415
 
401
416
  ---
402
417
 
403
- ### Step 8: Roadmap Generation (delegated to agent)
418
+ ### Step 8: Roadmap Generation (delegated to subagent)
419
+
420
+ Display to the user: `◐ Spawning planner (roadmap)...`
404
421
 
405
- Display to the user: `Spawning planner (roadmap)...`
422
+ Spawn the planner in roadmap mode:
406
423
 
407
- Invoke the `@planner` agent in roadmap mode with the roadmap prompt.
424
+ ```
425
+ Task({
426
+ subagent_type: "pbr:planner",
427
+ // After planner: check for ## PLANNING COMPLETE or ## PLANNING FAILED
428
+ prompt: <roadmap prompt>
429
+ })
430
+ ```
408
431
 
409
- **NOTE**: The `@planner` agent is defined in `agents/planner.md`. Do NOT inline it. The planner agent will read REQUIREMENTS.md and SUMMARY.md from disk — you only need to tell it what to do and where files are.
432
+ **NOTE**: The `pbr:planner` subagent type auto-loads the agent definition. Do NOT inline it. The planner agent will read REQUIREMENTS.md and SUMMARY.md from disk — you only need to tell it what to do and where files are.
410
433
 
411
- **Path resolution**: Before constructing the agent prompt, resolve plugin root to its absolute path. Do not pass the variable literally in prompts.
434
+ **Path resolution**: Before constructing the agent prompt, resolve `${PLUGIN_ROOT}` to its absolute path. Do not pass the variable literally in prompts — Task() contexts may not expand it.
412
435
 
413
436
  #### Roadmap Prompt Template
414
437
 
@@ -417,7 +440,7 @@ Read `skills/begin/templates/roadmap-prompt.md.tmpl` for the prompt structure.
417
440
  **Prepend this block to the roadmap planner prompt before sending:**
418
441
  ```
419
442
  <files_to_read>
420
- CRITICAL: Read these files BEFORE any other action:
443
+ CRITICAL (no hook): Read these files BEFORE any other action:
421
444
  1. .planning/REQUIREMENTS.md — scoped requirements for phase planning
422
445
  2. .planning/research/SUMMARY.md — research synthesis (if exists)
423
446
  </files_to_read>
@@ -428,17 +451,14 @@ CRITICAL: Read these files BEFORE any other action:
428
451
  - `{description}` — project description from Step 2
429
452
  - `{quick|standard|comprehensive}` — depth setting from Step 3
430
453
 
431
- **After the planner completes**, check the agent output for a completion marker:
432
- - If `## PLANNING COMPLETE` is present: planner finished successfully, proceed
433
- - If `## PLANNING FAILED` is present: warn the user that planning could not complete, display the reason, and offer to retry or abort
434
- - If neither marker is present: warn that planner may not have completed successfully, but proceed if ROADMAP.md exists on disk
435
-
454
+ **After the planner completes:**
436
455
  - **Spot-check:** Verify `.planning/ROADMAP.md` exists on disk using Glob before attempting to read it. If missing, the planner may have failed silently — warn: `⚠ ROADMAP.md not found after planner completed. Re-spawning planner...` and retry once.
437
456
  - Read `.planning/ROADMAP.md`
438
- - Count the phases and milestones from the roadmap content
457
+ - Count the phases from the roadmap content
458
+ - Verify the roadmap contains a `## Milestone:` section wrapping the phases (the planner should generate this). If not, the initial set of phases constitutes the first milestone — add the section header yourself.
439
459
  - Display:
440
460
  ```
441
- Roadmap created — {N} phases across {M} milestones
461
+ Roadmap created — {N} phases in milestone "{name}"
442
462
  ```
443
463
  - If `gates.confirm_roadmap` is true in config, use the **approve-revise-abort** pattern from `skills/shared/gate-prompts.md`:
444
464
  question: "Approve this roadmap?"
@@ -446,7 +466,7 @@ CRITICAL: Read these files BEFORE any other action:
446
466
  - label: "Approve" description: "Proceed with this roadmap"
447
467
  - label: "Request changes" description: "Discuss adjustments before proceeding"
448
468
  - label: "Abort" description: "Cancel and start over"
449
- - If user selects "Request changes": edit the roadmap inline (small changes) or re-invoke planner
469
+ - If user selects "Request changes": edit the roadmap inline (small changes) or re-spawn planner
450
470
  - If user selects "Approve": proceed to Step 9
451
471
  - If user selects "Abort": stop execution
452
472
 
@@ -456,9 +476,9 @@ CRITICAL: Read these files BEFORE any other action:
456
476
 
457
477
  Write the project state files from templates:
458
478
 
459
- **CRITICAL: You MUST write all 5 state initialization files (Steps 9a-9e). Do NOT skip any.**
479
+ **CRITICAL (no hook): You MUST write all 5 state initialization files (Steps 9a-9e). Do NOT skip any.**
460
480
 
461
- **CRITICAL: Write PROJECT.md NOW. Do NOT skip this step.**
481
+ **CRITICAL (no hook): Write PROJECT.md NOW. Do NOT skip this step.**
462
482
 
463
483
  **9a. Write PROJECT.md:**
464
484
  1. Read `skills/begin/templates/PROJECT.md.tmpl`
@@ -472,7 +492,7 @@ Write the project state files from templates:
472
492
  3. Write to `.planning/PROJECT.md`
473
493
  4. Ensure the `## Milestones` section is filled in with the project name and phase count from the roadmap
474
494
 
475
- **CRITICAL: Write STATE.md NOW. Do NOT skip this step.**
495
+ **CRITICAL (no hook): Write STATE.md NOW. Do NOT skip this step.**
476
496
 
477
497
  **9b. Write STATE.md:**
478
498
  1. Read `skills/begin/templates/STATE.md.tmpl`
@@ -486,7 +506,7 @@ Write the project state files from templates:
486
506
  4. Fill in the `## Milestone` section with the project name and total phase count
487
507
  5. **STATE.md size limit**: Follow size limit enforcement rules in `skills/shared/state-update.md` (150 lines max).
488
508
 
489
- **CRITICAL: Write CONTEXT.md NOW. Do NOT skip this step.**
509
+ **CRITICAL (no hook): Write CONTEXT.md NOW. Do NOT skip this step.**
490
510
 
491
511
  **9c. Write CONTEXT.md:**
492
512
  Create `.planning/CONTEXT.md` from information gathered during questioning:
@@ -512,7 +532,7 @@ Create `.planning/CONTEXT.md` from information gathered during questioning:
512
532
  | {feature} | {reason} |
513
533
  ```
514
534
 
515
- **CRITICAL: Write HISTORY.md NOW. Do NOT skip this step.**
535
+ **CRITICAL (no hook): Write HISTORY.md NOW. Do NOT skip this step.**
516
536
 
517
537
  **9d. Write HISTORY.md:**
518
538
  Create `.planning/HISTORY.md` with an initial entry:
@@ -527,7 +547,7 @@ Create `.planning/HISTORY.md` with an initial entry:
527
547
  - Roadmap: {N} phases planned
528
548
  ```
529
549
 
530
- **CRITICAL: Create phase directories NOW. Do NOT skip this step.**
550
+ **CRITICAL (no hook): Create phase directories NOW. Do NOT skip this step.**
531
551
 
532
552
  **9e. Create phase directories:**
533
553
  For each phase in the roadmap, create the directory structure:
@@ -587,10 +607,10 @@ Display the `PROJECT INITIALIZED ✓` banner with project name, core value, phas
587
607
  ## Error Handling
588
608
 
589
609
  ### Research agent fails
590
- If a researcher agent fails or times out:
610
+ If a researcher Task() fails or times out:
591
611
  - Note which topic wasn't researched
592
612
  - Continue with available research
593
- - Display: "Research on {topic} failed. Proceeding without it. You can re-research during /pbr:plan."
613
+ - Display: `⚠ Research on {topic} failed. Proceeding without it. You can re-research during /pbr:plan.`
594
614
 
595
615
  ### User wants to restart
596
616
  If user says they want to start over mid-flow:
@@ -600,7 +620,9 @@ If user says they want to start over mid-flow:
600
620
  ### Config write fails
601
621
  If `.planning/` directory can't be created, display:
602
622
  ```
603
- ERROR
623
+ ╔══════════════════════════════════════════════════════════════╗
624
+ ║ ERROR ║
625
+ ╚══════════════════════════════════════════════════════════════╝
604
626
 
605
627
  Cannot create .planning/ directory.
606
628
 
@@ -63,7 +63,7 @@ Reference: `skills/shared/config-loading.md` for the tooling shortcut and config
63
63
  1. Parse `$ARGUMENTS` for phase number and flags
64
64
  2. Read `.planning/config.json` for parallelization, model, and gate settings (see config-loading.md for field reference)
65
65
  3. Resolve depth profile: run `node ${PLUGIN_ROOT}/scripts/pbr-tools.js config resolve-depth` to get the effective feature/gate settings for the current depth. Store the result for use in later gating decisions.
66
- 4. **CRITICAL: Write .active-skill NOW.** Write `.planning/.active-skill` with the content `build` (registers with workflow enforcement hook)
66
+ 4. **CRITICAL (hook-enforced): Write .active-skill NOW.** Write `.planning/.active-skill` with the content `build` (registers with workflow enforcement hook)
67
67
  5. Validate:
68
68
  - Phase directory exists at `.planning/phases/{NN}-{slug}/`
69
69
  - PLAN.md files exist in the directory
@@ -82,27 +82,17 @@ Reference: `skills/shared/config-loading.md` for the tooling shortcut and config
82
82
 
83
83
  **Staleness check (dependency fingerprints):**
84
84
  After validating prerequisites, check plan staleness:
85
- 1. Read each PLAN.md file's `dependency_fingerprints` field (if present)
86
- 2. For each fingerprinted dependency, check the current SUMMARY.md file (length + modification time)
87
- 3. If any fingerprint doesn't match: the dependency phase was re-built after this plan was created
88
- 4. Use AskUserQuestion (pattern: stale-continue from `skills/shared/gate-prompts.md`):
89
- question: "Plan {plan_id} may be stale — dependency phase {M} was re-built after this plan was created."
90
- header: "Stale"
91
- options:
92
- - label: "Continue anyway" description: "Proceed with existing plans (may still be valid)"
93
- - label: "Re-plan" description: "Stop and re-plan with `/pbr:plan {N}` (recommended)"
94
- If "Re-plan" or "Other": stop and suggest `/pbr:plan {N}`
95
- If "Continue anyway": proceed with existing plans
96
- 10. If plans have no `dependency_fingerprints` field, fall back to timestamp-based staleness detection:
97
- a. Read `.planning/ROADMAP.md` and identify the current phase's dependencies (the `depends_on` field)
98
- b. For each dependency phase, find its phase directory under `.planning/phases/`
99
- c. Check if any SUMMARY.md files in the dependency phase directory have a modification timestamp newer than the current phase's PLAN.md files
100
- d. If any upstream dependency was modified after planning, display a warning (do NOT block):
101
- ```
102
- Warning: Phase {dep_phase} (dependency of Phase {N}) was modified after this phase was planned.
103
- Plans may be based on outdated assumptions. Consider re-planning with `/pbr:plan {N}`.
104
- ```
105
- e. This is advisory only — continue with the build after displaying the warning
85
+
86
+ ```bash
87
+ node ${PLUGIN_ROOT}/scripts/pbr-tools.js staleness-check {phase-slug}
88
+ ```
89
+
90
+ Returns `{ stale: bool, plans: [{id, stale, reason}] }`. If `stale: true` for any plan:
91
+ - Use AskUserQuestion (pattern: stale-continue from `skills/shared/gate-prompts.md`):
92
+ question: "Plan {plan_id} may be stale {reason}"
93
+ options: ["Continue anyway", "Re-plan with /pbr:plan {N}"]
94
+ - If "Re-plan": stop. If "Continue anyway": proceed.
95
+ If `stale: false`: proceed silently.
106
96
 
107
97
  **Validation errors — use branded error boxes:**
108
98
 
@@ -198,30 +188,19 @@ Validate wave consistency:
198
188
 
199
189
  ### Step 5b: Write Checkpoint Manifest (inline)
200
190
 
201
- **CRITICAL: Write .checkpoint-manifest.json NOW before entering the wave loop.**
202
-
203
- Before entering the wave loop, write `.planning/phases/{NN}-{slug}/.checkpoint-manifest.json`:
191
+ **CRITICAL (hook-enforced): Initialize checkpoint manifest NOW before entering the wave loop.**
204
192
 
205
- ```json
206
- {
207
- "plans": ["02-01", "02-02", "02-03"],
208
- "checkpoints_resolved": [],
209
- "checkpoints_pending": [],
210
- "wave": 1,
211
- "deferred": [],
212
- "commit_log": [],
213
- "last_good_commit": null
214
- }
193
+ ```bash
194
+ node ${PLUGIN_ROOT}/scripts/pbr-tools.js checkpoint init {phase-slug} --plans "{comma-separated plan IDs}"
215
195
  ```
216
196
 
217
- This file tracks execution progress for crash recovery and rollback. On resume after compaction, read this manifest to determine where execution left off and which plans still need work.
197
+ After each wave completes, update the manifest:
218
198
 
219
- Update the manifest after each wave completes:
220
- - Move completed plan IDs into `checkpoints_resolved`
221
- - Advance the `wave` counter
222
- - Record commit SHAs in `commit_log` (array of `{ plan, sha, timestamp }` objects)
223
- - Update `last_good_commit` to the SHA of the last successfully verified commit
224
- - Append any deferred items collected from executor SUMMARYs
199
+ ```bash
200
+ node ${PLUGIN_ROOT}/scripts/pbr-tools.js checkpoint update {phase-slug} --wave {N} --resolved {plan-id} --sha {commit-sha}
201
+ ```
202
+
203
+ This tracks execution for crash recovery and rollback. Read `.checkpoint-manifest.json` on resume to reconstruct which plans are complete.
225
204
 
226
205
  ---
227
206
 
@@ -325,11 +304,11 @@ Use the filled template as the Task() prompt.
325
304
 
326
305
  ```
327
306
  Task({
328
- agent_type: "pbr:executor",
307
+ subagent_type: "pbr:executor",
329
308
  prompt: <executor prompt constructed above>
330
309
  })
331
310
 
332
- NOTE: The pbr:executor agent type auto-loads the agent definition.
311
+ NOTE: The pbr:executor subagent type auto-loads the agent definition.
333
312
 
334
313
  After executor completes, check for completion markers: `## PLAN COMPLETE`, `## PLAN FAILED`, or `## CHECKPOINT: {TYPE}`. Route accordingly — PLAN COMPLETE proceeds to next plan, PLAN FAILED triggers failure handling, CHECKPOINT triggers checkpoint flow. Do NOT inline it.
335
314
  ```
@@ -357,7 +336,7 @@ For each completed executor:
357
336
 
358
337
  **Spot-check executor claims:**
359
338
 
360
- CRITICAL: Before reading results or advancing to the next wave, run the spot-check CLI for each completed plan.
339
+ CRITICAL (no hook): Before reading results or advancing to the next wave, run the spot-check CLI for each completed plan.
361
340
 
362
341
  For each completed plan in this wave:
363
342
 
@@ -392,13 +371,7 @@ Use AskUserQuestion with the three options. Route:
392
371
  - Also search SUMMARY.md for `## Self-Check: FAILED` marker — if present, warn before next wave
393
372
  - Between waves: verify no file conflicts from parallel executors (`git status` for uncommitted changes)
394
373
 
395
- **Additional wave spot-checks:**
396
- - Check for `## Self-Check: FAILED` in SUMMARY.md — if present, warn user before proceeding to next wave
397
- - Between waves: verify no file conflicts from parallel executors (check `git status` for uncommitted changes)
398
- - If ANY spot-check fails, present user with: **Retry this plan** / **Continue to next wave** / **Abort build**
399
-
400
374
  **Read executor deviations:**
401
-
402
375
  After all executors in the wave complete, read all SUMMARY frontmatter and:
403
376
  - Collect `deferred` items into a running list (append to `.checkpoint-manifest.json` deferred array)
404
377
  - Flag any deviation-rule-4 (architectural) stops — these require user attention
@@ -419,16 +392,14 @@ Wave {W} Results:
419
392
 
420
393
  **Skip if** the depth profile has `features.inline_verify: false`.
421
394
 
422
- To check: use the resolved depth profile. Only `comprehensive` mode enables inline verification by default.
423
-
424
- When inline verification is enabled, each completed plan gets a targeted verification pass before the orchestrator proceeds to the next wave. This catches issues early — before dependent plans build on a broken foundation.
395
+ To check: use the resolved depth profile. Only `comprehensive` mode enables inline verification by default. When inline verification is enabled, each completed plan gets a targeted verification pass before the orchestrator proceeds to the next wave — catching issues early before dependent plans build on a broken foundation.
425
396
 
426
397
  For each plan that completed successfully in this wave:
427
398
 
428
399
  1. Read the plan's SUMMARY.md to get `key_files` (the files this plan created/modified)
429
400
  2. Display to the user: `◐ Spawning inline verifier for plan {plan_id}...`
430
401
 
431
- Spawn `Task({ agent_type: "pbr:verifier", model: "haiku", prompt: ... })`. Read `skills/build/templates/inline-verifier-prompt.md.tmpl` and fill in `{NN}-{slug}`, `{plan_id}`, and `{comma-separated key_files list}` (key_files from PLAN.md frontmatter). Use the filled template as the `prompt` value.
402
+ Spawn `Task({ subagent_type: "pbr:verifier", model: "haiku", prompt: ... })`. Read `skills/build/templates/inline-verifier-prompt.md.tmpl` and fill in `{NN}-{slug}`, `{plan_id}`, and `{comma-separated key_files list}` (key_files from PLAN.md frontmatter). Use the filled template as the `prompt` value.
432
403
 
433
404
  3. If verifier reports FAIL for any file:
434
405
  - Present the failure to the user: "Inline verify failed for plan {plan_id}: {details}"
@@ -487,19 +458,17 @@ Use AskUserQuestion (pattern: multi-option-failure from `skills/shared/gate-prom
487
458
  - If yes: warn user that those plans will also need to be skipped or adjusted
488
459
 
489
460
  **If user selects 'Rollback':**
490
- - Read `last_good_commit` from `.checkpoint-manifest.json`
491
- - If `last_good_commit` exists:
492
- - Show the user: "Rolling back to commit {sha} (last verified good state). This will soft-reset {N} commits."
493
- - Run: `git reset --soft {last_good_commit}`
494
- - Delete the failed plan's SUMMARY.md file if it was created
495
- - **CRITICAL — Invalidate downstream dependencies:**
496
- - Check if any plans in later waves depend on the rolled-back plan
497
- - For each downstream plan that depends on it: delete its SUMMARY.md (forces re-execution)
498
- - Remove ALL downstream dependent plans from `checkpoints_resolved` in the manifest
499
- - If downstream phases (outside this build) have `dependency_fingerprints` referencing this phase, warn: "Downstream phases may need re-planning with `/pbr:plan <N>` since Phase {current} was partially rolled back."
500
- - Update the checkpoint manifest: remove the failed plan from `checkpoints_resolved`
501
- - Continue to next wave or stop based on user preference
502
- - If no `last_good_commit`: warn "No rollback point available (this was the first plan). Use abort instead."
461
+ Run the rollback CLI:
462
+
463
+ ```bash
464
+ node ${PLUGIN_ROOT}/scripts/pbr-tools.js rollback .planning/phases/{NN}-{slug}/.checkpoint-manifest.json
465
+ ```
466
+
467
+ Returns `{ ok, rolled_back_to, plans_invalidated, files_deleted, warnings }`.
468
+
469
+ - If `ok` is `true`: display "Rolled back to commit {rolled_back_to}. {plans_invalidated.length} downstream plans invalidated."
470
+ Show any warnings. Continue to next wave or stop based on user preference.
471
+ - If `ok` is `false`: display the error message. Suggest "Use abort instead."
503
472
 
504
473
  **If user selects 'Abort':**
505
474
  - Update STATE.md with current progress
@@ -544,34 +513,34 @@ If `config.ci.gate_enabled` is `true` AND `config.git.branching` is not `none`:
544
513
 
545
514
  1. Push current commits: `git push`
546
515
  2. Wait 5 seconds for CI to trigger
547
- 3. Check: `gh run list --branch $(git branch --show-current) --limit 1 --json status,conclusion,url`
548
- 4. If in_progress: poll every 15 seconds up to `config.ci.wait_timeout_seconds`
549
- 5. If failed/timed out: show warning box:
550
-
516
+ 3. Get the current run ID:
517
+ ```bash
518
+ gh run list --branch $(git branch --show-current) --limit 1 --json databaseId -q '.[0].databaseId'
551
519
  ```
552
- CI Status: {conclusion}
553
- Run: {url}
554
- Options: [Wait] [Continue anyway] [Abort]
520
+ 4. Poll CI status using CLI:
521
+ ```bash
522
+ node ${PLUGIN_ROOT}/scripts/pbr-tools.js ci-poll <run-id> [--timeout <seconds>]
555
523
  ```
556
-
557
- 6. Use AskUserQuestion to present options: Wait / Continue anyway / Abort
558
- 7. If "Continue anyway": log deviation `DEVIATION: CI gate bypassed for wave {N}`
559
- 8. If "Abort": stop build, update STATE.md
524
+ Returns `{ status, conclusion, url, next_action, elapsed_seconds }`.
525
+ 5. If `next_action` is `"continue"`: proceed to next wave
526
+ 6. If `next_action` is `"wait"`: re-run ci-poll after 15 seconds (repeat up to `config.ci.wait_timeout_seconds`)
527
+ 7. If `next_action` is `"abort"` or `status` is `"failed"`:
528
+ Show warning box and use AskUserQuestion: Wait / Continue anyway / Abort
529
+ 8. If "Continue anyway": log deviation — `DEVIATION: CI gate bypassed for wave {N}`
530
+ 9. If "Abort": stop build, update STATE.md
560
531
 
561
532
  #### 6f. Update STATE.md
562
533
 
563
534
  After each wave completes (all plans in the wave are done, skipped, or aborted):
564
535
 
565
536
  **SUMMARY gate — verify before updating STATE.md:**
537
+ For every plan in the wave, run:
566
538
 
567
- Before writing any STATE.md update, verify these three gates for every plan in the wave:
568
- 1. SUMMARY file exists at the expected path
569
- 2. SUMMARY file is not empty (file size > 0)
570
- 3. SUMMARY file has a valid title and YAML frontmatter (contains `---` delimiters and a `status:` field)
539
+ ```bash
540
+ node ${PLUGIN_ROOT}/scripts/pbr-tools.js summary-gate {phase-slug} {plan-id}
541
+ ```
571
542
 
572
- Block the STATE.md update until ALL gates pass. If any gate fails:
573
- - Warn user: "SUMMARY gate failed for plan {id}: {which gate}. Cannot update STATE.md."
574
- - Ask user to retry the executor or manually inspect the SUMMARY file
543
+ Returns `{ ok: bool, gate: string, detail: string }`. Block STATE.md update until ALL plans return `ok: true`. If any fail, warn: "SUMMARY gate failed for plan {id}: {gate} — {detail}. Cannot update STATE.md."
575
544
 
576
545
  Once gates pass, update `.planning/STATE.md`:
577
546
 
@@ -589,6 +558,12 @@ node ${PLUGIN_ROOT}/scripts/pbr-tools.js state update last_activity now
589
558
 
590
559
  **STATE.md size limit:** Follow the size limit enforcement rules in `skills/shared/state-update.md` (150 lines max — collapse completed phases, remove duplicated decisions, trim old sessions).
591
560
 
561
+ **Completion check:** Before proceeding to next wave, confirm ALL of:
562
+ - [ ] SUMMARY gate passed for every plan in this wave
563
+ - [ ] STATE.md frontmatter `plans_complete` updated
564
+ - [ ] STATE.md body progress bar updated
565
+ - [ ] `last_activity` timestamp refreshed
566
+
592
567
  ---
593
568
 
594
569
  ### Step 7: Phase Verification (delegated, conditional)
@@ -615,11 +590,11 @@ Spawn a verifier Task():
615
590
 
616
591
  ```
617
592
  Task({
618
- agent_type: "pbr:verifier",
593
+ subagent_type: "pbr:verifier",
619
594
  prompt: <verifier prompt>
620
595
  })
621
596
 
622
- NOTE: The pbr:verifier agent type auto-loads the agent definition. Do NOT inline it.
597
+ NOTE: The pbr:verifier subagent type auto-loads the agent definition. Do NOT inline it.
623
598
 
624
599
  After verifier completes, check for completion marker: `## VERIFICATION COMPLETE`. Read VERIFICATION.md frontmatter for status.
625
600
  ```
@@ -633,7 +608,7 @@ Use the same verifier prompt template as defined in `/pbr:review`: read `skills/
633
608
  **Prepend this block to the verifier prompt before sending:**
634
609
  ```
635
610
  <files_to_read>
636
- CRITICAL: Read these files BEFORE any other action:
611
+ CRITICAL (no hook): Read these files BEFORE any other action:
637
612
  1. .planning/phases/{NN}-{slug}/PLAN-*.md — must-haves to verify against
638
613
  2. .planning/phases/{NN}-{slug}/SUMMARY-*.md — executor build summaries
639
614
  3. .planning/phases/{NN}-{slug}/VERIFICATION.md — prior verification results (if exists)
@@ -684,14 +659,14 @@ If triggered:
684
659
  Spawn a lightweight mapper Task():
685
660
  ```
686
661
  Task({
687
- agent_type: "pbr:codebase-mapper",
662
+ subagent_type: "pbr:codebase-mapper",
688
663
  model: "haiku",
689
664
  prompt: "Incremental codebase map update. These files changed during the Phase {N} build:\n{diff file list}\n\nRead the existing .planning/codebase/ documents. Update ONLY the sections affected by these changes. Do NOT rewrite entire documents — make targeted updates. If a new dependency was added, update STACK.md. If new directories/modules were created, update STRUCTURE.md. If new patterns were introduced, update CONVENTIONS.md. Write updated files to .planning/codebase/."
690
665
  })
691
666
  ```
692
667
  4. Do NOT block on this — use `run_in_background: true` and continue to Step 8a. Report completion in Step 8f if it finishes in time.
693
668
 
694
- **CRITICAL: Update ROADMAP.md progress table NOW. Do NOT skip this step.**
669
+ **CRITICAL (no hook): Update ROADMAP.md progress table NOW. Do NOT skip this step. (roadmap-sync warns)**
695
670
 
696
671
  **8a. Update ROADMAP.md Progress table** (REQUIRED — do this BEFORE updating STATE.md):
697
672
 
@@ -709,13 +684,18 @@ These return `{ success, old_status, new_status }` or `{ success, old_plans, new
709
684
  5. Update the `Status` column to the final_status determined in Step 8-pre
710
685
  6. Save the file — do NOT skip this step
711
686
 
712
- **CRITICAL: Update STATE.md NOW with phase completion status. Do NOT skip this step.**
687
+ **CRITICAL (no hook): Update STATE.md NOW with phase completion status. Do NOT skip this step. (state-sync warns)**
713
688
 
714
- **8b. Update STATE.md (CRITICAL — update BOTH frontmatter AND body):**
689
+ **8b. Update STATE.md (CRITICAL (no hook) — update BOTH frontmatter AND body):**
715
690
  - Frontmatter: `status`, `plans_complete`, `last_activity`, `progress_percent`, `last_command`
716
691
  - Body `## Current Position`: `Phase:` line, `Plan:` line, `Status:` line, `Last activity:` line, `Progress:` bar
717
692
  - These MUST stay in sync — the status line reads frontmatter, humans read the body
718
693
 
694
+ **Completion check:** Before proceeding to 8c, confirm ALL of:
695
+ - [ ] STATE.md frontmatter fields set: status, plans_complete, last_activity, progress_percent, last_command
696
+ - [ ] STATE.md body ## Current Position updated: Phase, Status, Last activity, Progress bar
697
+ - [ ] Frontmatter and body are consistent (same status value in both)
698
+
719
699
  **8c. Commit planning docs (if configured):**
720
700
  Reference: `skills/shared/commit-planning-docs.md` for the standard commit pattern.
721
701
  If `planning.commit_docs` is `true`:
@@ -779,6 +759,12 @@ After invoking the chained skill, it runs within the same session. When it compl
779
759
  Write `.planning/.auto-next` containing the next logical command (e.g., `/pbr:plan {N+1}` or `/pbr:review {N}`)
780
760
  - This file signals to the user or to wrapper scripts that the next step is ready
781
761
 
762
+ **Completion check:** Before proceeding to 8f, confirm ALL of:
763
+ - [ ] auto_advance OR auto_continue evaluated (one path taken)
764
+ - [ ] If auto_continue: `.auto-next` file written with correct next command
765
+ - [ ] Pending todos evaluated (Step 8e-ii)
766
+ - [ ] Clearly-satisfied todos auto-closed via `pbr-tools.js todo done`
767
+
782
768
  **8e-ii. Check Pending Todos:**
783
769
 
784
770
  **CRITICAL (no hook): Check pending todos after build. Do NOT skip this step.**