Field Guides / Set up coding agents with review gates

Setup guide · last checked December 2, 2026

Set up coding agents with review gates.

Let agents write the code, and let tests, CI and a few written rules decide what merges.

For small software teams starting to use coding agents. It is how I run my own repositories, where agents write most of the code and I review what matters. It works with any agent that reads files in your repo and opens pull requests, and the examples use GitHub because most teams do.

Step 1

What changes

Writing code stops being the slow part. Reviewing it, and knowing it works, takes its place.

Step 2

Put the rules in the repo

An agent starts each session knowing nothing about your project. A rules file it reads every time is how it learns.

Most agents read a Markdown file at the root of the repo. AGENTS.md is an open format used by over 60,000 open-source projects, and GitHub Copilot reads it, with the nearest file in the directory tree taking precedence (GitHub Docs). Some tools use their own name, such as CLAUDE.md for Claude Code (Claude Code docs).

Step 3

One task, one branch, one pull request

Size each task so a person can review the result in one sitting.

Step 4

Make CI the gate

Nothing reaches the main branch except through a pull request whose checks passed.

Step 5

Decide what an agent may merge

Not every change needs a person, and some always do. Write the line down before the first pull request.

ClassExamplesWho merges
RoutineTests, docs, a bug fix with a failing test, a refactor with no change in behaviour, patch-level dependency updates.The agent, once every required check passes.
SensitiveSign-in and permissions, payments, data migrations or deletion, CI and deployment config, public-facing copy, major dependency upgrades, and the agent’s own rules and permissions.A person, after reading the diff.
DecisionA new feature outside the product’s scope, pricing, anything users can’t undo.Nobody builds it until a person decides.

An example split, not a standard. Start stricter than you think you need, and loosen a class once its record earns it.

Step 6

Memory and handoffs

Sessions end. The work has to survive them.

Step 7

Secrets and permissions

An agent can do whatever its tokens allow. Give it less.

Step 8

Measure cost and quality

Decide with numbers, not with how fast it feels.

Setup checklist

Twelve things to be able to say before agents merge anything on their own.

  1. Rules. A rules file in the repo says how to build, test and verify, and what the agent must not touch.
  2. Verify. One command runs every check, and it passes on the main branch today.
  3. Tests. A bug fix starts with a test that fails before the fix.
  4. Tasks. Each task fits one branch and one pull request a person can review in one sitting.
  5. Parallel. Parallel sessions each work in their own branch and working folder.
  6. Gate. The main branch takes changes only through pull requests whose required checks passed on an up-to-date branch.
  7. Classes. Written risk classes say which changes an agent may merge and which wait for a person.
  8. Owners. Sensitive paths have named owners whose review is required.
  9. Handoffs. Every session leaves what changed, what it checked and what is left in the pull request or ticket.
  10. Tokens. Agent tokens reach only the repositories and permissions they need, and they expire.
  11. Secrets. Pushes that contain credentials are blocked before they reach the repository.
  12. Measure. Cost per merged change and the change fail rate are reviewed every month.

On paper: the printable checklist has these twelve lines with space to sign each one off.

Honest limits

What this setup won’t do, so nobody is surprised.

If you’d like this set up on your repository, with the rules, CI review and a walkthrough on your own code, that is my Agent Workflow Setup.

Sources and method

Written by Matthew Bonham with AI drafting assistance. Every fact on this page links to its source, and the sources below were last checked on December 2, 2026. The steps, risk classes and checklist are my recommendations from my own work, not a standard or any vendor’s guidance.

No affiliation with any project, vendor or agency named here is implied. Spot an error or an out-of-date detail? Tell me.