AboutExperienceEducationBlogGet in Touch
All articles

Legacy Was Never About Old Code

AI can recover lost context faster than ever, or create more of it. The difference is whether anyone is still thinking.

AIEngineeringLegacy SystemsOrganizations
Abstract illustration: an old grey network on the left with several faded and broken links, a single blue node connecting it to a stream of new blue nodes arriving fast from the right, most of them hollow and only loosely connected.

A few years ago, one of my teams wanted to switch off a module in a legacy system. It wasn’t critical, and nobody thought it was still doing anything useful. But before turning it off, we needed to confirm that nothing depended on it. That confirmation took weeks.

The strange part wasn’t that the module existed. It was that nobody could say why. The code was there. The tests were there, more or less. What was missing was the reasoning: what problem it had solved, who had asked for it, and what would happen if it stopped running. The people who knew had moved on, and the knowledge had moved on with them.

I’ve been thinking about that module a lot lately, because I believe legacy systems have something important to tell us about AI. Not about how to modernize them, although AI is remarkably good at that. About what happens when an organization creates things faster than it can understand them. We have already lived through that once. We are about to do it again, at a very different scale.

Legacy is lost context, not old code

We tend to describe legacy systems by their age or their technology. A COBOL codebase, a framework nobody maintains anymore, a database nobody wants to touch. But age isn’t always the problem. There is plenty of old code that is perfectly fine to work with, and plenty of two-year-old code that nobody dares to change.

What makes a system legacy is that the reasoning behind it has disappeared. Every system is the sum of thousands of decisions that made sense at the time: a workaround for a bug in a dependency, a special case for one important customer, a shortcut taken under a deadline that was never revisited. Each decision had a context. Over time, the context is lost and only the decision remains. Anyone who has watched an AI assistant forget the beginning of a long conversation knows the feeling. Organizations have been running out of context window for decades.

That’s why working with legacy systems feels the way it does. You are not fighting the code. You are trying to reconstruct the thinking of people who are no longer there, without the information they had.

A system becomes legacy the moment nobody can explain why it is the way it is.

Documentation rarely helps as much as we hope. Most of it, when it exists and is still accurate, describes what the system does: interfaces, data models, how to deploy it. What we need years later is a different kind of record: why it was built this way, what was considered and rejected, which constraint forced the shortcut. Very few teams keep that record, and it is the first thing to disappear.

We are producing legacy faster than ever

Here is where AI comes in, and I don’t think the connection gets enough attention.

AI has made code dramatically easier to produce. As I wrote in The Illusion of Productivity in the Age of AI, it has done much less for the cost of owning that code. And it has introduced a new way for context to go missing: the code can arrive without anyone having fully reasoned through it in the first place.

When an engineer writes a function, the reasoning exists at least once, in their head, even if it never makes it into a comment or a design note. When AI generates the same function and the engineer accepts it because it looks right and the tests pass, that reasoning may never have existed anywhere. There is nothing to lose, because nothing was ever captured.

We also hold AI output to a lower standard than we hold each other. If a colleague proposed a solution, we would ask how they got there. An answer that arrives in seconds and reads well rarely invites a second look. In this context, that is exactly backwards.

The result is code that is legacy from the day it is merged. Not because it is bad, often it is perfectly good, but because nobody owns the understanding of it. Multiply that across every team, every sprint, and every tool that makes generating code easier, and the organization is building its future legacy at a pace no previous generation of engineers could have managed.

AI doesn’t solve the legacy problem. It industrializes it.

The modernization paradox

To be fair, AI is also the best tool we have ever had for dealing with legacy. I have seen it first-hand.

One of my teams used AI heavily to modernize a set of old systems: making sense of data structures nobody had documented, reconstructing distributed processes that only existed in production, rewriting batch applications, generating tests for code that had never had any. It recovered context that we had assumed was gone for good. The project is much further along than it would have been otherwise, and I don’t think we could have done it the old way in a reasonable timeframe.

But the project also made clear where the recovery stops. One of the rewritten services became so much more efficient that it started overloading another system that had never been designed for that volume. AI had reconstructed the context of the service. It had not reconstructed the context of the system around it, the implicit assumptions other teams had been relying on for years without knowing it. The improvement was real. It simply didn’t stop at the boundary of the team that made it.

I described that case in As Execution Becomes Easier, Thinking Becomes More Important, and the lesson for modernization is specific. AI can recover what is written down, or what can be inferred from the code. The context that lived in people’s heads, and in the relationships between systems, still has to be rebuilt by someone who is thinking about the whole.

The pattern becomes clearer at a larger scale. I’m involved in the modernization of a set of monoliths built over thirty years: thousands of programs at the core of the business, poorly documented, and understood by a shrinking group of people. AI can translate that codebase into a modern stack at a speed that would have been unthinkable a few years ago. That speed changes what is possible, and the excitement around it is justified.

But the risks of that work are more interesting than the speed. The biggest ones are not about the technology we are moving to. They are about what nobody knows about the system we are leaving behind: business rules embedded in code that no specification ever mentioned, nightly jobs nobody remembers scheduling, dependencies that only show up in months of logs. And the answer to those risks is not more AI. It is talking to the people who operate the systems, auditing what actually runs, and running the old and the new side by side, comparing the outputs before anyone trusts the result.

So we end up with a paradox. AI helps us understand the legacy we already have, while making it easier to create more of it. Which of those effects wins has very little to do with the tool.

The thinking has to stay with us

What decides the outcome in these projects isn’t the quality of the model. It is whether the team keeps asking the questions the model isn’t asking. Which business rules are buried in this program that no document mentions? Which nightly job breaks if this table changes? Who still consumes this integration flow, and would they notice if it stopped? When the answer is “we don’t know,” someone has to go and find out before moving on.

That is critical thinking, and it matters more here than almost anywhere else. AI will explain, with complete confidence, why a thirty-year-old module exists. Sometimes it will be right. Sometimes it will be a plausible story inferred from variable names and a few comments. From the outside, the two look identical. The only way to tell them apart is to check, and checking requires someone who understands enough of the system to know what a wrong answer would look like.

This is where the modernization work connects to how we hire. In Hiring for Judgment, I argued that the ability to write code says less and less about an engineer, and that what sets people apart is questioning the value, seeing the system, and not accepting answers blindly. Modernizing a legacy system with AI is that argument in practice. The work is no longer translating old code into new code. It is deciding what deserves to be rewritten, what should simply be switched off, and what the old system was doing on purpose even though it looks like an accident. Those are judgment calls, and an engineer who accepts the generated answer without questioning it will produce a new system as opaque as the old one, only faster.

AI gives convincing answers about systems nobody understands. That is the most dangerous combination we have ever worked with.

That parallel run is worth pausing on, because it is scepticism turned into a process. We don’t trust the translated program because it compiles, or because the tests pass, or because the model explained its reasoning. We trust it after it has produced the same outputs as the original, on real data, for weeks. That is expensive, and it is exactly the kind of cost that looks optional when the generated code is sitting there looking finished. It isn’t optional. It is the part where the thinking happens.

There is a second reason the thinking has to stay with us. A modernization project is the one moment when someone is looking carefully at every decision the old system embodies. If we don’t capture the why while we are there, we lose it twice: once when the original authors left, and again when we rewrote their work without writing down what we learned. The next team will inherit a modern system with exactly the same problem we started with.

What legacy systems actually teach

If I take the lessons from years of living with legacy systems and apply them to how we use AI today, a few things stand out.

  • Record the why, not just the what. Code describes what a system does. What ages badly is the absence of reasoning. Decisions, trade-offs, and rejected alternatives are worth writing down, especially now that the code itself is so easy to produce. A modernization project is the best opportunity we will ever get to do this, because it is the only time anyone reads the old system closely. A short decision record will outlive any amount of generated code.
  • The understanding is the asset, not the system. In a system like that, the most urgent risk isn’t the code. It is that the people who can read it are leaving, and soon nobody will be able to say what a program does without running it. A system nobody understands is a liability, no matter how modern its stack. When we let AI take over the work people used to learn from, we should ask who will understand the result in five years.
  • Every shortcut eventually has an owner. Usually someone who wasn’t there when it was taken. Speed is only free if nobody has to maintain the result. Someone always does.
  • Switch things off. Legacy accumulates because removing something feels riskier than leaving it. When we inventoried a large integration platform ahead of migrating it, we expected that a meaningful share of its flows could simply be decommissioned. Nobody had done it, because nobody had ever been asked to. The cheapest flow to migrate is the one you delete. AI lowers the cost of adding. It does nothing for the discipline of removing. A capability that nobody owns and nobody can explain should be a candidate for deletion, not for preservation.

None of this is new. Experienced engineers have said all of it for decades. What is new is that the cost of ignoring it has gone up, because the volume of what we produce has gone up.

The same question, at a different scale

Ten years from now, someone will look at a system one of our teams is building today. They will find a module, or a service, or a decision, and they will ask the same question my team asked about that legacy module: why is this here, and what happens if we turn it off?

The answer we leave them will not depend on how fast we built it. It will depend on whether anyone understood it, and whether that understanding was written down anywhere.

Legacy systems are rarely just a technology problem. Most of the time, they are a memory problem. AI can help us remember, or help us forget faster.