# A review that learns from its own findings

Table of Contents

In the first post, I noted that tests written in the same session as the feature code share the same blind spots. Code review has the exact same problem.

Asking an agent to “check your work” at the end of a long session is like reviewing your own pull request. It knows what it meant to write, so that is what it sees. To catch real issues, fresh agents that never saw the code being built must review every change before it ships.

Two reviewers, two questions

When a change is ready, the builder agent spawns two fresh reviewers. Each gets a short brief, the commit list, and read access to the repo, with zero context on how the code was written.

Each reviewer focuses on one question:

  • Does it do what was asked? This reviewer compares the issue against the diff, hunting for missing requirements, altered behaviour, or unrequested changes.
  • Does it follow the rules? This reviewer checks the diff against project rules and senior engineering standards: duplicated logic, misleading names, bloated functions, and premature abstractions.

Every finding includes the file, line number, what is wrong, and why it matters. Keeping these two questions separate stops functional checks from crowding out code quality.

The reviewers don’t get the last word

Reviewers occasionally flag false alarms. The builder agent checks each finding against the codebase, dismissing false positives with a written explanation. Zero findings is also a valid outcome.

The review then ends with one of three verdicts:

  • FAIL: A requirement is missing or a rule is broken. The agent fixes it and reruns the full review on the new version.
  • PASS with notes: Only minor remarks or judgement calls remain, which are listed for me.
  • PASS: Nothing left to fix.

Only a pass on the exact commit being shipped counts. Green CI is not a verdict.

Last week, a change allowing the app to run without an optional module earned a “PASS with notes”. The reviewers caught three issues:

  • The fallback rule for a missing module was duplicated in five places.
  • The frontend and backend interpreted the missing value in opposite ways.
  • A method was named the exact opposite of what it returned.

None of these broke a test, yet all three would have caused headaches later. One practical tip: settle your scope before the first review. Fixing things after a review triggers another full round with both reviewers, so finding all affected callers upfront saves cycles.

When a finding shows up twice

Fixing a finding solves it once. When the same mistake happens twice, I want it solved permanently without relying on a reviewer to catch it again.

For any repeated finding, the review proposes an automated check as an issue for me to approve, always picking the strongest possible enforcement:

  1. An architecture test that fails the build across the codebase.
  2. A strict type that makes invalid code impossible to compile.
  3. A hook that blocks the agent’s file edit before it happens.
  4. A standard test covering that specific behaviour.
  5. A line in AGENTS.md, reserved strictly for human judgement calls.

Instructions are the weakest defense because agents only mostly follow them. The top four run automatically every time. For example, after a performance audit caught a resolver running 151 SQL queries on the home screen by loading rows individually, I added an architecture test that fails the build if any list resolver queries row by row. That bug can never return.

Hooks: rules the agent can’t skip

Hooks are the check I add most often. A hook is a small script that intercepts every file edit before it lands. If it spots a violation, it blocks the edit and tells the agent what to fix.

Here are a few rules from my setup:

[inTests, /\bTask\.Delay\(|\bThread\.Sleep\(/,
'A fixed delay in a test: wait on the condition instead.'],
[inTests, /\[(Fact|Theory)\([^)]*\bSkip\s*=/,
'A skipped test: fix it or delete it.'],
[isCs && !generated, /#pragma\s+warning\s+disable/,
'A suppressed warning: fix the cause.'],

Other hooks block empty catch blocks, package versions declared outside the central file, and code comments where a clearer name would work. Another hook blocks git push to main so everything goes through the ship script.

Agents don’t argue with hooks. They read the error, fix the code, and move on. I also use a counter that may only go down, to get rid of code comments: the build fails if any file gets more comments than it had. After 33 cleanup commits, the count is zero.

Where to start

  1. Review with fresh agents. A new session with a short brief, the diff, and read access beats asking the builder to check its own work.
  2. Split the questions. Dedicate one reviewer to requirements and another to code quality.
  3. Verify the findings. Dismiss false alarms backed by the code and document why.
  4. Automate repeated catches. The second time an issue appears, build an automated check instead of fixing it by hand.

If you add one thing this week, make it a hook. It takes minutes to write, runs on every edit, and never gets tired of enforcing your rules.

Grab the review skill and guard.mjs hook from shipping-with-an-agent/review, copy them into your repo, and adapt the rules.

Next: Evidence or it didn't happen

Shipping with an agent Series

Comments