How much of your code should an agent write?
Leaders ask us this a lot. Developers ask it too, usually with a worried look. How much of our code can agents write before things break?
You will find a tidy answer online: 25 to 40 percent. Our own repository is far above that number, and it still works. This post explains why, and how to find the right number for your team.
What the 25-40% band says
MetaCTO is a development consultancy. It says an optimal band is 25 to 40 percent AI-generated code per team. Above that band, it says, review burden outweighs the gain. MetaCTO sells AI-adoption advice, so read the number with that in mind.
Other sources point the same way. Anthropic’s 2026 Agentic Coding Trends Report describes a “delegation gap”. Developers use AI for about 60 percent of their coding work. They can hand off fully only 0 to 20 percent of tasks without review. Anthropic sells the models that CodeHerder orchestrates.
Faros AI studied 22,000 developers in 2026. It found that median pull request review time rose 441.5 percent. Faros AI sells engineering-analytics software, so a slow review pipeline helps its sales case.
All three sources agree on one thing. The cost does not come from writing code. It comes from reading it.
Our number
We build CodeHerder with CodeHerder. So we can measure our own share.
In October 2026, the first-parent history of the Core main branch held 7,738 commits. Of these, 7,547 were merges of agent task branches. That is 97.5 percent.
You can repeat the count in a full clone of the Core repository:
git log --first-parent --since=2026-10-01 --until=2026-11-01 \
--format=%s main | wc -l
git log --first-parent --since=2026-10-01 --until=2026-11-01 \
--format=%s main | grep -c "Merge branch 'task/"
Read this number with care. It does not say “written by AI”. A person files each task. A person can approve each one. The number says that the work arrived through an agent task branch.
It also does not say that 97.5 percent is right for you. We think code share is the wrong thing to limit.
The limit is review capacity
Think of a team that reviews every line by hand. Each new agent adds more changes for the same few reviewers. Review time grows. At some share, the queue wins. That is probably what the 25-40% band measures.
We do not ask a person to read every line. Review is a stage in the workflow, and the server enforces its gates. Our one human check is an approval on the git host before merge.
Four things replace line-by-line human review. Stage gates stop a task from skipping from code to merge. Each stage has an exit rule. The others are:
- A review agent. It reads the task first, then the change. Review reads the task explains why that order matters.
- Recorded check results. The agent runs tests, lint and type checks in its own sandbox. CI on the git host runs them again. A workflow can mark a check as required. Then the server holds the task until a pass is recorded. Each result names who recorded it. See Verification for the full list.
- One human approval on the git host. Protect the main branch and require one approval. The agent that wrote the change cannot give it. A custom workflow can also add an approval gate inside CodeHerder, on the Starter plan or higher. Who approves the agent’s work? has the details.
Only the last step needs a person, and you need only one approval per change. The rest of the review work moves from tired readers to rules that run every time. So the share can rise and the queue stays short.
What it costs
This is not free. Gates catch problems, and catching a problem costs money.
We measured one week of stories, from 21 to 27 September 2026. The sample holds 355 stories. The method is in the published cost sample, and npm run cost:sample in the marketing folder rebuilds it.
| Outcome | Share of stories | Mean cost |
|---|---|---|
| Clean run, no gate fired | 60.8% | $9.02 |
| Sent back before merge | 35.5% | $26.55 |
| Sent back by verify after merge | 1.1% | $19.74 |
A small group was sent back both before and after merge. It is 2.5 percent of stories, at a mean cost of $70.32.
A story that a gate sends back costs about three times more than a clean one. That is the price of the gates. We pay it because the other option is a person finding the same problem later, in production. The anatomy of an $8 feature shows where the money goes in a clean run.
This is one workspace over one week. Your numbers will differ.
Find your own number
Do not pick a percentage. Measure three things.
- Review wait. How long does a finished change wait for a reviewer? Write down the median.
- Sent-back rate. How many changes come back after review? A high rate often means the brief is weak, not the code.
- Escapes. How many changes cause a problem after merge? Count them for one month.
If the wait grows, you have reached your limit. More agent output will not help. Move one kind of check into a gate first. Then raise the share again.
A leader can ask a team for these three numbers without reading any code. A developer can pull them from the git host in an afternoon. Both people then talk about the same facts.
Agents also make mistakes that gates do not catch. See when agents get it wrong for real examples. The goal is not zero mistakes. The goal is to catch them before a customer does.
A two-week pilot
Do this with one team and one repository.
Week one
Choose a small, low-risk kind of task. Write each brief with an acceptance list. Let agents do all of it. Record the three numbers above.
Week two
Add one gate that replaces a manual check. Raise the number of tasks. Record the three numbers again.
At the end, compare the weeks. If review wait stayed flat and escapes did not grow, raise the share. If not, fix the gate first.
The rollout guide has the full plan for a two-week pilot. To see how we run our own herd, read built by the herd.