Microsoft Research and UC Berkeley have released TokenEconomizer, an open-source plugin that learns from past sessions to cut coding agent token costs by 18.4% to 30.9% — without changing the agent itself.
TokenEconomizer works as a plugin with Claude Code, Codex, GitHub Copilot CLI and Pi, runs on any machine with Python 3.10+, and needs no GPU or API key of its own.
TokenEconomizer (Credits: MarkTechPost)
Where the waste hides
The team profiled 60 SWE-Bench tasks using Claude Code with Opus 4.8 and found three recurring cost sinks: repeated discovery (after 5 tasks, 30% of tool calls repeat an earlier action), unused tools (16 of 23 tool schemas load every turn but are never called), and failure loops (10 failed runs were just 17% of tasks but 32% of total spend).
The controller attacks all three: it stores one-line “micro-skills” facts per repository (like the working test command) that enter the prompt after 3 confirmations, prunes unused tools (cutting prompt tokens on Django’s first request from 43,351 to 16,295), and sets a learned turn budget with a stuck-agent detector that redirects once, then stops.
TokenEconomizer results on SWE-Bench
On 277 SWE-Bench tasks, savings ranged from 18.4% (Copilot CLI + Sonnet 5) to 30.9% (Claude Code + Opus 4.8), with costs cheaper in all 30 repository-setting cells. Accuracy barely budged: Pass@1 improved in 4 of 5 settings, dropping only 1.0 point on Opus 4.8. Results also held outside SWE-Bench — 16–21% cheaper on Web-Bench and CredData.
Savings compound: most repositories cost slightly more at first, but all were cheaper by the sixth task. The biggest single win was 33.2% when combined with RTK.
Also Read: MAO Launches: Team Up Claude Code, Codex And Grok On One Canvas — Free Trial, $20 Once
Source: MarkTechPost — read the full story there.