@zigrivers/scaffold 3.10.1 → 3.12.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.
@@ -208,17 +208,27 @@ Severity:
208
208
  Return ONLY valid JSON. No markdown, no explanation outside the JSON object.
209
209
  ```
210
210
 
211
+ **Foreground only:** Always run Codex and Gemini CLI commands as foreground Bash calls. Never use `run_in_background`, `&`, or `nohup`. Background execution produces empty output.
212
+
211
213
  #### Channel 1: Codex CLI
212
214
 
213
- **Auth check first** (tokens expire — always re-verify):
215
+ **Installation check first:**
216
+
217
+ ```bash
218
+ command -v codex >/dev/null 2>&1 || echo "Codex not installed"
219
+ ```
220
+
221
+ If not installed: queue a compensating pass (implementation correctness, security, API contracts, labeled `[compensating: Codex-equivalent]`). Skip to Channel 2.
222
+
223
+ **Auth check** (tokens expire — always re-verify):
214
224
 
215
225
  ```bash
216
226
  codex login status 2>/dev/null && echo "codex authenticated" || echo "codex NOT authenticated"
217
227
  ```
218
228
 
219
- If not authenticated: tell the user "Codex auth expired. Run: `! codex login`".
220
- Do NOT silently skip. Retry after user re-authenticates.
221
- If Codex is not installed: skip this channel and note it in the report.
229
+ If not authenticated: tell the user "Codex auth expired. Run: `! codex login`". Do NOT silently skip. Wait for re-auth and retry once. If auth cannot be recovered (auth_timeout or user declines): queue a compensating pass (implementation correctness, security, API contracts, labeled `[compensating: Codex-equivalent]`).
230
+
231
+ If Codex fails during execution (non-zero exit, malformed output, timeout): queue a compensating pass with the same focus and label.
222
232
 
223
233
  **Run the review:**
224
234
 
@@ -230,15 +240,23 @@ Store the JSON output as `CODEX_PHASE1_FINDINGS`.
230
240
 
231
241
  #### Channel 2: Gemini CLI
232
242
 
233
- **Auth check first:**
243
+ **Installation check first:**
244
+
245
+ ```bash
246
+ command -v gemini >/dev/null 2>&1 || echo "Gemini not installed"
247
+ ```
248
+
249
+ If not installed: queue a compensating pass (architectural patterns, design reasoning, broad context, labeled `[compensating: Gemini-equivalent]`). Skip to Channel 3.
250
+
251
+ **Auth check:**
234
252
 
235
253
  ```bash
236
254
  NO_BROWSER=true gemini -p "respond with ok" -o json 2>&1
237
255
  ```
238
256
 
239
- If exit code is 41: tell the user "Gemini auth expired. Run: `! gemini -p \"hello\"`".
240
- Do NOT silently skip.
241
- If Gemini is not installed: skip this channel and note it in the report.
257
+ If exit code is 41: tell the user "Gemini auth expired. Run: `! gemini -p \"hello\"`". Do NOT silently skip. Wait for re-auth and retry once. If auth cannot be recovered (auth_timeout or user declines): queue a compensating pass (architectural patterns, design reasoning, broad context, labeled `[compensating: Gemini-equivalent]`).
258
+
259
+ If Gemini fails during execution (non-zero exit, malformed output, timeout): queue a compensating pass with the same focus and label.
242
260
 
243
261
  **Run the review (independent — do NOT include Codex output in this prompt):**
244
262
 
@@ -248,6 +266,8 @@ NO_BROWSER=true gemini -p "[PHASE 1 REVIEW PROMPT]" --output-format json --appro
248
266
 
249
267
  Store as `GEMINI_PHASE1_FINDINGS`.
250
268
 
269
+ **After all Phase 1 channels:** Run any queued compensating passes. Record which channels were real, compensating, or skipped. This availability map is used for Phase 2.
270
+
251
271
  #### Channel 3: Superpowers Code-Reviewer
252
272
 
253
273
  Dispatch the `superpowers:code-reviewer` subagent. This channel always runs.
@@ -349,13 +369,21 @@ Acceptance Criteria:
349
369
  Run all three review channels. Each runs independently — do NOT share one channel's
350
370
  output with another.
351
371
 
