@sienklogic/plan-build-run 2.33.1 → 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 (140) hide show
  1. package/CHANGELOG.md +678 -0
  2. package/dashboard/public/css/command-center.css +152 -65
  3. package/dashboard/public/css/explorer.css +70 -41
  4. package/dashboard/public/css/layout.css +163 -2
  5. package/dashboard/public/css/settings.css +108 -110
  6. package/dashboard/public/css/timeline.css +2 -1
  7. package/dashboard/public/css/tokens.css +13 -0
  8. package/dashboard/public/js/sidebar-toggle.js +21 -7
  9. package/dashboard/src/components/Layout.tsx +51 -7
  10. package/dashboard/src/components/explorer/tabs/MilestonesTab.tsx +18 -2
  11. package/dashboard/src/components/explorer/tabs/PhasesTab.tsx +11 -1
  12. package/dashboard/src/components/explorer/tabs/TodosTab.tsx +25 -6
  13. package/dashboard/src/components/partials/AttentionPanel.tsx +7 -1
  14. package/dashboard/src/components/partials/CurrentPhaseCard.tsx +26 -24
  15. package/dashboard/src/components/partials/QuickActions.tsx +21 -11
  16. package/dashboard/src/components/partials/StatCardGrid.tsx +67 -0
  17. package/dashboard/src/components/partials/StatusHeader.tsx +2 -1
  18. package/dashboard/src/components/settings/LogEntryList.tsx +43 -5
  19. package/dashboard/src/routes/command-center.routes.tsx +8 -7
  20. package/dashboard/src/routes/index.routes.tsx +32 -29
  21. package/package.json +2 -2
  22. package/plugins/copilot-pbr/agents/audit.agent.md +128 -16
  23. package/plugins/copilot-pbr/agents/codebase-mapper.agent.md +48 -1
  24. package/plugins/copilot-pbr/agents/debugger.agent.md +47 -1
  25. package/plugins/copilot-pbr/agents/executor.agent.md +152 -8
  26. package/plugins/copilot-pbr/agents/general.agent.md +46 -1
  27. package/plugins/copilot-pbr/agents/integration-checker.agent.md +52 -2
  28. package/plugins/copilot-pbr/agents/plan-checker.agent.md +50 -2
  29. package/plugins/copilot-pbr/agents/planner.agent.md +54 -1
  30. package/plugins/copilot-pbr/agents/researcher.agent.md +47 -2
  31. package/plugins/copilot-pbr/agents/synthesizer.agent.md +49 -1
  32. package/plugins/copilot-pbr/agents/verifier.agent.md +86 -2
  33. package/plugins/copilot-pbr/hooks/hooks.json +11 -0
  34. package/plugins/copilot-pbr/plugin.json +1 -1
  35. package/plugins/copilot-pbr/references/agent-contracts.md +27 -0
  36. package/plugins/copilot-pbr/references/checkpoints.md +32 -1
  37. package/plugins/copilot-pbr/references/context-quality-tiers.md +45 -0
  38. package/plugins/copilot-pbr/references/pbr-tools-cli.md +115 -0
  39. package/plugins/copilot-pbr/references/questioning.md +21 -1
  40. package/plugins/copilot-pbr/references/verification-patterns.md +52 -1
  41. package/plugins/copilot-pbr/skills/audit/SKILL.md +19 -3
  42. package/plugins/copilot-pbr/skills/begin/SKILL.md +57 -4
  43. package/plugins/copilot-pbr/skills/build/SKILL.md +39 -2
  44. package/plugins/copilot-pbr/skills/debug/SKILL.md +12 -1
  45. package/plugins/copilot-pbr/skills/explore/SKILL.md +13 -2
  46. package/plugins/copilot-pbr/skills/import/SKILL.md +26 -1
  47. package/plugins/copilot-pbr/skills/milestone/SKILL.md +15 -3
  48. package/plugins/copilot-pbr/skills/plan/SKILL.md +50 -0
  49. package/plugins/copilot-pbr/skills/quick/SKILL.md +21 -0
  50. package/plugins/copilot-pbr/skills/review/SKILL.md +45 -0
  51. package/plugins/copilot-pbr/skills/scan/SKILL.md +20 -0
  52. package/plugins/copilot-pbr/templates/SUMMARY-complex.md.tmpl +95 -0
  53. package/plugins/copilot-pbr/templates/SUMMARY-minimal.md.tmpl +48 -0
  54. package/plugins/cursor-pbr/.cursor-plugin/plugin.json +1 -1
  55. package/plugins/cursor-pbr/agents/audit.md +51 -5
  56. package/plugins/cursor-pbr/agents/codebase-mapper.md +48 -1
  57. package/plugins/cursor-pbr/agents/debugger.md +47 -1
  58. package/plugins/cursor-pbr/agents/executor.md +152 -8
  59. package/plugins/cursor-pbr/agents/general.md +46 -1
  60. package/plugins/cursor-pbr/agents/integration-checker.md +51 -1
  61. package/plugins/cursor-pbr/agents/plan-checker.md +49 -1
  62. package/plugins/cursor-pbr/agents/planner.md +54 -1
  63. package/plugins/cursor-pbr/agents/researcher.md +46 -1
  64. package/plugins/cursor-pbr/agents/synthesizer.md +49 -1
  65. package/plugins/cursor-pbr/agents/verifier.md +85 -1
  66. package/plugins/cursor-pbr/hooks/hooks.json +9 -0
  67. package/plugins/cursor-pbr/references/agent-contracts.md +27 -0
  68. package/plugins/cursor-pbr/references/checkpoints.md +32 -1
  69. package/plugins/cursor-pbr/references/context-quality-tiers.md +45 -0
  70. package/plugins/cursor-pbr/references/pbr-tools-cli.md +115 -0
  71. package/plugins/cursor-pbr/references/questioning.md +21 -1
  72. package/plugins/cursor-pbr/references/verification-patterns.md +52 -1
  73. package/plugins/cursor-pbr/skills/audit/SKILL.md +19 -3
  74. package/plugins/cursor-pbr/skills/begin/SKILL.md +57 -4
  75. package/plugins/cursor-pbr/skills/build/SKILL.md +37 -2
  76. package/plugins/cursor-pbr/skills/debug/SKILL.md +12 -1
  77. package/plugins/cursor-pbr/skills/explore/SKILL.md +13 -2
  78. package/plugins/cursor-pbr/skills/import/SKILL.md +26 -1
  79. package/plugins/cursor-pbr/skills/milestone/SKILL.md +15 -3
  80. package/plugins/cursor-pbr/skills/plan/SKILL.md +50 -0
  81. package/plugins/cursor-pbr/skills/quick/SKILL.md +21 -0
  82. package/plugins/cursor-pbr/skills/review/SKILL.md +45 -0
  83. package/plugins/cursor-pbr/skills/scan/SKILL.md +20 -0
  84. package/plugins/cursor-pbr/templates/SUMMARY-complex.md.tmpl +95 -0
  85. package/plugins/cursor-pbr/templates/SUMMARY-minimal.md.tmpl +48 -0
  86. package/plugins/pbr/.claude-plugin/plugin.json +1 -1
  87. package/plugins/pbr/agents/audit.md +44 -0
  88. package/plugins/pbr/agents/codebase-mapper.md +47 -0
  89. package/plugins/pbr/agents/debugger.md +46 -0
  90. package/plugins/pbr/agents/executor.md +150 -6
  91. package/plugins/pbr/agents/general.md +45 -0
  92. package/plugins/pbr/agents/integration-checker.md +50 -0
  93. package/plugins/pbr/agents/plan-checker.md +48 -0
  94. package/plugins/pbr/agents/planner.md +51 -0
  95. package/plugins/pbr/agents/researcher.md +45 -0
  96. package/plugins/pbr/agents/synthesizer.md +48 -0
  97. package/plugins/pbr/agents/verifier.md +84 -0
  98. package/plugins/pbr/hooks/hooks.json +9 -0
  99. package/plugins/pbr/references/agent-contracts.md +27 -0
  100. package/plugins/pbr/references/checkpoints.md +32 -0
  101. package/plugins/pbr/references/context-quality-tiers.md +45 -0
  102. package/plugins/pbr/references/pbr-tools-cli.md +115 -0
  103. package/plugins/pbr/references/questioning.md +21 -0
  104. package/plugins/pbr/references/verification-patterns.md +52 -0
  105. package/plugins/pbr/scripts/check-plan-format.js +15 -3
  106. package/plugins/pbr/scripts/check-state-sync.js +26 -7
  107. package/plugins/pbr/scripts/check-subagent-output.js +30 -2
  108. package/plugins/pbr/scripts/config-schema.json +11 -1
  109. package/plugins/pbr/scripts/context-bridge.js +259 -0
  110. package/plugins/pbr/scripts/context-budget-check.js +2 -2
  111. package/plugins/pbr/scripts/lib/config.js +178 -0
  112. package/plugins/pbr/scripts/lib/core.js +578 -0
  113. package/plugins/pbr/scripts/lib/history.js +73 -0
  114. package/plugins/pbr/scripts/lib/init.js +166 -0
  115. package/plugins/pbr/scripts/lib/phase.js +364 -0
  116. package/plugins/pbr/scripts/lib/roadmap.js +175 -0
  117. package/plugins/pbr/scripts/lib/state.js +397 -0
  118. package/plugins/pbr/scripts/pbr-tools.js +346 -1235
  119. package/plugins/pbr/scripts/post-write-dispatch.js +5 -4
  120. package/plugins/pbr/scripts/post-write-quality.js +3 -3
  121. package/plugins/pbr/scripts/pre-write-dispatch.js +1 -1
  122. package/plugins/pbr/scripts/progress-tracker.js +1 -1
  123. package/plugins/pbr/scripts/suggest-compact.js +1 -1
  124. package/plugins/pbr/scripts/track-context-budget.js +53 -2
  125. package/plugins/pbr/scripts/validate-task.js +20 -28
  126. package/plugins/pbr/skills/audit/SKILL.md +19 -3
  127. package/plugins/pbr/skills/begin/SKILL.md +48 -2
  128. package/plugins/pbr/skills/build/SKILL.md +39 -2
  129. package/plugins/pbr/skills/debug/SKILL.md +12 -1
  130. package/plugins/pbr/skills/debug/templates/continuation-prompt.md.tmpl +12 -1
  131. package/plugins/pbr/skills/debug/templates/initial-investigation-prompt.md.tmpl +12 -5
  132. package/plugins/pbr/skills/explore/SKILL.md +13 -2
  133. package/plugins/pbr/skills/import/SKILL.md +26 -1
  134. package/plugins/pbr/skills/milestone/SKILL.md +15 -3
  135. package/plugins/pbr/skills/plan/SKILL.md +52 -2
  136. package/plugins/pbr/skills/quick/SKILL.md +21 -0
  137. package/plugins/pbr/skills/review/SKILL.md +46 -0
  138. package/plugins/pbr/skills/scan/SKILL.md +20 -0
  139. package/plugins/pbr/templates/SUMMARY-complex.md.tmpl +95 -0
  140. package/plugins/pbr/templates/SUMMARY-minimal.md.tmpl +48 -0
