What should be in place before AI coding agents merge code?
4 min read
›Contents
- 1. Tests the agent cannot talk its way past
- 2. Gates that hold agent-written changes to those tests
- 3. Instruction files that carry your conventions
- 4. Small changes
- 5. Review rules that match
- 6. A pipeline that ships small changes often, with a safe way back
- 7. A spend budget, and numbers
- What not to do first
- How to see where you are
The short answer: seven things. Tests the agent cannot talk its way past, with a coverage floor enforced in CI. Gates that hold agent-written changes to those tests. Instruction files that carry your conventions. Small changes. Review rules that match. A pipeline that ships often and has a safe way back. And a spend budget, with numbers to tell you whether any of it works. Put these in before you hand agents more of the work, not after.
These are the guardrails the Kelright Agentic Guild installs in a team's repository and CI. Here is why each one is on the list.
1. Tests the agent cannot talk its way past#
An agent can make a failing test pass. The question is whether it makes the code right or the test quiet. A suite you can lean on, brought to a coverage target you have agreed and enforced in CI, is what turns "the agent says it works" into "the pipeline says it works".
The check that closes this step is plain: coverage reported in CI meets the target, and a change below the floor cannot merge. In the Guild this is milestone M2, the test harness, and it runs in weeks three to six.
2. Gates that hold agent-written changes to those tests#
A gate is a check a change must pass before it merges. Three are worth having for agent-written code:
- a coverage floor, so coverage cannot quietly fall;
- a required test on an agent-written change, so new behaviour arrives with its proof;
- a limit on change size, so a human reviewer can still read what they approve.
The point of a gate is that it holds without anyone watching every change. That is what makes it possible to accept work you did not see being done.
3. Instruction files that carry your conventions#
Agents read the repository. Agent instruction files put your conventions where they will be read as the agent works: how the code is organised, what to run before opening a pull request, what never to touch. Without them, each agent session rediscovers your conventions, or guesses.
4. Small changes#
Review is where agent output piles up, and large changes are where review stops being real. Keeping changes small, by gate and by instruction, keeps each one something a person can understand. It also keeps the blast radius of any single mistake low.
5. Review rules that match#
Branch protection and review rules should say who must look at what. If agent-written changes to a sensitive area need a second reviewer, make that a rule the system enforces, not a norm people remember. Where the rule comes from a decision your company made, the Brain can hold agent work to it, and a change that passes every test can still be held until the second reviewer has looked.
6. A pipeline that ships small changes often, with a safe way back#
Agents produce many small changes. A slow pipeline turns that into a queue; a pipeline with no safe way back turns each merge into a risk. The check here is measurable: pipeline time, typical and slowest, and deployment frequency meet targets you set. In the Guild this is M3, CI and delivery, in weeks five to nine.
7. A spend budget, and numbers#
Agent work has a cost, and it should sit inside a budget you chose. Whether the budget is well spent is a measurement question: AI spend per merged pull request, alongside cycle time and rework for agent-assisted work against the rest.
That needs a baseline frozen before you change anything. Without one, you cannot tell whether the guardrails helped. How to measure whether agents are working.
What not to do first#
Do not hand agents more of the work before the checks exist. When agents go up before the checks do, you get output outrunning the checks: more code than the tests and reviewers can verify, and review as the place it piles up. If that is where you are, tighten the gates first.
How to see where you are#
The Agentic Readiness Check takes about six minutes and tells you which of these your team has and which to look at first. If you would rather have the install done to a fixed scope, with each milestone accepted by a check in your own systems, that is the Guild.