@sienklogic/plan-build-run 2.34.0 → 2.37.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 (133) hide show
  1. package/CHANGELOG.md +663 -0
  2. package/dashboard/public/css/command-center.css +152 -65
  3. package/dashboard/public/css/explorer.css +22 -41
  4. package/dashboard/public/css/layout.css +119 -1
  5. package/dashboard/public/css/tokens.css +13 -0
  6. package/dashboard/src/components/Layout.tsx +32 -6
  7. package/dashboard/src/components/explorer/tabs/PhasesTab.tsx +11 -1
  8. package/dashboard/src/components/explorer/tabs/TodosTab.tsx +18 -2
  9. package/dashboard/src/components/partials/AttentionPanel.tsx +7 -1
  10. package/dashboard/src/components/partials/CurrentPhaseCard.tsx +26 -24
  11. package/dashboard/src/components/partials/QuickActions.tsx +21 -11
  12. package/dashboard/src/components/partials/StatCardGrid.tsx +67 -0
  13. package/dashboard/src/components/partials/StatusHeader.tsx +1 -0
  14. package/dashboard/src/routes/command-center.routes.tsx +8 -7
  15. package/dashboard/src/routes/index.routes.tsx +32 -29
  16. package/package.json +2 -2
  17. package/plugins/copilot-pbr/agents/audit.agent.md +128 -16
  18. package/plugins/copilot-pbr/agents/codebase-mapper.agent.md +48 -1
  19. package/plugins/copilot-pbr/agents/debugger.agent.md +47 -1
  20. package/plugins/copilot-pbr/agents/executor.agent.md +152 -8
  21. package/plugins/copilot-pbr/agents/general.agent.md +46 -1
  22. package/plugins/copilot-pbr/agents/integration-checker.agent.md +52 -2
  23. package/plugins/copilot-pbr/agents/plan-checker.agent.md +50 -2
  24. package/plugins/copilot-pbr/agents/planner.agent.md +54 -1
  25. package/plugins/copilot-pbr/agents/researcher.agent.md +47 -2
  26. package/plugins/copilot-pbr/agents/synthesizer.agent.md +49 -1
  27. package/plugins/copilot-pbr/agents/verifier.agent.md +86 -2
  28. package/plugins/copilot-pbr/hooks/hooks.json +11 -0
  29. package/plugins/copilot-pbr/plugin.json +1 -1
  30. package/plugins/copilot-pbr/references/agent-contracts.md +27 -0
  31. package/plugins/copilot-pbr/references/checkpoints.md +32 -1
  32. package/plugins/copilot-pbr/references/context-quality-tiers.md +45 -0
  33. package/plugins/copilot-pbr/references/pbr-tools-cli.md +115 -0
  34. package/plugins/copilot-pbr/references/questioning.md +21 -1
  35. package/plugins/copilot-pbr/references/verification-patterns.md +52 -1
  36. package/plugins/copilot-pbr/skills/audit/SKILL.md +19 -3
  37. package/plugins/copilot-pbr/skills/begin/SKILL.md +57 -4
  38. package/plugins/copilot-pbr/skills/build/SKILL.md +39 -2
  39. package/plugins/copilot-pbr/skills/debug/SKILL.md +12 -1
  40. package/plugins/copilot-pbr/skills/explore/SKILL.md +13 -2
  41. package/plugins/copilot-pbr/skills/import/SKILL.md +26 -1
  42. package/plugins/copilot-pbr/skills/milestone/SKILL.md +15 -3
  43. package/plugins/copilot-pbr/skills/plan/SKILL.md +50 -0
  44. package/plugins/copilot-pbr/skills/quick/SKILL.md +21 -0
  45. package/plugins/copilot-pbr/skills/review/SKILL.md +45 -0
  46. package/plugins/copilot-pbr/skills/scan/SKILL.md +20 -0
  47. package/plugins/copilot-pbr/templates/SUMMARY-complex.md.tmpl +95 -0
  48. package/plugins/copilot-pbr/templates/SUMMARY-minimal.md.tmpl +48 -0
  49. package/plugins/cursor-pbr/.cursor-plugin/plugin.json +1 -1
  50. package/plugins/cursor-pbr/agents/audit.md +51 -5
  51. package/plugins/cursor-pbr/agents/codebase-mapper.md +48 -1
  52. package/plugins/cursor-pbr/agents/debugger.md +47 -1
  53. package/plugins/cursor-pbr/agents/executor.md +152 -8
  54. package/plugins/cursor-pbr/agents/general.md +46 -1
  55. package/plugins/cursor-pbr/agents/integration-checker.md +51 -1
  56. package/plugins/cursor-pbr/agents/plan-checker.md +49 -1
  57. package/plugins/cursor-pbr/agents/planner.md +54 -1
  58. package/plugins/cursor-pbr/agents/researcher.md +46 -1
  59. package/plugins/cursor-pbr/agents/synthesizer.md +49 -1
  60. package/plugins/cursor-pbr/agents/verifier.md +85 -1
  61. package/plugins/cursor-pbr/hooks/hooks.json +9 -0
  62. package/plugins/cursor-pbr/references/agent-contracts.md +27 -0
  63. package/plugins/cursor-pbr/references/checkpoints.md +32 -1
  64. package/plugins/cursor-pbr/references/context-quality-tiers.md +45 -0
  65. package/plugins/cursor-pbr/references/pbr-tools-cli.md +115 -0
  66. package/plugins/cursor-pbr/references/questioning.md +21 -1
  67. package/plugins/cursor-pbr/references/verification-patterns.md +52 -1
  68. package/plugins/cursor-pbr/skills/audit/SKILL.md +19 -3
  69. package/plugins/cursor-pbr/skills/begin/SKILL.md +57 -4
  70. package/plugins/cursor-pbr/skills/build/SKILL.md +37 -2
  71. package/plugins/cursor-pbr/skills/debug/SKILL.md +12 -1
  72. package/plugins/cursor-pbr/skills/explore/SKILL.md +13 -2
  73. package/plugins/cursor-pbr/skills/import/SKILL.md +26 -1
  74. package/plugins/cursor-pbr/skills/milestone/SKILL.md +15 -3
  75. package/plugins/cursor-pbr/skills/plan/SKILL.md +50 -0
  76. package/plugins/cursor-pbr/skills/quick/SKILL.md +21 -0
  77. package/plugins/cursor-pbr/skills/review/SKILL.md +45 -0
  78. package/plugins/cursor-pbr/skills/scan/SKILL.md +20 -0
  79. package/plugins/cursor-pbr/templates/SUMMARY-complex.md.tmpl +95 -0
  80. package/plugins/cursor-pbr/templates/SUMMARY-minimal.md.tmpl +48 -0
  81. package/plugins/pbr/.claude-plugin/plugin.json +1 -1
  82. package/plugins/pbr/agents/audit.md +44 -0
  83. package/plugins/pbr/agents/codebase-mapper.md +47 -0
  84. package/plugins/pbr/agents/debugger.md +46 -0
  85. package/plugins/pbr/agents/executor.md +150 -6
  86. package/plugins/pbr/agents/general.md +45 -0
  87. package/plugins/pbr/agents/integration-checker.md +50 -0
  88. package/plugins/pbr/agents/plan-checker.md +48 -0
  89. package/plugins/pbr/agents/planner.md +51 -0
  90. package/plugins/pbr/agents/researcher.md +45 -0
  91. package/plugins/pbr/agents/synthesizer.md +48 -0
  92. package/plugins/pbr/agents/verifier.md +84 -0
  93. package/plugins/pbr/hooks/hooks.json +9 -0
  94. package/plugins/pbr/references/agent-contracts.md +27 -0
  95. package/plugins/pbr/references/checkpoints.md +32 -0
  96. package/plugins/pbr/references/context-quality-tiers.md +45 -0
  97. package/plugins/pbr/references/pbr-tools-cli.md +115 -0
  98. package/plugins/pbr/references/questioning.md +21 -0
  99. package/plugins/pbr/references/verification-patterns.md +52 -0
  100. package/plugins/pbr/scripts/check-plan-format.js +13 -1
  101. package/plugins/pbr/scripts/check-state-sync.js +26 -7
  102. package/plugins/pbr/scripts/check-subagent-output.js +30 -2
  103. package/plugins/pbr/scripts/config-schema.json +11 -1
  104. package/plugins/pbr/scripts/context-bridge.js +259 -0
  105. package/plugins/pbr/scripts/lib/config.js +178 -0
  106. package/plugins/pbr/scripts/lib/core.js +578 -0
  107. package/plugins/pbr/scripts/lib/history.js +73 -0
  108. package/plugins/pbr/scripts/lib/init.js +166 -0
  109. package/plugins/pbr/scripts/lib/phase.js +364 -0
  110. package/plugins/pbr/scripts/lib/roadmap.js +175 -0
  111. package/plugins/pbr/scripts/lib/state.js +397 -0
  112. package/plugins/pbr/scripts/pbr-tools.js +346 -1310
  113. package/plugins/pbr/scripts/post-write-dispatch.js +5 -4
  114. package/plugins/pbr/scripts/pre-write-dispatch.js +1 -1
  115. package/plugins/pbr/scripts/progress-tracker.js +1 -1
  116. package/plugins/pbr/scripts/suggest-compact.js +1 -1
  117. package/plugins/pbr/scripts/track-context-budget.js +53 -2
  118. package/plugins/pbr/scripts/validate-task.js +20 -28
  119. package/plugins/pbr/skills/audit/SKILL.md +19 -3
  120. package/plugins/pbr/skills/begin/SKILL.md +48 -2
  121. package/plugins/pbr/skills/build/SKILL.md +39 -2
  122. package/plugins/pbr/skills/debug/SKILL.md +12 -1
  123. package/plugins/pbr/skills/debug/templates/continuation-prompt.md.tmpl +12 -1
  124. package/plugins/pbr/skills/debug/templates/initial-investigation-prompt.md.tmpl +12 -5
  125. package/plugins/pbr/skills/explore/SKILL.md +13 -2
  126. package/plugins/pbr/skills/import/SKILL.md +26 -1
  127. package/plugins/pbr/skills/milestone/SKILL.md +15 -3
  128. package/plugins/pbr/skills/plan/SKILL.md +52 -2
  129. package/plugins/pbr/skills/quick/SKILL.md +21 -0
  130. package/plugins/pbr/skills/review/SKILL.md +46 -0
  131. package/plugins/pbr/skills/scan/SKILL.md +20 -0
  132. package/plugins/pbr/templates/SUMMARY-complex.md.tmpl +95 -0
  133. package/plugins/pbr/templates/SUMMARY-minimal.md.tmpl +48 -0
