Comprehension Trap: AI on Legacy Systems


AI coding is cool. We use it every day. However, there is a trap and I see teams walking right into it, specially on legacy systems. The trap is this: AI removed the cost of producing code and text, but it did not remove the cost of understanding it. Comprehension is still human, still slow, still expensive.

Legacy systems are not hard because the code is hard. They are hard because the knowledge is gone and usually the foundation is not strong. The people left, the docs rotted, the reasons behind the weird if are nowhere. Modernization is 80% comprehension and 20% typing. AI is incredible at the 20%. Guess which part we are accelerating? And this was true before AI showed up - your code was never pristine, the elegance was never the expensive part. What changed is that generation got cheap and verification did not.

So now we have a new kind of debt. Not technical debt - comprehension debt. Code that exists in the repository but does not exist in anybody's head. The system grows, the shared mental model shrinks. That gap is where the outages live. Addy Osmani wrote about this as comprehension debt and his point is the one that scares me: unlike technical debt, this one gives you false confidence. The repository looks clean, the tests are green, and nobody can explain the design.

Comprehension Debt: the distance between what the repository contains and what the team can explain. Interest rate: paid in production, at 3am, by whoever is on call. Only payment method accepted: a human reading, struggling and arguing until they can predict the system.

People dont read

This is the one nobody wants to admit. People dont read. They never did. But now is much much worst. LLM Models hallucinate and people don't event fact check it.

Before AI we had a few docs nobody read. Now we can generate 300 pages of legacy analysis in 20 minutes, with diagrams, with tables, with a nice summary. Beautiful. Nobody reads that either. We did not fix the problem, we industrialized it. Even if people read it they don't challenge it, they bellive it.

Think about the bottleneck. Writing was the constraint, so we optimized writing. But the system was never limited by writing:

  • Producing text: used to be hours, now is seconds.
  • Reading text: used to be hours, still is hours.
  • Understanding text: used to be days, still is days.

You cannot speed up the slow part by making the fast part faster. That is not how constraints work. All you do is build a bigger queue in front of the slow part, and humans dont have back pressure - they just drop stuff on the floor silently.

On legacy work this is brutal. Somebody asks the agent "what does this batch job do?", gets a solid 4000 word answer, skims the first paragraph, copies the summary into Slack, and moves on. Three weeks later the job dies in production and we find out the answer had a conditional in paragraph 11 that changed everything. The information was there. The comprehension was not.

IMHO we need to stop measuring output and start measuring what was actually absorbed. If a document was generated and not read, it is not documentation. It is garbage with good formatting.

People dont make the effort to figure out

Here is the uncomfortable part. The struggle was the learning.

When you had to understand a 15 year old Java monolith, you did it the hard way. You traced the call. You put a breakpoint in a place that made no sense. You ran git log -S on a variable name and found a commit from 2011 with the message "fix". You talked to the person who was there. It took two weeks and it was painful - and at the end you had a mental model. You could predict the system. That is the real asset.

Now you ask, you get an answer in 8 seconds, and you have... an answer. Not a model. Answers dont compose. Models do.

The difference shows up the moment reality disagrees with the answer:

  • With a model, you debug. You know where to look because you know how the thing is shaped.
  • With an answer, you ask again. And again. You are now in a loop you cannot exit, because every new answer needs comprehension you never built.

And this is where it gets dangerous on legacy. Legacy code is full of lies. Dead flags that are not dead. A method named validate that writes to the database. A config that is ignored in prod because of an env var set by a deploy script in another repository. The agent reads the code and tells you what the code says. The system does what the system does. Only comprehension closes that gap, and comprehension costs effort that nobody wants to pay anymore.

So we patch. We paper over symptoms faster than ever - the fix commit is cheap, the root cause fix needs the mental model nobody built, so we trade technical debt for comprehension debt and call it velocity.

We outsourced the thinking and kept the accountability. Bad trade.

Content fights for attention and PRs

Review capacity is fixed. It is a hard physical limit - the number of engineers times the hours they can actually concentrate, which is like 3 or 4 per day if we are honest.

Generation capacity is now effectively infinite.

So what happens? Content inflation. Same thing that happens to a currency when you print it. Everything is worth less:

  • PRs get bigger, so reviews get shallower.
  • The queue grows, so "LGTM" becomes the default.
  • ADRs multiply, so nobody knows which one is current.
  • Slack fills up, so the important message scrolls away.
  • Five AI generated migration plans exist, all plausible, all slightly different.

And now these things compete. Not on correctness - on attention. The plan that wins is the one that is well formatted, confident and arrived first. Not the one that is right. We replaced technical decision making with a popularity contest where the judges are tired.

On a legacy migration this is how you destroy a system. Somebody ships a 2000 line refactor on a module that handles money. It is clean, it is tested, the tests were generated too, and the tests encode the bug as the expected behavior. Two reviewers approve it in 90 seconds because they have 14 other PRs waiting. Nobody in that chain understood the module. The code is better and the system is worse.

What do I do about it? Boring stuff, honestly:

  • Small PRs, non negotiable. If I cannot hold it in my head, I cannot review it.
  • The author explains the WHY in the description, in their own words. If the description was generated, the PR goes back.
  • Review the risk, not the diff. On legacy, 30 lines in the billing path deserve more time than 900 lines of config.
  • Cap work in progress. A review queue is a queue. Treat it like one.

No Group Learnings

This is the one that will hurt us the most in 3 years, and almost nobody is talking about it.

Engineering knowledge was always socially built. Pairing. Design reviews where somebody says "that will not work, we tried in 2019". Incident reviews. The whiteboard argument that goes 40 minutes and ends with everybody understanding the system better than when they walked in. That is how tribal knowledge is created and transferred, and legacy systems run on tribal knowledge - it is literally all they have left.

AI conversations are private. One engineer, one session, one answer, zero witnesses.

So the team of 8 becomes 8 separate teams of 1. Everybody has a slightly different story about how the integration layer works, all of them partially right, none of them challenged. Nobody is wrong out loud, so nobody gets corrected. The mental models drift apart quietly and you only discover it during an incident, at 3am, when two people disagree about what the system does while the site is down.

We also lost the by-product. When you figured something nasty out the hard way, you told people. You were proud of it. You wrote it down because it cost you something. Cheap answers dont get shared, because sharing costs more than asking again.

How to do Better?

So what works, from what I have seen:

  • Bring the AI into the room. Use it in pairing, in design reviews, on the shared screen, where it can be challenged.
  • Make somebody teach the system back to the group. Verbally, no slides. If they cannot explain it, we dont understand it yet.
  • Keep one shared document per legacy subsystem that humans own and edit. One source of truth, not 40 chat sessions.
  • Reward comprehension, not throughput. Who can explain the system is worth more than who can produce the most diffs.

AI is the best tool we ever had for working with legacy code. It is also the fastest way to build a system that nobody on earth understands. The difference is not the tool, it is whether we still pay the price of comprehension - reading, struggling, arguing, learning together. That price did not go away. It just stopped being charged upfront, and now we pay it in production.

Popular posts from this blog

Cool Retro Terminal

Harness Engineering

AI coding Agents Evolution