Skip to main content
coreydaley.dev

The reviewer should not be the author: separation of duties for multi-agent code review

If you want multi-agent code review to be more than theater, start with one rule: the reviewer should not be the author.

That sounds obvious, and most agent workflows still violate it the first time anyone asks the same agent to both write and review. One agent writes the code. The same agent gets a follow-up: review your work, be critical, look for bugs, think harder. The surface changes. The structure does not. The same actor is grading the same assumptions that produced the patch — and the priors that made the bug invisible while writing keep it invisible while reviewing.

You can prompt around it. Be more critical. Pretend you didn’t write this. You’ll get more critical-sounding language and roughly the same lenient judgments. “Be more critical” doesn’t work. “You don’t see what you wrote” does. The first asks an agent to override its priors; the second never gives the agent the priors in the first place. Same outcome on paper, totally different result in practice.

The fix I keep coming back to lives in agent-config, my open-source Claude Code stack, inside a skill called /sprint-self-review. What I like about it isn’t that it makes any individual agent a better reviewer — it doesn’t. It removes the easiest ways for bad review behavior to happen at all. The pattern works because of structural constraints, not because the agents are smart. That distinction is the whole post. (More on the repository itself is on the agent-config project page.)

The Architecture, Briefly

/sprint-self-review runs after a separate skill has opened a draft PR (or several, for sprints that span repositories). The unit of review is the sprint — every repository’s diff lands in one bundle so cross-repo issues stay visible.

The pipeline is a state machine. Six steps matter for this post.

  1. Compute a frozen per-repo diff bundle. Reviewers read this bundle, not the working tree. The diff is the artifact under review.
  2. Run two reviewers in parallel. Claude (as a general-purpose subagent) and Codex (via codex exec) get the same prompt body and the same bundle, on different processes, neither seeing the other’s output. Claude’s findings carry a CR- prefix, Codex’s carry CX-.
  3. Synthesize. The orchestrator now reads both review files for the first time. It deduplicates, calibrates severity, suppresses items already resolved in the rolling ledger, and writes a unified list with SR- IDs that point back to their CR- and CX- sources.
  4. Devil’s-advocate pass. Codex runs again, but this time as an attacker — full worktree access, looking for false positives, miscalibrated severities, missed findings, and bad suggestions in the synthesis. Valid challenges get incorporated in place.
  5. Address per finding. Apply the fix in the right worktree, run that worktree’s tests and lint, commit if green. Cross-repo fixes apply atomically: edits go in both worktrees, tests run in both, then either both commit or both revert.
  6. Decide and loop. If only Low/Nit findings remain, or the iteration cap is hit, escalate to the user. Otherwise loop back to step 1 so the next round sees a fresh diff against the post-fix tree.

The orchestrator’s restraint isn’t a convention — it’s enforced. The whole pipeline is a Graphviz graph.dot file with a thin walker that validates every transition. If any node tries to move from synthesis straight to address, skipping the devil’s-advocate pass, the walker errors out and lists the legal alternatives. The orchestrator can’t quietly reroute itself into reviewing because the graph doesn’t have an edge for it. (I’ve written about the dot-graph pattern elsewhere; same enforcement strategy.)

Directed graph for the sprint-self-review skill showing the orchestrator's coordination flow: compute-diff feeding parallel Claude and Codex reviewers, synthesis, devil's-advocate, per-finding address with cross-repo atomic fixes, and a decide node that loops back through compute-diff or escalates to the user

The graph makes the separation visible at a glance: independent-reviews is the parallel split, synthesis and devils-advocate are sequential and separate, address runs per-finding with the loop back through compute-diff so each iteration re-reads the post-fix state. Every edge the orchestrator can take is on this picture. Every edge it can’t take — synthesis straight to address, address straight to terminal without going back through decide — isn’t.

Why Each Constraint Earns Its Keep

Parallel, not sequential. If reviewer #2 reads reviewer #1’s findings before forming its own, it’s primed. Its priors collapse toward the framing it just absorbed. Running both reviewers concurrently — neither one seeing the other’s output until synthesis — preserves independent priors. Disagreement between them is the signal worth listening to. You can’t get that signal if you’ve already laundered one reviewer’s framing through the other.

Same prompt body for both reviewers. Disagreement only means something when instructions are held constant. If Claude gets a slightly more permissive review prompt and Codex gets a slightly stricter one, every difference in their output is ambiguous: are we seeing independent judgment, or just prompt drift? The skill goes out of its way to share the prompt body verbatim and substitute only the ID prefix and the output filename. I once spent an afternoon trying to figure out why Claude was flagging things Codex wasn’t — convinced I’d discovered something interesting about model differences — until I diff’d the prompt files and found a single comma I’d added to one of them weeks earlier while editing. The “interesting divergence” was punctuation. That’s the failure mode the constraint exists to prevent: prompt drift that masquerades as judgment.

