SkyWaysThe agentic manual

How to review AI-generated code: by risk, not by diff size

The policy is the bottleneck, not the people. Two readers on a money tool, one on a reversible write, none on a read-only change, and a count of what escapes.

6 minutesIntermediateLesson 5 of 13Updated By

On this page
  1. Sound familiar?
  2. Why review by risk?
  3. Change the policy, step by step
  4. Where you'll use it
  5. Why it matters
  6. Try it
  7. Key takeaways
  8. FAQ
  9. Apply it in your role
  10. Sources and credits
All lessonsStart here

Getting started

  1. What is the agentic PDLC?
  2. How this tutorial works

Agentic PDLC fundamentals

  1. The evolution of the PDLC
  2. Why agentic AI projects fail
  3. P0 · Frame
  4. P1 · Design & Spec
  5. The one hard gate
  6. P2 · Build & Prove
  7. P3 · Run & Learn
  8. The eight loops
  9. The evidence pack

Methods decoded

  1. AI-DLC vs AIDD vs agentic SDLC
  2. What is AI-DLC?
  3. What is AIDD?
  4. What is the BMAD Method?
  5. What is spec-driven development?
  6. One lifecycle for every method
  7. How much process a change needs

Running delivery

  1. How to run an agentic AI project
  2. Bolts vs sprints
  3. A board for agentic work
  4. Cut delivery from months to weeks
  5. Review AI code by risk
  6. How accurate must an agent be?
  7. Prove the agent meets its bar
  8. Shadow mode and cut-over
  9. Why the AI bill is 4× the estimate
  10. Guardrails that hold
  11. The five governance gates
  12. Catch AI drift
  13. AI incident postmortems

By role

  1. For product managers
  2. For program managers
  3. For solution architects
  4. For engineers
  5. For forward-deployed engineers
  6. For QA
  7. For DevOps and platform
  8. For business sponsors
  9. For executives

Teams and organisation

  1. Team structure for agentic AI
  2. Measuring AI productivity
  3. The maturity model
  4. Rolling it out in 90 days

Practice

  1. The SkyWays case study
  2. The operating rhythm
  3. The workbench
  4. Twelve exercises

Interviews and careers

  1. What is an FDE?
  2. Six answer frameworks
  3. AI PM interview questions
  4. FDE interview questions
  5. GenAI engineer questions
  6. Agentic engineer questions
  7. AWS GenAI questions

In short

Review AI-generated code by the risk band of the most dangerous thing a change touches. That is two named readers on money, identity or policy, one reader on a reversible or hard-to-reverse write, and the harness alone on read-only changes. Enforce the band with a path rule nobody sets for their own work, and report three numbers monthly so the policy survives: slots needed, days in the queue, and escapes from the no-reader lane.

Review by risknever by diff sizeA changeThe most dangerous toolor path it touches?R4 · R5two named readers, every timemoney, identity, policy, irreversibleR2 · R3one reader, after the harnessa write, reversible or hard to reverseR1the harness alone, escapes countedreads onlyFour hundred lines of help text cannot move money; three lines in a refund cap can. The band decides the readers.

Review by risk never by diff size

A change

The most dangerous tool or path it touches?

  • money, identity, policy, irreversibleR4 · R5two named readers, every time
  • a write, reversible or hard to reverseR2 · R3one reader, after the harness
  • reads onlyR1the harness alone, escapes counted

Four hundred lines of help text cannot move money; three lines in a refund cap can. The band decides the readers.

In this lesson you'll learn:

  • how to measure a review queue, and why capacity is not the lever;
  • how to band every change by what it touches, and enforce the band with a path rule;
  • how to open a no-reader lane safely, and the three numbers that keep the policy alive.

Sound familiar?#

  • Nine pull requests, a four-day queue, and two senior reviewers who cannot read any faster.
  • A one-line change to a payment limit got one quick approval because it was small.
  • The review that happens is a scroll to the bottom and an approve.

The policy treats every change as equally dangerous. Agents produce changes faster than people can read them, so a policy that ignores risk will always produce a queue.

Why review by risk?#

When agents write most of the code, reading becomes the scarce resource. Hiring a reviewer takes months; the agents will produce more changes long before then. So the only lever you control is how much reading each change needs, and the size of a diff is the wrong way to decide it. A one-line change to a refund cap is the most dangerous change of the week; a large refactor of a read-only report may be the safest.

Change the policy, step by step#

Step 1 · Measure the queue#

Queue time = review slots needed ÷ review slots available per day. Count slots, not pull requests: a change needing two readers takes two. Measure slots available from reviews actually completed over the last four weeks, not from a job description. At SkyWays, nine changes on a two-senior-reviewer policy needed 18 slots against 4.5 a day: a four-day queue.

Step 2 · Band every change by what it touches#

Give every tool and path a band from the authority budget (R1 read-only, R2 reversible write, R3 hard-to-reverse write, R4 money, R5 irreversible) and let a change inherit the band of the most dangerous thing it touches. No band is ever decided by the size of a diff.

R1search_flightsread onlynothingR2draft_messagereversibleone readerR3rebook(...)hard to reverseapprove firstR4issue_refund(≤400)moneynamed approverR5change_identityirreversiblenot delegatedR1search_flightsread onlynothingR2draft_messagereversibleone readerR3rebook(...)hard to reverseapprove firstR4issue_refund(≤400)moneynamed approverR5change_identityirreversiblenot delegated
The band belongs to the tool. A change inherits the band of whatever it touches.

