Software engineering teams see initial velocity spikes when deploying autonomous coding agents, but those gains evaporate within months due to rising code complexity.
Adam Tornhill, founder of CodeScene, presented these findings at GOTO Copenhagen, explaining that large language models frequently operate in a self-destructive mode by generating code they cannot reliably maintain later.
A study of more than 1,000 open-source projects shows that while AI assistance boosts productivity during the first few weeks, cumulative complexity cancels out all velocity gains after two months. Building prototypes has rarely been the primary bottleneck in software engineering, since 95% of project costs accumulate after the initial release.
“Building a prototype was never the hard problem in software; 95% of the costs for any software project come after the first release,” Tornhill told InfoQ.
Unhealthy code bases routinely force models to consume significantly more resources during maintenance and reviews. A pre-registered study of 465 agent-authored pull requests across 246 repositories examined how repository quality affects large language models, according to CodeScene. Researchers from Lund University, led by PhD student Lo Gullstrand Heander, partnered with CodeScene to evaluate pull requests through a five-agent pipeline using three distinct language models.
Every point increase on CodeScene’s code quality metric reduces required tokens by 3.5% to 6.1% during agent reviews. Contrast analyses between typical unhealthy repositories and healthy codebases reveal significant token savings across different serving stacks and caching mechanisms.
| Large Language Model | Token Saving Per Code Health Point | Total Contrast Saving (2.8 to 9.7 Code Health) |
|---|---|---|
| deepseek-v4-flash | 6.1% | 35.0% |
| qwen3.6 | 4.8% | 28.9% |
| claude-sonnet-5 | 3.5% | 21.8% |
Evaluating maintainability requires combining metrics across multiple architectural tiers rather than relying on a single metric. CodeScene measures software design across module-level cohesion, function-level API expressiveness, and implementation-level accidental complexity.
The average codebase sits at a code health score of 5.15, whereas AI-friendly thresholds begin at 9.5.
Human developers working inside healthy repositories operate up to 10x faster than peers tackling similar tasks in degraded codebases, while defect risk drops fifteenfold and code reviews finish twice as fast.
Unassisted AI models struggle to perform deep architectural refactoring once code health improves. Claude fixes roughly 50% of quality issues in low-health code, but its success rate drops to 20% in cleaner codebases where models become overly conservative.
Integrating a Model Context Protocol (MCP) supplying real-time code health data lifts automated fix rates to between 90% and 100%.
Automated safeguards like linting, mutation testing, and code coverage must operate locally through command-line tools or MCP servers to guide agents effectively.
“Safeguarding needs to happen at multiple levels, and all safeguards need to be completely automated in an agentic context,” Tornhill told InfoQ.
Pull request diff size acts as the primary driver of token consumption, while the underlying code health serves as a distinct secondary driver. Unhealthy files force language models to parse larger footprints and spend more computational effort per review pass.
Teams establish a baseline by measuring existing code quality, deploy a reliable test suite to preserve behavioral consistency, and feed objective code health data back into the agentic loop.
The average codebase registers a code health score of 5.15, while AI-friendly codebases score 9.5 or higher on CodeScene’s quality metric.