# Does Code Cleanliness Affect Coding Agents? A Controlled Minimal-Pair Study

**Authors:** Priyansh Trivedi, Olivier Schmitt  
**arXiv:** [2605.20049](https://arxiv.org/abs/2605.20049)  
**Date:** 2026-05-19  
**Summary page:** https://www.summarizepaper.com/en/arxiv-id/2605.20049v1/

## Key points

- Study title: "Does Code Cleanliness Affect Coding Agents? A Controlled Minimal-Pair Study"
- Authors: Priyansh Trivedi and Olivier Schmitt from SonarSource
- Research focus: Impact of code cleanliness on autonomous coding agents
- Innovative evaluation protocol: Using minimal pairs of repositories to isolate the effect of code cleanliness from agent capability
- Code cleanliness does not significantly impact the agent's pass rate
- Cleaner code leads to agents using 7 to 8% fewer tokens and reducing file revisitations by 34%
- Traditional maintainability principles are still relevant in AI-driven development
- Code cleanliness influences computational cost and navigational efficiency of coding agents alongside other factors like model choice, harnessing techniques, and prompting strategies

## Summary

, , , , 


In their study titled "Does Code Cleanliness Affect Coding Agents? A Controlled Minimal-Pair Study," authors Priyansh Trivedi and Olivier Schmitt from SonarSource explore the impact of code cleanliness on autonomous coding agents. The existing evaluation of these agents has primarily focused on task completion rates while holding the target codebase constant. However, a critical question remains unanswered: does the structural and stylistic quality, or "cleanliness," of the underlying code influence an agent's ability to navigate and modify it? To address this question, Trivedi and Schmitt introduce an innovative evaluation protocol centered around minimal pairs of repositories. These pairs are designed to match in terms of architecture, dependencies, and external behavior but differ in static-analysis rule violations and cognitive complexity. By creating pairs in both directions – one with a clean repository degraded by agent pipelines and another with a messy repository cleaned up by agents – the researchers aim to isolate the effect of code cleanliness from agent capability. The study includes 33 tasks distributed across six pairs, which are evaluated through hidden tests at the application's public surface. Over 660 trials conducted with Claude Code, it is found that code cleanliness does not significantly impact the agent's pass rate. However, it does have a substantial effect on the agent's operational footprint: agents working on cleaner code use 7 to 8% fewer tokens and reduce file revisitations by 34%. These findings highlight the continued relevance of traditional maintainability principles in AI-driven development. They demonstrate that code cleanliness plays a crucial role in shaping the computational cost and navigational efficiency of coding agents alongside factors like model choice, harnessing techniques, and prompting strategies. Overall, this study sheds light on how code cleanliness influences agent behaviors in software development environments.