Step 3 · Put the band in a path rule nobody sets for their own work#

Generate a rule file in the repository (a CODEOWNERS file, for example) from the authority budget, so the band of a change is decided by the paths it touches, not by the author. Self-assessed risk is not a control.

Step 4 · Route the readers by band#

BandReadersWhat the reader is for
R4 · R5Two, namedThe authority: does this change what the tool may do, or the limit it may do it to?
R2 · R3OneCorrectness and blast radius, after the harness has already run
R1NoneThe harness alone

At SkyWays routing cut the slots needed from 18 to 7 and the queue from four days to 1.6, with the same people reading at the same speed.

Step 5 · Open the no-reader lane, and count the escapes#

A lane with no reader is exactly as safe as its harness, so count the escapes (defects that reach production through it) every week. Zero escapes over n merges bounds the escape rate at about 3 ÷ n (the rule of three): 3% after 100 merges, 1.5% after 200. Write the lane's charter before opening it, including the condition that closes it, and close it on the first escape.

Step 6 · Report three numbers, monthly, together#

Report review slots needed, days in the queue and escapes from the no-reader lane, and report the escape count even when it is zero. Any one alone can be argued with; together they answer whether you went faster without going blind.

Where you'll use it#

  • As an engineering lead, the week the queue passes two days.
  • As a programme manager, reading the review queue off the board every week.
  • In a security or audit review, where the path rule shows that money changes can never skip two readers.

Why it matters#

Adding reviewers is slow and does not scale with agents. Changing the policy takes an afternoon and cuts most of the queue, while raising the scrutiny on the changes that can actually do harm.

Try it#

This week's changes: three touch only report queries; four change reversible write tools; two change the refund tool. The current policy is two reviewers on everything, and the team clears 4 slots a day. What is the queue now, and after routing by band?

Show the answer

Now: 18 slots ÷ 4 = 4.5 days. Nine changes × two readers. After routing: 8 slots ÷ 4 = 2 days. The three read-only changes need none, the four reversible writes need one each, and the two refund changes keep two each: 0 + 4 + 4 = 8. The refund changes lose nothing; the queue halves.

Key takeaways#

  1. Reading is the scarce resource: measure the queue in slots, and change the policy, not the headcount.
  2. Band by what a change touches, enforced by a path rule: two readers on money, one on writes, none on reads.
  3. Count the escapes, and report slots, queue days and escapes together every month.

FAQ#

How do you review AI-generated code?#

By risk. Band each change by the most dangerous tool or path it touches, and route readers by band: two named readers for money, identity or policy; one reader for other writes, after the automated harness has passed; the harness alone for read-only changes, with defects that escape counted weekly.

Should AI-generated code be reviewed differently from human code?#

The same risk rules apply to both. What changes is volume: agents produce more changes than people can read line by line, so a policy that reviews everything equally creates a queue, and a policy that reviews by risk keeps scrutiny where the harm is.

Is it safe to merge code without a human reviewer?#

For read-only, low-risk changes, only as safe as the automated checks that gate the merge, which is why the no-reader lane needs a written charter, a weekly count of escaped defects, and a rule that closes it on the first escape.

What is the rule of three?#

A statistical rule of thumb: if you have seen zero failures in n independent trials, the failure rate is below about 3 ÷ n with 95% confidence. It is how you state what zero escapes through a no-reader lane actually proves.

Apply it in your role#

If you are…Do thisThe AI-augmented shortcut
A forward-deployed engineerAgree the review bands with the customer's security team early. Their sign-off on the path rule is worth more than any number of reviews.Ask a model to generate the path rules (CODEOWNERS) from the authority budget.
A product manager or FDPMWatch the queue in days. When it grows, the policy is the bottleneck, not the people.Have a model compute slots needed and queue days from the open pull requests.
A GenAI or agentic AI engineerKeep each change in one band. A pull request that touches a money path and a label is reviewed at the money band.Ask the coding agent to split mixed-band changes before it opens them.

Across the enterprise. The lane with no human reader needs a written charter and a weekly count of escaped defects across teams. That data is what lets you widen it safely.

The ten-minute workflow. Review routing, generated from what the tools may do:

Here is our authority budget: <tools with risk bands R1 to R5> and our repository layout: <tree>. Write a
CODEOWNERS file that sends R4 and R5 paths to two named owners, R2 and R3 to one, and leaves R1 to the harness.
List any path you could not place, and any file that serves more than one band.

Sources and credits#

IdeaOriginSource
Risk bands, routing by band, the no-reader lane and the three numbersOriginal: this manualHow to review by risk band
Queue time = slots needed ÷ slots per dayBorrowedLittle, J. D. C. (1961). Operations Research 9(3)
The rule of three for zero observed failuresBorrowedHanley, J. A. & Lippman-Hand, A. (1983). If nothing goes wrong, is everything all right? JAMA 249(13)
Code owners as a path ruleBorrowedGitHub Docs. About code owners
The SkyWays queueIllustrative: a fictional airlineTry the queue calculator

Prefer GitHub? This track is on the wiki, and this lesson is markdown. Found a mistake? Edit this lesson, or say so.