We don’t think of legacy code in terms of its literal age; we tend to define it by whether anyone on the current team can explain how it works. But by this definition, some of the fastest-growing legacy code in many companies now was written within the last six months.
Imagine sitting in on a design review. Let’s say a new microservice has just gone live. The deployment didn’t throw any errors, the tests were fine, and the service seems to be handling production traffic perfectly well. An engineer asks a basic question: Why does it retry on this timeout error and not on that one?
Nobody has an answer. The developer who “wrote” the module admits that their AI agent generated the logic—and that it just worked.
A system that is barely three weeks old already works like legacy code.
Three kinds of legacy
Back in 1985, Peter Naur argued that there’s more to a program than its source code. He said the real program lives as an understanding in the heads of the people who built it; they know why it’s shaped in a certain way, and they know how it ought to change. Naur called this the program’s “theory.” He warned that you can’t just rebuild it from code and documents.
We see three distinct ways in which a team might end up without that theory.
“Archaeological” legacy is old code; understanding has been lost. Think of twenty-year-old ERPs, COBOL batch jobs, or early Java monoliths. The theory was there, but the original developers took it with them when they left. What remains might be readable—but it’s unexplained. Every change is an archaeology dig.
In “Ungoverned” legacy, engineering never owned the understanding. You’ll usually see this with low-code platforms like OutSystems, Mendix, and Power Apps. The platforms themselves are perfectly fine, and many companies run them well. The trouble is apps that nobody owns. A business team might build one outside of standard engineering checks; it becomes critical to operations, and then the creators move on. When it starts throwing errors, no engineer knows how it works or why it was built the way it was—and the platform limits what you can change. The gap here is ownership.
Then there’s AI-built code, or “Polished” legacy—where the understanding was never formed. An agent writes 400 lines, tests pass, and the pull request merges. The code usually looks clean; it is consistently named and well commented. (It’s often tidier than what a person would write.) But because no human ever built the theory of why it works, the polish you see hides the absence of understanding—which in turn makes it much easier for things to go wrong without anyone noticing.
Archaeological (old code) | Ungoverned (low-code) | Polished (AI-built) | |
|---|---|---|---|
What happened to the understanding? | Lost over time | Never owned by an engineering team | Never formed in the first place |
How it looks from the outside | Intimidating | Harmless, as in “just another app” | Clean, tidy, well tested |
Speed of accumulation | Decades | Years | Days |
The way out | We need to reconstruct the theory | We must bring it under our ownership (or retire it) | We shouldn’t skip building the theory |
There is no “way out” with old code and ungoverned code, strictly speaking: We inherit old code and we deal with it. We have to figure out how to govern low-code applications. But when it comes to AI-built code, we can prevent it from becoming a legacy burden. We make that choice every time we evaluate incoming code changes.
The newest legacy is the most dangerous
Steve Krouse has argued that “vibe code is legacy code,” and LeadDev recently called AI “both the problem and the cure for legacy code.”
Addy Osmani and Margaret-Anne Storey have done excellent work in identifying the types of technical debt involved. Our perspective builds on their foundation—but we also want to bring in low-code, identify an additional type of debt, and lay out the financial argument your CFO needs to hear.
Legacy systems make their presence known. Everyone on an engineering team knows which aging system is the intimidating one. AI-built legacy, on the other hand, hides in plain sight. The code looks clean, the tests pass, and the monitoring dashboards look healthy. You don’t get the usual warning signs. Addy Osmani calls this “comprehension debt”; he defines it as the growing gap between the volume of code that exists and how much of it anyone understands. Technical debt introduces friction; comprehension debt creates a false sense of confidence (Osmani).
There are a few reasons why this new breed of legacy code is the hardest to manage.
First, it arrives fully formed without theory. With traditional legacy systems, foundational understanding fades away over years. AI-gen code starts its life without human understanding attached. Margaret-Anne Storey captures this dynamic perfectly in her Triple Debt Model: Generative AI may reduce technical debt while accelerating both cognitive debt (our shared understanding) and intent debt (the documented reasons behind our technical choices). (Storey, 2026).
Second, this code is accumulating at machine speed. GitClear recently looked at 623 million code changes made between 2023 and 2026; AI-assisted commits make up about a quarter of the total. The volume of duplicated code blocks has gone up by 81%, while refactoring efforts have dropped by 70%—and general updates to older codebases have fallen by 74% compared with 2022 levels. (GitClear, LeadDev). The numbers only suggest a correlation between AI use and code decay, but the pattern is unmistakable. We’re watching teams generate code much faster than they can realistically maintain it.
Third, relying on these tools actively erodes the skills we need to troubleshoot their output. Anthropic ran a randomised trial where 52 developers were asked to learn a new coding library. When they tested everyone’s comprehension afterwards, the developers who used AI scored 50%, while those who coded by hand scored 67% (Anthropic). Interestingly, the biggest performance gap showed up in debugging—which is precisely the skill you need when an AI-generated module starts throwing errors in production. This was a relatively small study, but the findings reinforce our perspective.
At this point, the pushback from developers is usually: “I can ask the AI to explain the code to me later.” That is partly true, of course. A coding agent can quickly scan a file and tell you what the code does. But it just can’t tell you why a certain design pattern was chosen over the alternatives. It can’t explain what unwritten business rules the logic is meant to enforce—unless a person captured that intent beforehand.
It’s easy to explain what a block of code does. It’s impossible to regenerate rationale.
The cost of surface polish: “Confidence debt”
Comprehension debt is the disconnect between the code and what engineers understand. We’ve started tracking a second gap—the one that makes “Polished Legacy” code risky: Confidence debt, the disconnect between how trustworthy a piece of code looks and how reliable it is.
Human-written code usually indicates its own quality. If a developer rushes a ticket, the resulting code looks messy, and reviewers inspect it closely. AI-gen code bypasses this warning system. It arrives complete with tidy variable names, perfectly formatted docstrings, standard try-catch blocks, and passing unit tests; reviewers speed through approvals just when they should be pausing.
There’s evidence that surface-level polish is masking architectural flaws. GitClear’s data indicates that error-masking code—like exception handlers that catch a failure but quietly carry on—increased by 47% between 2023 and 2026 (LeadDev). At a quick glance, such code looks defensively written. In practice, it buries the failure deep in the system until a customer trips over it in production.
Comprehension debt slows down your team when they need to modify a module. Confidence debt compromises your system much earlier in the lifecycle: Your team trusts it and actively approves a defect.
Building theory versus skipping it
AI is the most powerful tool we have for recovering lost understanding. We use it to actively rebuild a program’s theory (and compress months of work into weeks) when an agent traces business rules through a twenty-year-old system, or extracts logic so we can migrate off a low-code platform.
Conversely, when developers use AI to generate code without doing their bit, they’re using it to actively skip the theory.
The implications for comprehension are clear from the Anthropic study. Developers who outright delegated coding scored below 40% on comprehension. Those who used AI for conceptual questions scored 86%; those who used AI to generate code and then questioned the agent about its choices scored 68% (DAIR summary of the paper).
But this is where the good news is: Of the three types of legacy, the AI-built version is the easiest to fix. The code is open, readable, and in your hands from the start. Allowing it to become legacy is a process decision.
The financial argument: Balancing features and “futures”
Kent Beck summarises the business case perfectly: Software has two kinds of value, “the value of its current features” and “the value of the optionality of future changes.” He calls the second one “futures.” His key observation: “Features are legible. Futures are invisible (until they aren’t)” (Beck, QCon SF 2026).
Every time you add a feature, you use up a little of the system’s ability to adapt—whether by locking in a data model, or by introducing dependencies. AI dramatically increases the speed at which this happens. It’s cheaper to churn out features, so teams ship more of them—which makes future adaptability drop off fast.
If you aren’t doing deliberate architectural reviews, the codebase quickly reaches a point where it can’t be safely modified. We refer to this state as “going solid.”
This dynamic changes the economics of a new system. Engineering teams used to build systems to last five to ten years. AI can now build those systems in months. From what we’re observing in client systems, our working hypothesis is that an AI-built system operating without regular review could go solid within one to two years. From a CFO’s perspective, this means the company isn’t investing in a long-term asset; it is it is renting a disposable one.
When you’re talking to the board, the important question is: How much of the system’s future adaptability was used up to achieve the speed that AI affords?
Our goal shouldn’t be to maximise the footprint of our codebase. We should aim to deliver value by shipping systems that retain their capacity for change.
Build a sustainable review loop
Metrics like development velocity and pull request counts can look fantastic even as a team’s actual grip on the system slips away. The blue line in the chart above doesn’t come about by luck. Maintaining control requires a deliberate review cycle after every batch of work: review, learn, fix, and share. You can enforce this cycle using five practices:
- Assign a human owner to every AI-generated change. You need someone who can explain why the logic was built a certain way without having to ask the agent. If no one can, the change isn’t ready to be merged.
- Treat code review as a test of comprehension. Require the author to explain a proposed change in their own words before anyone approves it. Stop allowing silent approvals on agent-written code; insist on splitting up large, AI-generated diffs so they are scrutinised instead of skimmed.
- Document the intent before generating the code. Require a note for every meaningful change—a note outlines the problem, the operating constraints, and the alternatives that were rejected. This forces the team to pay their “intent debt” (Storey, 2026) upfront, and it improves your AI agents because they read the context, too.
- Monitor quality signals alongside development speed. Track code duplication, churn, and refactoring rates rather than raw velocity. It helps to add a standard question to your incident reviews: Could the on-call engineer explain the failing code before they opened the file?
- Audit the code itself (rather than relying on the tool’s guardrails). Most teams use a mix of AI assistants, and safety controls built into one tool only protect the people using that platform. Running checks directly on the codebase ensures you treat every author—human or agent—the same way.
All these will, of course, add a few minutes to every change. But the alternative costs months of lost time—which you’ll end up paying for during a major outage, when a key engineer leaves, or during a migration.
We integrated this feedback cycle into our own delivery pipeline by applying a single set of rules at both ends of the process. Every time our coding agents edit, commit, or merge logic, the code is checked against those rules to catch copied blocks, swallowed errors, meaningless tests, and hallucinated packages. We run the same assessment when we take over an external codebase to gauge how much “Polished Legacy” code resides in the system. These checks rely on deterministic rules rather than an AI model (so we never have one AI grading another)—and disabling any of them requires a documented justification.
You don’t own what you can’t explain
A system’s underlying theory might be lost over the years, never officially owned by engineering, or never formed. The outcome in every case is that your team loses the ability to reason about the system as a whole.
Our industry spent the last decade paying to decode and rebuild systems other people wrote. We really shouldn’t spend the next ten years paying to rebuild systems we generated last quarter.
If your engineers can’t explain how your software works, your company doesn’t own it. You’re dependent on it—and you’re helpless when it fails.
Sources
- Peter Naur, Programming as Theory Building (1985)
- Steve Krouse, Vibe code is legacy code (Val Town, Aug 2025)
- LeadDev, Why AI is both the problem and the cure for legacy code (Jan 2026)
- Addy Osmani, Comprehension Debt: the hidden cost of AI-generated code
- Margaret-Anne Storey, From Technical Debt to Cognitive and Intent Debt (2026)
- GitClear, The Maintainability Gap: AI Code Quality in 2026
- LeadDev, Code maintainability plummets in the AI coding era (Jul 2026)
- Anthropic, How AI assistance impacts the formation of coding skills (Jan 2026)
- DAIR.AI, How AI Impacts Skill Formation (paper summary)
- Kent Beck, Features vs Futures (QCon SF, Nov 2026); also Features and Futures (Heavybit podcast)