372
+ **Foreground only:** Always run Codex and Gemini CLI commands as foreground Bash calls. Never use `run_in_background`, `&`, or `nohup`. Background execution produces empty output.
373
+
374
+ **Session-scoped channel availability:** Phase 1 has already probed channel installation and auth. Pass the Phase 1 channel availability results to each Phase 2 subagent. Subagents do NOT re-probe — if Codex was `auth failed` in Phase 1, every Phase 2 subagent treats Codex as unavailable and runs a compensating pass immediately.
375
+
376
+ Phase 2 compensating passes adapt the focus to story context:
377
+ - Missing Codex → focus compensating pass on implementation correctness and edge cases for this story's acceptance criteria.
378
+ - Missing Gemini → focus compensating pass on design coherence and architectural alignment for this story.
379
+
352
380
  Channel 1 — Codex CLI:
353
- Auth: codex login status 2>/dev/null
354
381
  Run: codex exec --skip-git-repo-check -s read-only --ephemeral "[PER-STORY PROMPT]" 2>/dev/null
382
+ (Only if Codex was available in Phase 1. Otherwise run compensating pass immediately.)
355
383
 
356
384
  Channel 2 — Gemini CLI (independent):
357
- Auth: NO_BROWSER=true gemini -p "respond with ok" -o json 2>&1 (exit 41 = auth failure)
358
385
  Run: NO_BROWSER=true gemini -p "[PER-STORY PROMPT]" --output-format json --approval-mode yolo 2>/dev/null
386
+ (Only if Gemini was available in Phase 1. Otherwise run compensating pass immediately.)
359
387
 
360
388
  Channel 3 — Superpowers code-reviewer:
361
389
  Dispatch superpowers:code-reviewer with:
@@ -409,9 +437,14 @@ The per-story review prompt for Codex and Gemini:
409
437
 
410
438
  Normalize the Superpowers code-reviewer findings to the same JSON shape as
411
439
  Codex/Gemini (severity, acceptance_criterion, file, line, description, suggestion)
