Don't Automate a Loop That Makes Slop
Before you build a software factory, fix the inner loop. Automation multiplies whatever one agent session already produces, good or bad.
This is the build order: foundation, then framing, then wiring and inspection, and only then do you move in. Most teams I talk to want to start with move-in.
The pitch for agent automation is easy to like. Agents pick up issues, write the fix, open the pull request, and merge it while you sleep. I run a few of these. One sweeps my test suites and files issues with a diagnosis. Another turns failures into pull requests. A third drafts outreach for a person to send. I merge on green without reading every line.
That only works because of the boring work underneath. The most common mistake I see is building the automation first.
Automation multiplies the inner loop
The inner loop is one agent session: you ask for something, the agent writes code, you look at it, you correct it. The outer loop is everything that runs that session for you: schedules, queues, bots that file and fix and merge.
The outer loop doesn't improve the inner one. It runs it more often. If a single session produces code you'd send back half the time, a hundred unattended sessions produce fifty pull requests you'd send back, and nobody is there to send them back. So you add a review agent to catch the first agent's mistakes, then a third to arbitrate. It gets expensive fast, and the code doesn't get better.
If a single session reliably produces code you'd merge, the outer loop is easy. You barely have to build anything.
Build it in order
The order that has worked for me follows the house.
- Foundation: turn corrections into checks. Every time you correct an agent, ask whether that correction can be a lint rule, a type, or a better API. Prose rules get followed most of the time. Checks get followed every time. Then clean up the patterns agents copy. A new lint rule stops new violations, but the old ones are still in the codebase looking like the right way to do things. More in Your Codebase Is the Biggest Prompt.
- Framing: make green mean something. A passing check proves what the tests cover, and when an agent wrote both the code and the tests, that can be very little. Kill flaky tests, because a test you rerun until it passes tells you nothing.
- Wiring and inspection: make verification strong. The agent should run the app, exercise the change, and bring proof: a test that failed before, screenshots, a recording. More in Review the Evidence, Not the Diff.
- Then move in. By now most of what you'd check in review is checked by the machine, and the outer loop is mostly plumbing.
Steps one through three are the factory. The automation is the last few percent.
What it looked like when I skipped ahead
My bots went on timers before their inner loop was solid. Each pass was a Claude Code session reading a long skill file, and the skill file was where every correction went. A bot did something wrong, I added a paragraph. Within a few months the largest skill file was thousands of lines, and every pass loaded all of it before taking a single step.
None of those paragraphs were checks. The bots followed them most of the time. The failures that remained were the expensive kind, the ones nobody sees until later: an eval step that reported success while failing for weeks, a rule about rerunning a failure once that the model applied from memory.
The fix wasn't a better bot. It was going back down the house: fixed sequences moved into scripts, gates became commands that fail closed, results became records checked against a schema, and the evals were built from the incidents that had actually happened. The timers stayed the same. What they ran got better.
How you know it's working
Velocity is the obvious number, and the least useful on its own. Anyone can open more pull requests. The numbers that tell you whether the foundation is holding:
- Revert rate. If it climbs as volume climbs, you're shipping slop faster. A healthy foundation keeps reverts flat, around half a percent, even as pull request volume goes up by orders of magnitude.
- Performance over time. Bad patterns compound into slowness. If startup time and the core interactions get faster while volume goes up, the codebase is getting healthier.
- Who can contribute. When the guardrails are in the code, someone with little context can land a good change, because the build tells them what's wrong.
- What review looks like. If reviewers still hunt for the same mistakes every week, those mistakes should be checks.
- How much prose is left. The rules file and the skill files should shrink as checks replace them. If they keep growing, corrections are landing in the wrong layer.
What becomes possible
Once the foundation is there, ambitious automation stops being risky. A release goes out, and an agent uses the new build like a real person would, files every bug it finds, opens a fix for each, and merges the fixes that pass. That sounds reckless. It's reasonable when pull requests in your codebase are good by default, because the codebase makes the wrong thing hard and verification catches the rest.
I don't think the job of a software engineer is writing code anymore, or even reviewing it. The job is keeping quality high while output goes up by a couple of orders of magnitude. Most of that work happens in the codebase and the checks, long before any bot runs on a timer.
Fix the loop, then put it on a timer. In the other order, you get slop on a timer.