@sienklogic/plan-build-run 2.34.0 → 2.38.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 (160) hide show
  1. package/CHANGELOG.md +683 -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 +129 -16
  18. package/plugins/copilot-pbr/agents/codebase-mapper.agent.md +49 -1
  19. package/plugins/copilot-pbr/agents/debugger.agent.md +50 -1
  20. package/plugins/copilot-pbr/agents/dev-sync.agent.md +23 -0
  21. package/plugins/copilot-pbr/agents/executor.agent.md +153 -8
  22. package/plugins/copilot-pbr/agents/general.agent.md +46 -1
  23. package/plugins/copilot-pbr/agents/integration-checker.agent.md +55 -2
  24. package/plugins/copilot-pbr/agents/plan-checker.agent.md +50 -2
  25. package/plugins/copilot-pbr/agents/planner.agent.md +80 -1
  26. package/plugins/copilot-pbr/agents/researcher.agent.md +50 -2
  27. package/plugins/copilot-pbr/agents/synthesizer.agent.md +49 -1
  28. package/plugins/copilot-pbr/agents/verifier.agent.md +114 -13
  29. package/plugins/copilot-pbr/commands/test.md +5 -0
  30. package/plugins/copilot-pbr/hooks/hooks.json +11 -0
  31. package/plugins/copilot-pbr/plugin.json +1 -1
  32. package/plugins/copilot-pbr/references/agent-contracts.md +27 -0
  33. package/plugins/copilot-pbr/references/checkpoints.md +32 -1
  34. package/plugins/copilot-pbr/references/context-quality-tiers.md +45 -0
  35. package/plugins/copilot-pbr/references/pbr-tools-cli.md +115 -0
  36. package/plugins/copilot-pbr/references/questioning.md +21 -1
  37. package/plugins/copilot-pbr/references/verification-patterns.md +96 -18
  38. package/plugins/copilot-pbr/skills/audit/SKILL.md +19 -3
  39. package/plugins/copilot-pbr/skills/begin/SKILL.md +57 -4
  40. package/plugins/copilot-pbr/skills/build/SKILL.md +39 -2
  41. package/plugins/copilot-pbr/skills/config/SKILL.md +12 -2
  42. package/plugins/copilot-pbr/skills/debug/SKILL.md +12 -1
  43. package/plugins/copilot-pbr/skills/explore/SKILL.md +13 -2
  44. package/plugins/copilot-pbr/skills/health/SKILL.md +13 -5
  45. package/plugins/copilot-pbr/skills/import/SKILL.md +26 -1
  46. package/plugins/copilot-pbr/skills/milestone/SKILL.md +15 -3
  47. package/plugins/copilot-pbr/skills/plan/SKILL.md +50 -0
  48. package/plugins/copilot-pbr/skills/quick/SKILL.md +21 -0
  49. package/plugins/copilot-pbr/skills/review/SKILL.md +45 -0
  50. package/plugins/copilot-pbr/skills/scan/SKILL.md +20 -0
  51. package/plugins/copilot-pbr/skills/setup/SKILL.md +9 -1
  52. package/plugins/copilot-pbr/skills/shared/context-budget.md +10 -0
  53. package/plugins/copilot-pbr/skills/shared/universal-anti-patterns.md +6 -0
  54. package/plugins/copilot-pbr/skills/test/SKILL.md +210 -0
  55. package/plugins/copilot-pbr/templates/SUMMARY-complex.md.tmpl +95 -0
  56. package/plugins/copilot-pbr/templates/SUMMARY-minimal.md.tmpl +48 -0
  57. package/plugins/cursor-pbr/.cursor-plugin/plugin.json +1 -1
  58. package/plugins/cursor-pbr/agents/audit.md +52 -5
  59. package/plugins/cursor-pbr/agents/codebase-mapper.md +49 -1
  60. package/plugins/cursor-pbr/agents/debugger.md +50 -1
  61. package/plugins/cursor-pbr/agents/dev-sync.md +23 -0
  62. package/plugins/cursor-pbr/agents/executor.md +153 -8
  63. package/plugins/cursor-pbr/agents/general.md +46 -1
  64. package/plugins/cursor-pbr/agents/integration-checker.md +54 -1
  65. package/plugins/cursor-pbr/agents/plan-checker.md +49 -1
  66. package/plugins/cursor-pbr/agents/planner.md +80 -1
  67. package/plugins/cursor-pbr/agents/researcher.md +49 -1
  68. package/plugins/cursor-pbr/agents/synthesizer.md +49 -1
  69. package/plugins/cursor-pbr/agents/verifier.md +113 -12
  70. package/plugins/cursor-pbr/commands/test.md +5 -0
  71. package/plugins/cursor-pbr/hooks/hooks.json +9 -0
  72. package/plugins/cursor-pbr/references/agent-contracts.md +27 -0
  73. package/plugins/cursor-pbr/references/checkpoints.md +32 -1
  74. package/plugins/cursor-pbr/references/context-quality-tiers.md +45 -0
  75. package/plugins/cursor-pbr/references/pbr-tools-cli.md +115 -0
  76. package/plugins/cursor-pbr/references/questioning.md +21 -1
  77. package/plugins/cursor-pbr/references/verification-patterns.md +96 -18
  78. package/plugins/cursor-pbr/skills/audit/SKILL.md +19 -3
  79. package/plugins/cursor-pbr/skills/begin/SKILL.md +57 -4
  80. package/plugins/cursor-pbr/skills/build/SKILL.md +37 -2
  81. package/plugins/cursor-pbr/skills/config/SKILL.md +12 -2
  82. package/plugins/cursor-pbr/skills/debug/SKILL.md +12 -1
  83. package/plugins/cursor-pbr/skills/explore/SKILL.md +13 -2
  84. package/plugins/cursor-pbr/skills/health/SKILL.md +14 -5
  85. package/plugins/cursor-pbr/skills/import/SKILL.md +26 -1
  86. package/plugins/cursor-pbr/skills/milestone/SKILL.md +15 -3
  87. package/plugins/cursor-pbr/skills/plan/SKILL.md +50 -0
  88. package/plugins/cursor-pbr/skills/quick/SKILL.md +21 -0
  89. package/plugins/cursor-pbr/skills/review/SKILL.md +45 -0
  90. package/plugins/cursor-pbr/skills/scan/SKILL.md +20 -0
  91. package/plugins/cursor-pbr/skills/setup/SKILL.md +9 -1
  92. package/plugins/cursor-pbr/skills/shared/context-budget.md +10 -0
  93. package/plugins/cursor-pbr/skills/shared/universal-anti-patterns.md +6 -0
  94. package/plugins/cursor-pbr/skills/test/SKILL.md +211 -0
  95. package/plugins/cursor-pbr/templates/SUMMARY-complex.md.tmpl +95 -0
  96. package/plugins/cursor-pbr/templates/SUMMARY-minimal.md.tmpl +48 -0
  97. package/plugins/pbr/.claude-plugin/plugin.json +1 -1
  98. package/plugins/pbr/agents/audit.md +45 -0
  99. package/plugins/pbr/agents/codebase-mapper.md +48 -0
  100. package/plugins/pbr/agents/debugger.md +49 -0
  101. package/plugins/pbr/agents/dev-sync.md +23 -0
  102. package/plugins/pbr/agents/executor.md +151 -6
  103. package/plugins/pbr/agents/general.md +45 -0
  104. package/plugins/pbr/agents/integration-checker.md +53 -0
  105. package/plugins/pbr/agents/plan-checker.md +48 -0
  106. package/plugins/pbr/agents/planner.md +78 -1
  107. package/plugins/pbr/agents/researcher.md +48 -0
  108. package/plugins/pbr/agents/synthesizer.md +48 -0
  109. package/plugins/pbr/agents/verifier.md +112 -11
  110. package/plugins/pbr/commands/test.md +5 -0
  111. package/plugins/pbr/hooks/hooks.json +9 -0
  112. package/plugins/pbr/references/agent-contracts.md +27 -0
  113. package/plugins/pbr/references/checkpoints.md +32 -0
  114. package/plugins/pbr/references/context-quality-tiers.md +45 -0
  115. package/plugins/pbr/references/pbr-tools-cli.md +115 -0
  116. package/plugins/pbr/references/questioning.md +21 -0
  117. package/plugins/pbr/references/verification-patterns.md +96 -17
  118. package/plugins/pbr/scripts/check-plan-format.js +13 -1
  119. package/plugins/pbr/scripts/check-state-sync.js +26 -7
  120. package/plugins/pbr/scripts/check-subagent-output.js +30 -2
  121. package/plugins/pbr/scripts/config-schema.json +11 -1
  122. package/plugins/pbr/scripts/context-bridge.js +265 -0
  123. package/plugins/pbr/scripts/lib/config.js +271 -0
  124. package/plugins/pbr/scripts/lib/core.js +587 -0
  125. package/plugins/pbr/scripts/lib/history.js +73 -0
  126. package/plugins/pbr/scripts/lib/init.js +166 -0
  127. package/plugins/pbr/scripts/lib/migrate.js +169 -0
  128. package/plugins/pbr/scripts/lib/phase.js +364 -0
  129. package/plugins/pbr/scripts/lib/roadmap.js +175 -0
  130. package/plugins/pbr/scripts/lib/state.js +397 -0
  131. package/plugins/pbr/scripts/lib/todo.js +300 -0
  132. package/plugins/pbr/scripts/pbr-tools.js +425 -1310
  133. package/plugins/pbr/scripts/post-write-dispatch.js +5 -4
  134. package/plugins/pbr/scripts/pre-write-dispatch.js +1 -1
  135. package/plugins/pbr/scripts/progress-tracker.js +1 -1
  136. package/plugins/pbr/scripts/suggest-compact.js +1 -1
  137. package/plugins/pbr/scripts/track-context-budget.js +53 -2
  138. package/plugins/pbr/scripts/validate-task.js +20 -28
  139. package/plugins/pbr/skills/audit/SKILL.md +19 -3
  140. package/plugins/pbr/skills/begin/SKILL.md +48 -2
  141. package/plugins/pbr/skills/build/SKILL.md +39 -2
  142. package/plugins/pbr/skills/config/SKILL.md +12 -2
  143. package/plugins/pbr/skills/debug/SKILL.md +12 -1
  144. package/plugins/pbr/skills/debug/templates/continuation-prompt.md.tmpl +12 -1
  145. package/plugins/pbr/skills/debug/templates/initial-investigation-prompt.md.tmpl +12 -5
  146. package/plugins/pbr/skills/explore/SKILL.md +13 -2
  147. package/plugins/pbr/skills/health/SKILL.md +14 -3
  148. package/plugins/pbr/skills/help/SKILL.md +2 -0
  149. package/plugins/pbr/skills/import/SKILL.md +26 -1
  150. package/plugins/pbr/skills/milestone/SKILL.md +15 -3
  151. package/plugins/pbr/skills/plan/SKILL.md +52 -2
  152. package/plugins/pbr/skills/quick/SKILL.md +21 -0
  153. package/plugins/pbr/skills/review/SKILL.md +46 -0
  154. package/plugins/pbr/skills/scan/SKILL.md +20 -0
  155. package/plugins/pbr/skills/setup/SKILL.md +9 -1
  156. package/plugins/pbr/skills/shared/context-budget.md +10 -0
  157. package/plugins/pbr/skills/shared/universal-anti-patterns.md +6 -0
  158. package/plugins/pbr/skills/test/SKILL.md +212 -0
  159. package/plugins/pbr/templates/SUMMARY-complex.md.tmpl +95 -0
  160. package/plugins/pbr/templates/SUMMARY-minimal.md.tmpl +48 -0
@@ -136,7 +136,12 @@ For each session:
136
136
  ```
137
137
  Task({
138
138
  subagent_type: "pbr:audit",
139
- prompt: "<audit_assignment>
139
+ prompt: "<files_to_read>
140
+ CRITICAL: Read these files BEFORE any other action:
141
+ 1. {absolute_path_to_session.jsonl} — session log to analyze
142
+ 2. {subagent log paths, if any} — subagent session logs
143
+ </files_to_read>
144
+ <audit_assignment>
140
145
  Session JSONL: {absolute_path_to_session.jsonl}
141
146
  Subagent logs: {list of subagent jsonl paths, or 'none'}
142
147
  Audit mode: {mode}
@@ -172,7 +177,9 @@ Display progress:
172
177
 
173
178
  ## Step 5 — Collect and Synthesize
174
179
 
175
- As agents complete, collect their findings. Wait for all agents before proceeding.
180
+ As agents complete, check each audit agent's Task() output for `## AUDIT COMPLETE`. If the marker is absent, mark that session as "analysis failed" in the synthesis and skip its findings — do not treat incomplete output as valid analysis. Log: `⚠ Session {id}: audit agent did not return completion marker — skipping.`
181
+
182
+ Wait for all agents before proceeding.
176
183
 
177
184
  Synthesize across all sessions:
178
185
 
@@ -257,6 +264,15 @@ The report should follow this structure:
257
264
 
258
265
  ---
259
266
 
267
+ ## Step 6b — Spot-Check Artifacts
268
+
269
+ **Before displaying results, verify the report landed on disk:**
270
+
271
+ 1. Glob `.planning/audits/{YYYY-MM-DD}-session-audit.md` to confirm the file exists
272
+ 2. If missing: re-attempt the write (Step 6). If still missing, display an error and include findings inline instead.
273
+
274
+ ---
275
+
260
276
  ## Step 7 — Display Summary
261
277
 
262
278
  After writing the report, display inline (keep it concise — the full report is on disk):
@@ -288,7 +304,7 @@ Full report: .planning/audits/{filename}
288
304
  - If todos identified: **Create todos** → `/pbr:todo add "{description}"`
289
305
  - Default: **See project status** → `/pbr:status`
290
306
 
291
- `/clear` first → fresh context window
307
+ <sub>`/clear` first → fresh context window</sub>
292
308
  ```
293
309
 
294
310
  ---
@@ -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`)
@@ -112,10 +112,11 @@ Use AskUserQuestion:
112
112
  - label: "Depth" description: "quick/standard/comprehensive"
113
113
  - label: "Model profile" description: "quality/balanced/budget/adaptive"
114
114
  - label: "Features" description: "Toggle workflow features, gates, status line"
115
- - label: "Git settings" description: "branching strategy, commit mode"
115
+ - label: "Git settings" description: "branching strategy, commit mode"
116
+ - label: "Save as defaults" description: "Save current config as user-level defaults for new projects"
116
117
  multiSelect: false
117
118
 
118
- Note: The original 7 categories are condensed to 4. "Models" (per-agent) is accessible through "Model profile" with a follow-up option. "Gates", "Parallelization", and "Status Line" are grouped under "Features".
119
+ Note: The original 7 categories are condensed to 5. "Models" (per-agent) is accessible through "Model profile" with a follow-up option. "Gates", "Parallelization", and "Status Line" are grouped under "Features". "Save as defaults" exports to ~/.claude/pbr-defaults.json.
119
120
 
120
121
  **Follow-up based on selection:**
121
122
 
@@ -178,6 +179,15 @@ Use AskUserQuestion:
178
179
  - label: "Disabled" description: "No git integration"
179
180
  multiSelect: false
180
181
 
182
+ If user selects "Save as defaults":
183
+ Save current project config as user-level defaults for future projects:
184
+
185
+ ```bash
186
+ node "${PLUGIN_ROOT}/scripts/pbr-tools.js" config save-defaults
187
+ ```
188
+
189
+ Display: "Saved your preferences to ~/.claude/pbr-defaults.json. New projects created with /pbr:setup will use these as starting values."
190
+
181
191
  If user types something else (freeform): interpret as a direct setting command and handle via Step 2 argument parsing logic.
182
192
 
183
193
  ### 4. Apply Changes
@@ -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)
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  name: health
3
3
  description: "Check planning directory integrity. Find and fix corrupted state."
4
+ argument-hint: "[--repair]"
4
5
  ---
5
6
 
6
7
  ## Step 0 — Immediate Output
@@ -17,10 +18,16 @@ Then proceed to Step 1.
17
18
 
18
19
  # /pbr:health — Planning Directory Diagnostics
19
20
 
20
- You are running the **health** skill. Your job is to validate the integrity of the `.planning/` directory, report problems, and suggest targeted fixes. You never auto-repair anything.
21
+ You are running the **health** skill. Your job is to validate the integrity of the `.planning/` directory, report problems, and suggest targeted fixes.
21
22
 
22
23
  This skill runs **inline**. It is read-only by default, but offers an optional **auto-fix** flow for common corruption patterns (see the Auto-Fix section below).
23
24
 
25
+ ## Argument Parsing
26
+
27
+ Check if the user passed `--repair`:
28
+ - `--repair`: Skip the AskUserQuestion prompt in the Auto-Fix section and automatically apply ALL fixes (equivalent to selecting "Fix all"). Still create backups before any destructive operations.
29
+ - No flag: Use the interactive AskUserQuestion flow as described below (default behavior).
30
+
24
31
  ---
25
32
 
26
33
  ## How Checks Work
@@ -184,7 +191,11 @@ cp .planning/STATE.md .planning/backups/STATE-$(date +%Y%m%dT%H%M%S).md
184
191
 
185
192
  This ensures the user can recover the original STATE.md if the fix produces incorrect results.
186
193
 
187
- 1. Count the auto-fixable issues and present:
194
+ 1. Count the auto-fixable issues.
195
+
196
+ **If `--repair` flag was passed**: Skip the question and go directly to "Fix all" (step 2). Display: "Auto-repair mode: applying {N} fixes..."
197
+
198
+ **Otherwise**: Present the choice:
188
199
 
189
200
  Use AskUserQuestion:
190
201
  question: "Found {N} auto-fixable issues. How should we handle them?"
@@ -194,7 +205,7 @@ This ensures the user can recover the original STATE.md if the fix produces inco
194
205
  - label: "Review each" description: "Show each fix and confirm individually"
195
206
  - label: "Skip" description: "Do nothing — just report"
196
207
 
197
- 2. If "Fix all": Apply all fixes in order, then display a summary:
208
+ 2. If "Fix all" (or `--repair`): Apply all fixes in order, then display a summary:
198
209
  ```
199
210
  Auto-fix results:
200
211
  - Fixed: {description of fix 1}
@@ -213,8 +224,6 @@ This ensures the user can recover the original STATE.md if the fix produces inco
213
224
 
214
225
  4. If "Skip": Do nothing, continue to the rest of the output.
215
226
 
216
- **Note:** When auto-fix is active, the health skill is no longer strictly read-only. The `allowed-tools` frontmatter must include `Write` and `AskUserQuestion` for auto-fix to work. Update the frontmatter accordingly.
217
-
218
227
  ---
219
228
 
220
229
  ## Bonus: Recent Decisions
@@ -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.