Top stories
Controlled study finds cleaner code cuts coding-agent token cost
- Category: ML research
- Status: developing
- Sources: arXiv 2605.20049, HN discussion
- Summary: SonarSource researchers Priyansh Trivedi and Olivier Schmidt (submitted 2026-05-19, resurfaced on Hacker News 2026-07-06) ran a minimal-pair protocol that pairs repositories identical in architecture and dependencies but differing in static-analysis violations and cognitive complexity, either degrading clean code or cleaning messy code, across six pairs and 33 tasks. Over 660 trials with Claude Code, code cleanliness did not change task completion rate, but agents on cleaner code used 7 to 8 percent fewer tokens and made 34 percent fewer file revisitations.
- Why it matters: It puts a measured cost figure on technical debt for agent-driven workflows, separating computational cost and navigation efficiency from task success.
- Follow-up: Watch for independent replication on other agents and models and for larger task sets past the 33 reported.