Microsoft Research has explained how TokenEconomizer uses completed coding sessions to reduce an AI agent’s costs on later work in the same repository. The open-source controller retains useful commands and removes tools that go unused. Microsoft’s November 16 post builds on research first published in October. [1][2]
The authors report cost reductions of 18.4% to 30.9% across five agent and model combinations on SWE-Bench, including the controller’s own overhead. Task success stayed broadly comparable with the baseline in those experiments. [2]
Learning what a repository needs
An initial study of 60 tasks found agents repeating earlier actions within a repository and loading many tool definitions they never used. Failed tasks also consumed a disproportionate share of spending. [1]
TokenEconomizer addresses those patterns with short operational notes, evidence-based tool pruning and a guard that detects unproductive loops. The notes can retain details such as a working test command. Tool pruning narrows the set of available tools after observing usage, while the loop guard can suggest a different approach when work stalls. [3]
The public plugin supports for Claude Code, Codex, GitHub Copilot CLI and Pi. It requires Python 3.10 or later and uses the agent's existing login and plan, without a separate TokenEconomizer API key. Model calls for its own analysis still have a cost, which the project counts in its accounting. [3]
What the savings numbers cover
The main evaluation used 277 SWE-Bench tasks across six repositories. Costs reflect cached-token pricing, an important detail when repeated prompts cost less than fresh ones. Reducing the number of tokens alone would not establish the same dollar saving. [2]
Results varied across configuration. In the paper’s Claude Code and Opus 4.8 setting, cost fell 30.9%, while the task pass rate declined from 74.0% to 73.0%. The authors also note that their task streams contain related but independent fixes, rather than actual continuous user sessions. Interactive coding remains a setting to test further. [2]
A team evaluating the plugin would need to compare its own cost per completed task over several sessions. Tracking completed fixes alongside spending would help distinguish savings from a reduction in useful work.
The plugin leaves stopping decisions to the user
The interactive plugin behaves differently from the experimental controller in several practical ways. According to its documentation, micro-skills are off by default because generating them calls a model on the user’s plan and draws on repository-controlled command output. Users must choose to enable that feature. [4]
The loop guard also never stops a turn automatically. It can redirect an agent, then notify the user if the work still appears stuck. The user decides whether to end it. That differs from the autonomous benchmark setup, where the controller could terminate a run. [4]
Learned state is stored locally under ~/.tokeneconomizer. Removing the plugin leaves that directory in place, so users who want to erase its retained state need to remove it separately. Local storage describes where those records live; the plugin still uses the host agent's model access for its analysis. [4]
Sources
[1] Microsoft Research on TokenEconomizer
[2] TokenEconomizer research paper and results
[3] Microsoft TokenEconomizer repository README
[4] TokenEconomizer plugin behavior and local state
Archive photograph of development work at the 2018 Kiwix Hackathon in Zurich. Illustrative coding scene, not TokenEconomizer or its developers. Coding 2 by The other Kiwix guy / Wikimedia Commons. CC BY-SA 4.0. Wikimedia's resized version; no crop or other editorial alteration. The image remains available under CC BY-SA 4.0. Image source. Image license / permission.
Have a correction or a useful perspective?
Get in touch with the publication.