@@ -226,6 +226,14 @@ For each researcher, construct the prompt by reading the template and filling in
226
226
 
227
227
  Read `skills/begin/templates/researcher-prompt.md.tmpl` for the prompt structure.
228
228
 
229
+ **Prepend this block to the researcher prompt before sending:**
230
+ ```
231
+ <files_to_read>
232
+ CRITICAL: Read these files BEFORE any other action:
233
+ 1. .planning/REQUIREMENTS.md — scoped requirements (if exists)
234
+ </files_to_read>
235
+ ```
236
+
229
237
  **Placeholders to fill:**
230
238
  - `{project name from questioning}` — project name gathered in Step 2
231
239
  - `{2-3 sentence description from questioning}` — project description from Step 2
@@ -268,6 +276,11 @@ Read `skills/begin/templates/researcher-prompt.md.tmpl` for the prompt structure
268
276
  - When all complete: "All {N} researchers finished. Proceeding to synthesis."
269
277
  - Wait for all to complete before proceeding
270
278
 
279
+ **After each researcher completes**, check the agent output for a completion marker:
280
+ - If `## RESEARCH COMPLETE` is present: researcher finished successfully, proceed
281
+ - If `## RESEARCH BLOCKED` is present: warn the user that research could not complete, ask if they want to proceed with limited context or stop
282
+ - If neither marker is present: warn that researcher may not have completed successfully, but proceed if output files exist on disk
283
+
271
284
  ---
