New research from CodeScene reveals that AI-coding assistants can increase defect risk by at least 30% when applied to unhealthy codebases, with the real-world impact likely much higher in legacy systems. The peer-reviewed study, "Code for Machines, Not Just Humans: Quantifying AI-Friendliness with Code Health Metrics," conducted by Markus Borg and Adam Tornhill, demonstrates that AI tools accelerate output but often amplify technical debt in poorly maintained code, leading to more bugs, slower delivery, and eroded productivity gains.
Quick Intel
The study explains recent industry observations of increased bugs and diminished returns after initial AI enthusiasm. In unhealthy code, AI generates faster but often poorer-quality changes that compound maintainability issues over time. Healthy codebases, however, benefit from AI acceleration without the same downside risk.
"In the AI era, healthy code is no longer optional," said Adam Tornhill, Founder and CTO at CodeScene. "It's a prerequisite for safe, effective, and economically viable AI adoption."
To mitigate these risks, CodeScene has outlined an automated, self-correcting framework built on three integrated components:
This creates an agentic loop: assess health → safeguard AI output → refactor weak areas → validate improvements via CodeHealth™ → repeat. The approach ensures measurable, predictable outcomes tied directly to business metrics like defect rates, delivery speed, and ROI.
At loveholidays, initial use of agentic coding with Claude led to declining code health. After implementing CodeScene's safeguards, the team reversed the trend and scaled safely to 50% agent-assisted code within five months, increasing throughput while preserving quality.
"AI has an amplifying effect. If your engineering practices are strong, AI helps you move faster. If they're weak, it will destroy you," said Stuart Caborn, Distinguished Engineer at loveholidays.
"AI can't determine what 'good code' looks like," Tornhill added. "Code Health gives AI that ground truth, connecting AI performance directly to business outcomes like speed, defects, and ROI."
The full whitepaper, "AI-Ready Code: How Code Health Determines AI Performance," is available now and provides deeper insights into the research, framework, and practical implementation.
About CodeScene
CodeScene helps organizations manage technical debt by impact, adopt AI-assisted coding safely, and prove ROI using CodeHealth™ — the only scientifically validated code quality metric proven to predict defect risk and delivery performance.