lockstep
5 min readNaman Jain

Technical debt from AI coding: how it builds and how to manage it

How AI coding agents create technical debt, mapped to Fowler's debt quadrant, and practical ways to control it: context, review, tests, and decisions.

A team adopts coding agents and ships twice as many features in a quarter. In the next quarter, velocity drops. Every change touches three near-identical helper functions, the API has two pagination styles, and one service quietly reintroduced a library the team removed in spring. Nothing is broken. Everything is slower.

That's technical debt, arriving faster than usual. This guide looks at how AI coding agents create it, using Martin Fowler's framing in Technical Debt and the Technical Debt Quadrant, checked on 16 November 2026, and how to keep it under control.

Technical debt, briefly

Fowler describes cruft as deficiencies in internal quality that make a system harder to change, and technical debt, a metaphor from Ward Cunningham, as a way to think about it: the extra effort each new feature takes is the interest; cleaning up is paying down the principal.

His example: a feature that would take four days in clean code takes six because of a confusing module structure. The two days are interest. Cleanup pays off only if you'll keep working in that area, which is why he suggests paying debt down gradually, in the parts of the code you actually change.

The debt quadrant, applied to AI

Fowler splits debt on two axes: prudent or reckless, and deliberate or inadvertent.

DeliberateInadvertent
Prudent"Ship now with the agent's quick version, refactor next sprint." Logged and planned."Now that it's built, we see a better structure." Normal learning.
Reckless"No time to review, merge what the agent wrote.""We didn't know the agent duplicated the billing logic."

AI coding pushes debt toward the bottom row. Code arrives faster than people read it, so the reckless cells fill up, often without anyone choosing to.

How agents create debt

Duplication. An agent that doesn't find an existing helper writes a new one. Across many sessions, the same logic appears in several places, each slightly different.

Convention drift. Without the codebase's patterns in context, agents use whatever is common in their training data: a second date library, a different error format, a new state management approach.

Code nobody understands. Accepted without reading, it can't be safely changed later. That's the cost Simon Willison describes in vibe coding: fine for a prototype, risky when kept.

Decision drift. The agent builds a clean solution against a decision it never heard about, such as using the deprecated endpoint the team agreed to stop calling. The code is fine; it's the wrong code.

Security debt. Generated code can look correct and still be unsafe. A Veracode study, summarized on Wikipedia, found generated code had improved much more in function than in security.

How to keep it under control

1. Give the agent the context a new hire would get

Most agent debt starts as missing context. Put conventions, preferred libraries, and "use the existing X for Y" in CLAUDE.md or AGENTS.md. Keep it short and specific. See CLAUDE.md examples.

2. Plan before large changes

Ask for a plan first, and check it reuses what exists. In Claude Code, plan mode does this. Reading a plan for "add a new date utility" is cheaper than finding the fourth one later.

3. Review the code, not just the result

Willison's rule: don't commit code you couldn't explain to someone else. Review agent diffs like any other change, and look for duplication and new dependencies specifically. See Claude Code best practices for workflow tips.

4. Make tests the gate

Tests catch broken behavior; they don't catch duplication, but they make refactoring it safe. A hook that runs the tests before a task counts as done keeps agents honest.

5. Turn reckless debt into deliberate debt

When you accept a shortcut, write it down: what, why, and when to fix it. That moves it from the reckless to the prudent column. A decision log or an issue labeled tech-debt both work.

6. Pay down where you work

Follow Fowler's advice: clean up as you change code, in the areas you touch most. Agents are good at this kind of refactoring when given a clear target, such as "replace the three date helpers with the one in utils/date.ts and update callers."

Measuring it

Fowler is direct that productivity, and so the cost of debt, can't be measured objectively. Useful signals anyway:

  • Time to make changes in areas with heavy agent-written code, compared with others
  • The same logic or library appearing in more than one place
  • Defect rates in recently agent-written code
  • How often agent changes contradict an existing team decision

The debt that isn't in the code

Decision drift is the hardest to see because the code looks fine. The decision lives in a Slack thread or a meeting, and the agent writing code next week never saw it. Duplication shows up in a code search; a contradicted decision only shows up when someone remembers.

Where Lockstep fits

Lockstep goes after decision drift. It captures decisions from PRDs, Slack, and pull requests, routes each to its owner for approval, and briefs Claude Code sessions on the approved decisions that apply to the code being changed. Its checks are advisory: they flag a change that likely conflicts with a decision for a person to review.

See how it works.

Sources checked 16 November 2026

For why agents miss past decisions, see why Claude Code forgets architecture decisions. For recording them, see architecture decision record examples. For reviewing agent-written code, see AI code review best practices. For a definition of done that covers agent-written code, see definition of done vs acceptance criteria. For a review checklist with AI-specific checks, see the code review checklist. For measuring delivery as agents speed things up, see DORA metrics. For flag debt, see feature flag best practices.

Frequently asked questions

Does AI-generated code create technical debt?
It can, mostly by speed. An agent writes plausible, working code quickly, so it's easy to accept code nobody fully understands, that duplicates existing logic, or that ignores team decisions. The debt comes from accepting it without the context and review you'd apply to a person's code.
What is the technical debt quadrant?
Martin Fowler's way of classifying debt on two axes: reckless or prudent, and deliberate or inadvertent. Prudent deliberate debt is a conscious trade-off, such as shipping now and refactoring later. Reckless inadvertent debt is taken on without knowing it. Unreviewed AI code mostly lands in the reckless inadvertent cell.
How do I reduce technical debt from AI coding agents?
Give the agent the codebase's conventions and the team's decisions up front, ask for a plan before large changes, review every diff you merge, gate changes on tests, and keep a record of deliberate shortcuts so they can be paid down. Watch for duplication, which agents create when they don't find existing code.
Is vibe-coded code always technical debt?
For a throwaway prototype, it doesn't matter, because the code will be deleted. It becomes debt the moment it's kept and built on. Treat vibe-coded prototypes as specifications for real code, not as the start of the production codebase.
How do I measure technical debt from AI?
Fowler notes productivity, and so the cost of debt, can't be measured objectively. Practical signals are the time to change areas with heavy AI-written code, how often the same logic appears in several places, defect rates in those areas, and how often agents' changes contradict past decisions.

Keep reading