blog / guides

How to review what an AI coding agent changed before you commit

A practical checklist for reviewing AI agent changes: diff per turn, spot deleted tests, new dependencies and secrets, check blast radius, run the tests, commit small.

Bettr cover: review every agent turn, with a terminal showing a turn diff and checklist

An AI coding agent can touch twenty files in a minute. Its summary sounds confident, and the temptation is to type git commit -am "agent changes" and move on. That is how a silently deleted test or a hardcoded API key ends up in main.

An agent does not know which parts of your codebase are fragile, and it will happily "fix" a failing check by weakening it. Here is a checklist to run before every commit.

Review per turn, not per day

The single biggest improvement is timing. If you let an agent work for three hours and then open git diff, you are reading hundreds of lines with no idea which instruction produced which change. Review after each turn instead: one prompt, one answer, one diff.

A simple way to get a clean baseline is to commit (or stash) before you send the next prompt, so the next diff contains only what the agent did in that turn:

git add -p            # stage what you already reviewed
git commit -m "Add invoice export endpoint"
# send the next prompt, then:
git diff --stat       # what did this turn touch?
git diff              # read it

Per-turn review loop: agent turn, diff, checklist, blast radius, test, small commit

The checklist

  1. Files you did not expect to change. You asked for a fix in the export endpoint and the diff touches auth/session.ts and the CI config? Stop and ask why. Unexpected files are the strongest signal that the agent wandered off.
  2. Deleted tests or weakened assertions. Look for removed it(...) / test(...) blocks, new .skip, assertions changed from exact values to toBeTruthy(), loosened regexes, raised timeouts. An agent under pressure to make tests pass will sometimes change the test instead of the code.
  3. New dependencies. Check package.json, requirements.txt, go.mod, Cargo.toml and the lockfile. Is the package real, maintained and actually needed? Does its licence fit your project?
  4. Config, env and secrets. Any change to .env*, CI workflows, Docker files or permissions deserves a slow read. Make sure no key or token is hardcoded "for testing".
  5. Migrations and data changes. Schema migrations, seed scripts and anything that drops, renames or backfills a column are hard to undo in production. Read them line by line.
  6. Swallowed errors. Empty catch blocks, catch (e) { return null }, || [] fallbacks that hide a failed fetch, try/except: pass. They make failures invisible.
  7. Run the tests yourself. Do not trust "all tests pass" in the agent's summary. Run the suite, typechecker and linter yourself and read the output.

A quick way to scan the diff for some of the red flags:

git diff | grep -nE '^\-.*(it\(|test\(|assert)'   # removed tests/asserts
git diff | grep -nE '^\+.*(\.skip|catch *\(.*\) *\{ *\}|except: *pass)'
git diff --name-only | grep -E 'package\.json|lock|\.env|migrations/|\.github/'

Think in blast radius

A diff shows what changed. It does not show what depends on what changed. That is the blast radius: every caller, importer and test that relies on the function or module the agent edited.

If the agent changed the signature or behaviour of formatPrice(), the three lines in the diff may look perfect while twelve call sites elsewhere now get the wrong result. To find them:

git grep -n "formatPrice("        # every call site in tracked files
git grep -n "from './pricing'"    # every importer of the module

In an editor, "Find All References" (or your language server's equivalent) does the same with better precision for typed languages. The more callers a changed symbol has, the more carefully you read and test around it.

Commit small

Once a turn passes review, commit it with a message that says what it does. Small commits give you a clean baseline for the next diff, an easy git revert and a history you can bisect. If a turn mixes two unrelated changes, split them with git add -p.

How Bettr helps with this

Bettr is a terminal for running AI coding agents side by side, and it builds the per-turn review into the pane itself.

  • Turn report. When any agent pane finishes a turn, a badge appears in the pane's title bar with what that turn changed, for example 6 files · +120 −34. The baseline is the turn, not your last commit: Bettr snapshots the repo when the agent starts working and diffs when it is done, without touching your git index. Hover to preview the card, click to keep it open.
  • Blast radius. For a repo you have mapped, the card lists what depends on the changed code ("What depends on them") and rates the reach as Blast radius LOW/MEDIUM/HIGH. It rates reach, not safety.
  • Flow warnings. If the Flow lens finds a problem in code the turn touched, such as a write without validation or an HTTP route reaching the database without auth, the badge turns red with ⚠ N issues. Send to agent, Send all and Ask agent to review this turn type a request into the agent's prompt without submitting it, so you stay in control.
  • Undo this turn. If the turn went wrong, Undo this turn returns the changed files to how they were before the turn, after backing up what is there now, so Put it back can restore it. Your commits and HEAD stay untouched.
  • Codebase map. Behind all this is the codebase map (⌘/Ctrl+Shift+K) — a symbol graph of your repo with Blast radius and Live lenses. Nothing is indexed until you click Map this repo.

It works the same for Claude Code, Codex or any other CLI agent.

Frequently asked questions

How often should I review an AI agent's changes? After every turn, before you send the next prompt. Reviewing one prompt's worth of changes takes a minute; reviewing a whole afternoon of changes at once is where mistakes slip through.

Can I let the agent review its own changes? Asking it to review is useful as a second pass, because it often catches its own slips. It does not replace your review: the same model that made a wrong assumption will tend to confirm it, so you still read the diff and run the tests yourself.

What is the fastest way to find what depends on a changed function? Run git grep -n "functionName(" for call sites and use your editor's "Find All References" for typed code. A tool with a symbol graph, such as Bettr's codebase map, can show the callers and their callers in one view.

// keep reading

CLAUDE.md, AGENTS.md, GEMINI.md: write project instructions your AI agents actually follow

Which instructions file Claude Code, Codex and Gemini CLI read, what to put in it, what to leave out, and how to keep one AGENTS.md as the single source of truth.

Git worktrees for AI coding agents: a practical guide

Two agents in one checkout will collide. How git worktrees give each agent its own branch and folder: commands, naming, env files, merging, cleanup, pitfalls.

Keep your API keys away from your AI coding agent

How API keys leak through AI coding agents via prompts, .env and MCP configs, the habits that stop it, and what to do when a key gets out.

$ bettr

Give your agents a better terminal.

Free to download. Checks for updates itself. Runs on your machine — no telemetry.

macOS

Universal — Apple silicon & Intel

.dmg · 230 MB

Windows

64-bit installer

.exe · 120 MB

Linux

x86-64 · AppImage or Debian / Ubuntu

AppImage · 158 MB · .deb · 103 MB

v1.41.1 · free · checks for updates itself