Skip to content
HN On Hacker News ↗

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

▲ 190 points 89 comments by softwaredoug 1d ago HN discussion ↗

Pangram verdict · v3.3

We believe that this document is fully AI-generated

78 %

AI likelihood · overall

AI
0% human-written 100% AI-generated
SEGMENTS · HUMAN 0 of 1
SEGMENTS · AI 1 of 1
WORD COUNT 247
PEAK AI % 78% · §1
Analyzed
Jul 6
backend: pangram/v3.3
Segments scanned
1 windows
avg 247 words each
Distribution
0 / 100%
human / AI fraction
Verdict
AI
Pangram v3.3

Article text · 247 words · 1 segments analyzed

Human AI-generated
§1 AI · 78%

View PDF HTML (experimental) 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.

Subjects: Software Engineering (cs.SE); Artificial Intelligence (cs.AI) Cite as: arXiv:2605.20049 [cs.SE]   (or arXiv:2605.20049v1 [cs.SE] for this version)   https://doi.org/10.48550/arXiv.2605.20049 arXiv-issued DOI via DataCite Submission history From: Priyansh Trivedi [view email] [v1] Tue, 19 May 2026 16:06:26 UTC (1,094 KB)