What is comprehension debt?
A definition
Every codebase has two sizes: the amount of code in it, and the amount of it that someone on the team could explain, change safely or debug without help. Comprehension debt is the difference between the two.
It is different from technical debt. Technical debt is about the code itself: shortcuts, missing tests, tangled dependencies. It slows you down every day, so you notice it. Comprehension debt is about people. The code can be clean, well tested and well named and still be debt, because nobody has a model of how it works. It stays invisible until something breaks and the person on call opens a file nobody has ever really read.
The term was popularized in 2026 by Addy Osmani, who argued that code review used to force understanding: reading a colleague's change was a bottleneck, but a productive one. When an agent writes the code and the review is a quick skim of a clean-looking diff, that feedback loop disappears.
Why AI coding agents make it grow
Agents don't create comprehension debt on purpose. It comes from how they change the economics of writing code:
- Volume. One person with an agent can produce several times as many lines per day. Reading speed did not change.
- Plausibility. Agent-written code is usually syntactically clean and follows conventions, exactly the signals that used to tell a reviewer "this is fine".
- Passive delegation. "Make the tests pass" is a different task from "help me understand this". A randomized study by Anthropic researchers (arXiv:2601.20245) found that developers who leaned on AI assistance while learning a new library finished in about the same time but scored noticeably lower on a follow-up comprehension quiz, and that passive delegation hurt far more than asking the AI questions.
None of this means agents are bad. It means understanding no longer happens as a side effect of writing code, so it has to happen on purpose.
What it costs
- Slow incidents. Debugging code nobody understands is archaeology, under time pressure.
- Risky changes. People are reluctant to touch code they can't explain, so it calcifies, or they change it blindly.
- A bus factor of zero. With human-written code, at least the author understood it once. With agent-written code, possibly nobody ever did.
- False confidence. Dashboards look healthy: coverage is high, the linter is quiet, velocity is up.
How to measure comprehension debt
You can't measure what's in people's heads directly, but you can measure two things that together get you most of the way:
1. Which code was written by AI
Most coding agents leave evidence in git: Claude Code adds a Co-Authored-By: Claude trailer, GitHub's Copilot coding agent commits as its own account or adds a co-author line, Cursor's agent uses cursoragent@cursor.com, Aider prefixes messages with aider:. Combine that with git blame and you know, line by line, which current code came from an agent-assisted commit.
2. Which of it someone has shown they understand
This is the part teams skip. Approving a pull request is weak evidence; answering questions about the code is strong evidence. A short quiz, "what happens if this list is empty?", "why is this check before that one?", "a user reports X, where do you look?", separates understanding from skimming in two minutes.
Then you can define a number:
comprehension debt = (AI-written lines nobody has shown they understand
+ ½ × lines only skimmed or understood long ago)
÷ all meaningful lines
This is exactly what grokmap computes. It runs locally on any git repository:
pipx install grokmap
grokmap status # the number, the riskiest files, who understands what
grokmap report # an interactive heatmap
grokmap trend # how the AI-written share changed month by month
Understanding is tracked per line: if a line someone was quizzed on is later changed, it counts as new code again. Understanding older than six months is marked as fading.
How to pay it down
- Quiz right after the change. The best moment to understand code is right after an agent writes it, while the context is fresh. grokmap's agent skill offers a two-minute quiz before you commit, on exactly the lines you haven't seen.
- Start with the riskiest files. Debt in payment, authentication or data-migration code matters more than debt in a test fixture. Mark critical paths and look at those first.
- Make it visible in pull requests. A PR comment saying "this change adds 340 AI-written lines, 0 understood" changes behavior more than any policy document.
- Ask, don't just delegate. Using the agent to explain code, rather than only to produce it, builds understanding instead of eroding it.
- Don't turn it into a leaderboard. The goal is an honest map of what the team understands, not a ranking of people. A measure people game is worse than none.
What comprehension debt is not
- Not an argument against AI coding. Teams that write most of their code with agents can have low comprehension debt if people engage with what gets merged.
- Not the same as missing documentation. Docs help, but reading a design doc is not the same as being able to debug the code.
- Not measurable from code alone. Static analysis can tell you code is complex; it can't tell you nobody understands it.
Try it on your repository
See a live example report, read how much of popular open-source projects is AI-written, or install grokmap from GitHub. It's free, MIT-licensed, and makes no network calls.