STORY · FORSKNING_

Economic benefits of code refactoring with AI agents

A CTO at Thoughtworks documents how AI agents (primarily Claude Code) wrote a 150,000-line application and conducted an experiment where refactoring a bloated data access layer (17,155 lines) was used to measure token consumption reduction on subsequent tasks. The results showed that each refactoring round significantly lowered input tokens, particularly when the largest files were split up.

WHY IT MATTERS

This demonstrates a practice-based method for optimizing token costs in agent-driven development, which becomes economically significant as organizations scale up their use of AI code generation.

SOURCES

MACHINE-GENERATED SUMMARY This summary is written by machine from the sources below. We sort and explain — but we are a way into the field, not the final word. Check the source when something matters to you.