Almost every estate of any age contains at least one service that works, matters, and is understood by nobody currently employed. The documentation, if it exists, describes an interface that changed three years ago. The original authors have moved on. The service keeps running because nobody has a sufficiently compelling reason — or sufficient nerve — to touch it.
So the suggestion that AI coding agents can help close that knowledge gap is not hype. It is one of the few genuinely boring, genuinely useful applications of the technology: point something at a codebase that nobody can explain and get an explanation back in minutes rather than weeks. The question for anyone running IT is not whether the agent can read the code. It's what you do with what it tells you, and what happens when it's wrong.
Why legacy services resist documentation in the first place
Documentation debt is not an accident of laziness. It is a structural outcome of how delivery is funded. Documentation is written during a project, when there is a budget line for it, and then decays continuously afterwards, when there isn't. Every change made in a hurry — a hotfix, a certificate rotation, a config tweak to survive a load spike — widens the gap between the written design and the running system.
The result is that the most critical services tend to be the worst documented, because criticality attracts urgent change. The sleepy internal reporting tool has pristine docs. The payment integration that everything depends on has a wiki page last edited in 2019 and a diagram with three boxes marked "TBC".
An agent that can read the code and produce a current description of what it actually does attacks exactly this problem. It derives the description from the artefact that cannot lie — the source — rather than from the artefact that always does, which is the wiki.
What an agent can genuinely tell you
The honest list of things an agent is good at here is shorter than the marketing suggests, but it is not empty:
- Call graphs and dependency surfaces. What does this service actually talk to, and what talks to it? This is mechanical work and agents do mechanical work well.
- Behaviour under specific inputs. Tracing what happens to a given request through a codebase nobody has read in years.
- Drift between stated and actual interfaces. Comparing the documented contract to the implemented one and flagging the differences.
- Candidate test coverage. Generating characterisation tests that pin down current behaviour before you change anything.
That last one is the most valuable and the least discussed. If you are going to modify a service you don't understand, the thing that protects you is not a document — it's a test suite that fails loudly when behaviour changes. Agents are reasonably good at producing that scaffolding, and it is the kind of tedious work that never gets prioritised otherwise.
What it cannot tell you, and this is the important part
Code tells you what the system does. It does not tell you why. The reason that validation rule exists, the regulatory requirement behind that retention period, the incident in 2017 that led to the retry logic being deliberately set to a value that looks wrong — none of that is in the source. An agent reading the code will either omit the rationale or, worse, invent a plausible one.
This is the failure mode I'd worry about most. A generated architecture description reads with the same fluent confidence whether it is correct or not. A human writing documentation about code they half-understand tends to hedge, leave gaps, write "not sure why this is here". The agent doesn't hedge. It produces a clean narrative, and clean narratives are extremely persuasive to people under delivery pressure.
My view is that the output of an agent on a legacy codebase should be treated as a hypothesis requiring verification, not as a design record. The difference is procedural: a hypothesis gets tested against runtime behaviour, logs, and whoever is left who remembers the system. A design record gets filed in SharePoint and cited in a change approval six months later by someone who assumes a human wrote it.
The governance questions nobody asks first
Before any of this touches a production codebase, there are a few things worth settling. Where does the code go when the agent reads it? If the service in question handles regulated data, the source may itself be sensitive — hardcoded endpoints, embedded logic that reveals control design, occasionally credentials that should have been rotated years ago. Whether your agent runs locally, in your tenant, or against a third-party endpoint is a materially different risk picture in each case, and it's worth confirming the actual data flow rather than the vendor's description of it.
Then there is write access. Reading a legacy service is low risk. Letting an agent propose and merge changes to one is a different proposition entirely, and it belongs behind the same review, approval and rollback controls as any other change. The temptation when the agent is right four times in a row is to loosen the fifth review. That's the one that costs you.
[AUTHOR: add a real example here from your own delivery experience if you have one — a legacy service where missing documentation drove risk, and how it was handled.]
Where this actually changes the economics
The genuine shift is in the cost of starting. Historically, the business case for understanding a legacy service was poor: weeks of expensive senior time to produce a document that might be wrong and would certainly decay. So the work didn't happen, and the service stayed opaque until it failed or blocked something important.
If an agent reduces that initial investigation from weeks to days, the calculation changes. Understanding becomes cheap enough to do speculatively, before there's a crisis forcing it. That is the real operational benefit — not better documents, but more systems that someone has actually looked at recently.
The discipline that has to come with it is ownership. A generated description with no named owner is not documentation; it's output. Someone has to sign their name against it, verify the parts that matter, and take responsibility for keeping it current. The agent removes the excuse that the work is too expensive to begin. It does not remove the obligation to finish it properly.
Source: Five Ways To Use AI Coding Agents to Improve Your Software Architecture