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