@@ -281,6 +281,13 @@ NOTE: The pbr:plan-checker subagent type auto-loads the agent definition. Do NOT
281
281
  ```
282
282
  You are the plan-checker agent.
283
283
 
284
+ <files_to_read>
285
+ CRITICAL: Read these files BEFORE any other action:
286
+ 1. .planning/CONTEXT.md — locked decisions and constraints (if exists)
287
+ 2. .planning/STATE.md — current project state and progress
288
+ 3. .planning/ROADMAP.md — phase structure, goals, and dependencies
289
+ </files_to_read>
290
+
284
291
  <plans_to_check>
285
292
  {For each generated PLAN.md:}
286
293
  --- Plan File: {filename} ---
@@ -311,7 +318,15 @@ Run all verification dimensions on these plans. Return your structured report.
311
318
  Do NOT write any files. Return your findings as your response text.
312
319
  ```
313
320
 
314
- **Process checker results — revision loop:**
321
+ **Process checker results — completion marker check:**
322
+
323
+ After the plan-checker completes, check for completion markers in the Task() output:
324
+
325
+ - If `## CHECK PASSED` is present: skip the revision loop entirely and proceed to Step 7.
326
+ - If `## ISSUES FOUND` is present: enter the revision loop below.
327
+ - If neither marker is found: treat as issues found and enter the revision loop.
328
+
329
+ **Revision loop:**
315
330
 
316
331
  Reference: `skills/shared/revision-loop.md` for the full Check-Revise-Escalate pattern (max 3 iterations).
317
332
 
@@ -331,6 +346,16 @@ If existing plans are being replaced (user confirmed in Step 1):
331
346
 
332
347
  ---
333
348
 
349
+ **Step 7b — Spot-check artifacts:**
350
+
351
+ After writing plan files, verify they landed on disk:
352
+
353
+ 1. Glob `.planning/phases/{NN}-{slug}/PLAN-*.md` to confirm files exist
354
+ 2. Count matches — must equal the number of plans generated in Step 5
355
+ 3. If any are missing: re-attempt the write. If still missing, display an error listing the missing files.
356
+
357
+ ---
358
+
334
359
  ### Step 8: Update All State (inline)
335
360
 
336
361
  Perform all state updates in this order:
@@ -491,6 +491,12 @@ Verify milestone completion with cross-phase integration checks.
491
491
  ```
492
492
  You are integration-checker. Perform cross-phase integration verification.
493
493
 
494
+ <files_to_read>
495
+ CRITICAL: Read these files BEFORE any other action:
496
+ 1. .planning/ROADMAP.md — phase structure, goals, and dependencies
497
+ 2. .planning/phases/{NN}-{slug}/SUMMARY.md — for each milestone phase (read all)
498
+ </files_to_read>
499
+
494
500
  Milestone: {version or "current"}
495
501
  Phases to check: {list of phase directories}
496
502
 
@@ -510,20 +516,26 @@ Verify milestone completion with cross-phase integration checks.
510
516
  5. Return findings as a structured report
511
517
  ```