272
285
 
273
286
  ### Step 6: Synthesis (delegated to agent)
@@ -284,12 +297,38 @@ Invoke the `@synthesizer` agent with the synthesis prompt.
284
297
 
285
298
  Read `skills/begin/templates/synthesis-prompt.md.tmpl` for the prompt structure.
286
299
 
300
+ **Prepend this block to the synthesizer prompt before sending:**
301
+ ```
302
+ <files_to_read>
303
+ CRITICAL: Read these files BEFORE any other action:
304
+ 1. .planning/research/*.md — all research output files from Step 5
305
+ </files_to_read>
306
+ ```
307
+
287
308
  **Placeholders to fill:**
288
309
  - `{List all .planning/research/*.md files that were created}` — list the research files produced in Step 5
289
310
 
290
- **After the synthesizer completes**, display:
311
+ **After the synthesizer completes**, check for completion markers in the Task() output:
312
+
313
+ - If `## SYNTHESIS COMPLETE` is present: proceed normally
314
+ - If `## SYNTHESIS BLOCKED` is present: warn the user and offer to proceed without synthesis:
315
+ ```
316
+ ⚠ Synthesizer reported BLOCKED: {reason from output}
317
+ Research files are still available individually in .planning/research/.
318
+ ```
319
+ Use AskUserQuestion (pattern: yes-no from `skills/shared/gate-prompts.md`):
320
+ question: "Synthesis was blocked. Continue without synthesis?"
321
+ header: "Blocked"
322
+ options:
323
+ - label: "Yes" description: "Proceed to requirements — use individual research files"
324
+ - label: "No" description: "Stop and investigate"
325
+ - If "Yes": proceed to Step 7 without SUMMARY.md
326
+ - If "No": stop and suggest reviewing .planning/research/ files
327
+ - If neither marker is found: warn the user that the synthesizer may not have completed successfully, but proceed if SUMMARY.md exists on disk
328
+
329
+ If synthesis succeeded, display:
291
330
  ```
292
- Research synthesis complete — see .planning/research/SUMMARY.md
331
+ Research synthesis complete — see .planning/research/SUMMARY.md
293
332
  ```
294
333
 
295
334
  ---
@@ -353,12 +392,26 @@ Invoke the `@planner` agent in roadmap mode with the roadmap prompt.
353
392
 
354
393
  Read `skills/begin/templates/roadmap-prompt.md.tmpl` for the prompt structure.
355
394
 
395
+ **Prepend this block to the roadmap planner prompt before sending:**
396
+ ```
397
+ <files_to_read>
398
+ CRITICAL: Read these files BEFORE any other action:
399
+ 1. .planning/REQUIREMENTS.md — scoped requirements for phase planning
400
+ 2. .planning/research/SUMMARY.md — research synthesis (if exists)
401
+ </files_to_read>
402
+ ```
403
+
356
404
  **Placeholders to fill:**
357
405
  - `{project name}` — project name from Step 2
358
406
  - `{description}` — project description from Step 2
359
407
  - `{quick|standard|comprehensive}` — depth setting from Step 3
360
408
 
361
- **After the planner completes:**
409
+ **After the planner completes**, check the agent output for a completion marker:
410
+ - If `## PLANNING COMPLETE` is present: planner finished successfully, proceed
411
+ - If `## PLANNING FAILED` is present: warn the user that planning could not complete, display the reason, and offer to retry or abort
412
+ - If neither marker is present: warn that planner may not have completed successfully, but proceed if ROADMAP.md exists on disk
413
+
414
+ - **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.
362
415
  - Read `.planning/ROADMAP.md`
363
416
  - Count the phases and milestones from the roadmap content
364
417
  - Display:
