At the GOTO conference in Copenhagen, Adam Tornhill said coding agents used 40–45% fewer tokens to complete the same task when working with healthy code. The benefit goes beyond token use, he argued: code that is easy to understand and change is also easier for an agent to maintain after it writes it.
Tornhill said agents can help teams complete tasks two to three times as fast, in part because developers can resolve problems without waiting for colleagues. But he cited a study of more than 1,000 open-source projects in which delivery accelerated during the first few weeks of AI use. After two months, increased code complexity had erased the speed gains. The risk, he said, is that agents write code they cannot reliably maintain later.
What code health measures
In a follow-up interview with InfoQ, Tornhill described code health as a combination of measures at three levels. At the module level, the question is whether the code serves one coherent purpose or mixes unrelated responsibilities. At the function level, it is whether individual functions are well designed and their APIs easy to understand. At the implementation level, the measures flag avoidable complexity such as deeply nested logic and excessive copying and pasting.
Tornhill cited research predating coding agents in which developers working with healthy code solved comparable problems up to 10 times as fast as those working with unhealthy code. He said defect risk fell to one-fifteenth and code reviews were twice as fast. He argued that these differences matter more after the prototype stage, estimating that 95% of a software project’s costs come after its first release.
Giving agents feedback during refactoring
Tornhill put the average code health score for a typical codebase at 5.15, against a threshold of 9.5 for AI-friendly code. He described a limit to using Claude to close that gap: even in the best case, the agent fixed about half the identified issues in low-health code. Once code health improved, Claude correctly refactored only about 20% of the code, often making small edits that did little for quality. When the agent received code health data through the Model Context Protocol (MCP), Tornhill said, the fix rate reached 90–100%.
For large-scale refactoring, Tornhill recommended starting with a baseline that identifies where quality needs to improve and a reliable test suite that checks whether existing behavior has changed. After each edit, the agent can use test results and updated health measures to answer two distinct questions: did the code still behave as expected, and did the change bring its design closer to the target?
Tornhill said these checks need to run automatically through a local MCP server or command-line tools. They can include linting, coverage checks and mutation testing to see whether tests actually catch faults. In his team’s research, agents also kept an evolving playbook of refactoring patterns that had worked in the particular codebase. Tornhill said automation can already address many quality problems within modules; the harder challenge is extending those gains to the design and architecture of the system as a whole.