512
518
 
513
- 4. **Check requirements coverage:**
519
+ 4. **Check integration-checker completion:**
520
+
521
+ After the integration-checker completes, check for `## INTEGRATION CHECK COMPLETE` in the Task() output. If the marker is absent, warn: `⚠ Integration checker did not return completion marker — results may be incomplete.` Proceed with whatever findings were returned but note the incomplete status in the audit report.
522
+
523
+ 5. **Check requirements coverage:**
514
524
  - Read REQUIREMENTS.md
515
525
  - For each requirement tagged for this milestone:
516
526
  - Search VERIFICATION.md files for coverage
517
527
  - Search SUMMARY.md `provides` fields
518
528
  - Flag uncovered requirements
519
529
 
520
- 5. **Write audit report:**
530
+ 6. **Write audit report:**
521
531
 
522
532
  Create `.planning/{version}-MILESTONE-AUDIT.md` using the template:
523
533
 
524
534
  Read `skills/milestone/templates/audit-report.md.tmpl` for the audit report format. Fill in all `{variable}` placeholders with actual data from the audit.
525
535
 
526
- 6. **Report to user** using branded banners:
536
+ **Spot-check:** After writing, verify `.planning/{version}-MILESTONE-AUDIT.md` exists on disk using Glob. If missing, re-attempt the write. If still missing, display an error and include findings inline.
537
+
538
+ 7. **Report to user** using branded banners:
527
539
 
528
540
  **If PASSED:**
529
541
  ```
@@ -139,6 +139,8 @@ Reference: `skills/shared/config-loading.md` for the tooling shortcut (`state lo
139
139
 
140
140
  ### Step 2: Load Context (inline)
141
141
 
142
+ **Init-first pattern**: When spawning agents, pass the output of `node plugins/pbr/scripts/pbr-tools.js init plan-phase {N}` as context rather than having the agent read multiple files separately. This reduces file reads and prevents context-loading failures.
143
+
142
144
  Read context file PATHS and metadata. Build lean context bundles for subagent prompts — include paths and one-line descriptions, NOT full file bodies. Agents have the Read tool and will pull file contents on-demand.
143
145
 
144
146
  ```
@@ -232,8 +234,22 @@ Read `skills/plan/templates/researcher-prompt.md.tmpl` and use it as the prompt
232
234
  - `{dependencies from roadmap}` - dependency list
233
235
  - Fill `<project_context>` and `<prior_work>` blocks per the shared partial (`templates/prompt-partials/phase-project-context.md.tmpl`): Decision Summary for context, manifest table for prior work
234
236
 
237
+ **Prepend this block to the researcher prompt before sending:**
238
+ ```
239
+ <files_to_read>
240
+ CRITICAL: Read these files BEFORE any other action:
241
+ 1. .planning/ROADMAP.md — phase goals, dependencies, and structure
242
+ 2. .planning/REQUIREMENTS.md — scoped requirements for this phase (if exists)
243
+ </files_to_read>
244
+ ```
245
+
235
246
  Wait for the researcher to complete before proceeding.
236
247
 
248
+ After the researcher completes, check the Task() output for a completion marker:
249
+ - If `## RESEARCH COMPLETE` is present: proceed to planner
250
+ - If `## RESEARCH BLOCKED` is present: warn the user that research could not complete, ask if they want to proceed with limited context or stop
251
+ - If neither marker is present: warn that researcher may not have completed successfully, but proceed
252
+
237
253
  ---
238
254
 
239
255
  ### Step 4.5: Seed Scanning (inline, before planning)
@@ -344,7 +360,9 @@ Task({
344
360
  prompt: <planning prompt>
345
361
  })
346
362
 
