@sienklogic/plan-build-run 2.0.2 → 2.2.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 (166) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +25 -6
  3. package/dashboard/src/routes/pages.routes.js +11 -4
  4. package/dashboard/src/services/dashboard.service.js +81 -17
  5. package/dashboard/src/services/phase.service.js +30 -24
  6. package/dashboard/src/services/roadmap.service.js +3 -3
  7. package/dashboard/src/views/partials/phase-content.ejs +5 -4
  8. package/package.json +1 -1
  9. package/plugins/cursor-pbr/.cursor-plugin/plugin.json +1 -1
  10. package/plugins/cursor-pbr/CHANGELOG.md +15 -0
  11. package/plugins/cursor-pbr/README.md +118 -0
  12. package/plugins/cursor-pbr/agents/codebase-mapper.md +108 -0
  13. package/plugins/cursor-pbr/agents/debugger.md +168 -0
  14. package/plugins/cursor-pbr/agents/executor.md +236 -0
  15. package/plugins/cursor-pbr/agents/general.md +87 -0
  16. package/plugins/cursor-pbr/agents/integration-checker.md +87 -0
  17. package/plugins/cursor-pbr/agents/plan-checker.md +198 -0
  18. package/plugins/cursor-pbr/agents/planner.md +180 -0
  19. package/plugins/cursor-pbr/agents/researcher.md +162 -0
  20. package/plugins/cursor-pbr/agents/synthesizer.md +101 -0
  21. package/plugins/cursor-pbr/agents/verifier.md +193 -0
  22. package/plugins/cursor-pbr/assets/logo.svg +21 -0
  23. package/plugins/cursor-pbr/hooks/hooks.json +189 -7
  24. package/plugins/cursor-pbr/references/agent-anti-patterns.md +25 -0
  25. package/plugins/cursor-pbr/references/agent-interactions.md +135 -0
  26. package/plugins/cursor-pbr/references/agent-teams.md +55 -0
  27. package/plugins/cursor-pbr/references/checkpoints.md +158 -0
  28. package/plugins/cursor-pbr/references/common-bug-patterns.md +14 -0
  29. package/plugins/cursor-pbr/references/config-reference.md +442 -0
  30. package/plugins/cursor-pbr/references/continuation-format.md +213 -0
  31. package/plugins/cursor-pbr/references/deviation-rules.md +113 -0
  32. package/plugins/cursor-pbr/references/git-integration.md +227 -0
  33. package/plugins/cursor-pbr/references/integration-patterns.md +118 -0
  34. package/plugins/cursor-pbr/references/model-profiles.md +100 -0
  35. package/plugins/cursor-pbr/references/model-selection.md +32 -0
  36. package/plugins/cursor-pbr/references/pbr-rules.md +194 -0
  37. package/plugins/cursor-pbr/references/plan-authoring.md +182 -0
  38. package/plugins/cursor-pbr/references/plan-format.md +288 -0
  39. package/plugins/cursor-pbr/references/planning-config.md +214 -0
  40. package/plugins/cursor-pbr/references/questioning.md +215 -0
  41. package/plugins/cursor-pbr/references/reading-verification.md +128 -0
  42. package/plugins/cursor-pbr/references/stub-patterns.md +161 -0
  43. package/plugins/cursor-pbr/references/subagent-coordination.md +120 -0
  44. package/plugins/cursor-pbr/references/ui-formatting.md +462 -0
  45. package/plugins/cursor-pbr/references/verification-patterns.md +199 -0
  46. package/plugins/cursor-pbr/references/wave-execution.md +96 -0
  47. package/plugins/cursor-pbr/rules/pbr-workflow.mdc +48 -0
  48. package/plugins/cursor-pbr/setup.ps1 +78 -0
  49. package/plugins/cursor-pbr/setup.sh +83 -0
  50. package/plugins/cursor-pbr/skills/begin/SKILL.md +566 -0
  51. package/plugins/cursor-pbr/skills/begin/templates/PROJECT.md.tmpl +34 -0
  52. package/plugins/cursor-pbr/skills/begin/templates/REQUIREMENTS.md.tmpl +19 -0
  53. package/plugins/cursor-pbr/skills/begin/templates/STATE.md.tmpl +50 -0
  54. package/plugins/cursor-pbr/skills/begin/templates/config.json.tmpl +64 -0
  55. package/plugins/cursor-pbr/skills/begin/templates/researcher-prompt.md.tmpl +20 -0
  56. package/plugins/cursor-pbr/skills/begin/templates/roadmap-prompt.md.tmpl +31 -0
  57. package/plugins/cursor-pbr/skills/begin/templates/synthesis-prompt.md.tmpl +17 -0
  58. package/plugins/cursor-pbr/skills/build/SKILL.md +902 -0
  59. package/plugins/cursor-pbr/skills/config/SKILL.md +253 -0
  60. package/plugins/cursor-pbr/skills/continue/SKILL.md +159 -0
  61. package/plugins/cursor-pbr/skills/debug/SKILL.md +512 -0
  62. package/plugins/cursor-pbr/skills/debug/templates/continuation-prompt.md.tmpl +17 -0
  63. package/plugins/cursor-pbr/skills/debug/templates/initial-investigation-prompt.md.tmpl +28 -0
  64. package/plugins/cursor-pbr/skills/discuss/SKILL.md +344 -0
  65. package/plugins/cursor-pbr/skills/discuss/templates/CONTEXT.md.tmpl +62 -0
  66. package/plugins/cursor-pbr/skills/discuss/templates/decision-categories.md +10 -0
  67. package/plugins/cursor-pbr/skills/explore/SKILL.md +375 -0
  68. package/plugins/cursor-pbr/skills/health/SKILL.md +218 -0
  69. package/plugins/cursor-pbr/skills/health/templates/check-pattern.md.tmpl +31 -0
  70. package/plugins/cursor-pbr/skills/health/templates/output-format.md.tmpl +64 -0
  71. package/plugins/cursor-pbr/skills/help/SKILL.md +152 -0
  72. package/plugins/cursor-pbr/skills/import/SKILL.md +499 -0
  73. package/plugins/cursor-pbr/skills/milestone/SKILL.md +701 -0
  74. package/plugins/cursor-pbr/skills/milestone/templates/audit-report.md.tmpl +49 -0
  75. package/plugins/cursor-pbr/skills/milestone/templates/stats-file.md.tmpl +31 -0
  76. package/plugins/cursor-pbr/skills/note/SKILL.md +228 -0
  77. package/plugins/cursor-pbr/skills/pause/SKILL.md +246 -0
  78. package/plugins/cursor-pbr/skills/pause/templates/continue-here.md.tmpl +72 -0
  79. package/plugins/cursor-pbr/skills/plan/SKILL.md +648 -0
  80. package/plugins/cursor-pbr/skills/plan/templates/checker-prompt.md.tmpl +22 -0
  81. package/plugins/cursor-pbr/skills/plan/templates/gap-closure-prompt.md.tmpl +33 -0
  82. package/plugins/cursor-pbr/skills/plan/templates/planner-prompt.md.tmpl +39 -0
  83. package/plugins/cursor-pbr/skills/plan/templates/researcher-prompt.md.tmpl +20 -0
  84. package/plugins/cursor-pbr/skills/plan/templates/revision-prompt.md.tmpl +24 -0
  85. package/plugins/cursor-pbr/skills/quick/SKILL.md +351 -0
  86. package/plugins/cursor-pbr/skills/resume/SKILL.md +399 -0
  87. package/plugins/cursor-pbr/skills/review/SKILL.md +649 -0
  88. package/plugins/cursor-pbr/skills/review/templates/debugger-prompt.md.tmpl +61 -0
  89. package/plugins/cursor-pbr/skills/review/templates/gap-planner-prompt.md.tmpl +41 -0
  90. package/plugins/cursor-pbr/skills/review/templates/verifier-prompt.md.tmpl +116 -0
  91. package/plugins/cursor-pbr/skills/scan/SKILL.md +301 -0
  92. package/plugins/cursor-pbr/skills/scan/templates/mapper-prompt.md.tmpl +202 -0
  93. package/plugins/cursor-pbr/skills/setup/SKILL.md +250 -0
  94. package/plugins/cursor-pbr/skills/shared/commit-planning-docs.md +36 -0
  95. package/plugins/cursor-pbr/skills/shared/config-loading.md +103 -0
  96. package/plugins/cursor-pbr/skills/shared/context-budget.md +41 -0
  97. package/plugins/cursor-pbr/skills/shared/context-loader-task.md +87 -0
  98. package/plugins/cursor-pbr/skills/shared/digest-select.md +80 -0
  99. package/plugins/cursor-pbr/skills/shared/domain-probes.md +126 -0
  100. package/plugins/cursor-pbr/skills/shared/error-reporting.md +80 -0
  101. package/plugins/cursor-pbr/skills/shared/gate-prompts.md +389 -0
  102. package/plugins/cursor-pbr/skills/shared/phase-argument-parsing.md +46 -0
  103. package/plugins/cursor-pbr/skills/shared/progress-display.md +54 -0
  104. package/plugins/cursor-pbr/skills/shared/revision-loop.md +82 -0
  105. package/plugins/cursor-pbr/skills/shared/state-loading.md +63 -0
  106. package/plugins/cursor-pbr/skills/shared/state-update.md +162 -0
  107. package/plugins/cursor-pbr/skills/shared/universal-anti-patterns.md +34 -0
  108. package/plugins/cursor-pbr/skills/status/SKILL.md +362 -0
  109. package/plugins/cursor-pbr/skills/todo/SKILL.md +195 -0
  110. package/plugins/cursor-pbr/templates/CONTEXT.md.tmpl +53 -0
  111. package/plugins/cursor-pbr/templates/INTEGRATION-REPORT.md.tmpl +152 -0
  112. package/plugins/cursor-pbr/templates/RESEARCH-SUMMARY.md.tmpl +98 -0
  113. package/plugins/cursor-pbr/templates/ROADMAP.md.tmpl +41 -0
  114. package/plugins/cursor-pbr/templates/SUMMARY.md.tmpl +82 -0
  115. package/plugins/cursor-pbr/templates/VERIFICATION-DETAIL.md.tmpl +117 -0
  116. package/plugins/cursor-pbr/templates/continue-here.md.tmpl +74 -0
  117. package/plugins/cursor-pbr/templates/prompt-partials/phase-project-context.md.tmpl +38 -0
  118. package/plugins/pbr/agents/codebase-mapper.md +41 -206
  119. package/plugins/pbr/agents/debugger.md +65 -171
  120. package/plugins/pbr/agents/executor.md +90 -275
  121. package/plugins/pbr/agents/general.md +27 -97
  122. package/plugins/pbr/agents/integration-checker.md +35 -112
  123. package/plugins/pbr/agents/plan-checker.md +71 -164
  124. package/plugins/pbr/agents/planner.md +76 -245
  125. package/plugins/pbr/agents/researcher.md +63 -255
  126. package/plugins/pbr/agents/synthesizer.md +49 -174
  127. package/plugins/pbr/agents/verifier.md +75 -366
  128. package/plugins/pbr/hooks/hooks.json +14 -10
  129. package/plugins/pbr/references/ui-formatting.md +1 -1
  130. package/plugins/pbr/scripts/auto-continue.js +20 -4
  131. package/plugins/pbr/scripts/check-dangerous-commands.js +1 -1
  132. package/plugins/pbr/scripts/check-phase-boundary.js +1 -1
  133. package/plugins/pbr/scripts/check-plan-format.js +3 -3
  134. package/plugins/pbr/scripts/check-roadmap-sync.js +3 -3
  135. package/plugins/pbr/scripts/check-skill-workflow.js +1 -1
  136. package/plugins/pbr/scripts/check-state-sync.js +2 -2
  137. package/plugins/pbr/scripts/check-subagent-output.js +1 -1
  138. package/plugins/pbr/scripts/check-summary-gate.js +198 -0
  139. package/plugins/pbr/scripts/context-budget-check.js +1 -1
  140. package/plugins/pbr/scripts/event-handler.js +2 -2
  141. package/plugins/pbr/scripts/event-logger.js +1 -1
  142. package/plugins/pbr/scripts/log-subagent.js +1 -1
  143. package/plugins/pbr/scripts/pbr-tools.js +1 -1
  144. package/plugins/pbr/scripts/post-write-dispatch.js +1 -1
  145. package/plugins/pbr/scripts/post-write-quality.js +1 -1
  146. package/plugins/pbr/scripts/pre-bash-dispatch.js +1 -1
  147. package/plugins/pbr/scripts/pre-write-dispatch.js +16 -3
  148. package/plugins/pbr/scripts/session-cleanup.js +1 -1
  149. package/plugins/pbr/scripts/status-line.js +1 -1
  150. package/plugins/pbr/scripts/suggest-compact.js +1 -1
  151. package/plugins/pbr/scripts/task-completed.js +1 -1
  152. package/plugins/pbr/scripts/track-context-budget.js +11 -6
  153. package/plugins/pbr/scripts/validate-commit.js +1 -1
  154. package/plugins/pbr/scripts/validate-task.js +1 -1
  155. package/plugins/pbr/skills/begin/SKILL.md +4 -2
  156. package/plugins/pbr/skills/begin/templates/roadmap-prompt.md.tmpl +2 -0
  157. package/plugins/pbr/skills/build/SKILL.md +6 -4
  158. package/plugins/pbr/skills/continue/SKILL.md +2 -1
  159. package/plugins/pbr/skills/review/SKILL.md +4 -3
  160. package/plugins/pbr/skills/status/SKILL.md +5 -2
  161. package/plugins/pbr/templates/ROADMAP.md.tmpl +6 -1
  162. package/plugins/cursor-pbr/agents/.gitkeep +0 -0
  163. package/plugins/cursor-pbr/references/.gitkeep +0 -0
  164. package/plugins/cursor-pbr/rules/.gitkeep +0 -0
  165. package/plugins/cursor-pbr/skills/.gitkeep +0 -0
  166. package/plugins/cursor-pbr/templates/.gitkeep +0 -0
@@ -0,0 +1,649 @@
1
+ ---
2
+ name: review
3
+ description: "Verify the build matched the plan. Automated checks + walkthrough with you."
4
+ argument-hint: "<phase-number> [--auto-fix] [--teams]"
5
+ ---
6
+
7
+ # /pbr:review — Phase Review and Verification
8
+
9
+ You are the orchestrator for `/pbr:review`. This skill verifies that what was built matches what was planned. It runs automated three-layer checks against must-haves, then walks the user through a conversational UAT (user acceptance testing) for each deliverable. Your job is to present findings clearly and help the user decide what's good enough versus what needs fixes.
10
+
11
+ ## Context Budget
12
+
13
+ Reference: `skills/shared/context-budget.md` for the universal orchestrator rules.
14
+
15
+ Additionally for this skill:
16
+ - **Minimize** reading agent output — read only VERIFICATION.md frontmatter for summaries
17
+
18
+ ## Step 0 — Immediate Output
19
+
20
+ **Before ANY tool calls**, display this banner:
21
+
22
+ ```
23
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
24
+ PLAN-BUILD-RUN ► REVIEWING PHASE {N}
25
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
26
+ ```
27
+
28
+ Where `{N}` is the phase number from `$ARGUMENTS`. Then proceed to Step 1.
29
+
30
+ ## Prerequisites
31
+
32
+ - `.planning/config.json` exists
33
+ - Phase has been built: SUMMARY.md files exist in `.planning/phases/{NN}-{slug}/`
34
+
35
+ ### Event-Driven Auto-Verification
36
+
37
+ When `features.goal_verification` is enabled and depth is "standard" or "comprehensive", event hooks automatically queue verification after executor completion. The hook writes `.planning/.auto-verify` as a signal file. The build skill's orchestrator detects this signal and invokes the verifier agent.
38
+
39
+ **This is additive**: `/pbr:review` can always be invoked manually regardless of auto-verification settings. If auto-verification already ran, `/pbr:review` re-runs verification (useful for re-checking after fixes).
40
+
41
+ ---
42
+
43
+ ## Argument Parsing
44
+
45
+ Parse `$ARGUMENTS` according to `skills/shared/phase-argument-parsing.md`.
46
+
47
+ | Argument | Meaning |
48
+ |----------|---------|
49
+ | `3` | Review phase 3 |
50
+ | `3 --auto-fix` | Review phase 3, automatically diagnose and create gap-closure plans for failures |
51
+ | `3 --teams` | Review phase 3 with parallel specialist verifiers (functional + security + performance) |
52
+ | (no number) | Use current phase from STATE.md |
53
+
54
+ ---
55
+
56
+ ## Orchestration Flow
57
+
58
+ Execute these steps in order.
59
+
60
+ ---
61
+
62
+ ### Step 1: Parse and Validate (inline)
63
+
64
+ 1. Parse `$ARGUMENTS` for phase number and `--auto-fix` flag
65
+ 2. Read `.planning/config.json`
66
+ 3. Resolve depth profile: run `node ${PLUGIN_ROOT}/scripts/pbr-tools.js config resolve-depth` to get the effective feature/gate settings for the current depth. Store the result for use in later gating decisions.
67
+ 4. Validate:
68
+ - Phase directory exists at `.planning/phases/{NN}-{slug}/`
69
+ - SUMMARY.md files exist (phase has been built)
70
+ - PLAN.md files exist (needed for must-have extraction)
71
+ 5. If no phase number given, read current phase from `.planning/STATE.md`
72
+ 6. If `.planning/.auto-verify` signal file exists, read it and note the auto-verification was already queued. Delete the signal file after reading (one-shot).
73
+
74
+ **Validation errors — use branded error boxes:**
75
+
76
+ If no SUMMARY.md files:
77
+ ```
78
+ ERROR
79
+
80
+ Phase {N} hasn't been built yet.
81
+
82
+ **To fix:** Run `/pbr:build {N}` first.
83
+ ```
84
+
85
+ If no PLAN.md files:
86
+ ```
87
+ ERROR
88
+
89
+ Phase {N} has no plans.
90
+
91
+ **To fix:** Run `/pbr:plan {N}` first.
92
+ ```
93
+
94
+ ---
95
+
96
+ ### Step 2: Check Existing Verification (inline)
97
+
98
+ Reference: `skills/shared/config-loading.md` for the tooling shortcut (`phase-info`) and config field reference.
99
+
100
+ Check if a VERIFICATION.md already exists from `/pbr:build`'s auto-verification step:
101
+
102
+ 1. Look for `.planning/phases/{NN}-{slug}/VERIFICATION.md`
103
+ 2. If it exists:
104
+ - Read it and check the status
105
+ - If `status: passed` and no `--auto-fix` flag: skip to Step 4 (conversational UAT)
106
+ - If `status: gaps_found`: present gaps and proceed to Step 4
107
+ - If `status: human_needed`: proceed to Step 4
108
+
109
+ 3. If it does NOT exist: proceed to Step 3 (automated verification)
110
+
111
+ ---
112
+
113
+ ### Step 3: Automated Verification (delegated)
114
+
115
+ **Depth profile gate:** Before invoking the verifier, resolve the depth profile. If `features.goal_verification` is false in the profile, skip automated verification and proceed directly to Step 5 (Conversational UAT). Note to user: "Automated verification skipped (depth: {depth}). Proceeding to manual review."
116
+
117
+ #### Team Review Mode
118
+
119
+ If `--teams` flag is present OR `config.parallelization.use_teams` is true:
120
+
121
+ 1. Create team output directory: `.planning/phases/{NN}-{slug}/team/` (if not exists)
122
+ 2. Display to the user: `Spawning 3 verifiers in parallel (functional, security, performance)...`
123
+
124
+ Invoke THREE `@verifier` agents in parallel:
125
+
126
+ **Agent 1 -- Functional Reviewer**:
127
+ - Invoke `@verifier` with: "You are the FUNCTIONAL REVIEWER in a review team. Focus on: must-haves met, code correctness, completeness, integration points. Write output to `.planning/phases/{NN}-{slug}/team/functional-VERIFY.md`."
128
+
129
+ **Agent 2 -- Security Auditor**:
130
+ - Invoke `@verifier` with: "You are the SECURITY AUDITOR in a review team. Focus on: vulnerabilities, auth bypass paths, injection risks, secrets exposure, permission escalation. Write output to `.planning/phases/{NN}-{slug}/team/security-VERIFY.md`."
131
+
132
+ **Agent 3 -- Performance Analyst**:
133
+ - Invoke `@verifier` with: "You are the PERFORMANCE ANALYST in a review team. Focus on: N+1 queries, memory leaks, unnecessary allocations, bundle size impact, blocking operations. Write output to `.planning/phases/{NN}-{slug}/team/performance-VERIFY.md`."
134
+
135
+ 3. Wait for all three to complete
136
+ 4. Display to the user: `Spawning synthesizer...`
137
+
138
+ Invoke `@synthesizer` with: "Read all *-VERIFY.md files in `.planning/phases/{NN}-{slug}/team/`. Synthesize into a unified VERIFICATION.md. Merge pass/fail verdicts -- a must-have fails if ANY reviewer flags it. Combine gap lists. Security and performance findings go into dedicated sections."
139
+ 5. Proceed to UAT walkthrough with the unified VERIFICATION.md
140
+
141
+ If teams not enabled, proceed with existing single-verifier flow.
142
+
143
+ Reference: `references/agent-teams.md`
144
+
145
+ #### Single-Verifier Flow (default)
146
+
147
+ Display to the user: `Spawning verifier...`
148
+
149
+ Invoke the `@verifier` agent to run three-layer checks.
150
+
151
+ **Path resolution**: Before constructing any agent prompt, resolve plugin root to its absolute path. Do not pass the variable literally in prompts. Use the resolved absolute path for any pbr-tools.js or template references included in the prompt.
152
+
153
+ #### Verifier Prompt Template
154
+
155
+ Read `skills/review/templates/verifier-prompt.md.tmpl` and use its content as the verifier prompt.
156
+
157
+ **Placeholders to fill before sending:**
158
+ - `{For each PLAN.md file in the phase directory:}` — inline each plan's must_haves frontmatter block
159
+ - `{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.
160
+ - `{NN}-{slug}` — the phase directory name
161
+ - `{N}` — the phase number
162
+ - `{date}`, `{count}`, `{phase name}` — fill from context
163
+
164
+ Wait for the verifier to complete.
165
+
166
+ **After the verifier completes**, read VERIFICATION.md frontmatter and display a quick summary before the full results:
167
+
168
+ ```
169
+ Verifier: {passed}/{total} must-haves verified
170
+ ```
171
+
172
+ Then show a brief table of must-haves with pass/fail status:
173
+
174
+ ```
175
+ | Must-Have | Status |
176
+ |-----------|--------|
177
+ | {name} | PASS |
178
+ | {name} | FAIL |
179
+ ```
180
+
181
+ Then display the overall verdict (`PASSED`, `GAPS FOUND`, or `HUMAN NEEDED`) before proceeding to the full results presentation.
182
+
183
+ ---
184
+
185
+ ### Step 4: Present Verification Results (inline)
186
+
187
+ Read the VERIFICATION.md frontmatter. Check the `attempt` counter.
188
+
189
+ **If `attempt >= 3` AND `status: gaps_found`:** This phase has failed verification multiple times. Present escalation options instead of the normal flow:
190
+
191
+ Present the escalation context:
192
+ ```
193
+ Phase {N}: {name} — Verification Failed ({attempt} attempts)
194
+ The same gaps have persisted across {attempt} verification attempts.
195
+ Remaining gaps: {count}
196
+ ```
197
+
198
+ Use the multi-option-escalation pattern from `skills/shared/gate-prompts.md`:
199
+ question: "Phase {N} has failed verification {attempt} times with {count} persistent gaps. How should we proceed?"
200
+ header: "Escalate"
201
+ options:
202
+ - label: "Accept gaps" description: "Mark as complete-with-gaps and move on"
203
+ - label: "Re-plan" description: "Go back to /pbr:plan {N} with gap context"
204
+ - label: "Debug" description: "Invoke /pbr:debug to investigate root causes"
205
+ - label: "Retry" description: "Try one more verification cycle"
206
+
207
+ - **If user selects "Accept gaps":** Follow up with a second question:
208
+ question: "Accept all gaps or pick specific ones to override?"
209
+ header: "Override?"
210
+ options:
211
+ - label: "Accept all" description: "Mark phase as complete-with-gaps, accept everything"
212
+ - label: "Pick specific" description: "Choose which gaps to mark as false positives"
213
+ - If "Accept all": Update STATE.md status to `complete-with-gaps`, update ROADMAP.md to `verified*`, add a note in VERIFICATION.md about accepted gaps. Proceed to next phase.
214
+ - If "Pick specific": Use the override flow from Step 6 "Gaps Found" section (present each gap for selection).
215
+ - **If user selects "Re-plan":** Suggest `/pbr:plan {N} --gaps` to create targeted fix plans.
216
+ - **If user selects "Debug":** Suggest `/pbr:debug` with the gap details as starting context.
217
+ - **If user selects "Retry":** Continue with normal Step 5 flow.
218
+
219
+ **Otherwise**, present results normally:
220
+
221
+ ```
222
+ Phase {N}: {name} — Verification Results
223
+
224
+ Status: {PASSED | GAPS FOUND | HUMAN NEEDED}
225
+ Attempt: {attempt}
226
+
227
+ Must-have truths: {passed}/{total}
228
+ Must-have artifacts: {passed}/{total}
229
+ Must-have key links: {passed}/{total}
230
+
231
+ {If all passed:}
232
+ All automated checks passed.
233
+
234
+ {If gaps found:}
235
+ Gaps found:
236
+ 1. {gap description} — {failed layer}
237
+ 2. {gap description} — {failed layer}
238
+
239
+ {If human needed:}
240
+ Items requiring your verification:
241
+ 1. {item} — {why automated check couldn't verify}
242
+ ```
243
+
244
+ ---
245
+
246
+ ### Step 5: Conversational UAT (inline)
247
+
248
+ Walk the user through each deliverable one by one. This is an interactive conversation, not an automated check.
249
+
250
+ **For each plan in the phase:**
251
+
252
+ 0. **Filter out ineligible plans**: Read each plan's SUMMARY.md `status` field. Skip plans with `status: failed`, `status: incomplete`, or `status: partial` that have zero committed tasks (check `commits` frontmatter field). Only walk through plans that completed successfully (`status: complete`) or partially with at least one committed task. For each skipped plan, note it to the user: "Skipping plan {plan_id} ({status}) — not eligible for UAT." If ALL plans in the phase are skipped, display: "No plans eligible for UAT walkthrough. All plans in Phase {N} are incomplete or failed. Run `/pbr:build {N}` to retry." and stop.
253
+ 1. Read the plan's must-haves and SUMMARY.md
254
+ 2. Present what was built:
255
+
256
+ ```
257
+ Plan {plan_id}: {plan name}
258
+
259
+ What was built:
260
+ {Brief description from SUMMARY.md}
261
+
262
+ Key deliverables:
263
+ 1. {artifact/truth 1}
264
+ 2. {artifact/truth 2}
265
+ 3. {artifact/truth 3}
266
+ ```
267
+
268
+ 3. For each must-have truth, walk the user through verification:
269
+
270
+ ```
271
+ Checking: "{truth statement}"
272
+
273
+ How to verify:
274
+ {Specific steps the user can take to check this}
275
+ {e.g., "Open http://localhost:3000 and click Login"}
276
+ {e.g., "Run `npm test` and check that auth tests pass"}
277
+
278
+ Does this work as expected? [pass / fail / skip]
279
+ ```
280
+
281
+ 4. Record the user's assessment for each item
282
+
283
+ **Keep the conversation flowing:**
284
+ - If user says "pass": move to the next item
285
+ - If user says "fail": ask what's wrong, record the issue
286
+ - If user says "skip": note it and move on
287
+ - If user has questions: answer them using the SUMMARY.md and plan context
288
+
289
+ ---
290
+
291
+ ### Step 6: Handle Results (inline)
292
+
293
+ Compile the UAT results and determine next steps.
294
+
295
+ #### All Items Pass
296
+
297
+ If all automated checks and UAT items passed:
298
+
299
+ 1. **Update `.planning/ROADMAP.md` Progress table** (REQUIRED — do this BEFORE updating STATE.md):
300
+
301
+ **Tooling shortcut**: Use the CLI for atomic ROADMAP.md and STATE.md updates:
302
+ ```bash
303
+ node ${PLUGIN_ROOT}/scripts/pbr-tools.js roadmap update-status {phase} verified
304
+ node ${PLUGIN_ROOT}/scripts/pbr-tools.js state update status verified
305
+ node ${PLUGIN_ROOT}/scripts/pbr-tools.js state update last_activity now
306
+ ```
307
+
308
+ 1. Open `.planning/ROADMAP.md`
309
+ 2. Find the `## Progress` table
310
+ 3. Locate the row matching this phase number
311
+ 4. Update the `Status` column to `verified`
312
+ 5. Update the `Completed` column to the current date (YYYY-MM-DD)
313
+ 6. Save the file — do NOT skip this step
314
+ 2. Update `.planning/STATE.md`:
315
+ - Phase status: "verified"
316
+ - Progress updated
317
+ - Last activity timestamp
318
+ - **STATE.md size limit:** Follow size limit enforcement rules in `skills/shared/state-update.md` (150 lines max).
319
+ 3. Update VERIFICATION.md with UAT results (append UAT section)
320
+ 3. Present completion:
321
+
322
+ Use the branded output from `references/ui-formatting.md`:
323
+ - If more phases remain: use the "Phase Complete" banner template
324
+ - If this was the last phase: use the "Milestone Complete" banner template
325
+ - Always include the "Next Up" routing block
326
+
327
+ 4. If `gates.confirm_transition` is true in config AND `features.auto_advance` is NOT true:
328
+ - Use the yes-no pattern from `skills/shared/gate-prompts.md`:
329
+ question: "Phase {N} verified. Ready to move to Phase {N+1}?"
330
+ header: "Continue?"
331
+ options:
332
+ - label: "Yes" description: "Proceed to plan Phase {N+1}"
333
+ - label: "No" description: "Stay on Phase {N} for now"
334
+ - If "Yes": suggest `/pbr:plan {N+1}`
335
+ - If "No" or "Other": stop
336
+
337
+ 5. **If `features.auto_advance` is `true` AND `mode` is `autonomous` AND more phases remain:**
338
+ - Chain directly to plan next phase
339
+ - This continues the build->review->plan cycle automatically
340
+ - **If this is the last phase:** HARD STOP — do NOT auto-advance past milestone boundaries
341
+
342
+ #### Gaps Found WITH `--auto-fix`
343
+
344
+ If gaps were found and `--auto-fix` was specified:
345
+
346
+ **Step 6a: Diagnose**
347
+
348
+ Display to the user: `Spawning debugger...`
349
+
350
+ Invoke the `@debugger` agent to analyze each failure.
351
+
352
+ ##### Debugger Prompt Template
353
+
354
+ Read `skills/review/templates/debugger-prompt.md.tmpl` and use its content as the debugger prompt.
355
+
356
+ **Placeholders to fill before sending:**
357
+ - `[Inline the VERIFICATION.md content]` — provide file path; debugger reads via Read tool
358
+ - `[Inline all SUMMARY.md files for the phase]` — provide manifest table of file paths
359
+ - `[Inline all PLAN.md files for the phase]` — provide manifest table of file paths
360
+
361
+ **Step 6b: Create Gap-Closure Plans**
362
+
363
+ After receiving the root cause analysis, display to the user: `Spawning planner (gap closure)...`
364
+
365
+ Invoke the `@planner` agent in gap-closure mode.
366
+
367
+ ##### Gap Planner Prompt Template
368
+
369
+ Read `skills/review/templates/gap-planner-prompt.md.tmpl` and use its content as the gap planner prompt.
370
+
371
+ **Placeholders to fill before sending:**
372
+ - `[Inline VERIFICATION.md]` — provide file path; planner reads via Read tool
373
+ - `[Inline the debugger's root cause analysis]` — keep inline (already in conversation context)
374
+ - `[Inline all existing PLAN.md files for this phase]` — provide manifest table of file paths
375
+ - `[Inline CONTEXT.md if it exists]` — provide file path; planner reads via Read tool
376
+ - `{NN}-{slug}` — the phase directory name
377
+
378
+ **Step 6c: Validate gap-closure plans (conditional)**
379
+
380
+ If `features.plan_checking` is true in config:
381
+ - Display to the user: `Spawning plan checker...`
382
+ - Invoke `@plan-checker` on the new gap-closure plans
383
+ - Same process as `/pbr:plan` Step 6
384
+
385
+ **Step 6d: Present gap-closure plans to user**
386
+
387
+ ```
388
+ Auto-fix analysis complete.
389
+
390
+ Gaps found: {count}
391
+ Root causes identified: {count}
392
+ Gap-closure plans created: {count}
393
+
394
+ Plans:
395
+ {plan_id}: {name} — fixes: {gap description} ({difficulty})
396
+ {plan_id}: {name} — fixes: {gap description} ({difficulty})
397
+
398
+ Use the approve-revise-abort pattern from `skills/shared/gate-prompts.md`:
399
+ question: "Approve these {count} gap-closure plans?"
400
+ header: "Approve?"
401
+ options:
402
+ - label: "Approve" description: "Proceed — I'll suggest the build command"
403
+ - label: "Review first" description: "Let me review the plans before approving"
404
+ - label: "Fix manually" description: "I'll fix these gaps myself"
405
+
406
+ - If "Approve": suggest `/pbr:build {N} --gaps-only`
407
+ - If "Review first" or "Other": present the full plan files for inspection
408
+ - If "Fix manually": suggest relevant files to inspect based on gap details
409
+
410
+ #### Gaps Found WITHOUT `--auto-fix`
411
+
412
+ If gaps were found and `--auto-fix` was NOT specified:
413
+
414
+ 1. List all gaps clearly
415
+ 2. **Default to auto-fix** — offer it as the recommended action, not a hidden flag
416
+
417
+ ```
418
+ Phase {N}: {name} — Gaps Found
419
+
420
+ {count} verification gaps need attention:
421
+
422
+ 1. {gap description}
423
+ Layer failed: {existence | substantiveness | wiring}
424
+ Details: {what's wrong}
425
+
426
+ 2. {gap description}
427
+ ...
428
+
429
+ Use the multi-option-gaps pattern from `skills/shared/gate-prompts.md`:
430
+ question: "{count} verification gaps need attention. How should we proceed?"
431
+ header: "Gaps"
432
+ options:
433
+ - label: "Auto-fix" description: "Diagnose root causes and create fix plans (recommended)"
434
+ - label: "Override" description: "Accept specific gaps as false positives"
435
+ - label: "Manual" description: "I'll fix these myself"
436
+ - label: "Skip" description: "Save results for later"
437
+
438
+ **If user selects "Auto-fix":** proceed with the same Steps 6a-6d as the `--auto-fix` flow above (diagnose, create gap-closure plans, validate, present). This is the default path.
439
+
440
+ **If user selects "Override":** present each gap and ask which ones to accept. For each accepted gap, collect a reason. Add to VERIFICATION.md frontmatter `overrides` list:
441
+ ```yaml
442
+ overrides:
443
+ - must_have: "{text}"
444
+ reason: "{user's reason}"
445
+ accepted_by: "user"
446
+ accepted_at: "{ISO date}"
447
+ ```
448
+ After adding overrides, re-evaluate: if all remaining gaps are now overridden, mark status as `passed`. Otherwise, offer auto-fix for the remaining non-overridden gaps.
449
+
450
+ **If user selects "Manual":** suggest relevant files to inspect based on the gap details.
451
+
452
+ **If user selects "Skip":** save results and exit.
453
+
454
+ ---
455
+
456
+ ## UAT Result Recording
457
+
458
+ After conversational UAT, append UAT results to VERIFICATION.md:
459
+
460
+ ```markdown
461
+ ## User Acceptance Testing
462
+
463
+ | # | Item | Automated | UAT | Final Status |
464
+ |---|------|-----------|-----|-------------|
465
+ | 1 | {must-have} | PASS | PASS | VERIFIED |
466
+ | 2 | {must-have} | PASS | FAIL | GAP |
467
+ | 3 | {must-have} | GAP | — | GAP |
468
+ | 4 | {must-have} | PASS | SKIP | UNVERIFIED |
469
+
470
+ UAT conducted: {date}
471
+ Items verified: {count}
472
+ Items passed: {count}
473
+ Items failed: {count}
474
+ Items skipped: {count}
475
+ ```
476
+
477
+ ---
478
+
479
+ ## Integration Verification (optional)
480
+
481
+ If `features.integration_verification: true` AND this phase depends on prior phases:
482
+
483
+ After Step 3, also check cross-phase integration:
484
+ - Read SUMMARY.md `provides` and `requires` from this phase and dependent phases
485
+ - Verify that exports from prior phases are used in this phase's code
486
+ - Verify that this phase's outputs are compatible with future phase expectations
487
+ - Include integration findings in Step 4 presentation
488
+
489
+ ---
490
+
491
+ ## Error Handling
492
+
493
+ ### Verifier agent fails
494
+ If the verifier agent fails, display:
495
+ ```
496
+ ERROR
497
+
498
+ Automated verification failed.
499
+
500
+ **To fix:** We'll do a manual walkthrough instead.
501
+ ```
502
+ Fall back to manual UAT only (skip automated checks).
503
+
504
+ ### No must-haves to check
505
+ If plans have empty must_haves:
506
+ - Warn user: "Plans don't have defined must-haves. UAT will be based on plan descriptions only."
507
+ - Use SUMMARY.md content as the basis for UAT
508
+
509
+ ### User can't verify something
510
+ If user can't verify an item (e.g., needs server running, needs credentials):
511
+ - Mark as SKIP
512
+ - Record what's needed
513
+ - Suggest how to verify later
514
+
515
+ ### Debugger fails during auto-fix
516
+ If the debugger agent fails, display:
517
+ ```
518
+ ERROR
519
+
520
+ Auto-diagnosis failed.
521
+
522
+ **To fix:** Create gap-closure plans based on the verification report alone.
523
+ ```
524
+ Ask user: "Would you like to proceed with gap-closure plans without root cause analysis?"
525
+
526
+ ---
527
+
528
+ ## Files Created/Modified by /pbr:review
529
+
530
+ | File | Purpose | When |
531
+ |------|---------|------|
532
+ | `.planning/phases/{NN}-{slug}/VERIFICATION.md` | Verification report | Step 3 (created or updated with UAT) |
533
+ | `.planning/phases/{NN}-{slug}/*-PLAN.md` | Gap-closure plans | Step 6b (--auto-fix only) |
534
+ | `.planning/ROADMAP.md` | Status -> `verified` + Completed date | Step 6 |
535
+ | `.planning/STATE.md` | Updated with review status | Step 6 |
536
+
537
+ ---
538
+
539
+ ## Completion
540
+
541
+ After review completes, always present a clear next action:
542
+
543
+ **If verified (not final phase):**
544
+
545
+ Display the "Phase Complete" banner inline:
546
+ ```
547
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
548
+ PLAN-BUILD-RUN ► PHASE {N} COMPLETE
549
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
550
+
551
+ **Phase {N}: {Name}**
552
+
553
+ {X} plans executed
554
+ Goal verified
555
+ ```
556
+
557
+ Then the branded "Next Up" block:
558
+ ```
559
+ ---
560
+
561
+ ## Next Up
562
+
563
+ **Phase {N+1}: {Name}** — {Goal from ROADMAP.md}
564
+
565
+ `/pbr:plan {N+1}`
566
+
567
+ `/clear` first for a fresh context window
568
+
569
+ ---
570
+
571
+ **Also available:**
572
+ - `/pbr:discuss {N+1}` — talk through details before planning
573
+ - `/pbr:status` — see full project status
574
+
575
+ ---
576
+ ```
577
+
578
+ **If gaps remain:**
579
+ ```
580
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
581
+ PLAN-BUILD-RUN ► PHASE {N} GAPS FOUND
582
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
583
+
584
+ **Phase {N}: {name}** — {count} gaps remaining
585
+
586
+ ---
587
+
588
+ ## Next Up
589
+
590
+ **Fix gaps** — diagnose and create fix plans
591
+
592
+ `/pbr:review {N} --auto-fix`
593
+
594
+ `/clear` first for a fresh context window
595
+
596
+ ---
597
+
598
+ **Also available:**
599
+ - `/pbr:plan {N} --gaps` — create fix plans manually
600
+ - Fix manually, then `/pbr:review {N}`
601
+
602
+ ---
603
+ ```
604
+
605
+ **If final phase:**
606
+
607
+ Display the "Milestone Complete" banner inline:
608
+ ```
609
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
610
+ PLAN-BUILD-RUN ► MILESTONE COMPLETE
611
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
612
+
613
+ {N} phases completed
614
+ All phase goals verified
615
+ ```
616
+
617
+ Then:
618
+ ```
619
+ ---
620
+
621
+ ## Next Up
622
+
623
+ **Audit milestone** — verify cross-phase integration
624
+
625
+ `/pbr:milestone audit`
626
+
627
+ `/clear` first for a fresh context window
628
+
629
+ ---
630
+
631
+ **Also available:**
632
+ - `/pbr:milestone complete` — archive this milestone and tag it
633
+ - `/pbr:milestone new` — start planning next features
634
+ - `/pbr:status` — see final project status
635
+
636
+ ---
637
+ ```
638
+
639
+ ---
640
+
641
+ ## Notes
642
+
643
+ For user-friendly interpretation of verification results, see `references/reading-verification.md`.
644
+
645
+ - The verifier agent has NO Write/Edit tools for project source code — it can only read, check, and write VERIFICATION.md
646
+ - Re-running `/pbr:review` after gap closure triggers fresh verification
647
+ - UAT results are conversational — user responses are captured inline
648
+ - VERIFICATION.md is persistent and serves as the ground truth for gap closure
649
+ - The three-layer check (existence -> substantiveness -> wiring) catches progressively deeper issues