Does Code Cleanliness Affect Coding Agents? A Controlled Minimal-Pair Study
2026/05/19 by Priyansh Trivedi, Olivier Schmitt · 10 voices
Computer Science · #cs.SE #cs.AI
paper · pdf
Abstract
As autonomous coding agents see rapid adoption, their evaluation has primarily focused on task completion rates holding the target codebase fixed. This leaves a critical question unanswered: does the structural and stylistic quality, or ``cleanliness'' of the underlying code affect an agent's ability to navigate and modify it? To isolate the effect of code cleanliness from agent capability, we introduce an evaluation protocol built around minimal pairs: repositories that match on architecture, dependencies, and external behaviour, but differ on static-analysis rule violations and cognitive complexity. The pairs are constructed in both directions, by agent pipelines that either degrade a clean repository or clean a messy one. We author 33 tasks across six such pairs, evaluated through hidden tests at the application's public surface. Across 660 trials with Claude Code, code cleanliness does not change the agent's pass rate. However, it substantially alters the agent's operational footprint: agents working on cleaner code use 7 to 8% fewer tokens and reduce file revisitations by 34%. Our findings suggest that traditional maintainability principles remain highly relevant in the era of AI-driven development, shaping the computational cost and navigational efficiency of coding agents. Code cleanliness joins model choice, harness, and prompting as a factor that materially affects agent behaviours.
Citations
Discussions
- Does code cleanliness affect coding agents? A controlled minimal-pair study [hn, 210 points, 94 comments]
- Does code cleanliness affect coding agents? A controlled minimal-pair study View Article | Discussion + AI Summary Summary of HN discussion 🧵👇 [bsky, 1 points, 1 comments]
- Does Code Cleanliness Affect Coding Agents? https://arxiv.org/abs/2605.20049 (https://news.ycombinator.com/item?id=48798815) [bsky, 0 points, 0 comments]
- https://bsky.app/profile/hackernews.com.web.brid.gy/post/3mpxbvdemee72 [bsky, 0 points, 0 comments]
- Does code cleanliness affect coding agents? A controlled minimal-pair study [bsky, 0 points, 0 comments]
- Does code cleanliness affect coding agents? A controlled minimal-pair study #HackerNews https://arxiv.org/abs/2605.20049 [bsky, 0 points, 0 comments]
- Does code cleanliness affect coding agents? A controlled minimal-pair study https://arxiv.org/abs/2605.20049 https://news.ycombinator.com/item?id=48798815 [bsky, 0 points, 0 comments]
- A controlled minimal-pair study testing whether code cleanliness measurably changes how well coding agents complete tasks. Submit to upvote on HN https://news.ycombinator.com/submitlink?u=https%3A%2F% [bsky, 0 points, 0 comments]
- Does Code Cleanliness Affect Coding Agents? https://arxiv.org/abs/2605.20049 [bsky, 0 points, 0 comments]
- Does code cleanliness affect coding agents? A controlled minimal-pair study https://arxiv.org/abs/2605.20049 [comments] [95 points] [bsky, 0 points, 0 comments]
- Neue Studie: Sauberer Code macht Coding-Agenten messbar besser. Das ist 'garbage in, garbage out', wissenschaftlich bestätigt und mit arXiv-Nummer versehen. Wenigstens wissen wir jetzt offiziell, was [bsky, 0 points, 1 comments]
- Does code cleanliness affect coding agents? A controlled minimal-pair study https://arxiv.org/abs/2605.20049 (http://news.ycombinator.com/item?id=48798815) [bsky, 0 points, 0 comments]
- Does code cleanliness affect coding agents? A controlled minimal-pair study https:// arxiv.org/abs/2605.20049 # arxiv [mastodon, 0 points, 0 comments]
- Does code cleanliness affect coding agents? A controlled minimal-pair study https://arxiv.org/abs/2605.20049 https://news.ycombinator.com/item?id=48798815 [bsky, 0 points, 0 comments]
- Does Code Cleanliness Affect Coding Agents? https://arxiv.org/abs/2605.20049 (https://news.ycombinator.com/item?id=48798815) [bsky, 0 points, 0 comments]
Related