@zigrivers/scaffold 3.23.0 → 3.24.1

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.
package/README.md CHANGED
@@ -38,7 +38,7 @@ Either way, Scaffold constructs the prompt and the target AI tool does the work.
38
38
 
39
39
  **Depth scale** (1-5) — Controls how thorough each step's output is, from "focus on the core deliverable" (1) to "explore all angles, tradeoffs, and edge cases" (5). Depth resolves with 4-level precedence: CLI flag > step override > custom default > preset default.
40
40
 
41
- **Multi-model validation** — At depth 4-5, all 19 review and validation steps can dispatch independent reviews to Codex and/or Gemini CLIs. Two independent models catch more blind spots than one. When both CLIs are available, findings are reconciled by confidence level (both agree = high confidence, single model P0 = still actionable). When a channel is unavailable, a compensating Claude self-review pass runs in its place (labeled `[compensating: Codex-equivalent]` or `[compensating: Gemini-equivalent]`, single-source confidence). CLI commands must always run in the foreground — background execution produces empty output. See the [Multi-Model Review](#multi-model-review) section.
41
+ **Multi-model validation** — At depth 4-5, review and validation steps can dispatch independent reviews to the three MMR CLI channels (Codex, Gemini, Claude) via the `mmr` CLI, plus the Superpowers code-reviewer agent as a complementary 4th channel on wrapper invocations (`scaffold run review-pr`, `scaffold run review-code`). The MMR-backed wrappers are the preferred path; some older depth-5 validation steps still dispatch Codex/Gemini directly via the `multi-model-dispatch` skill (migration in progress). Multiple independent models catch more blind spots than one. Findings are reconciled by confidence level (multiple channels agree = high confidence, single channel P0 = still actionable). When Codex or Gemini is unavailable, a compensating Claude self-review pass runs in its place (labeled `[compensating: Codex-equivalent]` or `[compensating: Gemini-equivalent]`, single-source confidence); there is no compensating pass when Claude itself is unavailable — the review simply proceeds with the remaining channels. CLI commands must always run in the foreground — background execution produces empty output. `mmr review` also supports non-PR targets (staged changes, branch diff, specific files) — see the [Multi-Model Review](#multi-model-review) section.
42
42
 
43
43
  **State management** — Pipeline progress is tracked in `.scaffold/state.json` with atomic file writes and crash recovery. An advisory lock prevents concurrent runs. Decisions are logged to an append-only `decisions.jsonl`. Pressing Ctrl+C during any command exits cleanly with an informative message — no stack traces, no orphaned locks, no corrupted state.
44
44
 
@@ -826,7 +826,7 @@ Claude sets up your local dev environment with one-command startup and live relo
826
826
  | `dev-env-setup` | Claude configures your project so `make dev` (or equivalent) starts everything — dev server with live reload, local database, environment variables — and documents the setup in a getting-started guide. |
827
827
  | `design-system` | Claude creates a visual language — color palette (WCAG-compliant), typography scale, spacing system, component patterns — and generates working theme config files for your frontend framework. *(web apps only)* |
828
828
  | `git-workflow` | Claude sets up your branching strategy, commit message format, PR workflow, CI pipeline with lint and test jobs, and worktree scripts so multiple AI agents can work in parallel without conflicts. |
829
- | `automated-pr-review` | Claude configures automated code review — using Codex and/or Gemini CLIs for dual-model review when available, or an external bot with severity definitions and review criteria tailored to your project. *(optional)* |
829
+ | `automated-pr-review` | Claude configures automated code review — three-CLI MMR dispatch (Codex, Gemini, Claude) plus Superpowers code-reviewer as a complementary 4th channel via the scaffold wrappers, with severity definitions and review criteria tailored to your project. Covers PRs and non-PR targets (local code, diffs, files). *(optional)* |
830
830
  | `ai-memory-setup` | Claude extracts conventions from your docs into path-scoped rule files that load automatically, optimizes CLAUDE.md with a pointer pattern, and optionally sets up persistent cross-session memory. |
831
831
 
832
832
  ### Phase 4 — Testing Integration (integration)
@@ -1214,7 +1214,9 @@ channels:
1214
1214
  command: claude -p
1215
1215
  auth:
1216
1216
  check: "claude -p 'respond with ok' 2>/dev/null"
1217
- timeout: 5
1217
+ # Claude's auth probe is a full LLM round-trip (not a local status
1218
+ # check) and routinely takes 9-14s, so 20s is the realistic default.
1219
+ timeout: 20
1218
1220
  failure_exit_codes: [1]
1219
1221
  recovery: "Run: claude login"
1220
1222
 
@@ -1228,7 +1230,10 @@ channels:
1228
1230
  NO_BROWSER: "true"
1229
1231
  auth:
1230
1232
  check: "NO_BROWSER=true gemini -p 'respond with ok' -o json 2>&1"
1231
- timeout: 5
1233
+ # Gemini's auth probe is also a full LLM round-trip; same reasoning
1234
+ # as Claude. Codex stays at the 5s default (see below) because its
1235
+ # check is a local file probe.
1236
+ timeout: 20
1232
1237
  failure_exit_codes: [41]
1233
1238
  recovery: "Run: gemini -p 'hello' (interactive, opens browser)"
1234
1239
  timeout: 360 # Gemini tends to be slower
@@ -1285,11 +1290,12 @@ When multiple channels return findings, mmr applies consensus rules:
1285
1290
 
1286
1291
  | Scenario | Confidence | Action |
1287
1292
  |----------|-----------|--------|
1288
- | Both models flag the same issue | **High** | Fix immediately |
1289
- | Both models approve | **High** | Proceed confidently |
1290
- | One flags P0, other approves | **High** | Fix it (P0 is critical) |
1291
- | One flags P1, other approves | **Medium** | Review before fixing |
1292
- | Models contradict each other | **Low** | Present both to user |
1293
+ | 2+ channels flag the same issue | **High** | Fix immediately |
1294
+ | All channels approve | **High** | Proceed confidently |
1295
+ | One channel flags P0, others approve | **High** | Fix it (P0 is critical) |
1296
+ | One channel flags P1, others approve | **Medium** | Review before fixing |
1297
+ | Channels contradict each other | **Low** | Present all perspectives to user |
1298
+ | Compensating-pass P0/P1/P2 finding | **Single-source** | Fix per normal thresholds, label as compensating |
1293
1299
 
1294
1300
  Scaffold verifies CLI authentication before every dispatch. If a token has expired, it tells you and provides the command to re-authenticate — it never silently skips a review.
1295
1301
 
@@ -1302,15 +1308,15 @@ At depth 1-3, reviews are Claude-only — still thorough with multiple passes, b
1302
1308
  ### What You Need
1303
1309
 
1304
1310
  - **Depth 4 or 5** — set during `scaffold init` or override per step
1305
- - **At least one additional CLI** — Codex or Gemini (or both for triple-model review)
1306
- - **Valid authentication** — Scaffold checks before every dispatch and tells you if credentials need refreshing
1311
+ - **At least one additional CLI** — Codex, Gemini, and/or Claude CLI. All three dispatched independently as MMR channels when available. Missing Codex or Gemini channels fall back to compensating Claude passes (labeled `[compensating: Codex-equivalent]` / `[compensating: Gemini-equivalent]`, single-source confidence); if Claude itself is unavailable, the review proceeds with the remaining channels — MMR does not compensate for a missing Claude channel.
1312
+ - **Valid authentication** — Scaffold checks before every dispatch (run `mmr config test` to pre-flight all three at once) and tells you if credentials need refreshing
1307
1313
 
1308
1314
  ## Methodology Presets
1309
1315
 
1310
1316
  Not every project needs all 60 steps. Choose a methodology when you run `scaffold init`:
1311
1317
 
1312
1318
  ### deep (depth 5)
1313
- All steps enabled. Comprehensive analysis of every angle — domain modeling, ADRs, security review, traceability matrix, the works. At depth 4-5, review steps dispatch to Codex/Gemini CLIs for multi-model validation. Best for complex systems, team projects, or when you want thorough documentation.
1319
+ All steps enabled. Comprehensive analysis of every angle — domain modeling, ADRs, security review, traceability matrix, the works. At depth 4-5, review steps dispatch to the three MMR CLI channels (Codex, Gemini, Claude) for multi-model validation, with the Superpowers code-reviewer agent added as a complementary 4th channel via the scaffold wrappers. Best for complex systems, team projects, or when you want thorough documentation.
1314
1320
 
1315
1321
  ### mvp (depth 1)
1316
1322
  Only 7 critical steps: create-prd, review-prd, user-stories, review-user-stories, tdd, implementation-plan, and implementation-playbook. Minimal ceremony — get to code fast. Best for prototypes, hackathons, or solo projects.
@@ -1372,7 +1378,8 @@ scaffold check add-e2e-testing
1372
1378
  # → Applicable: yes | Platform: web | Brownfield: no | Mode: fresh
1373
1379
 
1374
1380
  scaffold check automated-pr-review
1375
- # → Applicable: yes | GitHub remote: yes | Available CLIs: codex, gemini | Recommended: local-cli (dual-model)
1381
+ # → Applicable: yes | GitHub remote: yes | Available CLIs: codex, gemini, claude | Recommended: local-cli (three-CLI MMR review)
1382
+ # (suffix is `(three-CLI MMR review)` / `(two-CLI MMR review)` / `(single-CLI review)` based on how many of codex/gemini/claude are detected)
1376
1383
 
1377
1384
  scaffold check ai-memory-setup
1378
1385
  # → Rules: no | MCP server: none | Hooks: none | Mode: fresh
@@ -1452,9 +1459,9 @@ These are orthogonal to the pipeline — usable at any time, not tied to pipelin
1452
1459
  | `scaffold run update` | Update Scaffold to the latest version. |
1453
1460
  | `scaffold run dashboard` | Open a visual progress dashboard in your browser. |
1454
1461
  | `scaffold run prompt-pipeline` | Print the full pipeline reference table. |
1455
- | `scaffold run review-code` | Run all 3 code review channels on local code before commit or push. |
1456
- | `scaffold run review-pr` | Run all 3 code review channels (Codex CLI, Gemini CLI, Superpowers) on a PR. |
1457
- | `scaffold run post-implementation-review` | Full 3-channel codebase review after an AI agent completes all tasks — checks requirements coverage, security, architecture alignment, and more. |
1462
+ | `scaffold run review-code` | Run all 3 MMR CLI review channels (Codex CLI, Gemini CLI, Claude CLI) on tracked local code (committed branch diff + staged + unstaged — no untracked files) before commit or push, plus Superpowers code-reviewer as a complementary 4th channel. |
1463
+ | `scaffold run review-pr` | Run all 3 MMR CLI review channels (Codex CLI, Gemini CLI, Claude CLI) on a PR, plus Superpowers code-reviewer as a complementary 4th channel. Also usable on non-PR targets (staged changes, branch diff, specific files) via `mmr review` directly. |
1464
+ | `scaffold run post-implementation-review` | Full codebase review (Codex CLI + Gemini CLI + Superpowers code-reviewer — note: does not currently include Claude CLI as a standard channel) after an AI agent completes all tasks — checks requirements coverage, security, architecture alignment, and more. |
1458
1465
  | `scaffold run spark` | Explore and expand a raw project idea through Socratic questioning, competitive research, and innovation expansion. Produces a `docs/spark-brief.md` that feeds into `create-vision`. At depth 4+, dispatches to external models for independent research and adversarial red-teaming. |
1459
1466
  | `scaffold run session-analyzer` | Analyze Claude Code session logs for patterns and insights. |
1460
1467
 
@@ -1,12 +1,12 @@
1
1
  ---
2
2
  name: automated-review-tooling
3
- description: Patterns for automated PR code review using AI CLI tools (Codex, Gemini, Claude) — orchestration, reconciliation, compensating passes, and CI integration
4
- topics: [code-review, automation, codex, gemini, pull-requests, ci-cd, review-tooling]
3
+ description: Patterns for automated code review using AI CLI tools (Codex, Gemini, Claude) — three-CLI MMR orchestration plus Superpowers 4th channel in wrappers, reconciliation, compensating passes, PR + non-PR targets, and CI integration
4
+ topics: [code-review, automation, codex, gemini, claude, pull-requests, non-pr-review, mmr, ci-cd, review-tooling]
5
5
  ---
6
6
 
7
7
  # Automated Review Tooling
8
8
 
9
- Automated PR review leverages AI models to provide consistent, thorough code review without manual reviewer bottlenecks. This knowledge covers the local CLI approach (no GitHub Actions), dual-model review patterns, and integration with the PR workflow.
9
+ Automated code review leverages AI models to provide consistent, thorough code review without manual reviewer bottlenecks. This knowledge covers the local CLI approach (no GitHub Actions), the three-channel MMR orchestration (Codex + Gemini + Claude) with the Superpowers code-reviewer added as a complementary 4th channel by the scaffold MMR wrappers, and integration with both PR and non-PR review targets (local code, branch diffs, specific files).
10
10
 
11
11
  ## Summary
12
12
 
@@ -48,7 +48,7 @@ When an AI agent dispatches CLI reviews via a tool runner (Claude Code Bash tool
48
48
 
49
49
  Before dispatching, verify the model CLI is installed and authenticated using a two-step process that produces distinct statuses for the orchestration layer:
50
50
 
51
- **Step 1 — Installation check:**
51
+ **Step 1 — Installation check** (all three MMR channels):
52
52
 
53
53
  ```bash
54
54
  # Codex: not found -> status: "not_installed"
@@ -56,6 +56,9 @@ command -v codex >/dev/null 2>&1
56
56
 
57
57
  # Gemini: not found -> status: "not_installed"
58
58
  command -v gemini >/dev/null 2>&1
59
+
60
+ # Claude CLI: not found -> status: "not_installed"
61
+ command -v claude >/dev/null 2>&1
59
62
  ```
60
63
 
61
64
  If the CLI is not found, report status `not_installed` to the orchestration layer. Do not prompt the user to install it.
@@ -64,17 +67,23 @@ If the CLI is not found, report status `not_installed` to the orchestration laye
64
67
 
65
68
  ```bash
66
69
  # Codex: fail -> status: "auth_failed"
67
- codex login status 2>/dev/null
70
+ codex login status 2>/dev/null # local file probe
68
71
 
69
72
  # Gemini: exit 41 -> status: "auth_failed"
70
- NO_BROWSER=true gemini -p "respond with ok" -o json 2>&1
73
+ NO_BROWSER=true gemini -p "respond with ok" -o json 2>&1 # full LLM round-trip
74
+
75
+ # Claude CLI: non-zero -> status: "auth_failed"
76
+ claude -p "respond with ok" 2>/dev/null # full LLM round-trip
71
77
  ```
72
78
 
79
+ Prefer `mmr config test` as a single-command pre-flight that runs all three checks and emits structured JSON.
80
+
73
81
  If auth fails, report status `auth_failed` and surface recovery to the user:
74
82
  - Codex: "Codex auth expired — run `! codex login` to re-authenticate"
75
83
  - Gemini: "Gemini auth expired — run `! gemini -p \"hello\"` to re-authenticate"
84
+ - Claude CLI: "Claude CLI auth expired — run `! claude login` to re-authenticate"
76
85
 
77
- If auth check times out (~5 seconds), retry once. If still failing, report `timeout`.
86
+ Auth-check timeouts: Codex's check is a local file probe so the default is 5s; Gemini's and Claude's are full LLM round-trips and routinely take 9-14s, so MMR's built-in defaults use 20s for those two. If a check times out, retry once. If still failing, report `timeout`.
78
87
  If auth succeeds, report `ready` and proceed to dispatch.
79
88
 
80
89
  **Post-dispatch terminal states:**
@@ -177,14 +177,15 @@ Once in-progress work is complete (or if there was none):
177
177
 
178
178
  4. **Run code reviews (MANDATORY)**
179
179
  - Run the review-pr tool: `scaffold run review-pr` (CLI) or `/scaffold:review-pr` (plugin)
180
- - This runs **all three** review channels on the PR diff:
180
+ - This runs the three MMR CLI channels on the PR diff plus the Superpowers code-reviewer agent as a complementary 4th channel reconciled through `mmr reconcile`:
181
181
  1. **Codex CLI**: `codex exec --skip-git-repo-check -s read-only --ephemeral "REVIEW_PROMPT" 2>/dev/null`
182
182
  2. **Gemini CLI**: `NO_BROWSER=true gemini -p "REVIEW_PROMPT" --output-format json --approval-mode yolo 2>/dev/null`
183
- 3. **Superpowers code-reviewer**: dispatch `superpowers:code-reviewer` subagent with BASE_SHA and HEAD_SHA
184
- - Verify auth before each CLI (`codex login status`, `NO_BROWSER=true gemini -p "respond with ok" -o json`)
185
- - All three channels must execute (skip only if a tool is genuinely not installed)
183
+ 3. **Claude CLI**: `claude -p "REVIEW_PROMPT" --output-format json 2>/dev/null`
184
+ 4. **Superpowers code-reviewer** (4th channel): dispatch `superpowers:code-reviewer` subagent with BASE_SHA and HEAD_SHA
185
+ - Verify auth before each CLI (`mmr config test` pre-flights all three at once)
186
+ - All four channels should execute. Missing Codex or Gemini → MMR runs a compensating Claude pass in its place (degraded-pass verdict). Missing Claude CLI → review proceeds without compensation.
186
187
  - Fix any P0/P1/P2 findings before proceeding
187
- - Do NOT move to the next task until all channels have run
188
+ - Do NOT move to the next task until the review completes
188
189
 
189
190
  5. **Between-task cleanup**
190
191
  - `git fetch origin --prune && git clean -fd`
@@ -238,7 +239,7 @@ Once in-progress work is complete (or if there was none):
238
239
  5. **TDD is not optional** — Continue the red-green-refactor cycle for any in-progress work.
239
240
  6. **Quality gates before PR** — Never create a PR with failing checks.
240
241
  7. **Honor pre-push review when requested** — If the user or project workflow asks for pre-push multi-model review, run `scaffold run review-code` after quality gates and before `git push`.
241
- 8. **Code review before next task** — After creating a PR, run all three review channels (Codex CLI, Gemini CLI, Superpowers code-reviewer) and fix all P0/P1/P2 findings before moving on.
242
+ 8. **Code review before next task** — After creating a PR, run `scaffold run review-pr`: three CLI channels (Codex CLI, Gemini CLI, Claude CLI) via MMR plus the Superpowers code-reviewer agent as a complementary 4th channel. Fix all P0/P1/P2 findings before moving on.
242
243
  9. **Follow CLAUDE.md** — It is the authority on project conventions and commands.
243
244
 
244
245
  ---
@@ -181,14 +181,15 @@ For each task:
181
181
 
182
182
  8. **Run code reviews (MANDATORY)**
183
183
  - Run the review-pr tool: `scaffold run review-pr` (CLI) or `/scaffold:review-pr` (plugin)
184
- - This runs **all three** review channels on the PR diff:
184
+ - This runs the three MMR CLI channels on the PR diff plus the Superpowers code-reviewer agent as a complementary 4th channel reconciled through `mmr reconcile`:
185
185
  1. **Codex CLI**: `codex exec --skip-git-repo-check -s read-only --ephemeral "REVIEW_PROMPT" 2>/dev/null`
186
186
  2. **Gemini CLI**: `NO_BROWSER=true gemini -p "REVIEW_PROMPT" --output-format json --approval-mode yolo 2>/dev/null`
187
- 3. **Superpowers code-reviewer**: dispatch `superpowers:code-reviewer` subagent with BASE_SHA and HEAD_SHA
188
- - Verify auth before each CLI (`codex login status`, `NO_BROWSER=true gemini -p "respond with ok" -o json`)
189
- - All three channels must execute (skip only if a tool is genuinely not installed)
187
+ 3. **Claude CLI**: `claude -p "REVIEW_PROMPT" --output-format json 2>/dev/null`
188
+ 4. **Superpowers code-reviewer** (4th channel): dispatch `superpowers:code-reviewer` subagent with BASE_SHA and HEAD_SHA
189
+ - Verify auth before each CLI (`mmr config test` pre-flights all three at once)
190
+ - All four channels should execute. Missing Codex or Gemini → MMR runs a compensating Claude pass in its place (degraded-pass verdict). Missing Claude CLI → review proceeds without compensation.
190
191
  - Fix any P0/P1/P2 findings before proceeding
191
- - Do NOT move to the next task until all channels have run
192
+ - Do NOT move to the next task until the review completes
192
193
 
193
194
  9. **Between-task cleanup**
194
195
  - `git fetch origin --prune && git clean -fd`
@@ -230,7 +231,7 @@ For each task:
230
231
  4. **TDD is not optional** — Write failing tests before implementation. No exceptions.
231
232
  5. **Quality gates before PR** — Never create a PR with failing checks.
232
233
  6. **Honor pre-push review when requested** — If the user or project workflow asks for pre-push multi-model review, run `scaffold run review-code` after quality gates and before `git push`.
233
- 7. **Code review before next task** — After creating a PR, run all three review channels (Codex CLI, Gemini CLI, Superpowers code-reviewer) and fix all P0/P1/P2 findings before moving on.
234
+ 7. **Code review before next task** — After creating a PR, run `scaffold run review-pr`: three CLI channels (Codex CLI, Gemini CLI, Claude CLI) via MMR plus the Superpowers code-reviewer agent as a complementary 4th channel. Fix all P0/P1/P2 findings before moving on.
234
235
  8. **Avoid task conflicts** — Check what other agents are working on before claiming.
235
236
  9. **Follow CLAUDE.md** — It is the authority on project conventions and commands.
236
237
 
@@ -154,14 +154,15 @@ Once in-progress work is complete (or if there was none):
154
154
 
155
155
  4. **Run code reviews (MANDATORY)**
156
156
  - Run the review-pr tool: `scaffold run review-pr` (CLI) or `/scaffold:review-pr` (plugin)
157
- - This runs **all three** review channels on the PR diff:
157
+ - This runs the three MMR CLI channels on the PR diff plus the Superpowers code-reviewer agent as a complementary 4th channel reconciled through `mmr reconcile`:
158
158
  1. **Codex CLI**: `codex exec --skip-git-repo-check -s read-only --ephemeral "REVIEW_PROMPT" 2>/dev/null`
159
159
  2. **Gemini CLI**: `NO_BROWSER=true gemini -p "REVIEW_PROMPT" --output-format json --approval-mode yolo 2>/dev/null`
160
- 3. **Superpowers code-reviewer**: dispatch `superpowers:code-reviewer` subagent with BASE_SHA and HEAD_SHA
161
- - Verify auth before each CLI (`codex login status`, `NO_BROWSER=true gemini -p "respond with ok" -o json`)
162
- - All three channels must execute (skip only if a tool is genuinely not installed)
160
+ 3. **Claude CLI**: `claude -p "REVIEW_PROMPT" --output-format json 2>/dev/null`
161
+ 4. **Superpowers code-reviewer** (4th channel): dispatch `superpowers:code-reviewer` subagent with BASE_SHA and HEAD_SHA
162
+ - Verify auth before each CLI (`mmr config test` pre-flights all three at once)
163
+ - All four channels should execute. Missing Codex or Gemini → MMR runs a compensating Claude pass in its place (degraded-pass verdict). Missing Claude CLI → review proceeds without compensation.
163
164
  - Fix any P0/P1/P2 findings before proceeding
164
- - Do NOT move to the next task until all channels have run
165
+ - Do NOT move to the next task until the review completes
165
166
 
166
167
  5. **Claim next task**
167
168
  - Return to main: `git checkout main && git pull origin main`
@@ -203,7 +204,7 @@ Once in-progress work is complete (or if there was none):
203
204
  4. **TDD is not optional** — Continue the red-green-refactor cycle for any in-progress work.
204
205
  5. **Quality gates before PR** — Never create a PR with failing checks.
205
206
  6. **Honor pre-push review when requested** — If the user or project workflow asks for pre-push multi-model review, run `scaffold run review-code` after quality gates and before `git push`.
206
- 7. **Code review before next task** — After creating a PR, run all three review channels (Codex CLI, Gemini CLI, Superpowers code-reviewer) and fix all P0/P1/P2 findings before moving on.
207
+ 7. **Code review before next task** — After creating a PR, run `scaffold run review-pr`: three CLI channels (Codex CLI, Gemini CLI, Claude CLI) via MMR plus the Superpowers code-reviewer agent as a complementary 4th channel. Fix all P0/P1/P2 findings before moving on.
207
208
  8. **Follow CLAUDE.md** — It is the authority on project conventions and commands.
208
209
 
209
210
  ---
@@ -160,14 +160,15 @@ For each task:
160
160
 
161
161
  8. **Run code reviews (MANDATORY)**
162
162
  - Run the review-pr tool: `scaffold run review-pr` (CLI) or `/scaffold:review-pr` (plugin)
163
- - This runs **all three** review channels on the PR diff:
163
+ - This runs the three MMR CLI channels on the PR diff plus the Superpowers code-reviewer agent as a complementary 4th channel reconciled through `mmr reconcile`:
164
164
  1. **Codex CLI**: `codex exec --skip-git-repo-check -s read-only --ephemeral "REVIEW_PROMPT" 2>/dev/null`
165
165
  2. **Gemini CLI**: `NO_BROWSER=true gemini -p "REVIEW_PROMPT" --output-format json --approval-mode yolo 2>/dev/null`
166
- 3. **Superpowers code-reviewer**: dispatch `superpowers:code-reviewer` subagent with BASE_SHA and HEAD_SHA
167
- - Verify auth before each CLI (`codex login status`, `NO_BROWSER=true gemini -p "respond with ok" -o json`)
168
- - All three channels must execute (skip only if a tool is genuinely not installed)
166
+ 3. **Claude CLI**: `claude -p "REVIEW_PROMPT" --output-format json 2>/dev/null`
167
+ 4. **Superpowers code-reviewer** (4th channel): dispatch `superpowers:code-reviewer` subagent with BASE_SHA and HEAD_SHA
168
+ - Verify auth before each CLI (`mmr config test` pre-flights all three at once)
169
+ - All four channels should execute. Missing Codex or Gemini → MMR runs a compensating Claude pass in its place (degraded-pass verdict). Missing Claude CLI → review proceeds without compensation.
169
170
  - Fix any P0/P1/P2 findings before proceeding
170
- - Do NOT move to the next task until all channels have run
171
+ - Do NOT move to the next task until the review completes
171
172
 
172
173
  9. **Update status**
173
174
  - If Beads: task status is managed via `bd` commands
@@ -201,7 +202,7 @@ For each task:
201
202
  2. **One task at a time** — Complete the current task fully before starting the next.
202
203
  3. **Quality gates before PR** — Never create a PR with failing checks.
203
204
  4. **Honor pre-push review when requested** — If the user or project workflow asks for pre-push multi-model review, run `scaffold run review-code` after quality gates and before `git push`.
204
- 5. **Code review before next task** — After creating a PR, run all three review channels (Codex CLI, Gemini CLI, Superpowers code-reviewer) and fix all P0/P1/P2 findings before moving on.
205
+ 5. **Code review before next task** — After creating a PR, run `scaffold run review-pr`: three CLI channels (Codex CLI, Gemini CLI, Claude CLI) via MMR plus the Superpowers code-reviewer agent as a complementary 4th channel. Fix all P0/P1/P2 findings before moving on.
205
206
  6. **Update status immediately** — Mark tasks complete as soon as review passes.
206
207
  7. **Consult lessons.md** — Check for relevant anti-patterns before each task.
207
208
  8. **Follow CLAUDE.md** — It is the authority on project conventions and commands.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: automated-pr-review
3
- description: Agent-driven automated PR review with external reviewers (Codex Cloud, Gemini Code Assist, or custom)
4
- summary: "Configures automated code review using Codex and/or Gemini CLIs for dual-model review when available, or an external bot with severity definitions and review criteria tailored to your project."
3
+ description: "Agent-driven automated code review via MMR (Codex, Gemini, Claude CLIs + Superpowers as 4th channel in wrappers), for PRs and non-PR targets"
4
+ summary: "Configures agent-driven automated code review: mandatory after `gh pr create` and also usable on any non-PR target. Direct `mmr review` runs three CLI channels (Codex, Gemini, Claude); `scaffold run review-pr` / `scaffold run review-code` add the Superpowers code-reviewer agent as a complementary 4th channel. An external GitHub App reviewer is supported as a fallback when CLIs are unavailable."
5
5
  phase: "environment"
6
6
  order: 340
7
7
  dependencies: [git-workflow]
@@ -12,10 +12,21 @@ knowledge-base: [review-methodology, automated-review-tooling]
12
12
  ---
13
13
 
14
14
  ## Purpose
15
- Configure an agent-driven automated PR review system using local CLI reviewers
16
- (Codex, Gemini — runs both when available for dual-model quality) or external
17
- GitHub App reviewers. Zero GitHub Actions workflows. The agent manages the
18
- entire review-fix loop locally.
15
+ Configure an agent-driven automated code review system using local CLI
16
+ reviewers dispatched through MMR (Codex, Gemini, Claude — runs all three when
17
+ available) plus the Superpowers code-reviewer agent as a complementary 4th
18
+ channel when using the MMR wrappers `scaffold run review-pr` and
19
+ `scaffold run review-code`. The review is mandatory after `gh pr create` and
20
+ also runs on non-PR targets (local staged/unstaged code, branch diffs,
21
+ specific files) via the same `mmr review` CLI.
22
+ `scaffold run post-implementation-review` is a separate full-codebase review
23
+ (Codex CLI + Gemini CLI + Superpowers code-reviewer) that runs after an AI
24
+ agent completes all implementation tasks; it does not currently use Claude
25
+ CLI as a standard channel and is not an MMR wrapper, though it can inject
26
+ findings into an existing MMR job via `mmr reconcile`.
27
+ External GitHub App reviewers remain supported as a fallback when CLIs are
28
+ unavailable. Zero GitHub Actions workflows. The agent manages the entire
29
+ review-fix loop locally.
19
30
 
20
31
  ## Inputs
21
32
  - docs/coding-standards.md (required) — review criteria reference
@@ -26,7 +37,7 @@ entire review-fix loop locally.
26
37
  ## Expected Outputs
27
38
  - AGENTS.md — Reviewer instructions with project-specific rules
28
39
  - docs/review-standards.md — severity definitions (P0-P3) and review criteria
29
- - scripts/cli-pr-review.sh (local CLI mode) — dual-model review with reconciliation
40
+ - scripts/cli-pr-review.sh (legacy dual-model fallback) — Codex+Gemini review with manual reconciliation, used when MMR / `scaffold run review-pr` is unavailable
30
41
  - scripts/await-pr-review.sh (external bot mode) — polling script with JSON output
31
42
  - docs/git-workflow.md updated with review loop integration
32
43
  - CLAUDE.md updated with agent-driven review workflow and review-pr hook
@@ -36,23 +47,27 @@ entire review-fix loop locally.
36
47
  - (mvp) Review standards document matches project coding conventions
37
48
  - (deep) Await script handles all exit conditions (approved, findings, cap, skip, timeout)
38
49
  - (mvp) CLAUDE.md workflow documents the agent-driven loop
50
+ - (mvp) CLAUDE.md review block covers both PR and non-PR targets (staged, branch diff, single file)
39
51
  - (mvp) No GitHub Actions workflows created (zero Actions minutes)
40
52
  - (mvp) No ANTHROPIC_API_KEY secret required
41
53
  - (mvp) Post-PR-creation hook configured in settings to remind agents to run review-pr
42
54
  - (deep) Legacy GitHub Actions workflows detected and cleanup offered
43
- - (deep) Dual-model review enabled when both CLIs available
55
+ - (deep) Three-CLI review (Codex, Gemini, Claude) enabled when all three CLIs available, with per-channel auth checks and compensating passes
56
+ - (deep) The MMR scaffold wrappers (review-pr, review-code) add the Superpowers code-reviewer agent as a complementary 4th channel and reconcile its findings through MMR. `post-implementation-review` follows a separate channel layout (Codex + Gemini + Superpowers, with optional `mmr reconcile` injection) and is not one of the MMR wrappers.
44
57
 
45
58
  ## Methodology Scaling
46
- - **deep**: Full setup with local CLI review (dual-model when both available),
47
- review-standards.md, AGENTS.md, and comprehensive CLAUDE.md workflow.
48
- Falls back to external bot review if no CLIs available.
59
+ - **deep**: Full setup with local three-CLI review dispatched through MMR
60
+ (Codex, Gemini, Claude), scaffold wrappers adding the Superpowers
61
+ code-reviewer as a complementary 4th channel, review-standards.md,
62
+ AGENTS.md, and comprehensive CLAUDE.md workflow covering PR and non-PR
63
+ targets. Falls back to external bot review if no CLIs available.
49
64
  - **mvp**: Step is disabled. Local self-review from git-workflow suffices.
50
65
  - **custom:depth(1-5)**:
51
66
  - Depth 1: disabled — local self-review from git-workflow suffices.
52
67
  - Depth 2: disabled — same as depth 1.
53
- - Depth 3: basic review-standards.md + single-CLI review (whichever CLI is available).
54
- - Depth 4: add dual-model review when both CLIs available, AGENTS.md with project-specific rules.
55
- - Depth 5: full suite with dual-model review, legacy Actions cleanup, and comprehensive CLAUDE.md workflow integration.
68
+ - Depth 3: basic review-standards.md + MMR dispatch using whichever CLIs are available (graceful compensating Claude passes for missing Codex or Gemini channels; if Claude CLI itself is unavailable, the review proceeds with the remaining channels — no compensating pass for missing Claude).
69
+ - Depth 4: three-CLI review via MMR when all CLIs available, plus AGENTS.md with project-specific rules and the Superpowers 4th channel on wrapper invocations.
70
+ - Depth 5: full suite three-CLI + Superpowers review, legacy GitHub Actions cleanup, comprehensive CLAUDE.md workflow integration covering PR and non-PR targets.
56
71
 
57
72
  ## Conditional Evaluation
58
73
  Enable when: project uses GitHub for version control, team size > 1 or CI/CD is
@@ -74,10 +89,14 @@ Check if AGENTS.md exists first. If it exists, check for scaffold tracking comme
74
89
  script customizations
75
90
  - **Triggers for update**: coding-standards.md changed (new review criteria),
76
91
  tdd-standards.md changed (coverage expectations), new external reviewer
77
- CLI became available, git-workflow.md changed PR workflow steps
92
+ CLI became available, git-workflow.md changed PR workflow steps, review
93
+ scope expanded beyond PRs (e.g., MMR now supports staged / diff / branch
94
+ / file targets)
78
95
  - **Conflict resolution**: if review criteria changed in coding-standards.md,
79
- update AGENTS.md review rules to match; if both CLI reviewers are now
80
- available, offer to enable dual-model review
96
+ update AGENTS.md review rules to match; if additional CLI reviewers have
97
+ become available, offer to enable the full three-CLI MMR flow (Codex,
98
+ Gemini, Claude) and, on wrapper invocations, surface Superpowers
99
+ code-reviewer as the complementary 4th channel
81
100
 
82
101
  ## Instructions
83
102
 
@@ -99,7 +118,7 @@ Add this to `.claude/settings.json`:
99
118
  "hooks": [
100
119
  {
101
120
  "type": "command",
102
- "command": "if echo \"$CC_BASH_COMMAND\" | grep -q 'gh pr create'; then echo '\\n⚠️ MANDATORY: Run all 3 code review channels before proceeding to the next task:\\n\\n 1. Codex CLI:\\n Auth: codex login status 2>/dev/null\\n Run: codex exec --skip-git-repo-check -s read-only --ephemeral \"REVIEW_PROMPT\" 2>/dev/null\\n\\n 2. Gemini CLI:\\n Auth: NO_BROWSER=true gemini -p \"respond with ok\" -o json 2>&1\\n Run: NO_BROWSER=true gemini -p \"REVIEW_PROMPT\" --output-format json --approval-mode yolo 2>/dev/null\\n\\n 3. Superpowers code-reviewer:\\n Dispatch superpowers:code-reviewer subagent with BASE_SHA and HEAD_SHA\\n\\nIf auth fails: tell user to run ! codex login or ! gemini -p \"hello\"\\nFix all P0/P1/P2 findings before moving on. Do NOT skip any channel.\\nFull instructions: scaffold run review-pr'; fi"
121
+ "command": "if echo \"$CC_BASH_COMMAND\" | grep -q 'gh pr create'; then echo '\\n⚠️ MANDATORY: Run all 3 CLI review channels plus the Superpowers 4th channel before proceeding to the next task:\\n\\n 1. Codex CLI:\\n Auth: codex login status 2>/dev/null\\n Run: codex exec --skip-git-repo-check -s read-only --ephemeral \"REVIEW_PROMPT\" 2>/dev/null\\n\\n 2. Gemini CLI:\\n Auth: NO_BROWSER=true gemini -p \"respond with ok\" -o json 2>&1\\n Run: NO_BROWSER=true gemini -p \"REVIEW_PROMPT\" --output-format json --approval-mode yolo 2>/dev/null\\n\\n 3. Claude CLI:\\n Auth: claude -p \"respond with ok\" 2>/dev/null\\n Run: claude -p \"REVIEW_PROMPT\" --output-format json 2>/dev/null\\n\\n 4. Superpowers code-reviewer (complementary 4th channel):\\n Dispatch superpowers:code-reviewer subagent with BASE_SHA and HEAD_SHA\\n\\nIf auth fails: tell user to run ! codex login, ! gemini -p \"hello\", or ! claude login (as applicable).\\nDo not silently skip channels — surface auth failures and let MMR decide: missing Codex/Gemini get compensating Claude passes (degraded-pass verdict); missing Claude proceeds without compensation.\\nFix all P0/P1/P2 findings before moving on.\\nFull instructions: scaffold run review-pr'; fi"
103
122
  }
104
123
  ]
105
124
  }
@@ -120,21 +139,54 @@ the actual CLI invocations ensures the agent can execute reviews even if the
120
139
 
121
140
  ### Add Review Workflow to CLAUDE.md
122
141
 
123
- Add the following to the project's CLAUDE.md in the Code Review section:
142
+ Add the following to the project's CLAUDE.md in the Code Review section. Wrap
143
+ the managed section in the `<!-- scaffold:automated-pr-review:claude-md -->`
144
+ markers shown below so Update Mode can idempotently rewrite this block without
145
+ duplicating it on re-run. If a prior version of the block exists **without**
146
+ markers, replace it in place and add the markers.
124
147
 
125
148
  ```markdown
126
149
  ## Code Review
127
150
 
128
- After creating a PR, run `/scaffold:review-pr <PR#>` to execute all three review
129
- channels (Codex CLI, Gemini CLI, Superpowers code-reviewer). Fix P0/P1/P2 findings
130
- before moving to the next task. A post-hook on `gh pr create` will remind you.
131
-
132
- | Command | Purpose |
133
- |---------|---------|
134
- | `/scaffold:review-pr <PR#>` | Run all 3 review channels on a PR |
135
- | `scripts/cli-pr-review.sh <PR#>` | Run dual-model CLI review only |
151
+ <!-- scaffold:automated-pr-review:claude-md start -->
152
+ **Mandatory after `gh pr create`** run `/scaffold:review-pr <PR#>` to execute
153
+ all three review channels (Codex CLI, Gemini CLI, Claude CLI), plus the
154
+ Superpowers code-reviewer agent as a complementary 4th channel. Fix P0/P1/P2
155
+ findings before moving to the next task. A post-hook on `gh pr create` will
156
+ remind you.
157
+
158
+ **Optional but supported** for non-PR targets the review is not PR-gated.
159
+ Direct `mmr review` runs the three CLI channels (Codex, Gemini, Claude) on
160
+ any diff or file. `scaffold run review-code` adds the Superpowers
161
+ code-reviewer agent as a complementary 4th channel on top of those three
162
+ CLIs for the local pre-commit review path.
163
+
164
+ | When | Command |
165
+ |------|---------|
166
+ | After creating a PR | `/scaffold:review-pr <PR#>` |
167
+ | Before commit / push (tracked local code: committed + staged + unstaged) | `scaffold run review-code` |
168
+ | Pending edits to a tracked file (changes since HEAD) | `git diff HEAD -- <path> \| mmr review --diff - --sync --format json` |
169
+ | Current contents of any file (tracked-with-no-changes, untracked, or brand-new) | `(diff -u /dev/null <path> \|\| true) \| mmr review --diff - --sync --format json` |
170
+ | Branch diff | `mmr review --base <ref> --head <ref> --sync --format json` |
171
+ | Staged changes only | `mmr review --staged --sync --format json` |
172
+ | All tracked uncommitted changes (staged + unstaged, no untracked) | `git diff HEAD \| mmr review --diff - --sync --format json` |
173
+ | Existing patch or diff file | `mmr review --diff <path.patch> --sync --format json` |
174
+ | Dual-model CLI only (no reconciliation) | `scripts/cli-pr-review.sh <PR#>` |
175
+
176
+ Note: `mmr review --diff` expects diff-format content; use the `git diff …`
177
+ or `(diff -u /dev/null … || true)` wrappers shown above to review plain
178
+ files. The `|| true` guard on `diff` is required because `diff` exits with
179
+ status 1 whenever files differ, which breaks pipelines under `pipefail`.
180
+ <!-- scaffold:automated-pr-review:claude-md end -->
136
181
  ```
137
182
 
183
+ **Idempotency note:** In Update Mode, find the `<!-- scaffold:automated-pr-review:claude-md start -->`
184
+ and `<!-- scaffold:automated-pr-review:claude-md end -->` markers and replace
185
+ everything between them with the current version of the block above. If the
186
+ markers are missing (pre-marker versions), locate the prior block by its
187
+ "After creating a PR, run `/scaffold:review-pr`" lead-in and replace it in
188
+ place, adding the markers around the new content. Never append a second copy.
189
+
138
190
  ### Configure AGENTS.md, Review Standards, and CLI Scripts
139
191
 
140
192
  Follow the existing instructions for creating AGENTS.md, docs/review-standards.md,
@@ -14,10 +14,38 @@ Dispatch code reviews to multiple AI model CLIs, poll for results, and collect r
14
14
 
15
15
  ## Quick Reference
16
16
 
17
+ `mmr review` works for any review target — not just PRs. Pick the input mode
18
+ that matches what you want reviewed:
19
+
17
20
  ```bash
18
- # Dispatch a review for a PR
21
+ # GitHub PR (fetches diff via `gh pr diff`)
19
22
  mmr review --pr <number> --focus "description of what to focus on"
20
23
 
24
+ # Staged git changes (pre-commit review)
25
+ mmr review --staged --focus "..."
26
+
27
+ # All tracked uncommitted changes (staged + unstaged) — excludes untracked
28
+ # files; use `scaffold run review-code` for full-worktree coverage
29
+ git diff HEAD | mmr review --diff - --focus "..."
30
+
31
+ # Branch diff / ref range
32
+ mmr review --base main --head <branch> --focus "..."
33
+
34
+ # Changes to a specific tracked file since HEAD (pending edits only).
35
+ # If the file has no local changes this pipeline sends an empty diff
36
+ # and MMR will refuse with "no diff content"; use the next form instead
37
+ # to review the file's current contents regardless of git state.
38
+ git diff HEAD -- path/to/file.md | mmr review --diff - --focus "..."
39
+
40
+ # A file's current contents, regardless of git state (tracked-with-no-
41
+ # changes, untracked, or brand-new). Synthesizes an "all added" diff.
42
+ # `|| true` is required: diff exits 1 whenever files differ, which breaks
43
+ # pipelines under `set -o pipefail`.
44
+ (diff -u /dev/null path/to/file.md || true) | mmr review --diff - --focus "..."
45
+
46
+ # Existing patch or diff file
47
+ mmr review --diff path/to/changes.patch --focus "..."
48
+
21
49
  # Check progress
22
50
  mmr status <job-id>
23
51
 
@@ -28,7 +56,20 @@ mmr results <job-id>
28
56
  mmr config test
29
57
  ```
30
58
 
31
- ## After Creating a PR
59
+ All input modes accept `--focus`, `--sync`, `--format`, and `--fix-threshold`
60
+ the same way. The "3-channel review" is not PR-specific — it reviews whatever
61
+ diff you point it at.
62
+
63
+ **`--diff` contract:** the flag expects diff-format content (a path to a
64
+ `.patch`/`.diff` file, or `-` for stdin). It does not read raw document
65
+ content — wrap the target in a diff first (see the `git diff …` and
66
+ `(diff -u /dev/null … || true)` patterns above). The `|| true` guard is
67
+ required because `diff` exits 1 whenever files differ, which breaks
68
+ pipelines under `set -o pipefail`.
69
+
70
+ ## Common Workflows
71
+
72
+ **After creating a PR**
32
73
 
33
74
  1. Run `mmr review --pr <number>`
34
75
  2. Note the job ID from the output
@@ -38,6 +79,35 @@ mmr config test
38
79
  6. If gate failed: fix findings at or above the threshold severity
39
80
  7. If gate passed: proceed to merge
40
81
 
82
+ **Reviewing a document or arbitrary file**
83
+
84
+ Pick the case that matches what the user wants reviewed:
85
+
86
+ - **Just the pending edits** to a tracked file (what changed since last
87
+ commit): `git diff HEAD -- path/to/doc.md | mmr review --diff -
88
+ --focus "..."`. Fails with "no diff content" if the file has no
89
+ local changes.
90
+ - **The file's current contents**, whether it's tracked-with-no-
91
+ changes, untracked, or brand-new: wrap as a synthetic "all added"
92
+ diff first: `(diff -u /dev/null path/to/doc.md || true) |
93
+ mmr review --diff - --focus "..."`. The `|| true` guard avoids
94
+ `diff`'s exit-1-on-differences breaking the pipeline under
95
+ `set -o pipefail`.
96
+
97
+ Same dispatch / status / results flow as above.
98
+
99
+ **Reviewing uncommitted work before push**
100
+
101
+ 1. `git add` the files you want reviewed
102
+ 2. Run `mmr review --staged`
103
+ 3. Fix findings at or above the gate threshold, re-stage, re-run as needed
104
+
105
+ Prefer the wrapper tools (`scaffold run review-pr`, `scaffold run review-code`)
106
+ when they cover your target — they add auth checks, compensating passes, and
107
+ the agent-review channel on top of `mmr review`. Call `mmr review` directly
108
+ for targets the wrappers don't cover (docs, arbitrary diffs, ref ranges
109
+ outside `main`).
110
+
41
111
  ## Auth Failures
42
112
 
43
113
  If `mmr review` reports auth failures, follow the recovery instructions in the output: