Why review becomes the bottleneck
When agents start writing most of a change, the time spent typing code shrinks and the time a pull request waits for a reader grows. Nothing else in the cycle got faster, so the review queue absorbs the difference. Teams notice it as pull requests that sit for days, reviewers who skim, and a growing habit of approving large diffs on trust.
Agent-written code makes the problem worse in a specific way: it looks finished. It is formatted, named sensibly and commented. The errors it carries are rarely in style. They are in logic and in what was left out: a boundary case nobody listed, a requirement read one way when it meant another, a shortcut around an agreed architecture, an error that is caught and swallowed. A tired human reader is bad at exactly those.
Size matters too. DORA's 2024 report found that AI adoption went together with lower delivery throughput and stability, and that small batches and robust testing remain important (DORA 2024 report). An agent left alone tends to produce large pull requests, and a large pull request is the hardest thing to review well, for a person or a model.
The answer is not to remove review but to change who does which part of it. Routine checks move to tools and a reviewing agent; people keep the decisions that need judgement and accountability.
Who checks what
Split review into three layers. Each one catches a different class of error, and each is cheap where the others are expensive.
| Layer | What it checks | Why it belongs there |
|---|---|---|
| Linters, type checkers, static analysis in CI | Formatting, style, types, known anti-patterns, dependency and secret scanning | Deterministic and free per run. A model should never spend tokens or a comment on what a linter can decide. |
| Reviewing agent | Does the change do what the spec and its acceptance criteria say; is each criterion backed by a test; were existing tests weakened; project rules; the usual suspects (boundaries, error handling, time zones, money, concurrency) | Needs reading and reasoning, but follows written rules. It runs on every push, never gets tired and does not mind a 40-file diff. |
| People | Architecture and impact on other teams; security-sensitive code; data and migrations; public APIs; whether the feature is what the product needed | These need context outside the repository and someone accountable for the decision. The agent can be the first reader here, but not the last. |
Where the line between the second and third layer falls depends on what a mistake costs. A change confined to one module, covered by tests, with good review rules, can go through on the agent's review and a person's quick look at the summary. A migration that rewrites a table customers depend on gets a person's full read whatever the agent said.
A reviewer that did not write the code
A model reviewing code it just wrote, in the same conversation, tends to agree with itself. It remembers why it made each choice, and those reasons read as justification rather than as claims to check. The reviewer should start fresh: a separate session, its own context, given the diff, the spec and the rules, and nothing of the author's reasoning.
A different model, or the same model at a different effort level, adds more independence, but the bigger gain is the clean context. A reviewer that sees only what a human reviewer would see reads the code the way the next maintainer will.
The same thinking applies to the reviewer's instructions. If the review reads its rules from the branch under review, a pull request can change the rules it is judged by. Read the rules from the base branch. Anthropic's Code Review does this for its REVIEW.md, taking it from the base or default branch and never from the pull request's own changes (Code Review docs).
Writing the reviewer's rules
A reviewing agent with no project rules writes generic advice: "consider adding error handling", "this could be more readable". Engineers learn to ignore it within a week. Rules turn it into a reviewer that knows what this team cares about. Good rules have four parts: what to read first, what blocks a merge, what not to comment on, and the shape of each comment.
Here is an example for a subscription-billing service. Write yours from your own incidents; this one is only a starting shape.
# Review rules: billing service
## Read first
1. The pull request description links the spec. Read it and list its
acceptance criteria (AC-1, AC-2, ...).
2. For each criterion, find the code that implements it and the test that
checks it. A criterion with no test is a blocking finding.
## Blocking findings
- An existing test changed, skipped or deleted without a sentence in the
description saying why.
- Money held in a float. Amounts are integer minor units (cents) plus a
currency code.
- A date compared or stored without a time zone. Renewal and billing dates
are computed in the customer's billing time zone, never the server's.
- A new call to an external service (payment provider, email, tax API)
without a timeout and without handling its failure.
- A retry around a charge without an idempotency key.
- Any change under migrations/, infra/ or packages/shared/: do not approve;
name the owner from CODEOWNERS and stop.
## Do not comment on
- Formatting, naming style, import order: the linter decides these.
- "Could be improved" without saying what breaks and when.
- Code the pull request did not change, unless the change makes it wrong.
## Each finding
- File and line.
- What is wrong, in one sentence.
- Why it matters: the input or sequence of events that breaks it.
- How to check the fix (a test to add, a command to run).
- Severity: blocking, or minor (nit / pre-existing bug).
## End of the review
- Verdict: approve, or request changes.
- The list of acceptance criteria with the test covering each.
Three habits keep the file useful. Keep it short, because every line costs attention on every review. Add a rule only after a defect escaped review, and name the class of defect rather than the incident. Remove rules that never fire; a rule that no change has triggered in three months is noise.
Where the file lives depends on the tool: Claude Code's /code-review reads the project's CLAUDE.md files, Anthropic's Code Review adds REVIEW.md (customizing Code Review), and the specialist services each have their own configuration. See CLAUDE.md and AGENTS.md for keeping the always-on instructions lean.
Where the review runs
| Option | Examples | Control | Fits when |
|---|---|---|---|
| Built into the code host | GitHub Copilot code review | Low: little say over rules and models | You want something on every pull request this week |
| Specialist review service | CodeRabbit, Qodo, Greptile; Anthropic's Code Review | Medium: their rule files, their infrastructure | You accept the code going to the vendor and want a maintained product |
| Your own agent in CI | Claude Code, Codex or another agent in GitHub Actions or GitLab CI | High: your prompt, your rules, your runners, your model endpoint | Security asks where the code goes, or the review has to fit your process exactly |
| On the developer's machine | Claude Code's /code-review | High, but nothing enforces it | A first pass before the pull request is opened |
For teams whose security function wants to know exactly where source code travels, the third option is usually the one that survives, because the agent can be pointed at the company's own LLM gateway.
The review-fix loop
Once a reviewing agent posts findings, a fixing agent can take them. The loop is simple to describe and easy to let run away, so give it edges.
- Review posts findingsInline comments on the pull request, one thread per finding, each with severity. The thread is the record; nothing lives only in a chat.
- A fixing session takes themIt reads every open thread, fixes what it agrees with, and replies with a reason on what it declines. Declining is allowed; silence is not.
- Tests run before the next reviewThe fix is pushed only with the project's tests green, so the next round reviews working code.
- The review reads the new commitsIt checks that each fixed thread is really fixed, resolves those, and looks for anything new.
- Stop on a rule, not a feelingStop when nothing important is open. If the fixes keep producing new findings round after round, or a fixed number of rounds pass without converging, hand it to a person.
- Read every escalationA loop that needed a person means a missing rule, a missing test or an unclear spec. Fix that, not just the pull request.
How to tell whether AI review works
Four numbers, collected from the code host and the defect tracker, are enough to judge it after a month:
- Open-to-merge time for pull requests, median and 85th percentile. It should fall, or at least stop growing as agent output grows.
- Share of agent comments that led to a change. Count a comment useful when the code changed because of it. Under half usually means the rules are too general; read the ignored comments and turn them into "do not comment on" lines.
- Defects that review missed, found later in QA or production. Each one is a candidate for a new rule or a new test.
- Human review load: hours per week people spend reviewing, and how many pull requests each person has waiting. The point of the agent is that this falls while quality holds.
Read them as a team trend, never per person. The wider measurement set is in DORA metrics and measuring AI's impact.
Questions
Can AI review replace human review entirely?
For some changes, nearly: a change in one module, covered by tests, under good rules, can go on the agent's review with a person reading the summary. Architecture, security-sensitive code, data migrations, public APIs and anything that affects other teams stay with a person, with the agent as first reader. The merge itself should stay a person's decision.
Why are the reviewing agent's comments mostly useless?
Usually because it has no project rules. Give it a short file that says what blocks a merge, what it must not comment on (style belongs to the linter), and that it must check the change against the spec and its acceptance criteria. Then remove rules that never produce a useful comment.
Can the same model write and review the code?
Yes, if the review runs in a fresh session that sees only the diff, the spec and the rules, not the author's reasoning. A different model can add independence, but the clean context matters more.
How do we review with AI without sending code to a vendor?
Run your own agent in your CI and point it at your company's LLM gateway, which routes to a provider account and region your security function has approved. See LLM gateway and on-premise models.
Take your team there, step by step
A 13-week pilot on one team: a baseline, a harness built around your process, real backlog tasks through the whole cycle, and the numbers before and after.