Two model families, not two instances of the same model. In my experience running these reviews, Claude and Codex have different default instincts. Claude tends to flag architectural concerns — abstraction quality, contract violations, what doesn’t fit the surrounding patterns. Codex tends to flag concrete bugs — off-by-one errors, missing nil checks, mishandled error returns. Two instances of the same model, given the same diff, produce reviews that look uncannily similar — same misses, same over-flags, same blind spots. Two different models produce findings that overlap in the dangerous middle and disagree at the edges. The disagreement is where most of the value lives.

Synthesis is its own node. Skipping the explicit synthesis pass and letting address read both raw reviews directly would be cheaper. It would also be wrong. Without an explicit synthesis pass, deduplication and severity calibration happen implicitly — and implicitly means inconsistently. A finding flagged High by Claude and Medium by Codex deserves an explicit decision, not a “whoever spoke first” bias. The synthesis node forces the decision into the open and writes it down with traceable sources.

Devil’s advocate runs after synthesis, not folded into it. This one took me a while to internalize. The synthesizer has confirmation bias toward its own merged output — it just made a bunch of judgment calls it now thinks are right. A devil’s-advocate step that runs during synthesis would mostly defer to those judgments. Synthesis stops being a merge and becomes an argument the synthesizer is trying to win. A separate pass — fresh actor, full worktree access, attacking the synthesized findings — catches what the merger over-credited. The orchestrator then incorporates valid challenges, which means the synthesizer is no longer protecting its own work.

Cross-repo fixes are atomic. When a finding spans repositories — a function rename in repo B that callers in repo A have to follow — the fix lands in both worktrees together or neither. The half-applied state is worse than no fix at all. I learned this the hard way: one repo committed, the coupled repo failed verification, and the next iteration’s diff reviewed an incoherent state where the change appeared partly landed. Reviewers re-flagged the broken half as a new finding while the fixed half looked resolved. The skill’s address node now either commits to both worktrees on success or reverts both on any failure. There is no middle state to reason about.

Two More Pieces That Make the Restraint Real

The findings ledger persists across runs. findings.md is a flat checkbox list, one finding per row, with Repo:, File:Line:, status tag, and seen-in-iteration history. When a finding is marked won’t-fix, deferred, or fixed, it doesn’t get re-litigated next iteration — synthesis suppresses it. Without that ledger, every run would have to re-argue settled decisions, which would slowly turn the loop back into a self-review cycle: the same actor proposing, the same actor rebutting, every iteration. Persistence is part of the separation-of-duties story, not an audit-trail nicety.

Degraded modes refuse to launder failure as success. If one reviewer fails or returns empty, synthesis warns and proceeds single-agent. If both fail, synthesis writes one explicit blocker entry and routes to escalate. The system would rather stop than silently reinterpret reviewer failure as “no findings” — because a clean-looking synthesis with zero findings would route the iteration through the terminal path as if the diff had been reviewed and found clean. Structural honesty over apparent progress.

Where This Generalizes

The pattern fits work that has a crisp surface for an attacker to push on: code, plans, security audits, schemas. Anywhere you can define who is allowed to know what, when, and what counts as evidence — separation of duties pays off.

It generalizes less obviously to open-ended creative work. A blog draft, a research direction, a brand voice — these don’t have the same crisp surface. You can run two writers in parallel and merge their outputs (I do, for these posts) but the value comes from breadth of perspective, not from adversarial pressure. Different mechanism, different name. I’d hesitate to call it “separation of duties” when the duty itself is fuzzy.

So: useful for code review, useful for sprint planning, useful for security audits. Less load-bearing for tasks where “wrong” is a matter of taste.

The pattern that connects this to existing research is straightforward. Constitutional AI separates critique from generation; scalable oversight has the same shape on a different axis, with a coordinator combining the judgments of multiple weaker reviewers to evaluate stronger work. /sprint-self-review is a small, applied version of both. The orchestrator is in some sense the weakest agent in the system — it doesn’t review, doesn’t generate code, just coordinates — and that is the point.

What I’d Reach For First

If you’re building agent workflows past toy scale and reviews keep coming back uncomfortably charitable, the first move I’d try isn’t a more demanding prompt:

  1. Remove the reviewer from the same conversation, context window, or process that produced the work.
  2. Run two reviewers in parallel from different model families, with identical prompts, neither seeing the other’s output until merge.
  3. Make the workflow refuse the shortcuts — graph-enforced transitions, persistent ledger, no laundering reviewer failure as success.

The agents don’t have to get any smarter. The structure does the work.

If your reviewer had to be structurally independent from your author tomorrow, what would break first?

Related posts