412
- before returning. Then return all three channels' findings:
440
+ before returning. Then return all three channels' findings plus channel status:
413
441
  {
414
442
  "story": "[STORY_TITLE]",
443
+ "channel_status": {
444
+ "codex": { "root_cause": "null|not_installed|auth_failed|auth_timeout|failed", "coverage_status": "full|compensating" },
445
+ "gemini": { "root_cause": "null|not_installed|auth_failed|auth_timeout|failed", "coverage_status": "full|compensating" },
446
+ "superpowers": { "root_cause": null, "coverage_status": "full" }
447
+ },
415
448
  "codex": { "findings": [...] },
416
449
  "gemini": { "findings": [...] },
417
450
  "superpowers": { "findings": [...] }
@@ -448,7 +481,9 @@ Create `docs/reviews/` if it does not exist. Write the following to
448
481
 
449
482
  - **Date:** [YYYY-MM-DD]
450
483
  - **Mode:** [Review + Fix | Report Only | Update Mode | Re-review]
451
- - **Channels:** Codex [completed | skipped reason] | Gemini [completed | skipped — reason] | Superpowers [completed]
484
+ - **Coverage:** [full-coverage / degraded-coverage / partial-coverage]
485
+ - **Channels (Phase 1):** Codex [completed | compensating | skipped — reason] | Gemini [completed | compensating | skipped — reason] | Superpowers [completed]
486
+ - **Channels (Phase 2):** [N] stories reviewed, [N] with full channels, [N] with compensating passes
452
487
  - **Findings:** P0: [N] | P1: [N] | P2: [N] | P3: [N]
453
488
  - **Fixed:** [N findings fixed | N/A — report-only]
454
489
 
@@ -602,7 +637,9 @@ Output the completion summary:
602
637
  ```
603
638
  Post-implementation review complete.
604
639
 
605
- Channels: Codex [status] | Gemini [status] | Superpowers [completed]
640
+ Coverage: [full-coverage / degraded-coverage / partial-coverage]
641
+ Channels (Phase 1): Codex [completed|compensating|skipped — reason] | Gemini [completed|compensating|skipped — reason] | Superpowers [completed]
642
+ Channels (Phase 2): [N] stories reviewed, [N] with full channels, [N] with compensating passes
606
643
  Findings: P0: [N] | P1: [N] | P2: [N] | P3: [N]
607
644
  Fixed: [N] | Remaining: [N]
608
645
 
@@ -616,23 +653,29 @@ the user they require manual attention before the project is ready to release.
616
653
 
617
654
  | Situation | Action |
618
655
  |-----------|--------|
619
- | Codex not installed | Skip Codex in all phases; document as "not installed" in report |
620
- | Gemini not installed | Skip Gemini in all phases; document as "not installed" in report |
621
- | Codex auth expired | Tell user: "Codex auth expired. Run: `! codex login`". Do NOT silently skip. Retry after re-auth. |
622
- | Gemini auth expired (exit 41) | Tell user: "Gemini auth expired. Run: `! gemini -p \"hello\"`". Do NOT silently skip. |
623
- | Neither CLI installed | Run Superpowers code-reviewer only; warn user that review coverage is reduced |
656
+ | Codex not installed (`command -v` fails) | Queue compensating pass (implementation correctness, security, API contracts, labeled `[compensating: Codex-equivalent]`); document as "not_installed" in report |
657
+ | Gemini not installed (`command -v` fails) | Queue compensating pass (architectural patterns, design reasoning, broad context, labeled `[compensating: Gemini-equivalent]`); document as "not_installed" in report |
658
+ | Codex auth expired user recovers | Re-run auth check; proceed with full Codex channel |
659
+ | Codex auth expired user declines or auth_timeout | Queue compensating pass (implementation correctness, security, API contracts, labeled `[compensating: Codex-equivalent]`); document as "auth_failed" or "auth_timeout" in report |
660
+ | Gemini auth expired (exit 41) user recovers | Re-run auth check; proceed with full Gemini channel |
661
+ | Gemini auth expired — user declines or auth_timeout | Queue compensating pass (architectural patterns, design reasoning, broad context, labeled `[compensating: Gemini-equivalent]`); document as "auth_failed" or "auth_timeout" in report |
662
+ | Channel fails during execution (non-zero exit, malformed output, timeout) | Queue compensating pass for that channel with same focus and label; document root cause in report |
663
+ | Both external CLIs unavailable (any combination of not_installed / auth failure) | Run all compensating passes plus Superpowers code-reviewer; report coverage as "degraded-coverage"; warn user that review coverage is reduced |
664
+ | Superpowers unavailable | Document as "unavailable" in report; proceed with remaining channels; Superpowers is a Claude subagent and should always be available |
624
665
  | `docs/user-stories.md` missing | Skip Phase 2; run Phase 1 only; warn user that functional review is incomplete |
625
666
  | `docs/coding-standards.md` missing | Proceed without it; note its absence in the report summary |
626
667
 
627
668
  ## Process Rules
628
669
 
629
- 1. **All three channels are mandatory** skip only when a tool is genuinely not installed, never by choice.
630
- 2. **Auth failures are not silent** — always surface to the user with the exact recovery command.
631
- 3. **Independence** — never share one channel's output with another. Each reviews independently.
632
- 4. **Verify every fix** — run tests (or re-read the file) immediately after each fix before moving on.
633
- 5. **3-round limit** — never attempt to fix the same finding more than 3 times. Surface unresolved findings to the user.
634
- 6. **Document everything** — the report must show which channels ran, which were skipped, and why.
635
- 7. **No auto-merge** — this tool modifies local files only. It never pushes, merges, or creates PRs.
670
+ 1. **Foreground only** Always run Codex and Gemini CLI commands as foreground Bash calls. Never use `run_in_background`, `&`, or `nohup`. Background execution produces empty output.
671
+ 2. **All three channels are mandatory** — a channel enters degraded mode (compensating pass) when not installed, auth cannot be recovered, or it fails during execution. Never skip silently by choice.
672
+ 3. **Auth failures are not silent** — always surface to the user with the exact recovery command (`! codex login` or `! gemini -p "hello"`). Wait for user response before queuing a compensating pass.
673
+ 4. **Independence** — never share one channel's output with another. Each reviews independently.
674
+ 5. **Verify every fix** — run tests (or re-read the file) immediately after each fix before moving on.
675
+ 6. **3-round limit** — never attempt to fix the same finding more than 3 times. Surface unresolved findings to the user.
676
+ 7. **Document everything** — the report must show which channels ran, which were compensating, which were skipped, and the root cause for any degraded channel.
677
+ 8. **No auto-merge** — this tool modifies local files only. It never pushes, merges, or creates PRs.
678
+ 9. **Dispatch pattern cross-reference** — Phase 2 parallel dispatch uses `superpowers:dispatching-parallel-agents`. Each story subagent dispatches its own `superpowers:code-reviewer` as Channel 3. This two-level nesting is intentional and supported.
636
679
 
637
680
  ## After This Step
638
681
 
@@ -642,7 +685,9 @@ When the review is complete, tell the user:
642
685
  **Post-implementation review complete.**
643
686
 
644
687
  Results:
645
- - Channels run: [list which ran in Phase 1 and Phase 2]
688
+ - Coverage: [full-coverage / degraded-coverage / partial-coverage]
689
+ - Channels (Phase 1): Codex [completed|compensating|skipped — reason] | Gemini [completed|compensating|skipped — reason] | Superpowers [completed]
690
+ - Channels (Phase 2): [N] stories reviewed, [N] with full channels, [N] with compensating passes
646
691
  - Phase 1 (systemic): [N] findings — [N] fixed, [N] remaining
647
692
  - Phase 2 (functional): [N] findings across [N] stories — [N] fixed, [N] remaining
648
693
  - Report: `docs/reviews/post-implementation-review.md`
@@ -159,6 +159,7 @@ Print the following reference directly. Do not read any files or run any command
159
159
  | **Resume (multi)** | `/scaffold:multi-agent-resume <agent-name>` | Resuming a worktree agent after a break |
160
160
  | **Version Bump** | `/scaffold:version-bump` | Bump version + changelog (no tag/release) |
161
161
  | **Release** | `/scaffold:release` | Project-defined release ceremony with changelog + relevant release artifacts |
162
+ | **Spark** | `/scaffold:spark` | Explore and expand a raw project idea |
162
163
  | **Visual Dashboard** | `/scaffold:dashboard` | HTML pipeline overview in browser |
163
164
 
164
165
  ## Process Rules
@@ -159,6 +159,8 @@ Format the changed-file context like:
159
159
 
160
160
  Each channel reviews independently. Do NOT share one channel's output with another.
161
161
 
162
+ **Foreground only:** Always run Codex and Gemini CLI commands as foreground Bash calls. Never use `run_in_background`, `&`, or `nohup`. Background execution produces empty output. Multiple foreground calls in a single message are fine.
163
+
162
164
  #### Channel 1: Codex CLI
163
165
 
164
166
  Check installation and auth:
@@ -168,8 +170,10 @@ command -v codex >/dev/null 2>&1
168
170
  codex login status 2>/dev/null
169
171
  ```
170
172
 
171
- - If `codex` is not installed: skip this channel and record `skipped (not installed)`
172
- - If auth fails: tell the user to run `! codex login`, retry after recovery, and if recovery is not possible, record `skipped (auth failed)` and continue with the remaining channels
173
+ - If `codex` is not installed: skip this channel and record root-cause `not_installed`
174
+ - If auth fails: tell the user to run `! codex login`, retry after recovery, and if recovery is not possible, record root-cause `auth_failed` and continue with the remaining channels
175
+
176
+ If auth cannot be recovered, or if Codex is not installed, queue a compensating Claude self-review pass focused on implementation correctness, security, and API contracts. Label findings as `[compensating: Codex-equivalent]`. If auth check times out (~5s), retry once; if still failing, record `auth timeout` and queue compensating pass. This pass runs after all channel dispatch attempts complete.
173
177
 
174
178
  Build the prompt in a temporary file and pass it over stdin:
175
179
 
@@ -179,6 +183,8 @@ PROMPT_FILE=$(mktemp)
179
183
  codex exec --skip-git-repo-check -s read-only --ephemeral - < "$PROMPT_FILE" 2>/dev/null
180
184
  ```
181
185
 
186
+ If the CLI exits with a non-zero code, produces malformed/unparseable output, or is killed by the tool runner timeout, record root-cause `failed` and queue a compensating pass for that channel.
187
+
182
188
  #### Channel 2: Gemini CLI
183
189
 
184
190
  Check installation and auth:
@@ -188,8 +194,10 @@ command -v gemini >/dev/null 2>&1
188
194
  NO_BROWSER=true gemini -p "respond with ok" -o json 2>&1
189
195
  ```
190
196
 
191
- - If `gemini` is not installed: skip this channel and record `skipped (not installed)`
192
- - If auth fails (including exit 41): tell the user to run `! gemini -p "hello"`, retry after recovery, and if recovery is not possible, record `skipped (auth failed)` and continue with the remaining channels
197
+ - If `gemini` is not installed: skip this channel and record root-cause `not_installed`
198
+ - If auth fails (including exit 41): tell the user to run `! gemini -p "hello"`, retry after recovery, and if recovery is not possible, record root-cause `auth_failed` and continue with the remaining channels
199
+
200
+ If auth cannot be recovered, or if Gemini is not installed, queue a compensating Claude self-review pass focused on architectural patterns, design reasoning, and broad context. Label findings as `[compensating: Gemini-equivalent]`. If auth check times out (~5s), retry once; if still failing, record `auth timeout` and queue compensating pass. This pass runs after all channel dispatch attempts complete.
193
201
 
194
202
  Build the prompt in a temporary file and pass it as a single prompt string:
195
203
 
@@ -199,6 +207,8 @@ PROMPT_FILE=$(mktemp)
199
207
  NO_BROWSER=true gemini -p "$(cat "$PROMPT_FILE")" --output-format json --approval-mode yolo 2>/dev/null
200
208
  ```
201
209
 
210
+ If the CLI exits with a non-zero code, produces malformed/unparseable output, or is killed by the tool runner timeout, record root-cause `failed` and queue a compensating pass for that channel.
211
+
202
212
  #### Channel 3: Superpowers code-reviewer
203
213
 
204
214
  Dispatch the `superpowers:code-reviewer` subagent.
@@ -213,6 +223,8 @@ Dispatch the `superpowers:code-reviewer` subagent.
213
223
  This channel must review the same local delivery candidate, even when no PR or
214
224
  clean ref range exists.
215
225
 
226
+ **After all channels:** Run any queued compensating passes as foreground Claude self-review passes. Each compensating pass uses the same review prompt as the missing channel, focusing on that channel's strength area.
227
+
216
228
  ### Step 5: Use This Review Prompt
217
229
 
218
230
  All channels should receive an equivalent prompt bundle built from the local review scope:
@@ -270,6 +282,7 @@ Use these rules:
270
282
  | Any single P2 | Fix unless clearly inapplicable; if disputed, surface to user |
271
283
  | All executed channels approve | Candidate passes review |
272
284
  | Strong contradiction on a medium-severity issue | Verdict becomes `needs-user-decision` |
285
+ | Compensating-pass P0/P1/P2 finding | Single-source confidence — fix per normal thresholds, but label as compensating in summary |
273
286
 
274
287
  ### Step 7: Apply Fixes Unless in Report-Only Mode
275
288
 
@@ -284,14 +297,18 @@ Otherwise:
284
297
  3. Repeat for up to 3 fix rounds
285
298
  4. If any finding remains unresolved after 3 rounds, stop with verdict `needs-user-decision`
286
299
 
300
+ **Fix cycle channel rule:** Re-run only channels that originally completed or ran as compensating passes. Never retry a channel marked `not installed`, `auth failed`, or `auth timeout` during fix rounds — its availability does not change within a session.
301
+
287
302
  ### Step 8: Final Verdict
288
303
 
289
304
  Return exactly one verdict:
290
305
 
291
- - `pass` — all available channels ran and no unresolved P0/P1/P2 findings remain
292
- - `degraded-pass` — at least one channel was skipped because the tool is not installed or auth could not be recovered, but all executed channels passed
293
- - `blocked` — reviewer execution failure or unresolved mandatory findings
294
- - `needs-user-decision` — reviewer disagreement or findings still unresolved after 3 fix rounds
306
+ - `pass` — all channels completed with `full` coverage, no unresolved P0/P1/P2
307
+ - `degraded-pass` — at least one channel was skipped/compensated (coverage is not all `full`), but all executed and compensating channels have no unresolved P0/P1/P2
308
+ - `blocked` — unresolved P0/P1/P2 findings remain after 3 fix rounds, OR no reconciled result was possible
309
+ - `needs-user-decision` — reviewer disagreement on a finding, or findings still unresolved after 3 rounds that require human judgment
310
+
311
+ When compensating passes ran for any channel, the maximum achievable verdict is `degraded-pass` — never `pass`, even if all findings are resolved. When both external channels were compensated, the review summary must note: "All findings are single-model (Claude only)."
295
312
 
296
313
  ### Step 9: Report Results
297
314
 
@@ -304,9 +321,9 @@ Output a concise summary in this format:
304
321
  [scope label]
305
322
 
306
323
  ### Channels Executed
307
- - Codex CLI — [completed / skipped (not installed) / skipped (auth failed) / error]
308
- - Gemini CLI — [completed / skipped (not installed) / skipped (auth failed) / error]
309
- - Superpowers code-reviewer — [completed / error]
324
+ - Codex CLI — root cause: [completed / not installed / auth failed / auth timeout / failed], coverage: [full / compensating (Codex-equivalent)]
325
+ - Gemini CLI — root cause: [completed / not installed / auth failed / auth timeout / failed], coverage: [full / compensating (Gemini-equivalent)]
326
+ - Superpowers code-reviewer — [completed / failed]
310
327
 
311
328
  ### Findings
312
329
  [consensus findings first, then single-source findings]
@@ -317,3 +334,12 @@ Output a concise summary in this format:
317
334
 
318
335
  If the verdict is `pass` or `degraded-pass`, explicitly say the code is ready
319
336
  for the next delivery step (commit, push, or PR creation).
337
+
338
+ ## Process Rules
339
+
340
+ 1. **Foreground only** — Always run Codex and Gemini CLI commands as foreground Bash calls. Never use `run_in_background`, `&`, or `nohup`.
341
+ 2. **All 3 channels are mandatory** — skip only when a tool is genuinely not installed, never by choice.
342
+ 3. **Auth failures are not silent** — always surface to the user with recovery instructions.
343
+ 4. **Independence** — never share one channel's output with another.
344
+ 5. **Fix before proceeding** — P0/P1/P2 findings must be resolved before moving to the next task.
345
+ 6. **Dispatch pattern** follows `multi-model-review-dispatch` knowledge entry. When modifying channel dispatch in this file, verify consistency with `review-pr.md` and `post-implementation-review.md`.
@@ -66,18 +66,28 @@ Read these files for review context (skip any that don't exist):
66
66
 
67
67
  Run all three channels. Track which ones complete successfully.
68
68
 
69
+ **Foreground only:** Always run Codex and Gemini CLI commands as foreground Bash calls. Never use `run_in_background`, `&`, or `nohup`. Background execution produces empty output.
70
+
69
71
  #### Channel 1: Codex CLI
70
72
 
73
+ **Installation check:**
74
+ ```bash
75
+ command -v codex >/dev/null 2>&1
76
+ ```
77
+ - If `codex` is not installed: queue a compensating Claude self-review pass focused on implementation correctness, security, and API contracts. Record root-cause `not_installed`. Skip to next channel.
78
+
71
79
  **Auth check first** (auth tokens expire — always re-verify):
72
80
 
73
81
  ```bash
74
82
  codex login status 2>/dev/null && echo "codex authenticated" || echo "codex NOT authenticated"
75
83
  ```
76
84
 
77
- If Codex is not installed, skip this channel and note it in the summary.
78
85
  If auth fails, tell the user: "Codex auth expired. Run: `! codex login`" — do NOT
79
86
  silently fall back. After the user re-authenticates, retry.
80
87
 
88
+ If auth cannot be recovered, queue a compensating pass (same focus as above). Record root-cause `auth_failed`.
89
+ If auth check times out (~5s), retry once. If still failing, record root-cause `auth_timeout` and queue compensating pass.
90
+
81
91
  **Run the review:**
82
92
 
83
93
  ```bash
@@ -90,8 +100,16 @@ The review prompt must include:
90
100
  - Review standards from docs/review-standards.md (if exists)
91
101
  - Instruction to report P0/P1/P2 findings as JSON with severity, location (file:line), description, and suggestion
92
102
 
103
+ If the CLI exits with a non-zero code, produces malformed/unparseable output, or is killed by the tool runner timeout, record root-cause `failed` and queue a compensating pass for that channel.
104
+
93
105
  #### Channel 2: Gemini CLI
94
106
 
107
+ **Installation check:**
108
+ ```bash
109
+ command -v gemini >/dev/null 2>&1
110
+ ```
111
+ - If `gemini` is not installed: queue a compensating Claude self-review pass focused on architectural patterns, design reasoning, and broad context. Record root-cause `not_installed`. Label findings as `[compensating: Gemini-equivalent]`. Skip to next channel.
112
+
95
113
  **Auth check first:**
96
114
 
97
115
  ```bash
@@ -104,9 +122,11 @@ elif [ "$GEMINI_EXIT" -eq 41 ]; then
104
122
  fi
105
123
  ```
106
124
 
107
- If Gemini is not installed, skip this channel and note it in the summary.
108
125
  If auth fails (exit 41), tell the user: "Gemini auth expired. Run: `! gemini -p \"hello\"`" — do NOT silently fall back. After the user re-authenticates, retry.
109
126
 
127
+ If auth cannot be recovered, queue a compensating pass focused on architectural patterns, design reasoning, and broad context. Record root-cause `auth_failed`. Label findings as `[compensating: Gemini-equivalent]`.
128
+ If auth check times out (~5s), retry once. If still failing, record root-cause `auth_timeout` and queue compensating pass labeled `[compensating: Gemini-equivalent]`.
129
+
110
130
  **Run the review:**
111
131
 
112
132
  ```bash
@@ -116,6 +136,8 @@ NO_BROWSER=true gemini -p "REVIEW_PROMPT" --output-format json --approval-mode y
116
136
  Same review prompt content as Codex. Do NOT share one model's output with the other —
117
137
  each reviews independently.
118
138
 
139
+ If the CLI exits with a non-zero code, produces malformed/unparseable output, or is killed by the tool runner timeout, record root-cause `failed` and queue a compensating pass for that channel.
140
+
119
141
  #### Channel 3: Superpowers Code-Reviewer Subagent
120
142
 
121
143
  Dispatch the `superpowers:code-reviewer` subagent. This channel always runs (it uses
@@ -134,6 +156,8 @@ providing:
134
156
  - `HEAD_SHA` — head commit
135
157
  - `DESCRIPTION` — PR summary
136
158
 
159
+ **After all channels:** Run any queued compensating passes as foreground Claude self-review passes. Each uses the same review prompt as the missing channel, focused on that channel's strength area. Label findings as `[compensating: Codex-equivalent]` or `[compensating: Gemini-equivalent]`.
160
+
137
161
  ### Step 4: Reconcile Findings
138
162
 
139
163
  After all channels complete, reconcile findings:
@@ -145,6 +169,7 @@ After all channels complete, reconcile findings:
145
169
  | One channel flags P0, others approve | **High** | Fix it — P0 is critical from any source |
146
170
  | One channel flags P1, others approve | **Medium** | Fix it — P1 findings are mandatory regardless of source count |
147
171
  | Channels contradict each other | **Low** | Present to user for adjudication |
172
+ | Compensating-pass P0/P1/P2 finding | **Single-source** | Fix per normal thresholds, label as compensating |
148
173
 
149
174
  ### Step 5: Report Results
150
175
 
@@ -154,9 +179,9 @@ Output a review summary in this format:
154
179
  ## Code Review Summary — PR #[number]
155
180
 
156
181
  ### Channels Executed
157
- - [ ] Codex CLI — [completed / skipped (not installed) / skipped (auth failed) / error]
158
- - [ ] Gemini CLI — [completed / skipped (not installed) / skipped (auth failed) / error]
159
- - [ ] Superpowers code-reviewer — [completed / error]
182
+ - [ ] Codex CLI — root cause: [completed / not installed / auth failed / auth timeout / failed], coverage: [full / compensating (Codex-equivalent)]
183
+ - [ ] Gemini CLI — root cause: [completed / not installed / auth failed / auth timeout / failed], coverage: [full / compensating (Gemini-equivalent)]
184
+ - [ ] Superpowers code-reviewer — [completed / failed]
160
185
 
161
186
  ### Consensus Findings (High Confidence)
162
187
  [Findings flagged by 2+ channels]
@@ -168,9 +193,22 @@ Output a review summary in this format:
168
193
  [Contradictions between channels]
169
194
 
170
195
  ### Verdict
171
- [All channels approve / Fix required (list P0/P1/P2 items) / User adjudication needed]
196
+ [pass / degraded-pass / blocked / needs-user-decision]
172
197
  ```
173
198
 
199
+ ### Step 5a: Final Verdict
200
+
201
+ Return exactly one verdict:
202
+
203
+ - `pass` — all channels ran, no unresolved P0/P1/P2
204
+ - `degraded-pass` — channels skipped/compensated, no unresolved P0/P1/P2
205
+ - `blocked` — unresolved P0/P1/P2 after 3 fix rounds
206
+ - `needs-user-decision` — contradictions or unresolvable findings
207
+
208
+ Verdict precedence: `needs-user-decision` > `blocked` > `degraded-pass` > `pass`.
209
+
210
+ When compensating passes ran, maximum achievable verdict is `degraded-pass`. When both external channels were compensated, note "All findings are single-model."
211
+
174
212
  ### Step 6: Fix P0/P1/P2 Findings
175
213
 
176
214
  If any P0, P1, or P2 findings exist:
@@ -179,12 +217,14 @@ If any P0, P1, or P2 findings exist:
179
217
  3. Re-run the channels that produced findings to verify fixes
180
218
  4. After 3 fix rounds with unresolved P0/P1/P2 findings, stop and ask the user for direction — do NOT merge automatically. Document remaining findings and let the user decide whether to continue fixing, create follow-up issues, or override.
181
219
 
220
+ **Fix cycle channel rule:** Re-run only channels that originally completed or ran as compensating passes. Never retry a channel marked `not installed`, `auth failed`, or `auth timeout` during fix rounds — its availability does not change within a session.
221
+
182
222
  ### Step 7: Confirm Completion
183
223
 
184
224
  After all findings are resolved (or 3 rounds complete), output:
185
225
 
186
226
  ```
187
- Code review complete. All 3 channels executed. PR #[number] is ready for merge.
227
+ Code review complete. Verdict: [pass/degraded-pass]. Channels: [N] executed, [N] compensating. PR #[number] is ready for merge.
188
228
  ```
189
229
 
190
230
  Do NOT proceed to the next task or merge until this confirmation is output.
@@ -193,19 +233,24 @@ Do NOT proceed to the next task or merge until this confirmation is output.
193
233
 
194
234
  | Situation | Action |
195
235
  |-----------|--------|
196
- | Neither Codex nor Gemini installed | Run Superpowers code-reviewer only; document as "single-channel review" |
197
- | One CLI installed, one not | Run available CLI + Superpowers; document missing channel |
198
- | CLI auth expired | Surface to user with recovery command; do NOT silently skip |
199
- | Superpowers plugin not installed | Run both CLIs; warn user to install superpowers plugin |
200
- | All external channels unavailable | Superpowers code-reviewer only; warn user that review coverage is reduced |
236
+ | Channel not installed | Queue compensating pass, report root-cause `not_installed` |
237
+ | Auth expired, user recovers | Retry dispatch |
238
+ | Auth expired, user declines | Queue compensating pass, report root-cause `auth_failed` |
239
+ | Auth check timeout (after retry) | Queue compensating pass, report root-cause `auth_timeout` |
240
+ | Channel fails during execution | Queue compensating pass, report root-cause `failed` |
241
+ | Both external channels unavailable | Two compensating passes, max verdict: `degraded-pass`, note "All findings single-model" |
242
+ | Superpowers unavailable | Run available CLIs, warn user (Superpowers is always-available Claude — no compensating pass) |
201
243
 
202
244
  ## Process Rules
203
245
 
204
- 1. **All three channels are mandatory** skip only when the tool is genuinely unavailable (not installed), never by choice.
205
- 2. **Auth failures are not silent** — always surface to the user with recovery instructions.
206
- 3. **Independence** — never share one channel's output with another. Each reviews the diff independently.
207
- 4. **Fix before proceeding** — P0/P1/P2 findings must be resolved before moving to the next task.
208
- 5. **Document everything** — the review summary must show which channels ran and which were skipped, with reasons.
246
+ 1. **Foreground only** Always run Codex and Gemini CLI commands as foreground Bash calls. Never use `run_in_background`, `&`, or `nohup`.
247
+ 2. **All three channels are mandatory** — skip only when a tool is genuinely not installed, never by choice.
248
+ 3. **Auth failures are not silent** — always surface to the user with the exact recovery command.
249
+ 4. **Independence** — never share one channel's output with another. Each reviews the diff independently.
250
+ 5. **Fix before proceeding** — P0/P1/P2 findings must be resolved before moving to the next task.
251
+ 6. **3-round limit** — never attempt more than 3 fix rounds. Surface unresolved findings to the user.
252
+ 7. **Document everything** — the review summary must show which channels ran and which were skipped, with reasons.
253
+ 8. **Dispatch pattern** follows `multi-model-review-dispatch` knowledge entry. When modifying channel dispatch in this file, verify consistency with `review-code.md` and `post-implementation-review.md`.
209
254
 
210
255
  ---
211
256
 
@@ -214,16 +259,13 @@ Do NOT proceed to the next task or merge until this confirmation is output.
214
259
  When code review is complete, tell the user:
215
260
 
216
261
  ---
217
- **Code review complete** — All channels executed for PR #[number].
262
+ **Code review complete** — Verdict: [pass/degraded-pass]. All channels executed for PR #[number].
218
263
 
219
264
  **Results:**
220
- - Channels run: [list which of the 3 ran]
265
+ - Channels run: [list which of the 3 ran, noting any compensating]
221
266
  - Findings fixed: [count]
222
267
  - Remaining: [none / list]
223
268
 
224
- **Next:** Return to the task execution loop — mark the task complete and pick up
225
- the next unblocked task with `/scaffold:single-agent-start`.
226
-
227
- **Pipeline reference:** `/scaffold:prompt-pipeline`
269
+ **Next:** Return to the task execution loop.
228
270
 
229
271
  ---