AI technical debt: the hidden cost of agent-written code
AI technical debt is the maintenance cost that agent-written code quietly hands to your future self. Like the original idea of technical debt, it's the gap between the fast thing the code did and the right thing the codebase needed. The difference is that now the code comes from an AI agent, at a speed and volume no human team ever matched. The interest still adds up. What changes is what the debt is made of.
The old forms are still here: shortcuts, missing tests, copy-pasted fixes. But the main new form of AI technical debt is drift — a codebase that slowly stops agreeing with itself. This post explains what drift is, why it builds up faster than the debt we're used to, why it stays hidden until it hurts, and what you can do to measure it and pay it down.
What is AI technical debt, exactly?
Technical debt has always been a way to describe borrowing against the future: you ship the quick thing now and agree to pay it back later with interest — slower changes, more bugs, harder onboarding. AI technical debt keeps that shape but changes who takes out the loan. It is no longer a tired engineer at 6pm. It's an agent that has no stake in the codebase six months from now, and no memory of it six minutes ago.
In practice, agent-written code piles up debt in a few common ways:
- +Pattern mismatch. The agent solves a problem in a way the codebase already solves differently — a new way to read data sitting next to three existing ones.
- +Duplicate and made-up code. It rewrites a helper that already exists, or invents one that looks right but doesn't match how the rest of the repo works.
- +Missing guardrails. A new endpoint skips the auth check or validation that every other endpoint has, because the agent never saw those other endpoints.
- +Convention drift. Naming, error handling, and file layout slowly split apart as each session decides them again from scratch.
None of these is a bug in the usual sense. Each one is a small, sensible local choice that's only wrong in context. Stack enough of them and the codebase loses the thing that made it cheap to change: it stops being consistent with itself.
Why drift is the dominant form of AI technical debt
The reason drift — not plain bugginess — defines AI technical debt comes down to how agents work. An AI agent works in stateless sessions. Each task starts fresh. It reads whatever context you hand it, makes reasonable local choices, and moves on. It keeps no lasting memory of the decisions it made last week, and no fixed sense of how this codebase likes to do things.
A human team builds up shared habits over time — the unwritten "how we do auth here," the instinct to copy the existing pattern, the reviewer who says "we already have a helper for that." That shared memory is what keeps a codebase consistent. Stateless agents don't have it. Across many sessions, many tasks, and often many different models, each change makes sense on its own but is out of step with the rest. The codebase splits into mismatched styles.
That's drift: the code behaving differently from one session to the next. Not one big mistake, but a thousand reasonable choices that don't add up to one coherent system. We dug into how this happens in your AI codebase is drifting.
Why does it accrue faster than human-era debt?
Two things make AI technical debt pile up faster than anything the human era produced: volume and amnesia.
Volume. An agent can write more code in an afternoon than a developer writes in a week. Debt has always grown with the amount of code written, so when writing gets ten times faster, debt is created ten times faster too. You're no longer reviewing one risky pull request a day. You're trying to keep up with a flood.
Amnesia. Human debt at least tends to stay consistent — a developer who wrote a module yesterday remembers how it works today. Stateless agents forget every session, so instead of building on a consistent style, they build on an inconsistent one. More code and less agreement show up together. That mix is unique to agent-written code, and it's why "we'll clean it up later" fails: later, there's ten times as much to clean, and it no longer follows any single rule.
Why is AI technical debt invisible?
Here's the trap. The tools we built to catch bad code were built for a different kind of bad code. AI technical debt slips past all of them because it isn't broken — it's just inconsistent.
- +It compiles. Drift is structural, not about syntax. A type checker has nothing to say about a function that works fine and simply disagrees with how the rest of the repo does the same job.
- +It passes lint. Linters check style inside one file. They don't know that this file's pattern is the odd one out across fifty others.
- +It passes review. A reviewer reading one tidy-looking diff has no easy way to see that it quietly split off from a convention. The code looks fine on its own, which is exactly the problem.
Drift is invisible because every single piece of it looks reasonable. The cost only shows up in aggregate — when a change that should touch one place touches five, when nobody can say which of the three auth patterns is the real one, when the next agent reads the inconsistent codebase and faithfully adds more of the same.
How do you measure AI technical debt?
You can't pay down debt you can't see, and "the codebase feels messy" isn't a number. The first step is to make consistency measurable. That's what the Vibe Drift Score is: a single score from 0 to 100, with a letter grade, that sums up how much a codebase agrees with itself. You get it from a local scan:
npx @vibedrift/cli .
It runs on your machine in about two seconds, your code never leaves it, and it's free, open source, and unlimited. Five local checks feed the score:
- +Architecture consistency — does new structure match the shape the project already uses?
- +Security checks — are guardrails like auth and validation applied the way the rest of the code applies them?
- +Redundancy — duplicate or made-up code that reinvents what already exists.
- +Convention adherence — whether naming, error handling, and idioms are holding or splitting apart.
- +Scaffolding hygiene — leftover stubs and generated clutter that never got cleaned up.
Instead of a wall of warnings, the scan reports the main pattern, the files that break from it, and a targeted fix — so the score points at the exact places debt is concentrated, not just that it exists. We explain what the number means and how to read it in the code coherence and Vibe Drift Score guide.
How do you pay it down — and stop creating it?
Measuring is step one. The score tells you where the debt lives; paying it down means acting on that — and the cheaper win is not creating the debt in the first place. There are three levers, and they build on each other:
1. Scan locally, often. Make the local scan part of your routine. Because it's free, unlimited, and runs in seconds, you can check the score after a burst of agent work and watch it from one scan to the next. A dropping grade is the early warning you never got from lint.
2. Deep scan to pay down concentrated debt. When you want to actually clear a patch of drift, run a deep scan:
vibedrift . --deep
It adds Claude-validated analysis on top of the local checks — catching duplicates and intent mismatches the fast pass can't — and returns AI-validated findings, a coherence report, and copy-ready fixes. That turns "the codebase is drifting" into a concrete list of edits.
3. Prevent debt in the loop with the MCP server. The most lasting fix is to stop the agent from writing drift in the first place. Install the VibeDrift MCP server and your agent can check the codebase before it writes:
claude mcp add vibedrift -- npx -y @vibedrift/cli mcp
It's free, open source, local, and needs no login — your code never leaves your machine. It gives the agent five tools: get_dominant_pattern, find_similar_function, check_file_drift, validate_change, and get_intent_hints. The effect is that a stateless agent gets, on demand, the shared memory it otherwise lacks: it asks how the repo already does things and follows that, instead of deciding again from scratch. It works with Claude Code, Cursor, Windsurf, and any MCP client. Setup for each one is in the MCP guide.
The bottom line on AI technical debt
AI technical debt isn't the old debt with a new label. The volume of agent-written code and the amnesia of stateless sessions have made drift the defining form of it — debt that compiles, passes review, and stays hidden right up until the codebase stops agreeing with itself and every change gets more expensive. The way out is the same as it's always been, just aimed at the new shape of the problem: make it measurable, pay it down where it's concentrated, and stop creating it at the moment of writing.
Start with the number. It's one command and your code never leaves your machine:
npx @vibedrift/cli .
Frequently asked questions
AI technical debt is the future maintenance cost created by agent-written code: the gap between what an AI agent produced quickly and what the codebase actually needed. Its dominant new form is drift, where a codebase stops agreeing with itself because each stateless AI session re-decides conventions instead of following the established ones.
Two reasons: volume and memory. AI agents generate far more code per hour than a human team, and each session starts with no memory of the codebase's conventions, so it reinvents patterns instead of reusing them. The result is more code and more inconsistency arriving at the same time.
Because it compiles, passes review, and passes lint. Drift is behavioral and structural, not syntactic: mismatched patterns, duplicated logic, missing auth checks, and convention fracture all look fine line by line. No type checker flags a function that disagrees with how the rest of the repo does the same thing.
Measure it with a coherence score. VibeDrift's local scan runs npx @vibedrift/cli . in about two seconds and returns a Vibe Drift Score from 0 to 100 with findings. Pay it down with the targeted fixes from a deep scan, and stop creating it by giving your agent the VibeDrift MCP server so it conforms to existing patterns before it writes.
Local scans and the MCP tools are free and open source, forever. The free tier includes 1 deep scan a month; Pro is $15/mo for 12, and you can top up 5 more for $10 on any plan. Credits never expire.