Skip to content
deftpace

What review rules should we set for agent-written code?

By Kevin DawkinsPublished 5 min read

In short: When agents write most of the code, the number and size of changes go up several times over while reviewer hours stay flat. Line-by-line human review stops working. The rigor has to move into four things: a named human owner, required evidence, review depth set by risk, and size caps.

Why review breaks

On teams that adopt coding agents widely, I see the same pattern:

  • Merged pull requests per engineer rise two to three times.
  • Each pull request gets several times bigger.
  • Reviewer hours stay flat, so the wait for a first review gets longer.

When review is the bottleneck, people skim, rubber-stamp, or hand the review to their own agent. A review request is a request for a person's judgment. An agent reviewing an agent, with no human anywhere, is not review.

How agents fail differently from people

Agent failure modes and the gate that catches each
FailureWhat it looks likeGate that catches it
Plausible code nobody ranThe change is described as tested, but the test ran in an environment that differs from the one that matters, such as an unrestricted test accountRequired evidence (rule 2) and CI that exercises the real path
Changes outside the taskAsked to add one entry to a list, the agent rewrites the list and drops entries that were already thereA diff-scope check, and escalation on changes unrelated to the task
Tests that assert the implementationThe agent bends the business logic until the existing tests pass, when it should fix the tests or the logicA human checks test intent on core paths, with mutation testing where it is cheap
New dependenciesLockfile or manifest changes slipped into an unrelated changeDependency changes always escalate
Leaked secretsKeys pasted into fixtures, logs or example configA secret scanner in CI that blocks the merge and does not merely warn

Rule 1: every change has a named human owner

A person merges every change and answers for the result if something goes wrong. Ownership is per change, not per tool. "The agent wrote it" is never an answer in a postmortem.

Pair this with area owners: a named person or team for each part of the codebase who defines that area's review criteria, reviews changes there when they escalate, and is responsible for how well review works in that area.

One warning about code-owner files: if all they decide is which person tells their agent to do the review, they do more harm than good.

Rule 2: every change arrives with evidence

The description of each change states:

  • What was run: commands, environments and data.
  • What passed: test names, checks, screenshots or output.
  • What was not verified: said plainly.

For a bug fix, state the observable symptom and the root cause in the first lines, and name the test that proves the fix. The description becomes the commit message, so it is what future engineers and agents will read.

Treat an untested change, especially a bug fix, as an automatic escalation.

Rule 3: review depth follows risk

One model that works: an agent reviews every change and approves by default, but escalates to a human area owner on any of these triggers.

  • Security-sensitive code
  • Changes to public APIs or behavior
  • Large diffs
  • Changes unrelated to the stated task
  • Changes with no stated reason
  • Untested changes, especially bug fixes
  • Changes to core data structures, algorithms or architecture
  • Changes to CI, release scripts or dependencies
  • Changes to the review criteria themselves

If a change touches several areas, all of their criteria apply and any escalation wins. Agent approval is one input alongside the CI checks, never a replacement for them, and it reruns on every new commit.

A stricter variant asks a model to label every agent-authored change low or high risk and requires two human reviewers for high risk. Expect a large share to be labeled high risk at first and expect shipping to slow for a while. That cost is worth accepting on purpose.

A practical tip: split the rubric. Running one prompt per review criterion gives better assessments than a single "review this" prompt.

Risk tiers: review, required evidence and size cap by path
TierExample pathsReviewRequired evidenceSize cap
T0 criticalAuth, payments and billing, database migrations, secrets and IAM, CI and release, dependency manifestsArea owner plus a second senior reviewer, both humanTests, a manual or production-like run, and a rollback planAbout 200 lines of non-test code
T1 coreCore libraries, public APIs, data modelsOne human area owner, after an agent pre-reviewTests run, plus what was not verifiedAbout 400 lines
T2 standardProduct features, internal toolsAgent review, plus a skim by the human ownerTests runAbout 600 lines
T3 lightDocs, test-only changes, examplesAgent approval is enough; the human author still owns itCI greenSoft cap

A change that touches more than one tier takes the strictest one.

Rule 4: size caps

A change too big to review gets rejected and split, not skimmed. Automatic approval should refuse anything above a size or risk threshold.

Stacks of small changes work well with agents. A feature can land as about ten small changes behind a flag, each reviewable in minutes.

Count non-test lines separately. A diff of 2,700 lines may be 250 lines of code plus tests. Report both numbers so reviewers know what they are signing up for.

What to measure

  • Revert rate, overall and by tier.
  • Defects that reach production, meaning incidents linked to a change.
  • Time to merge, and time to first review.

Set one guardrail before you loosen review: no increase in the revert or incident rate. Before switching anything on, replay old changes through the new process and check two things. Would it have approved the changes people approved? Would it have escalated the ones that were later reverted or caused regressions? Rerun that check whenever the criteria change.

Treat the policy as a living process. Turn it on, expect gaps, and when something slips through, update the criteria in the open.

Review time is also the largest cost in agent-assisted development. The arithmetic is in What does a coding agent cost per workflow, and how do we measure it?

Takeaway: a one-page review policy

  1. Every change has a named human owner who merges it and answers for it.
  2. Every change states what was run, what passed and what was not verified.
  3. Review depth follows the risk-tier table. The strictest tier touched wins.
  4. Changes over the size cap for their tier are split, not reviewed.
  5. Changes to dependencies, CI, the secret scanner and the review criteria always escalate to a human.
  6. Track revert rate, production defects and time to merge every month. If reverts or incidents rise, tighten review again.

About Deftpace

Deftpace helps engineering and operations teams put agents to work without lowering the bar. Kevin Dawkins runs workshops on setting review rules like these with your own repos and tools. Email hello@deftpace.com.