How AI agents build, test, and review code
Josh Arnold, CTO of BetterEngineer, on how his team takes a ticket to a pull request. Agents do the building. Rules in code decide the path, and automated checks send a failure back to be fixed before a person reviews it. An engineer still approves what ships. In the early run he reports, about 40% of tickets passed with no one in the loop.
- Tickets with no person in the loop
- 40%
- Quality gates before merge
- 16
- New tickets from one night of observation
- 15
Read the transcript
Introduction to The Software Factory
Josh asks who in the room is already running something they would call a software factory. He is speaking in the same territory as the talk before his, and says a lot of those findings match what BetterEngineer has seen.
Combining AI automation and human engineering
Engineers still drive the code. His read of common practice is that no more than about 30% of the work is fully automated. The factory and the people should not be two separate systems. Whatever the factory does, the engineers should do the same thing, and an improvement on one side should show up on the other.
Why AI agents need deterministic workflows
Leaving every decision to the model produces mistakes and missed context, and a bigger rule set makes important pieces easier to skip. The factory makes routing decisions in code, then sends the work to a specific agent based on what is changing. The code routes the models.
Human-driven and AI-driven engineering workflows
Both paths start from a spec. A developer uses a skill that turns the work into a formal spec. The factory does the same. The paths split at one step. On the developer side that step is a loop he calls No Mistakes: an agent walks a series of rules and checks. The goal is to catch bugs before a pull request, not after it is up for review. The factory runs the same checks and the same mechanical gates. Improving one path should improve the other.
Automated verification and self-correction loops
A series of checks runs, and any failure sends the work back to the previous step to be fixed, then back through the check. Those checks are enforced in code, not by trusting an agent to say the work is fine. The loop stops after three tries. If it is still failing, it is flagged for a person, and the fix is meant to be baked into the next run.
From production issues to automated software development
The intake point is a Linear ticket. The first use case is Sentry on production: a Sentry issue becomes a Linear issue, the ticket is enriched, the factory tries to reproduce it, and then it starts building a fix. They are keeping the automated work on smaller changes. Developers still take a large feature and build it. The factory is not handed an entire feature and told to start from scratch.
The complete Software Factory workflow
A ticket sits in Linear, then moves through intake, triage, and a plan that becomes an OpenSpec. When a change is more complex, a tool he calls Lavish builds a document of the unclear decisions, and sometimes a set of interface options, so a person can pick and send that choice back. Developers have that through Claude Code. The factory hosts the same step for each ticket that needs it.
Human oversight and autonomous deployment
This is not a box where you drop a request and it ships to production. People still join at some stages. Planning and review are still human. The next step is to find low-risk changes that can go from zero to production, mostly production fixes where the team is confident in the fix and no human review is required.
AI model costs and scalability
Asked about token cost, Josh says it does not register at their current size, so they are not breaking it out. They still use frontier models. If cost became a problem they could move to cheaper models or self-hosting. For now they would rather spend the attention on the workflow. A larger team would have to treat cost differently.
The 16 quality gates for AI-generated code
He walks through 16 gates. One example is duplicated code: a check looks for a copy of code that already exists elsewhere and sends it back so the agent can reuse what is there, or flags it if touching the other code would add risk. The agent can also decide whether a cleanup is safe to do now or should go to a person.
Repository-specific rules and engineering standards
The factory is its own repo and its own product. The rules live in the repo being built. It builds itself and the main company repo, and those repos do not share the same quality checks. When the factory picks up a repo, it loads that repo's agent instructions and the verification rules. The point of the rules is that an AI does not get to choose the path. A person defines how it works, and then the work is handed to an agent inside that structure.
Agentic workflows and automated review loops
The loop is heavy and can take a while. Nobody is supposed to sit and refresh. You put work in, it runs, and it either merges or lands in a queue. It is meant to be hands off. If verification fails, the work goes back. If it passes, it moves to the next gate. The structure says what the agent can and cannot do.
Separating AI coding and review agents
The agent that finds a problem is not allowed to fix it. It sends the finding back, and a different step fixes that specific issue from a clean start, so the model does not get muddled by working the same issue over and over. The reviewer has a small tool set. It cannot get creative and route around the system. Its job is to say the check worked or it did not.
Improving the system beyond prompt engineering
When something breaks, the move is not to keep tuning the prompt. The next time that case appears, it should be guaranteed by a check in code.
Early results and automation metrics
The numbers are a starting point. About 40% of tickets pass with no human involvement. About 21% fail something and go back through the flow once. About 15% go back twice. Each of those cases is a chance to change the flow so it does not happen the same way again. Duties stay strict: one step can do one job.
Industry examples of AI software factories
He points at published write-ups from larger teams. Stripe's custom factory, he says, is on the order of 1,300 pull requests a week. OpenAI published Symphony as a public proof of concept: a detailed spec that an AI then built in about 20 languages, including Rust, Go, and TypeScript. He treats that as a demo of how someone could build their own factory, not as a finished product.
Next steps: automated merging and deployment
The next piece is auto-merge for a low-risk change, straight to production. He also wants to run changes to the reviewers back across earlier runs, to see whether a new reviewer would have done better.
AI agent observability and continuous improvement
They had just turned on a tool called Halo. It watches every run through the factory, including reviewer agents loaded from the other repo, saves that record, and once a week sends it for an analysis of how the prompts could have done better. The pitch he is using it for: fixing one failure by hand tends to overfit that one case and break another. Halo groups a few hundred cases so the change is aimed at a type of problem. One overnight run produced 15 new Linear tickets. Nothing in that loop merges itself yet.
How AI enables small engineering teams to think bigger
On a small team he would previously have turned down a project to build self-improving agents. They stood it up quickly, it ran overnight, and the 15 tickets were waiting in Linear. The idea is that a small team can take on work that used to be reserved for a group with a specialist.
The risks of fully autonomous software deployment
He asks the room how anyone who auto-merges to production with no human keeps a fail-safe, so a bad pattern is caught before it has been shipping for two weeks. He wants that conversation.
A finding from the observation run
He shows one Halo finding: the tool read the instructions, stated what it found, and proposed a change. There were 15 of those from the night before. He expects that volume to start high and then drop as the checks absorb the repeated cases.