AI-Generated Code Is a Time Bomb: Why 40% of It Gets Rewritten Within Two Weeks
A study analyzing 153 million lines of code found that AI-generated code churn — the proportion of newly added code that gets updated or deleted within two weeks — jumped from 33% to 40% since AI coding tools went mainstream. That's not a rounding error. That's a structural shift in how we build software, and it points to something most teams aren't talking about: a maintainability crisis hiding beneath all the productivity gains.
Mislav Marohnić, ex-Principal Engineer at GitHub, put it bluntly: AI-generated code is a "ticking time bomb." His take is that this code looks plausible on the surface but is a nightmare to understand, debug, and safely modify later. Having spent over 14 years building and maintaining production systems, I think he's right. And I think we're only seeing the start of the fallout.
Does AI-Generated Code Create More Technical Debt?
The short answer is yes, and the data backs it up.
The GitClear study analyzed 153 million lines of code across thousands of repositories and found a clear trend: as AI tool adoption accelerated, code churn shot up. Code that was written and then rewritten or deleted within 14 days went from roughly one-third to nearly two-fifths of all new code. That's a huge increase in wasted effort. And it signals something deeper — the code being produced isn't sticking because it wasn't right in the first place.
Adam Tornhill, Founder of CodeScene, has been tracking this pattern across enterprise codebases. He describes AI tools as "masters of copy-paste" — they can spread complex or flawed patterns across a codebase much faster than a human ever could. One bad abstraction doesn't just stay in one file anymore. It metastasizes across entire modules before anyone notices.
I've seen this firsthand. Last year, a team I was working with leaned heavily on AI assistance for a new service. The initial velocity was impressive. Features shipped fast, PR cadence looked great on paper. But three months in, every bug fix was opening cans of worms. The AI had generated structurally similar but subtly inconsistent implementations across a dozen endpoints. Fixing one meant understanding twelve. That's not productivity. That's deferred pain.
The speed at which AI generates code is exactly what makes it dangerous. Bad patterns that would take a human weeks to spread can cover an entire codebase in an afternoon.
How AI-Generated Code Fails at Maintainability
Here's the thing nobody's saying about AI-generated code: it optimizes for the wrong moment. It optimizes for creation. But the actual cost of software is in the reading, debugging, and modification that happens over years. AI is terrible at that part.
Gergely Orosz, who writes The Pragmatic Engineer newsletter, has a good framing for this. He calls it the "dark side" of AI code generation. His core observation: AI coding assistants produce code that is "subtly wrong" — it compiles, it passes a quick glance, but it contains logic errors or architectural choices that take a senior engineer real effort to catch and correct. That review burden can offset the initial productivity gains entirely.
I've reviewed enough AI-assisted pull requests to recognize the pattern. The code looks clean. Variable names are reasonable. The structure seems logical. But the choices are surface-level. The AI doesn't understand why your team chose a particular error-handling strategy, why certain database queries are structured to avoid N+1 problems in a specific context, or why a seemingly redundant check exists because of a race condition discovered in production eighteen months ago. It generates code that looks like it belongs but doesn't actually fit.
I think of it as "uncanny valley code" — code that appears professional but lacks the institutional knowledge baked into a mature codebase. It's the software equivalent of a confidently wrong answer on an exam. The student shows their work, the handwriting is neat, and the conclusion is dead wrong.
If you've ever dealt with the nightmare of rewriting software from scratch, you know that maintaining context and institutional knowledge is everything. AI-generated code strips that context out by default.
The Junior Developer Skills Crisis Is Real
The maintainability crisis isn't just about the code. It's about the people who are supposed to maintain it.
Sarah Wells, former Tech Director at the Financial Times, has warned about a "hollowing out" of developer skills, especially among juniors. Her argument: the struggle of writing code — the debugging, the failed attempts, the deep thinking about why something doesn't work — is where real learning happens. When juniors lean on AI to skip that struggle, they miss the foundational understanding that turns them into engineers who can maintain complex systems.
This isn't some abstract worry. I've managed teams where junior developers used AI tools extensively. The ones who treated AI output as a starting point for learning grew fast. The ones who treated it as a finished product hit a wall within six months. They could generate features but couldn't debug them. They could create new code but couldn't reason about existing code. Productive in the narrow sense. Ineffective in every way that actually matters.
The irony stings: the industry is using AI to produce more code than ever while simultaneously undermining the pipeline of engineers capable of maintaining that code. We're building tomorrow's legacy systems and degrading the workforce that will need to keep them running.
I wrote about a related dynamic in how AI coding agents are changing the role of software engineers. The takeaway still holds: AI isn't replacing engineers. It's raising the floor on what you need to know to be effective. The engineers who can't read and reason about code — regardless of who or what wrote it — are the ones at risk.
What Senior Engineers Should Do About AI Code Quality
This is one of those things where the boring answer is actually the right one. The solution isn't to ban AI coding tools. It's to build systems and habits that catch the problems AI creates before they compound.
Treat AI output as a first draft, always. I've shipped enough features to know that the first version of anything is wrong in ways you can't predict. AI-generated code is no different. Every AI-generated block should get the same scrutiny as a junior developer's first PR.
Invest in code review as a first-class activity. The teams I've seen handle AI code well already had strong review cultures before AI showed up. They don't rubber-stamp clean-looking PRs. They ask "why" at every level — why this pattern, why this library, why this error handling approach. AI can't answer those questions, which means the human reviewing must.
Monitor code churn as a quality signal. If your team's churn rate is climbing, that's a leading indicator of AI-generated maintenance overhead piling up. Tools like CodeScene and GitClear can surface this data. Track it the same way you track deployment frequency or incident rates.
Protect the learning path for junior engineers. Don't let juniors use AI as a crutch for core skills they haven't built yet. I've started requiring junior developers on my teams to explain every AI-generated suggestion before committing it. If they can't explain it, they can't ship it. This connects directly to the security risks of vibe-coded applications — code you don't understand is code you can't secure.
Set architectural guardrails before AI touches the codebase. Define your patterns, conventions, and non-negotiable design decisions in writing. ADRs (Architecture Decision Records) become critical when AI is generating code. AI doesn't read your team's Slack history or attend your design reviews. You have to encode that context explicitly.
The Maintainability Reckoning Is Coming
The 153 million lines of data don't lie. AI coding tools are generating code faster than ever, and a growing share of it is disposable — written, shipped, and rewritten within days. The industry is celebrating velocity while ignoring the growing pile of AI tech debt accumulating in production systems.
Marohnić's "ticking time bomb" metaphor resonates because experienced engineers recognize the pattern. We've seen what happens when teams prioritize speed over maintainability. We've cleaned up the messes. The difference now is that AI has put that pattern on steroids.
My prediction: within two years, we'll see the first wave of high-profile incidents directly traceable to unmaintainable AI-generated code. A critical system will fail. An investigation will reveal layers of AI-generated logic that no engineer on the team actually understands. And the industry will have its reckoning. The companies that weather that moment will be the ones that built review cultures, monitored code quality metrics, and treated AI as a tool rather than an autopilot starting now.
The question isn't whether the code is being written. It's whether anyone will be able to read it when it matters.
Originally published on kunalganglani.com
Top comments (0)