347
- NOTE: The pbr:planner subagent type auto-loads the agent definition. Do NOT inline it.
363
+ NOTE: The pbr:planner subagent type auto-loads the agent definition.
364
+
365
+ After planner completes, check for completion markers: `## PLANNING COMPLETE`, `## PLANNING FAILED`, or `## PLANNING INCONCLUSIVE`. Route accordingly. Do NOT inline it.
348
366
  ```
349
367
 
350
368
  **Path resolution**: Before constructing the agent prompt, resolve `${CLAUDE_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.
@@ -359,6 +377,16 @@ Read `skills/plan/templates/planner-prompt.md.tmpl` and use it as the prompt tem
359
377
  - `<config>` - max tasks, parallelization, TDD mode from config.json
360
378
  - `<planning_instructions>` - phase-specific planning rules and output path
361
379
 
380
+ **Prepend this block to the planner prompt before sending:**
381
+ ```
382
+ <files_to_read>
383
+ CRITICAL: Read these files BEFORE any other action:
384
+ 1. .planning/CONTEXT.md — locked decisions and constraints (if exists)
385
+ 2. .planning/ROADMAP.md — phase goals, dependencies, and structure
386
+ 3. .planning/phases/{NN}-{slug}/RESEARCH.md — research findings (if exists)
387
+ </files_to_read>
388
+ ```
389
+
362
390
  Wait for the planner to complete.
363
391
 
364
392
  After the planner returns, read the plan files it created to extract counts. Display a completion summary:
@@ -369,6 +397,17 @@ After the planner returns, read the plan files it created to extract counts. Dis
369
397
 
370
398
  Where `{N}` is the number of PLAN.md files written and `{M}` is the number of distinct wave values across those plans (from frontmatter).
371
399
 
400
+ ### Step 5b: Spot-Check Planner Output
401
+
402
+ CRITICAL: Verify planner output before proceeding.
403
+
404
+ 1. **PLAN files exist**: Check `.planning/phases/{NN}-{slug}/PLAN-*.md` files exist on disk
405
+ 2. **Valid frontmatter**: Read first 20 lines of each PLAN file — verify `depends_on`, `files_modified`, `must_haves` fields present
406
+ 3. **Task structure**: Verify at least one `<task>` block exists in each plan file
407
+ 4. **Plan count matches**: Number of PLAN files matches what the planner reported
408
+
409
+ If ANY spot-check fails, present the user with options: **Retry** / **Continue anyway** / **Abort**
410
+
372
411
  ---
373
412
 
374
413
  ### Step 6: Plan Validation (delegated, conditional)
@@ -402,6 +441,15 @@ Read `skills/plan/templates/checker-prompt.md.tmpl` and use it as the prompt tem
402
441
  - `<phase_context>` - phase goal and requirement IDs
403
442
  - `<context>` - file paths to project-level and phase-level CONTEXT.md files (checker reads via Read tool)
404
443
 
444
+ **Prepend this block to the checker prompt before sending:**
445
+ ```
446
+ <files_to_read>
447
+ CRITICAL: Read these files BEFORE any other action:
448
+ 1. .planning/phases/{NN}-{slug}/PLAN-*.md — plan files to validate
449
+ 2. .planning/CONTEXT.md — locked decisions to check against (if exists)
450
+ </files_to_read>
451
+ ```
452
+
405
453
  **Process checker results:**
406
454
 
407
455
  After the plan checker returns, display its result:
@@ -492,7 +540,9 @@ Use AskUserQuestion (pattern: approve-revise-abort from `skills/shared/gate-prom
492
540
  4. Update the `Plans Complete` column to `0/{N}` where N = number of plan files just created
493
541
  5. Update the `Status` column to `planned`
494
542
  6. Save the file — do NOT skip this step
495
- - Update STATE.md **(CRITICAL — update BOTH frontmatter AND body)**: set `status: "planned"`, `plans_total`, `last_command` in frontmatter AND update `Status:`, `Plan:` lines in body `## Current Position`
543
+ - Update STATE.md via CLI **(CRITICAL — update BOTH frontmatter AND body)**: set `status: "planned"`, `plans_total`, `last_command` in frontmatter AND update `Status:`, `Plan:` lines in body `## Current Position`
544
+
545
+ **Tooling shortcut**: `node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js state patch '{"status":"planned","last_command":"/pbr:plan {N}"}'`
496
546
  - **If `features.auto_advance` is `true` AND `mode` is `autonomous`:** Chain directly to build: `Skill({ skill: "pbr:build", args: "{N}" })`. This continues the build→review→plan→build cycle automatically.
497
547
  - **Otherwise:** Suggest next action: `/pbr:build {N}`
498
548
 
@@ -45,6 +45,8 @@ Additionally for this skill:
45
45
 
46
46
  ### Step 1: Check Project Context
47
47
 
48
+ **Init-first pattern**: When spawning agents, pass the output of `node plugins/pbr/scripts/pbr-tools.js init quick "{description}"` as context rather than having the agent read multiple files separately. This reduces file reads and prevents context-loading failures.
49
+
48
50
  1. Check if `.planning/` directory exists
49
51
  - If yes: read config.json for settings
50
52
  - If no: create **both** `.planning/` and `.planning/quick/` directories, then warn "No Plan-Build-Run project found. This will create a standalone quick task. Consider running `/pbr:begin` first for full project tracking."
@@ -168,9 +170,17 @@ Display to the user: `◐ Spawning executor...`
168
170
 
169
171
  Spawn a `Task(subagent_type: "pbr:executor")` with the following prompt:
170
172
 
173
+ > **Completion markers**: After executor completes, check for `## PLAN COMPLETE` or `## PLAN FAILED`. Route accordingly.
174
+
171
175
  ```
172
176
  You are executor. Execute the following quick task plan.
173
177
 
178
+ <files_to_read>
179
+ CRITICAL: Read these files BEFORE any other action:
180
+ 1. .planning/quick/{NNN}-{slug}/PLAN.md — the quick task plan with task details
181
+ 2. .planning/STATE.md — current project state and progress (if exists)
182
+ </files_to_read>
183
+
174
184
  Plan file: .planning/quick/{NNN}-{slug}/PLAN.md
175
185
  Phase: quick
176
186
  Plan ID: {NNN}
@@ -193,6 +203,17 @@ After the executor completes:
193
203
  - `partial` — some tasks completed, others failed
194
204
  - `failed` — task failed entirely
195
205
 
206
+ ### Step 8b: Spot-Check Executor Output
207
+
208
+ CRITICAL: Verify executor output before proceeding.
209
+
210
+ 1. **SUMMARY.md exists**: Check `.planning/quick/{NNN}-{slug}/SUMMARY.md` exists
211
+ 2. **Key files exist**: Verify first 2 files from SUMMARY.md `key_files` frontmatter exist on disk
212
+ 3. **Commits present**: Run `git log --oneline -5` and verify at least one commit matches the task scope
213
+ 4. **Self-check status**: Look for `## Self-Check: FAILED` in SUMMARY.md — if present, warn the user
214
+
215
+ If ANY spot-check fails, present the user with options: **Retry** / **Continue anyway** / **Abort**
216
+
196
217
  ### Step 9: Update STATE.md
197
218
 
198
219
  If STATE.md exists, update the Quick Tasks section.
@@ -64,6 +64,8 @@ Execute these steps in order.
64
64
 
65
65
  ### Step 1: Parse and Validate (inline)
66
66
 
67
+ **Init-first pattern**: When spawning agents, pass the output of `node plugins/pbr/scripts/pbr-tools.js init verify-work {N}` as context rather than having the agent read multiple files separately. This reduces file reads and prevents context-loading failures.
68
+
67
69
  1. Parse `$ARGUMENTS` for phase number and `--auto-fix` flag
68
70
  2. Read `.planning/config.json`
69
71
  **CRITICAL: Write .active-skill NOW.** Write the text "review" to `.planning/.active-skill` using the Write tool.
@@ -164,6 +166,7 @@ Spawn a verifier Task() to run three-layer checks:
164
166
  ```
165
167
  Task({
166
168
  subagent_type: "pbr:verifier",
169
+ // After verifier completes, check for: ## VERIFICATION COMPLETE
167
170
  prompt: <verifier prompt>
168
171
  })
169
172
  ```
@@ -174,6 +177,16 @@ Task({
174
177
 
175
178
  Read `skills/review/templates/verifier-prompt.md.tmpl` and use its content as the verifier prompt.
176
179
 
180
+ **Prepend this block to the verifier prompt before sending:**
181
+ ```
182
+ <files_to_read>
183
+ CRITICAL: Read these files BEFORE any other action:
184
+ 1. .planning/phases/{NN}-{slug}/PLAN-*.md — must-haves to verify against
185
+ 2. .planning/phases/{NN}-{slug}/SUMMARY-*.md — executor build summaries
186
+ 3. .planning/phases/{NN}-{slug}/VERIFICATION.md — prior verification results (if exists)
187
+ </files_to_read>
188
+ ```
189
+
177
190
  **Placeholders to fill before sending:**
178
191
  - `{For each PLAN.md file in the phase directory:}` — inline each plan's must_haves frontmatter block
179
192
  - `{For each SUMMARY.md file in the phase directory:}` — provide manifest table with file paths and status from frontmatter. The verifier reads full content from disk via Read tool.
@@ -200,6 +213,17 @@ Then show a brief table of must-haves with pass/fail status:
200
213
 
201
214
  Then display the overall verdict (`PASSED`, `GAPS FOUND`, or `HUMAN NEEDED`) before proceeding to the full results presentation.
202
215
 
216
+ ### Step 3a: Spot-Check Verifier Output
217
+
218
+ CRITICAL: Verify verifier output before proceeding.
219
+
220
+ 1. **VERIFICATION.md exists**: Check `.planning/phases/{NN}-{slug}/VERIFICATION.md` exists on disk
221
+ 2. **Status field present**: Read VERIFICATION.md frontmatter — verify `status` field is present and is one of: pass, fail, partial
222
+ 3. **Must-haves checked**: Verify `must_haves_checked` count > 0 in frontmatter
223
+ 4. **Completion marker**: Look for `## VERIFICATION COMPLETE` in the Task() output
224
+
225
+ If ANY spot-check fails, present the user with options: **Retry** / **Continue anyway** / **Abort**
226
+
203
227
  ---
204
228
 
205
229
  ### Step 3b: Local LLM Verification Quality Check (optional, advisory)
@@ -395,6 +419,16 @@ Task({
395
419
 
396
420
  Read `skills/review/templates/debugger-prompt.md.tmpl` and use its content as the debugger prompt.
397
421
 
422
+ **Prepend this block to the debugger prompt before sending:**
423
+ ```
424
+ <files_to_read>
425
+ CRITICAL: Read these files BEFORE any other action:
426
+ 1. .planning/phases/{NN}-{slug}/VERIFICATION.md — gaps and failure details
427
+ 2. .planning/phases/{NN}-{slug}/SUMMARY-*.md — what was built
428
+ 3. .planning/phases/{NN}-{slug}/PLAN-*.md — original plan must-haves
429
+ </files_to_read>
430
+ ```
431
+
398
432
  **Placeholders to fill before sending:**
399
433
  - `[Inline the VERIFICATION.md content]` — provide file path; debugger reads via Read tool
400
434
  - `[Inline all SUMMARY.md files for the phase]` — provide manifest table of file paths
@@ -417,6 +451,16 @@ Task({
417
451
 
418
452
  Read `skills/review/templates/gap-planner-prompt.md.tmpl` and use its content as the gap planner prompt.
419
453
 
454
+ **Prepend this block to the gap planner prompt before sending:**
455
+ ```
456
+ <files_to_read>
457
+ CRITICAL: Read these files BEFORE any other action:
458
+ 1. .planning/phases/{NN}-{slug}/VERIFICATION.md — gaps to close
459
+ 2. .planning/phases/{NN}-{slug}/PLAN-*.md — existing plans for context
460
+ 3. .planning/CONTEXT.md — locked decisions and constraints (if exists)
461
+ </files_to_read>
462
+ ```
463
+
420
464
  **Placeholders to fill before sending:**
421
465
  - `[Inline VERIFICATION.md]` — provide file path; planner reads via Read tool
422
466
  - `[Inline the debugger's root cause analysis]` — keep inline (already in conversation context)
@@ -601,6 +645,8 @@ After review completes, always present a clear next action using the completion
601
645
  - **If gaps remain:** Use the "Gaps Found" template. Fill in phase number, name, gap count, and gap summaries.
602
646
  - **If final phase:** Use the "Milestone Complete" template. Fill in phase count.
603
647
 
648
+ Include `<sub>/clear first → fresh context window</sub>` inside the Next Up routing block of the completion template.
649
+
604
650
  ---
605
651
 
606
652
  ## Notes
@@ -126,6 +126,14 @@ For each agent, read `skills/scan/templates/mapper-prompt.md.tmpl` and fill in t
126
126
  - `{scale}`: detected scale from Step 2
127
127
  - `{output_path}`: `.planning/codebase/`
128
128
 
129
+ **Prepend this block to each mapper prompt before sending:**
130
+ ```
131
+ <files_to_read>
132
+ CRITICAL: Read these files BEFORE any other action:
133
+ 1. .planning/codebase/RECON.md — baseline reconnaissance data (if exists)
134
+ </files_to_read>
135
+ ```
136
+
129
137
  | Agent | Focus | Output Files | When |
130
138
  |-------|-------|-------------|------|
131
139
  | 1 | tech | STACK.md, INTEGRATIONS.md | Always |
@@ -145,6 +153,18 @@ All agents run in parallel. As each completes, display:
145
153
 
146
154
  (Only display lines for the focus areas that were actually spawned.)
147
155
 
156
+ ### Step 4b: Check Completion Markers
157
+
158
+ After each codebase-mapper Task() completes, check the Task() output for the `## MAPPING COMPLETE` marker:
159
+
160
+ - If `## MAPPING COMPLETE` is present: the mapper finished successfully, proceed normally
161
+ - If the marker is missing: warn the user that the mapper may not have completed successfully:
162
+ ```
163
+ ⚠ Codebase mapper ({focus_area}) did not report MAPPING COMPLETE.
164
+ Output may be incomplete — check .planning/codebase/ for partial results.
165
+ ```
166
+ Continue to Step 5 verification regardless (the file existence checks will catch truly missing output).
167
+
148
168
  ### Step 5: Verify Output
149
169
 
150
170
  After all agents complete, verify the expected files exist:
@@ -0,0 +1,95 @@
1
+ # SUMMARY-complex.md Template
2
+
3
+ > Use when: decisions were made OR fileCount > 6
4
+ > Referenced by: executor agent (complex plans, architectural work)
5
+
6
+ ## Frontmatter (YAML)
7
+
8
+ ```yaml
9
+ ---
10
+ phase: "{phase_id}"
11
+ plan: "{plan_id}"
12
+ status: "complete" # complete | partial | checkpoint
13
+ subsystem: "{main subsystem affected}"
14
+ tags:
15
+ - "{tag1}"
16
+ requires:
17
+ - "{plan_id}: {artifact}"
18
+ provides:
19
+ - "{export/artifact description}"
20
+ affects:
21
+ - "{affected area 1}"
22
+ tech_stack:
23
+ - "{technology used}"
24
+ key_files:
25
+ - "{file1}: {what it does}"
26
+ key_decisions:
27
+ - "{decision 1}: {rationale}"
28
+ patterns:
29
+ - "{pattern used}: {where}"
30
+ metrics:
31
+ duration_minutes: {n}
32
+ tasks_completed: {n}
33
+ tasks_total: {n}
34
+ commits: {n}
35
+ files_created: {n}
36
+ files_modified: {n}
37
+ deferred:
38
+ - "{thing noticed but not implemented}"
39
+ self_check_failures:
40
+ - "{failure description}"
41
+ architecture_notes:
42
+ - "{key architectural decision and why}"
43
+ ---
44
+ ```
45
+
46
+ ## Body Structure
47
+
48
+ ```markdown
49
+ # Plan Summary: {plan_id}
50
+
51
+ ## What Was Built
52
+
53
+ {2-3 paragraph description of what was accomplished}
54
+
55
+ ## Architecture Decisions
56
+
57
+ | Decision | Options Considered | Chosen | Rationale |
58
+ |----------|-------------------|--------|-----------|
59
+ | {decision} | {opt1}, {opt2} | {chosen} | {why} |
60
+
61
+ ## Task Results
62
+
63
+ | Task | Status | Commit | Files | Verify |
64
+ |------|--------|--------|-------|--------|
65
+ | {task_id}: {name} | done | {hash} | {count} | passed |
66
+
67
+ ## Key Implementation Details
68
+
69
+ {Important details about HOW things were implemented}
70
+
71
+ ## Integration Points
72
+
73
+ {How this plan connects to other plans - imports, exports, shared state}
74
+
75
+ ## Known Issues
76
+
77
+ {Issues discovered during execution}
78
+
79
+ ## Dependencies Provided
80
+
81
+ {What other plans can now depend on}
82
+
83
+ ## Deferred Items
84
+
85
+ {Items noticed but intentionally deferred - with rationale}
86
+ ```
87
+
88
+ ## Selection Heuristic
89
+
90
+ Use this template when ANY of the following are true:
91
+ - Key architectural decisions were made during execution
92
+ - Total files created or modified > 6
93
+ - Deviations from the plan occurred
94
+ - Multiple integration points were established
95
+ - The plan touched shared infrastructure or patterns
@@ -0,0 +1,48 @@
1
+ # SUMMARY-minimal.md Template
2
+
3
+ > Use when: taskCount <= 2 AND fileCount <= 3
4
+ > Referenced by: executor agent (quick tasks, simple plans)
5
+
6
+ ## Frontmatter (YAML)
7
+
8
+ ```yaml
9
+ ---
10
+ phase: "{phase_id}"
11
+ plan: "{plan_id}"
12
+ status: "complete" # complete | partial | checkpoint
13
+ requires: []
14
+ provides:
15
+ - "{export/artifact description}"
16
+ key_files:
17
+ - "{file1}: {what it does}"
18
+ deferred: []
19
+ metrics:
20
+ tasks_completed: {n}
21
+ tasks_total: {n}
22
+ commits: {n}
23
+ ---
24
+ ```
25
+
26
+ ## Body Structure
27
+
28
+ ```markdown
29
+ # Plan Summary: {plan_id}
30
+
31
+ ## What Was Built
32
+
33
+ {1 paragraph description}
34
+
35
+ ## Task Results
36
+
37
+ | Task | Status | Commit | Files |
38
+ |------|--------|--------|-------|
39
+ | {task_id}: {name} | done | {hash} | {count} |
40
+ ```
41
+
42
+ ## Selection Heuristic
43
+
44
+ Use this template when ALL of the following are true:
45
+ - Total tasks in the plan <= 2
46
+ - Total files created or modified <= 3
47
+ - No key decisions were made
48
+ - No deviations from the plan occurred