series · from legacy to agent-ready · post 1
What "Agent-Ready" Means, and Why High-Quality Code Isn't Enough
Three questions
Pick one component of a system you own. Not the whole system. One service, one module, one package. Now answer three questions about it.
Can you merge a change an agent made to it without reading every line?
Can you get that change implemented from one prompt, or does it take ten?
Can you release that change without anyone watching production?
The third one needs a word of explanation. Not watching is not optimism. It is knowing that if the change is wrong, something other than a customer will tell you, and something other than you will roll it back. Telemetry that shows the behavior the change was meant to produce, technical and business alike: not only errors and latency, but the orders, sign-ups, or payments the change was supposed to help and must not hurt. A deploy that is automated and reversible. Enough of both that an agent, or a plain alert, can spot strange behavior in production and roll back to the previous version without anyone having to step in. If the answer is "I would keep an eye on the dashboards", that is a no.
If the answer to any of the three is no, the component is legacy. Its age doesn't matter. It does not matter how high its code quality is. It does not matter that it has tests, that it shipped last week, or that the team who wrote it still sits next to you.
That is the definition this series uses, and the rest of it is the path from three noes to three yeses: from being in the loop on every change to being on the loop for most of them.
Why the usual definition stopped working
For most of my career, legacy meant one thing: code without tests. Michael Feathers gave us that definition in 2004, and it carried the industry for twenty years. I taught it in workshops. I built kata starter kits around it. I put it in a book. It is a good definition for a world where people write all the code, because the test suite is what lets a person change code without fear.
Agents changed who writes the code, and that changed what the fear and the frustration look like.
When an agent proposes a change, the fear is not "will this break something I cannot see." It is "do I have to read all of this?" An agent can produce a four-hundred-line change in the time it takes you to get coffee. If the only way to know the change is right is to read it, the agent has not saved you anything. It has moved the work from your keyboard to your eyes, your memory, and your judgment: reading every line, remembering everything that line might touch, and deciding whether it is right. All three are slower than typing ever was.
And when you ask an agent to implement a change, the frustration is not "will it understand me." It is "how many times will I have to correct it?" If every change needs a conversation of corrections, the agent didn't have the knowledge it needed. It was in your head, and you spent the conversation typing it out, one correction at a time.
And when a change ships, the fear used to be "did we test enough?" With an agent producing changes faster than anyone can test by hand, the fear becomes "will I find out from a customer?" If the only thing watching production is a person, the release rate is capped at how much one person can watch.
So the three questions are not new. They are the same questions Feathers asked, about a different author and a faster clock. Can this code be changed safely by someone who does not already know everything about it? The someone used to be the new team member. Now it is the agent.
High code quality answers none of the three
Here is the uncomfortable part. The codebases I have been asked to prepare for agents, at a large company and at a small startup, were not the worst code I had seen. Some had high code quality: good names, small functions, sensible layers, decent coverage. By the standards I spent years teaching, they were fine.
None of them passed the three questions.
In my three-day workshop on building, repairing, and evolving software with agents, which I have now run three times with three different teams, the first morning ends with a question that participants find annoying, because they have just spent an hour building a tested, working system with high code quality with an agent and are rather pleased with it:
The code quality is high, it has tests, and it is correct today. Is that enough?
No, because code quality is a property of the code, while the three questions are about what surrounds it.
Take trust. To merge an agent's change without reading it, something other than your eyes has to catch a wrong change. Tests that would fail. A contract the change cannot violate. A rule the change must follow, written down somewhere the agent can read it, and a check can enforce it. High-quality code has none of these by virtue of its quality. A beautifully named function with no test is exactly as dangerous to an agent as an ugly one.
Take the one prompt. To implement a change from one prompt, the agent needs the rules of the system, the shape of its boundaries, and the reasons behind its odd corners, all in files it can read. High-quality code makes those easier to infer. It does not make them present. The reasons, in particular, are rarely in the code, because the code records what was decided and not why. Every time an agent guesses a why and guesses wrong, you type a correction.
Take release. Nothing in the code itself, however high its quality, tells you whether its effect is visible in production, whether the deploy that carries it can be undone in one step, or whether anyone, human or agent, would notice if it misbehaved at three in the morning. Those are properties of the pipeline and the runtime, and a codebase can be spotless and have neither.
In all three cases, the checks should be deterministic wherever they can be. A test, a schema validation, a linter rule, an architecture test, a smoke test, a rollback threshold: each gives the same answer every time it runs, whoever or whatever wrote the change. That matters, because the checks are now judging work done by a model, and a model's output varies from run to run. The judge should not. Where a rule genuinely needs judgment, use adversarial review: a second agent, in a fresh context, with no stake in the change, whose job is to find what is wrong with it. And make both agents, the one that wrote the change and the one that reviews it, answer to the same deterministic checks first, so that the judgment call is the last step, on a much smaller question, and not the only one.
In the loop, on the loop, and why 80%
The destination has no industry-standard name, and the numbers people use for it disagree. The most widely shared ladder, Dan Shapiro's five levels, puts it at Level 4: you write and argue the specification, and you review plans and test results, not diffs. His Level 3 is the engineer who reviews every diff, and he notes that almost everyone tops out there. Other ladders number it differently again; Pedro's Law maps them. The numbers disagree. What does not change is where the people are. The engineer moves from in the loop, approving each change before it merges, to on the loop, supervising the system that approves it.
I define being on the loop by two numbers.
On the loop, engineers hand-write about 20% of the code. The agent writes the rest.
On the loop, engineers line-review about 20% of merge requests. The rest merge on evidence.
Those two numbers are the first two questions, turned into targets. "Merge without reading every line" becomes "80% of changes merge on evidence." "Implement from one prompt" becomes "80% of the code is written by an agent from one controlled prompt, with the agent iterating inside that prompt rather than you iterating outside it."
The third question has no percentage, because it is the condition that makes the review number defensible. You can only let 80% of changes merge on evidence if the defects the evidence misses are caught in production by something other than a customer and reversed by something other than a meeting. Without that, merging on evidence is not trust. It is hope.
I want to be precise about what being on the loop is not. It is not an agent with no one watching. Humans still own the specification. Humans still approve every change to a rule, a contract, or a decision record. Humans still read the 20% that touches something that cannot be undone. What changes is where human time goes: upstream, deciding what the system should do and how you would know, instead of downstream, reading what the agent did.
And the 80% is an average, not a quota. Inside one codebase where the team is on the loop, the spread is wide. The code that moves money, guards security, or cannot be rolled back may still be 100% written and 100% reviewed by people, on purpose. A well-fenced adapter behind a stable contract may be 100% written and 100% checked by agents. Most code sits somewhere in between. The two numbers are what you get when you add it all up, and each part sits where its risk says it should, not where a target says it must. What matters is that the team knows, for each part, which of the two it is and why.
The gap is verification, not intelligence
When a team tells me their agent "is not good enough yet" for their codebase, I ask them to try an experiment. Take the same agent, the same model, and point it at a small, well-tested library with a clear contract. It does fine. Point it at the legacy service. It flails.
The agent did not get dumber between the two. The second codebase cannot tell it when it is wrong.
This is the thesis the whole series rests on: autonomy is bounded by verification capacity, not by generation capacity. Agents can already generate far more code than any team can verify. The constraint on how much of that code you can accept is how much of it the repository and the runtime can check without you. Addy Osmani makes the same point: the safety net has to live outside the model, because the model will not supply it.
So "make the codebase agent-ready" does not mean "make the code nicer for the agent." It means "raise the codebase's capacity to verify a change without a person." The rest of this series is about raising that capacity, one step at a time.
What verification is made of
Verification has two parts, and most teams I meet have invested in half of one.
The first part makes a change judgeable. For a check to say whether a change is right, it needs a definition of right held somewhere other than the old code. Chad Fowler's Phoenix Architecture names four artifacts that together hold that definition, and I use his names. The Specification: the rules the system follows and the reasons for them, each rule with an identifier so a check can name it. The Evaluation: the checks every correct version must pass, behavior tests at a stable boundary and fitness functions, automated checks that guard the structure. Fowler's test for this one is the sharpest tool in the series: if you rewrote the system in another language, would the checks still be valid? If not, they check the implementation, not the behavior, and the agent's first real change kills them. The Context Boundary: the contracts other systems depend on, machine-readable, with one owner for each piece of data and one meaning for each term. And the Provenance: why the system has the shape it has, as decisions with the alternatives that were rejected.
Fowler's Deletion Test asks whether you could delete the code and rebuild the system from what is left. My corollary is that you need all four: keep them, and you can rebuild it; lose any one, and you cannot. In the age of agents that is also a readiness test. A codebase that passes it has written down what an agent needs to know. A codebase that fails it keeps that knowledge in people, and people become the bottleneck.
The second part makes the judgment automatic, before and after the merge. The four primitives define right and wrong. The pipeline and the runtime around them apply the definition to every change without a person: linting, formatting, and static analysis; a CI pipeline that runs every check on every change; security and dependency scanning; deployment smoke tests and automated rollback; telemetry, technical and business, that catches what the gates missed.
At Vista, I co-authored the framework that defines engineering excellence for the whole engineering organization. It grades every practice at three levels, and the levels are what matter here. At the lowest level, a check is run by hand. At the middle level, it runs in the pipeline. At the top level, the build fails when it fails.
Only the top level counts for any of the three yeses. A linter that reports warnings is advice, and an agent ignores advice, exactly as the humans before it did. A test suite that runs but cannot fail the build is a dashboard. A coverage number nobody gates on is a decoration. A rollback that needs a person is a plan. The question for every check you have is the same: if an agent's change makes this worse, can the change still ship? If yes, the check is not protecting you.
Which brings the post back to its thesis: autonomy is bounded by verification capacity, not by generation capacity. So, in one sentence: an agent-ready codebase has the four primitives written down, and every check that can be automated, before and after the merge, fails the build. The primitives make a change judgeable. The pipeline makes the judgment automatic. Neither alone gets you to three yeses.
What, concretely, has to be true under each yes for that sentence to hold is the next post. It takes the three yeses and works backward, goal by goal, to the individual steps, and the dependencies between those steps dictate the order of everything that follows.
AI amplifies what is already there
One belief from that excellence framework belongs in this post, because it is the belief behind the whole series.
AI is an amplifier. It amplifies excellence and mediocrity with equal enthusiasm. Point an agent at a codebase with a real oracle, enforced boundaries, and recorded reasons, and it produces more good code faster than any team I have worked with. Point it at a codebase with none of those, and it produces more of whatever that codebase already was, faster, with the same confidence.
This is why "just let the agent rewrite it" fails, which I come back to later in the series. And it is why the order of work matters. You do not get on the loop by adopting a better model. You get there by building, one step at a time, the verification that lets any model be trusted.
I spent the first part of my career doing that by hand: seams, characterization tests, contracts, decision records, one component at a time. I now do it with agents doing most of the typing, and the steps are the same. What changed is that the steps got faster, and that skipping them got more expensive.
What I would do in your codebase this week
Do not start a transformation. Start with a list.
Take every component you own and ask the three questions of each. Write the answers down, yes or no, with one line of evidence for each. Resist the urge to say "partly." A component where an agent's change needs a full read is a no, even if the read is quick. A component where a change needs three corrective prompts is a no, even if the corrections are small. A component you would release and then watch is a no, even if you have never had to roll it back.
You will end up with a short table. Most of it will say no, no, no. That is not a judgment on your team. It is the starting point, and it is the same starting point I have seen at a company with hundreds of engineers and at a small startup.
The next post takes the three yeses all the way down, from goals to sub-goals to the concrete steps, and that tree is the map of this series. Later in the series, the three-question list becomes a way to decide which step each component needs first.
Let's make it engineering.
Sources
- Pedro Santos, Pedro's Law: Specifications First, Code Second. The two numbers, the specs loop, and the implementation loop.
- Michael Feathers, Working Effectively with Legacy Code (2004). The original definition: legacy code is code without tests.
- Dan Shapiro, The Five Levels: from Spicy Autocomplete to the Dark Factory (January 2026). The most-cited autonomy ladder; its Level 4 is this series' destination.
- Chad Fowler, The Phoenix Primitives and The Deletion Test, in the Phoenix Architecture series.
- Chad Fowler, Evaluations Are the Real Codebase. The language-reimplementation test for checks.
- Addy Osmani, Software Factories, Light and Dark. The safety net has to live outside the model.
- Pedro Santos, Marco Consolaro, Alessandro Di Gioia, Agile Technical Practices Distilled. The legacy-code chapters.
How this was written: I used AI heavily to draft, edit, and polish this article. The ideas are mine, and so is the responsibility for every word. Why I am unapologetic about it.
Want help taking your codebase there?
Let's talk