StackMap
Subscribe
Explore / TokenEconomizer
microsoft

TokenEconomizer

Microsoft Research plugin that cuts coding-agent cost 18-31% on SWE-Bench by learning repo facts from past sessions, pruning unused tools and redirecting stuck failure loops — no agent changes.

7,756 530 Python MITupdated today
View on GitHubDispute this mapping →
Curator's take

Install it on repos where you run agents daily: it learns the build quirks the agent keeps rediscovering, drops tool definitions you never use, and nudges turns stuck in a failure loop — measured gains, fails open. Payoff needs repeated sessions in the same repo, so it does little for one-off tasks; and its fact-proposer and judge spend some of your own plan's tokens to save more.

Mapped by ShipWithAI editors · links verified

Continue your stack

What teams reach for next — and why each earns a place beside TokenEconomizer. Ranked by curator confidence.

pairs wellpairs wellpairs wellalternativertkcodeburnheadroomtoken-optimizerTokenEconomizer
pairs wellalternativebuilt withpick a node for the why · open it from the panel
Weekly digest
README.md1 min read

TokenEconomizer: Experience-Driven Black-Box Cost Control for Coding Agents

Aaron J. Li1, Weijia Xu2, Chandan Singh2, Zixiao Chen3, Jeevana Priya Inala2, Charlotte Siska3,
Acar Tamersoy3, Bin Yu1, Ion Stoica1, Michel Galley2, Jianfeng Gao2

1UC Berkeley   2Microsoft Research   3Microsoft Security

arXiv Project page X post Python 3.10+ MIT license

#1 Python repository of the day on Trendshift #10 Python repository of the week on Trendshift

Our measurement on SWE-Bench tasks: 18.4–30.9% lower mean cost across five agent–model combinations, cheaper in all 30 repository × combination cells, and Pass@1 up in 4 of 5. Results

An animation that opens on a title card: TokenEconomizer, experience-driven black-box cost control for coding agents, with its three mechanisms (micro-skills, tool pruning, failure-loop intervention), the agents it works with (Claude Code, Codex, GitHub Copilot CLI, Pi) and the UC Berkeley and Microsoft logos. Then a schematic of six sessions in one repository, each a bar of what it cost: the work itself plus three kinds of waste, namely re-learning the repo, tools never used, and getting stuck in loops. Each of the first three sessions teaches TokenEconomizer one thing, in order: 1 micro-skills remember how the repo works (run tests with python -m pytest), 2 tool pruning skips tools never used here (Read and Edit kept, Notebook and Browser left out), and 3 failure-loop intervention spots loops and steps in (the same error three times meets a nudge to try another way). In the session after each lesson that waste shrinks, so the bars step down below a dashed line marking the cost without TokenEconomizer. It ends on results measured on SWE-Bench tasks: 18.4–30.9% lower mean cost across five agent–model combinations, cheaper than default in 30 of 30 repository × combination cells, and Pass@1 up in 4 of 5; per combination, cost 23.6% lower and Pass@1 +1.3 for Claude Code with Sonnet 5, 30.9% and −1.0 with Opus 4.8, 24.7% and +0.9 for Codex with GPT-5.6 Terra, 26.1% and +1.6 with GPT-5.6 Sol, and 18.4% and +2.6 for Copilot CLI with Sonnet 5.

TokenEconomizer makes coding agents cheaper to run in the repositories you work in often, without changing the agent itself. It learns from the sessions an agent has already run in a repository, and uses that experience to cut waste in the sessions that follow. It has three mechanisms:

  • Micro-skills: remember how the repository works. Sessions keep rediscovering the same facts: a build step that must run first, the spel