AI & Tech

Refactoring Cut an Agent's Input Tokens by 83% for the Same Task

Thoughtworks CTO Giles Edwards-Alexander took a 150,000-line agent-built application, picked a bloated 17,155-line data access file, and applied fifteen refactoring steps — running the same feature task with a fresh agent after each one. Input tokens fell from 159,564 to 27,360, an 83% reduction, as the largest file shrank to 3,695 lines across 19 files. The data layer’s total size barely moved; modularity, not deletion, did the work. Output tokens stayed roughly flat, suggesting refactoring buys cheaper reading rather than cheaper writing. The agent was poor at choosing which refactorings to perform — a human picked them.

Read the original — via martinfowler.com ↗

← All shorts