Researchers have published a controlled minimal-pair study examining whether code cleanliness affects the performance of coding agents. The experiment paired identical programming tasks across two conditions: well-structured, documented codebases versus functionally equivalent but disorganized implementations. Agents consistently achieved higher success rates and required fewer iterations on clean code, with the gap widening as task complexity increased.
The findings carry immediate implications for teams integrating AI assistants into production workflows. Technical debt, long treated as a human maintainability concern, now directly constrains automated tooling. Organizations with legacy systems may see diminished returns from agent adoption unless refactoring precedes deployment.
The effect appears rooted in context window efficiency. Clean code reduces token consumption for equivalent semantic information, leaving more capacity for reasoning. Agents also exhibited fewer hallucinated dependencies when navigating explicit module boundaries.
Future work will test whether fine-tuning on messy code can close the gap, or if architectural hygiene remains a hard prerequisite. Tooling vendors are already experimenting with automated cleanup passes before agent invocation.