@@ -505,7 +558,7 @@ Delete `.planning/.active-skill` if it exists. This must happen on all paths (su
505
558
 
506
559
  After all steps complete, present the final summary using the stage banner format from Read `references/ui-formatting.md`:
507
560
 
508
- Display the `PROJECT INITIALIZED` banner with project name, core value, phase list, and requirement counts. Then display the "Next Up" block (see § "Next Up Block" in ui-formatting.md) pointing to `/pbr:discuss 1` with alternatives: `/pbr:explore`, `/pbr:plan 1`, `/pbr:config`.
561
+ Display the `PROJECT INITIALIZED ✓` banner with project name, core value, phase list, and requirement counts. Then display the "Next Up" block (see § "Next Up Block" in ui-formatting.md) pointing to `/pbr:discuss 1` with alternatives: `/pbr:explore`, `/pbr:plan 1`, `/pbr:milestone new`, `/pbr:config`. Include `<sub>/clear first → fresh context window</sub>` inside the Next Up routing block.
509
562
 
510
563
  ---
511
564
 
@@ -133,6 +133,8 @@ Phase {N} depends on Phase {M}, which is not complete.
133
133
 
134
134
  ### Step 2: Load Config (inline)
135
135
 
136
+ **Init-first pattern**: When spawning agents, pass the output of `node plugins/pbr/scripts/pbr-tools.js init execute-phase {N}` as context rather than having the agent read multiple files separately. This reduces file reads and prevents context-loading failures.
137
+
136
138
  Read configuration values needed for execution. See `skills/shared/config-loading.md` for the full field reference; build uses: `parallelization.*`, `features.goal_verification`, `features.inline_verify`, `features.atomic_commits`, `features.auto_continue`, `features.auto_advance`, `planning.commit_docs`, `git.commit_format`, `git.branching`.
137
139
 
138
140
  ---
@@ -302,6 +304,13 @@ Construct the executor prompt:
302
304
  ```
303
305
  You are the executor agent. Execute the following plan.
304
306
 
307
+ <files_to_read>
308
+ CRITICAL: Read these files BEFORE any other action:
309
+ 1. .planning/phases/{NN}-{slug}/{plan_id}-PLAN.md — the full plan with task details
310
+ 2. .planning/CONTEXT.md — locked decisions and constraints (if exists)
311
+ 3. .planning/STATE.md — current project state and progress
312
+ </files_to_read>
313
+
305
314
  <plan_summary>
306
315
  [Inline only the ## Summary section from PLAN.md]
307
316
  </plan_summary>
@@ -371,7 +380,9 @@ Task({
371
380
  prompt: <executor prompt constructed above>
372
381
  })
373
382
 
374
- NOTE: The pbr:executor agent type auto-loads the agent definition. Do NOT inline it.
383
+ NOTE: The pbr:executor agent type auto-loads the agent definition.
384
+
385
+ 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.
375
386
  ```
376
387
 
377
388
  **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. Use the resolved absolute path for any pbr-tools.js or template references included in the prompt.
@@ -407,6 +418,11 @@ After reading each SUMMARY, perform a lightweight verification:
407
418
  - If ANY spot-check fails, warn the user before proceeding to the next wave:
408
419
  "Spot-check failed for plan {id}: {detail}. Inspect before continuing?"
409
420
 
421
+ **Additional wave spot-checks:**
422
+ - Check for `## Self-Check: FAILED` in SUMMARY.md — if present, warn user before proceeding to next wave
423
+ - Between waves: verify no file conflicts from parallel executors (check `git status` for uncommitted changes)
424
+ - If ANY spot-check fails, present user with: **Retry this plan** / **Continue to next wave** / **Abort build**
425
+
410
426
  **Read executor deviations:**
411
427
 
412
428
  After all executors in the wave complete, read all SUMMARY frontmatter and:
@@ -449,7 +465,14 @@ For each plan that completed successfully in this wave:
449
465
  Task({
450
466
  agent_type: "pbr:verifier",
451
467
  model: "haiku",
452
- prompt: "Targeted inline verification for plan {plan_id}.
468
+ prompt: "<files_to_read>
469
+ CRITICAL: Read these files BEFORE any other action:
470
+ 1. .planning/phases/{NN}-{slug}/{plan_id}-PLAN.md — must-haves to verify against
471
+ 2. .planning/phases/{NN}-{slug}/SUMMARY-{plan_id}.md — what the executor claims was built
472
+ 3. .planning/phases/{NN}-{slug}/VERIFICATION.md — prior verification results (if exists)
473
+ </files_to_read>
474
+
475
+ Targeted inline verification for plan {plan_id}.
453
476
 
454
477
  Verify ONLY these files: {comma-separated key_files list}
455
478
 
@@ -654,6 +677,8 @@ Task({
654
677
  })
655
678
 
656
679
  NOTE: The pbr:verifier agent type auto-loads the agent definition. Do NOT inline it.
680
+
681
+ After verifier completes, check for completion marker: `## VERIFICATION COMPLETE`. Read VERIFICATION.md frontmatter for status.
657
682
  ```
658
683
 
659
684
  **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. Use the resolved absolute path for any pbr-tools.js or template references included in the prompt.
@@ -662,6 +687,16 @@ NOTE: The pbr:verifier agent type auto-loads the agent definition. Do NOT inline
662
687
 
663
688
  Use the same verifier prompt template as defined in `/pbr:review`: read `skills/review/templates/verifier-prompt.md.tmpl` and fill in its placeholders with the phase's PLAN.md must_haves and SUMMARY.md file paths. This avoids maintaining duplicate verifier prompts across skills.
664
689
 
690
+ **Prepend this block to the verifier prompt before sending:**
691
+ ```
692
+ <files_to_read>
693
+ CRITICAL: Read these files BEFORE any other action:
694
+ 1. .planning/phases/{NN}-{slug}/PLAN-*.md — must-haves to verify against
695
+ 2. .planning/phases/{NN}-{slug}/SUMMARY-*.md — executor build summaries
696
+ 3. .planning/phases/{NN}-{slug}/VERIFICATION.md — prior verification results (if exists)
697
+ </files_to_read>
698
+ ```
699
+
665
700
  After the verifier returns, read the VERIFICATION.md frontmatter and display the results:
666
701
 
667
702
  - If status is `passed`: display `✓ Verifier: {X}/{Y} must-haves verified` (where X = `must_haves_passed` and Y = `must_haves_checked`)
@@ -210,7 +210,18 @@ Continuing investigation...
210
210
 
211
211
  ### Step 4: Handle Debugger Results
212
212
 
213
- When the debugger agent completes, display: `✓ Debug session complete {N} hypotheses tested` (read the hypothesis count from the debug file's Hypotheses table).
213
+ When the debugger agent completes, first check for completion markers in the Task() output before routing:
214
+
215
+ | Marker in Task() Output | Route To |
216
+ |--------------------------|----------|
217
+ | `## DEBUG COMPLETE` | ROOT CAUSE FOUND + FIX path |
218
+ | `## ROOT CAUSE FOUND` | ROOT CAUSE FOUND (no fix) path |
219
+ | `## DEBUG SESSION PAUSED` | CHECKPOINT path |
220
+ | No marker found | INCONCLUSIVE path |
221
+
222
+ **Spot-check:** Before routing, verify `.planning/debug/{NNN}-{slug}.md` exists and was recently updated (modified timestamp is newer than the Task() spawn time). If the debug file was not updated, warn: `⚠ Debug file not updated by agent — results may be incomplete.`
223
+
224
+ Display: `✓ Debug session complete — {N} hypotheses tested` (read the hypothesis count from the debug file's Hypotheses table).
214
225
 
215
226
  The debugger returns one of four outcomes:
216
227
 
@@ -119,7 +119,12 @@ Display to the user: `◐ Spawning researcher...`
119
119
  ```
120
120
  Task({
121
121
  subagent_type: "pbr:researcher",
122
- prompt: "<research_assignment>
122
+ prompt: "<files_to_read>
123
+ CRITICAL: Read these files BEFORE any other action:
124
+ 1. .planning/CONTEXT.md — locked decisions and constraints (if exists)
125
+ 2. .planning/STATE.md — current project state (if exists)
126
+ </files_to_read>
127
+ <research_assignment>
123
128
  Topic: {specific research question}
124
129
  Output file: .planning/research/{topic-slug}.md
125
130
  Mode: project-research
@@ -131,7 +136,13 @@ Task({
131
136
  })
132
137
  ```
133
138
 
134
- After the researcher completes, display: `✓ Research complete results in .planning/research/{topic-slug}.md`
139
+ After the researcher completes, check for completion markers in the Task() output:
140
+
141
+ - If `## RESEARCH COMPLETE` is present: proceed normally
142
+ - If `## RESEARCH BLOCKED` is present: display the blocker reason and offer to retry:
143
+ `⚠ Research blocked: {reason}. Try a different angle or continue without research.`
144
+
145
+ Display: `✓ Research complete — results in .planning/research/{topic-slug}.md`
135
146
 
136
147
  Then:
137
148
  - Read ONLY the frontmatter and summary section of the research file (not the full document)
@@ -276,6 +276,13 @@ Task({
276
276
  ```
277
277
  You are the plan-checker agent.
278
278
 
279
+ <files_to_read>
280
+ CRITICAL: Read these files BEFORE any other action:
281
+ 1. .planning/CONTEXT.md — locked decisions and constraints (if exists)
282
+ 2. .planning/STATE.md — current project state and progress
283
+ 3. .planning/ROADMAP.md — phase structure, goals, and dependencies
284
+ </files_to_read>
285
+
279
286
  <plans_to_check>
280
287
  {For each generated PLAN.md:}
281
288
  --- Plan File: {filename} ---
@@ -306,7 +313,15 @@ Run all verification dimensions on these plans. Return your structured report.
306
313
  Do NOT write any files. Return your findings as your response text.
307
314
  ```
308
315
 
309
- **Process checker results — revision loop:**
316
+ **Process checker results — completion marker check:**
317
+
318
+ After the plan-checker completes, check for completion markers in the Task() output:
319
+
320
+ - If `## CHECK PASSED` is present: skip the revision loop entirely and proceed to Step 7.
321
+ - If `## ISSUES FOUND` is present: enter the revision loop below.
322
+ - If neither marker is found: treat as issues found and enter the revision loop.
323
+
324
+ **Revision loop:**
310
325
 
311
326
  Reference: `skills/shared/revision-loop.md` for the full Check-Revise-Escalate pattern (max 3 iterations).
312
327
 
@@ -326,6 +341,16 @@ If existing plans are being replaced (user confirmed in Step 1):
326
341
 
327
342
  ---
328
343
 
344
+ **Step 7b — Spot-check artifacts:**
345
+
346
+ After writing plan files, verify they landed on disk:
347
+
348
+ 1. Glob `.planning/phases/{NN}-{slug}/PLAN-*.md` to confirm files exist
349
+ 2. Count matches — must equal the number of plans generated in Step 5
350
+ 3. If any are missing: re-attempt the write. If still missing, display an error listing the missing files.
351
+
352
+ ---
353
+
329
354
  ### Step 8: Update All State (inline)
330
355
 
331
356
  Perform all state updates in this order:
@@ -487,6 +487,12 @@ Verify milestone completion with cross-phase integration checks.
487
487
  ```
488
488
  You are integration-checker. Perform cross-phase integration verification.
489
489
 
490
+ <files_to_read>
491
+ CRITICAL: Read these files BEFORE any other action:
492
+ 1. .planning/ROADMAP.md — phase structure, goals, and dependencies
493
+ 2. .planning/phases/{NN}-{slug}/SUMMARY.md — for each milestone phase (read all)
494
+ </files_to_read>
495
+
490
496
  Milestone: {version or "current"}
491
497
  Phases to check: {list of phase directories}
492
498
 
@@ -506,20 +512,26 @@ Verify milestone completion with cross-phase integration checks.
506
512
  5. Return findings as a structured report
507
513
  ```
508
514
 
509
- 4. **Check requirements coverage:**
515
+ 4. **Check integration-checker completion:**
516
+
517
+ 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.
518
+
519
+ 5. **Check requirements coverage:**
510
520
  - Read REQUIREMENTS.md
511
521
  - For each requirement tagged for this milestone:
512
522
  - Search VERIFICATION.md files for coverage
513
523
  - Search SUMMARY.md `provides` fields
514
524
  - Flag uncovered requirements
515
525
 
516
- 5. **Write audit report:**
526
+ 6. **Write audit report:**
517
527
 
518
528
  Create `.planning/{version}-MILESTONE-AUDIT.md` using the template:
519
529
 
520
530
  Read `skills/milestone/templates/audit-report.md.tmpl` for the audit report format. Fill in all `{variable}` placeholders with actual data from the audit.
521
531
 
522
- 6. **Report to user** using branded banners:
532
+ **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.
533
+
534
+ 7. **Report to user** using branded banners:
523
535
 
524
536
  **If PASSED:**
525
537
  ```
@@ -4,6 +4,8 @@ description: "Create a detailed plan for a phase. Research, plan, and verify bef
4
4
  argument-hint: "<phase-number> [--skip-research] [--assumptions] [--gaps] | add | insert <N> | remove <N>"
5
5
  ---
6
6
 
7
+ **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.**
8
+
7
9
  # /pbr:plan — Phase Planning
8
10
 
9
11
  You are the orchestrator for `/pbr:plan`. This skill creates detailed, executable plans for a specific phase. Plans are the bridge between the roadmap and actual code — they must be specific enough for an executor agent to follow mechanically. Your job is to stay lean, delegate heavy work to agents, and keep the user's main context window clean.
@@ -136,6 +138,8 @@ Reference: `skills/shared/config-loading.md` for the tooling shortcut (`state lo
136
138
 
137
139
  ### Step 2: Load Context (inline)
138
140
 
141
+ **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.
142
+
139
143
  Read context file PATHS and metadata. Build lean context bundles for agent prompts — include paths and one-line descriptions, NOT full file bodies. Agents have the Read tool and will pull file contents on-demand.
140
144
 
141
145
  ```
@@ -222,8 +226,22 @@ Read `skills/plan/templates/researcher-prompt.md.tmpl` and use it as the prompt
222
226
  - `{dependencies from roadmap}` - dependency list
223
227
  - 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
224
228
 
229
+ **Prepend this block to the researcher prompt before sending:**
230
+ ```
231
+ <files_to_read>
232
+ CRITICAL: Read these files BEFORE any other action:
233
+ 1. .planning/ROADMAP.md — phase goals, dependencies, and structure
234
+ 2. .planning/REQUIREMENTS.md — scoped requirements for this phase (if exists)
235
+ </files_to_read>
236
+ ```
237
+
225
238
  Wait for the researcher to complete before proceeding.
226
239
 
240
+ After the researcher completes, check the agent output for a completion marker:
241
+ - If `## RESEARCH COMPLETE` is present: proceed to planner
242
+ - If `## RESEARCH BLOCKED` is present: warn the user that research could not complete, ask if they want to proceed with limited context or stop
243
+ - If neither marker is present: warn that researcher may not have completed successfully, but proceed
244
+
227
245
  ---
228
246
 
229
247
  ### Step 4.5: Seed Scanning (inline, before planning)
@@ -337,6 +355,16 @@ Read `skills/plan/templates/planner-prompt.md.tmpl` and use it as the prompt tem
337
355
  - `<config>` - max tasks, parallelization, TDD mode from config.json
338
356
  - `<planning_instructions>` - phase-specific planning rules and output path
339
357
 
358
+ **Prepend this block to the planner prompt before sending:**
359
+ ```
360
+ <files_to_read>
361
+ CRITICAL: Read these files BEFORE any other action:
362
+ 1. .planning/CONTEXT.md — locked decisions and constraints (if exists)
363
+ 2. .planning/ROADMAP.md — phase goals, dependencies, and structure
364
+ 3. .planning/phases/{NN}-{slug}/RESEARCH.md — research findings (if exists)
365
+ </files_to_read>
366
+ ```
367
+
340
368
  Wait for the planner to complete.
341
369
 
342
370
  After the planner returns, read the plan files it created to extract counts. Display a completion summary:
@@ -347,6 +375,17 @@ Planner created {N} plan(s) across {M} wave(s)
347
375
 
348
376
  Where `{N}` is the number of PLAN.md files written and `{M}` is the number of distinct wave values across those plans (from frontmatter).
349
377
 
378
+ ### Step 5b: Spot-Check Planner Output
379
+
380
+ CRITICAL: Verify planner output before proceeding.
381
+
382
+ 1. **PLAN files exist**: Check `.planning/phases/{NN}-{slug}/PLAN-*.md` files exist on disk
383
+ 2. **Valid frontmatter**: Read first 20 lines of each PLAN file — verify `depends_on`, `files_modified`, `must_haves` fields present
384
+ 3. **Task structure**: Verify at least one `<task>` block exists in each plan file
385
+ 4. **Plan count matches**: Number of PLAN files matches what the planner reported
386
+
387
+ If ANY spot-check fails, present the user with options: **Retry** / **Continue anyway** / **Abort**
388
+
350
389
  ---
351
390
 
352
391
  ### Step 6: Plan Validation (delegated, conditional)
@@ -373,6 +412,15 @@ Read `skills/plan/templates/checker-prompt.md.tmpl` and use it as the prompt tem
373
412
  - `<phase_context>` - phase goal and requirement IDs
374
413
  - `<context>` - file paths to project-level and phase-level CONTEXT.md files (checker reads via Read tool)
375
414
 
415
+ **Prepend this block to the checker prompt before sending:**
416
+ ```
417
+ <files_to_read>
418
+ CRITICAL: Read these files BEFORE any other action:
419
+ 1. .planning/phases/{NN}-{slug}/PLAN-*.md — plan files to validate
420
+ 2. .planning/CONTEXT.md — locked decisions to check against (if exists)
421
+ </files_to_read>
422
+ ```
423
+
376
424
  **Process checker results:**
377
425
 
378
426
  After the plan checker returns, display its result:
@@ -464,6 +512,8 @@ Use the approve-revise-abort pattern from `skills/shared/gate-prompts.md`:
464
512
  5. Update the `Status` column to `planned`
465
513
  6. Save the file — do NOT skip this step
466
514
  - 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`
515
+
516
+ **Tooling shortcut**: `node ${PLUGIN_ROOT}/scripts/pbr-tools.js state patch '{"status":"planned","last_command":"/pbr:plan {N}"}'`
467
517
  - **If `features.auto_advance` is `true` AND `mode` is `autonomous`:** Chain directly to build. This continues the build->review->plan->build cycle automatically.
468
518
  - **Otherwise:** Suggest next action: `/pbr:build {N}`
469
519
 
@@ -44,6 +44,8 @@ Additionally for this skill:
44
44
 
45
45
  ### Step 1: Check Project Context
46
46
 
47
+ **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.
48
+
47
49
  1. Check if `.planning/` directory exists
48
50
  - If yes: read config.json for settings
49
51
  - 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."
@@ -167,9 +169,17 @@ Display to the user: `◐ Spawning executor...`
167
169
 
168
170
  Spawn a `Task(agent_type: "pbr:executor")` with the following prompt:
169
171
 
172
+ > **Completion markers**: After executor completes, check for `## PLAN COMPLETE` or `## PLAN FAILED`. Route accordingly.
173
+
170
174
  ```
171
175
  You are executor. Execute the following quick task plan.
172
176
 
177
+ <files_to_read>
178
+ CRITICAL: Read these files BEFORE any other action:
179
+ 1. .planning/quick/{NNN}-{slug}/PLAN.md — the quick task plan with task details
180
+ 2. .planning/STATE.md — current project state and progress (if exists)
181
+ </files_to_read>
182
+
173
183
  Plan file: .planning/quick/{NNN}-{slug}/PLAN.md
174
184
  Phase: quick
175
185
  Plan ID: {NNN}
@@ -192,6 +202,17 @@ After the executor completes:
192
202
  - `partial` — some tasks completed, others failed
193
203
  - `failed` — task failed entirely
194
204
 
205
+ ### Step 8b: Spot-Check Executor Output
206
+
207
+ CRITICAL: Verify executor output before proceeding.
208
+
209
+ 1. **SUMMARY.md exists**: Check `.planning/quick/{NNN}-{slug}/SUMMARY.md` exists
210
+ 2. **Key files exist**: Verify first 2 files from SUMMARY.md `key_files` frontmatter exist on disk
211
+ 3. **Commits present**: Run `git log --oneline -5` and verify at least one commit matches the task scope
212
+ 4. **Self-check status**: Look for `## Self-Check: FAILED` in SUMMARY.md — if present, warn the user
213
+
214
+ If ANY spot-check fails, present the user with options: **Retry** / **Continue anyway** / **Abort**
215
+
195
216
  ### Step 9: Update STATE.md
196
217
 
197
218
  If STATE.md exists, update the Quick Tasks section.
@@ -61,6 +61,8 @@ Execute these steps in order.
61
61
 
62
62
  ### Step 1: Parse and Validate (inline)
63
63
 
64
+ **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.
65
+
64
66
  1. Parse `$ARGUMENTS` for phase number and `--auto-fix` flag
65
67
  2. Read `.planning/config.json`
66
68
  **CRITICAL: Write .active-skill NOW.** Write the text "review" to `.planning/.active-skill` using the Write tool.
@@ -155,6 +157,16 @@ Invoke the `@verifier` agent to run three-layer checks.
155
157
 
156
158
  Read `skills/review/templates/verifier-prompt.md.tmpl` and use its content as the verifier prompt.
157
159
 
160
+ **Prepend this block to the verifier prompt before sending:**
161
+ ```
162
+ <files_to_read>
163
+ CRITICAL: Read these files BEFORE any other action:
164
+ 1. .planning/phases/{NN}-{slug}/PLAN-*.md — must-haves to verify against
165
+ 2. .planning/phases/{NN}-{slug}/SUMMARY-*.md — executor build summaries
166
+ 3. .planning/phases/{NN}-{slug}/VERIFICATION.md — prior verification results (if exists)
167
+ </files_to_read>
168
+ ```
169
+
158
170
  **Placeholders to fill before sending:**
159
171
  - `{For each PLAN.md file in the phase directory:}` — inline each plan's must_haves frontmatter block
160
172
  - `{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.
@@ -181,6 +193,17 @@ Then show a brief table of must-haves with pass/fail status:
181
193
 
182
194
  Then display the overall verdict (`PASSED`, `GAPS FOUND`, or `HUMAN NEEDED`) before proceeding to the full results presentation.
183
195
 
196
+ ### Step 3a: Spot-Check Verifier Output
197
+
198
+ CRITICAL: Verify verifier output before proceeding.
199
+
200
+ 1. **VERIFICATION.md exists**: Check `.planning/phases/{NN}-{slug}/VERIFICATION.md` exists on disk
201
+ 2. **Status field present**: Read VERIFICATION.md frontmatter — verify `status` field is present and is one of: pass, fail, partial
202
+ 3. **Must-haves checked**: Verify `must_haves_checked` count > 0 in frontmatter
203
+ 4. **Completion marker**: Look for `## VERIFICATION COMPLETE` in the Task() output
204
+
205
+ If ANY spot-check fails, present the user with options: **Retry** / **Continue anyway** / **Abort**
206
+
184
207
  ---
185
208
 
186
209
  ### Step 3b: Local LLM Verification Quality Check (optional, advisory)
@@ -368,6 +391,16 @@ Invoke the `@debugger` agent to analyze each failure.
368
391
 
369
392
  Read `skills/review/templates/debugger-prompt.md.tmpl` and use its content as the debugger prompt.
370
393
 
394
+ **Prepend this block to the debugger prompt before sending:**
395
+ ```
396
+ <files_to_read>
397
+ CRITICAL: Read these files BEFORE any other action:
398
+ 1. .planning/phases/{NN}-{slug}/VERIFICATION.md — gaps and failure details
399
+ 2. .planning/phases/{NN}-{slug}/SUMMARY-*.md — what was built
400
+ 3. .planning/phases/{NN}-{slug}/PLAN-*.md — original plan must-haves
401
+ </files_to_read>
402
+ ```
403
+
371
404
  **Placeholders to fill before sending:**
372
405
  - `[Inline the VERIFICATION.md content]` — provide file path; debugger reads via Read tool
373
406
  - `[Inline all SUMMARY.md files for the phase]` — provide manifest table of file paths
@@ -383,6 +416,16 @@ Invoke the `@planner` agent in gap-closure mode.
383
416
 
384
417
  Read `skills/review/templates/gap-planner-prompt.md.tmpl` and use its content as the gap planner prompt.
385
418
 
419
+ **Prepend this block to the gap planner prompt before sending:**
420
+ ```
421
+ <files_to_read>
422
+ CRITICAL: Read these files BEFORE any other action:
423
+ 1. .planning/phases/{NN}-{slug}/VERIFICATION.md — gaps to close
424
+ 2. .planning/phases/{NN}-{slug}/PLAN-*.md — existing plans for context
425
+ 3. .planning/CONTEXT.md — locked decisions and constraints (if exists)
426
+ </files_to_read>
427
+ ```
428
+
386
429
  **Placeholders to fill before sending:**
387
430
  - `[Inline VERIFICATION.md]` — provide file path; planner reads via Read tool
388
431
  - `[Inline the debugger's root cause analysis]` — keep inline (already in conversation context)
@@ -563,6 +606,8 @@ After review completes, always present a clear next action using the completion
563
606
  - **If gaps remain:** Use the "Gaps Found" template. Fill in phase number, name, gap count, and gap summaries.
564
607
  - **If final phase:** Use the "Milestone Complete" template. Fill in phase count.
565
608
 
609
+ Include `<sub>/clear first → fresh context window</sub>` inside the Next Up routing block of the completion template.
610
+
566
611
  ---
567
612
 
568
613
  ## Notes
@@ -123,6 +123,14 @@ For each agent, read `skills/scan/templates/mapper-prompt.md.tmpl` and fill in t
123
123
  - `{scale}`: detected scale from Step 2
124
124
  - `{output_path}`: `.planning/codebase/`
125
125
 
126
+ **Prepend this block to each mapper prompt before sending:**
127
+ ```
128
+ <files_to_read>
129
+ CRITICAL: Read these files BEFORE any other action:
130
+ 1. .planning/codebase/RECON.md — baseline reconnaissance data (if exists)
131
+ </files_to_read>
132
+ ```
133
+
126
134
  | Agent | Focus | Output Files | When |
127
135
  |-------|-------|-------------|------|
128
136
  | 1 | tech | STACK.md, INTEGRATIONS.md | Always |
@@ -142,6 +150,18 @@ All agents run in parallel. As each completes, display:
142
150
 
143
151
  (Only display lines for the focus areas that were actually spawned.)
144
152
 
153
+ ### Step 4b: Check Completion Markers
154
+
155
+ After each codebase-mapper Task() completes, check the Task() output for the `## MAPPING COMPLETE` marker:
156
+
157
+ - If `## MAPPING COMPLETE` is present: the mapper finished successfully, proceed normally
158
+ - If the marker is missing: warn the user that the mapper may not have completed successfully:
159
+ ```
160
+ ⚠ Codebase mapper ({focus_area}) did not report MAPPING COMPLETE.
161
+ Output may be incomplete — check .planning/codebase/ for partial results.
162
+ ```
163
+ Continue to Step 5 verification regardless (the file existence checks will catch truly missing output).
164
+
145
165
  ### Step 5: Verify Output
146
166
 
147
167
  After all agents complete, verify the expected files exist: