@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
@@ -1,4 +1,3 @@
1
- <!-- canonical: ../../pbr/references/checkpoints.md -->
2
1
  # Checkpoints Reference
3
2
 
4
3
  How Plan-Build-Run uses checkpoint tasks to pause execution and involve the human.
@@ -156,3 +155,35 @@ When creating plans that include checkpoints:
156
155
  4. **Provide clear instructions** — the `<action>` and `<verify>` elements should give the human everything they need
157
156
  5. **Consider autonomous alternatives** — if a task CAN be verified automatically, prefer `type="auto"` with a robust `<verify>` command
158
157
  6. **Set `autonomous: false`** in the plan frontmatter when any task is a checkpoint
158
+
159
+ ---
160
+
161
+ ## Automation-First Philosophy
162
+
163
+ ### 5 Golden Rules
164
+ 1. If Claude CAN run it, Claude MUST run it
165
+ 2. If Claude CAN verify it, Claude MUST verify it
166
+ 3. Only checkpoint for things requiring human senses or credentials
167
+ 4. Group manual actions to minimize checkpoint count
168
+ 5. Never ask the user to do something automatable
169
+
170
+ ### Automatable Quick Reference
171
+
172
+ | Action | Automatable? | Notes |
173
+ |--------|-------------|-------|
174
+ | Run tests | YES | `npm test`, `pytest`, etc. |
175
+ | Start dev server | YES | `npm run dev` (check port) |
176
+ | Check environment variables | YES | `env \| grep KEY` |
177
+ | Build project | YES | `npm run build` |
178
+ | Run linting | YES | `npm run lint` |
179
+ | Database migrations | YES | CLI commands |
180
+ | Click email verification link | NO | Requires browser + inbox |
181
+ | 3DS payment verification | NO | Requires card + phone |
182
+ | OAuth consent screen | NO | Requires browser interaction |
183
+ | Hardware token/YubiKey | NO | Physical device |
184
+
185
+ ### Anti-Patterns
186
+ - Asking user to "start the dev server" — just run it
187
+ - Asking user to "check if tests pass" — run `npm test`
188
+ - Saying "please verify the output" without running verification commands first
189
+ - Creating a checkpoint for `mkdir` or `npm install`
@@ -0,0 +1,45 @@
1
+ # Context Quality Tiers
2
+
3
+ Behavioral guidance for agents based on context window utilization.
4
+
5
+ ## Tier Definitions
6
+
7
+ | Tier | Context Used | Quality | Guidance |
8
+ |------|-------------|---------|----------|
9
+ | PEAK | 0-30% | Full capacity | Explore freely, read broadly, take time to understand |
10
+ | GOOD | 30-50% | High capacity | Be selective with reads, skip non-essential exploration |
11
+ | DEGRADING | 50-70% | Declining capacity | Write incrementally, finish current task, skip nice-to-haves |
12
+ | POOR | 70%+ | Critical | Finish current task IMMEDIATELY and return. No new reads. |
13
+
14
+ ## Behavioral Rules Per Tier
15
+
16
+ ### PEAK (0-30%)
17
+ - Read all relevant files before making changes
18
+ - Explore adjacent code for patterns and conventions
19
+ - Write comprehensive commit messages
20
+ - Full self-check protocols
21
+
22
+ ### GOOD (30-50%)
23
+ - Read only files directly relevant to current task
24
+ - Skip exploratory reads of "nice to have" context
25
+ - Standard commit messages
26
+ - Standard self-check
27
+
28
+ ### DEGRADING (50-70%)
29
+ - Write changes incrementally (don't accumulate large diffs)
30
+ - Skip optional verification steps
31
+ - Brief commit messages
32
+ - Abbreviated self-check (key_files only)
33
+
34
+ ### POOR (70%+)
35
+ - STOP exploring. Finish the current task only.
36
+ - Write SUMMARY.md immediately if executor
37
+ - Return completion marker immediately
38
+ - Do NOT start new tasks or reads
39
+
40
+ ## Agent-Specific Overrides
41
+
42
+ - **Researcher**: At DEGRADING, write findings immediately rather than accumulating
43
+ - **Executor**: At DEGRADING, complete current task then return CHECKPOINT
44
+ - **Verifier**: At DEGRADING, check existence only (skip substantiveness/wiring layers)
45
+ - **Planner**: At GOOD, reduce task detail level; at DEGRADING, finish current plan file only
@@ -283,3 +283,118 @@ node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js event error hook-failure '{"scri
283
283
  **Output:** `{ "logged": true, "category": "build", "event": "plan-complete" }`
284
284
 
285
285
  If the JSON-details argument is not valid JSON, it's stored as `{ "raw": "<the string>" }`.
286
+
287
+ ---
288
+
289
+ ## Compound Init Commands
290
+
291
+ Compound commands that compose multiple data sources into a single JSON response.
292
+ Replace multi-step context loading in skills with a single CLI call.
293
+
294
+ ### `init execute-phase <phase>`
295
+
296
+ Everything an executor needs to start building a phase.
297
+
298
+ ```bash
299
+ node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js init execute-phase 3
300
+ ```
301
+
302
+ **Output:**
303
+ ```json
304
+ {
305
+ "executor_model": "sonnet",
306
+ "verifier_model": "sonnet",
307
+ "config": { "depth": "standard", "mode": "interactive", "parallelization": {}, "planning": {}, "gates": {}, "features": {} },
308
+ "phase": { "num": "3", "dir": "03-auth", "name": "auth", "goal": "...", "has_context": false, "status": "planned", "plan_count": 2, "completed": 0 },
309
+ "plans": [{ "file": "PLAN-01.md", "plan_id": "01", "wave": 1, "autonomous": true, "has_summary": false, "must_haves_count": 4, "depends_on": [] }],
310
+ "waves": { "wave_1": ["01", "02"] },
311
+ "branch_name": "main",
312
+ "git_clean": true
313
+ }
314
+ ```
315
+
316
+ ### `init plan-phase <phase>`
317
+
318
+ Everything a planner needs to start phase planning.
319
+
320
+ ```bash
321
+ node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js init plan-phase 3
322
+ ```
323
+
324
+ **Output:** `researcher_model`, `planner_model`, `checker_model`, `config` (depth profile, features, planning settings), `phase` (num, dir, goal, depends_on), `existing_artifacts`, `workflow` flags.
325
+
326
+ ### `init quick <description>`
327
+
328
+ Everything the quick skill needs: next task number, slug, directory path.
329
+
330
+ ```bash
331
+ node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js init quick "add search feature"
332
+ ```
333
+
334
+ **Output:** `next_task_number`, `slug`, `dir`, `dir_name`, `timestamp`, `config` subset.
335
+
336
+ ### `init verify-work <phase>`
337
+
338
+ Everything a verifier needs to start verification.
339
+
340
+ ```bash
341
+ node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js init verify-work 3
342
+ ```
343
+
344
+ **Output:** `verifier_model`, `phase` info, `has_verification`, `prior_attempts`, `prior_status`, `summaries`.
345
+
346
+ ### `init resume`
347
+
348
+ Detect interrupted state and suggest continuation.
349
+
350
+ ```bash
351
+ node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js init resume
352
+ ```
353
+
354
+ **Output:** `state`, `auto_next`, `continue_here`, `active_skill`, `current_phase`, `progress`.
355
+
356
+ ### `init progress`
357
+
358
+ All phases with status and completion data.
359
+
360
+ ```bash
361
+ node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js init progress
362
+ ```
363
+
364
+ **Output:** `current_phase`, `total_phases`, `status`, `phases` array, `total_plans`, `completed_plans`, `percentage`.
365
+
366
+ ---
367
+
368
+ ## State Mutation Extensions
369
+
370
+ ### `state patch <JSON>`
371
+
372
+ Multi-field atomic STATE.md update. Updates all fields in a single pass.
373
+
374
+ ```bash
375
+ node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js state patch '{"status":"executing","last_activity":"now"}'
376
+ ```
377
+
378
+ **Valid fields:** `current_phase`, `status`, `plans_complete`, `last_activity`, `progress_percent`, `phase_slug`, `total_phases`, `last_command`, `blockers`
379
+
380
+ **Output:** `{ "success": true, "updated": ["status", "last_activity"] }`
381
+
382
+ ### `state advance-plan`
383
+
384
+ Increment current plan number in STATE.md and update progress percentage.
385
+
386
+ ```bash
387
+ node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js state advance-plan
388
+ ```
389
+
390
+ **Output:** `{ "success": true, "previous_plan": 1, "current_plan": 2, "total_plans": 5, "progress_percent": 40 }`
391
+
392
+ ### `state record-metric [--duration Nm] [--plans-completed N]`
393
+
394
+ Record session/execution metrics. Appends to HISTORY.md and updates last_activity.
395
+
396
+ ```bash
397
+ node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js state record-metric --duration 15m --plans-completed 3
398
+ ```
399
+
400
+ **Output:** `{ "success": true, "duration_minutes": 15, "plans_completed": 3 }`
@@ -1,4 +1,3 @@
1
- <!-- canonical: ../../pbr/references/questioning.md -->
2
1
  # Deep Questioning Guide
3
2
 
4
3
  Techniques for understanding a user's project vision during `/pbr:begin`. The goal is to build a complete mental model of what needs to be built, not just a feature list.
@@ -213,3 +212,24 @@ See **[skills/shared/domain-probes.md](../shared/domain-probes.md)** for technol
213
212
  9. **DO NOT** lead the user toward a particular solution
214
213
  10. **DO NOT** forget to summarize and confirm understanding
215
214
  11. **DO NOT** ask what you already know — track what the user has stated and never re-ask it. If they said "I'm using React", do not later ask "Are you using a frontend framework?" If they said "PostgreSQL", do not ask "What database are you using?" Redundant questions waste exchanges and erode trust. Instead, build on what you know: "You mentioned React — are you using Next.js or plain CRA?"
215
+
216
+ ---
217
+
218
+ ## Dream Extraction Philosophy
219
+
220
+ The goal of questioning is not to gather requirements — it's to extract the user's dream and make it buildable.
221
+
222
+ ### 4-Item Context Checklist
223
+ Before planning can begin, you must know:
224
+ 1. **What** are we building? (concrete deliverable, not abstract concept)
225
+ 2. **Why** does it exist? (the problem it solves, not the tech it uses)
226
+ 3. **Who** is it for? (specific users, not "everyone")
227
+ 4. **What does done look like?** (observable outcomes, not technical milestones)
228
+
229
+ ### Conversation Rules
230
+ - **Start open**: "Tell me about what you want to build"
231
+ - **Follow energy**: When they light up about something, dig deeper there
232
+ - **Challenge vagueness**: "You said 'user-friendly' — what does that mean specifically?"
233
+ - **Know when to stop**: When you have the 4 items above, move to planning
234
+ - **NEVER ask about technical experience**: It's irrelevant and condescending
235
+ - **NEVER present a menu of options**: Open questions reveal more than multiple choice
@@ -1,4 +1,3 @@
1
- <!-- canonical: ../../pbr/references/verification-patterns.md -->
2
1
  # Goal-Backward Verification Patterns
3
2
 
4
3
  Reference patterns for deriving verification criteria from goals. Used by the planner to create `<verify>` and `<done>` elements, and by the verifier to check phase completion.
@@ -197,3 +196,55 @@ Bad: "Tests pass"
197
196
  Good: "All 5 auth middleware tests pass: valid token, expired token,
198
197
  missing token, malformed token, and correct user extraction"
199
198
  ```
199
+
200
+ ---
201
+
202
+ ## Wiring Verification Patterns
203
+
204
+ 4 concrete patterns for verifying components are actually connected, not just present.
205
+
206
+ ### Pattern 1: Component to API
207
+ 1. Find the fetch/axios call in the component
208
+ 2. Verify the call is NOT commented out
209
+ 3. Verify the response is assigned to state (not discarded)
210
+ 4. Verify error handling exists (try/catch or .catch)
211
+
212
+ ### Pattern 2: API to Database
213
+ 1. Find the database query in the route handler
214
+ 2. Verify `await` is present (not fire-and-forget)
215
+ 3. Verify the result is returned in the response (not discarded)
216
+ 4. Verify error cases return appropriate HTTP status codes
217
+
218
+ ### Pattern 3: Form to Handler
219
+ 1. Find the form's onSubmit handler
220
+ 2. Verify it calls an API function (not just preventDefault)
221
+ 3. Verify form validation runs before the API call
222
+ 4. Verify success/error feedback is shown to the user
223
+
224
+ ### Pattern 4: State to Render
225
+ 1. Find state variables (useState, store, etc.)
226
+ 2. Verify they appear in JSX/template via .map(), interpolation, or conditional rendering
227
+ 3. Verify loading/error states are rendered (not just success state)
228
+ 4. Verify empty state is handled (not just "no data" crash)
229
+
230
+ ### Quick Verification Checklists
231
+
232
+ **Component Checklist (8 items):**
233
+ - [ ] Component file exists and exports correctly
234
+ - [ ] Props/types are defined (not `any`)
235
+ - [ ] API calls use actual endpoints (not hardcoded data)
236
+ - [ ] Loading state renders something meaningful
237
+ - [ ] Error state renders something meaningful
238
+ - [ ] Empty state renders something meaningful
239
+ - [ ] User interactions trigger actual handlers
240
+ - [ ] Component is imported and rendered in parent
241
+
242
+ **API Route Checklist (8 items):**
243
+ - [ ] Route file exists and exports handler
244
+ - [ ] Route is registered in router/app
245
+ - [ ] Request validation exists (body, params, query)
246
+ - [ ] Database query uses parameterized inputs
247
+ - [ ] Success response includes expected data shape
248
+ - [ ] Error response includes status code and message
249
+ - [ ] Authentication/authorization check exists if needed
250
+ - [ ] Response matches what the frontend expects
@@ -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`)
@@ -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: