microsoft /TokenEconomizer
Experience-Driven Black-Box Cost Control for Coding Agents
★ 5,577⑂ 345👁 20⑃ 105● 65▤ 1◈ 0
5,577
stars
+207
345
forks
20
watchers
105
prs
65
issues
1
releases
0
discussions
README
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
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
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 spelling of a command that works here
(python -m pytest where pytest is missing, npx tsc where tsc is), an environment
variable a command needs, where generated files live. Micro-skills learns such facts, in any
language, from two sources: failures that repeat across sessions, and a model that reviews the
recent sessions every k sessions (k = 3) and proposes facts. A fact is stated at the start
of each session once three sessions have confirmed it, and dropped when later sessions
contradict it.
- Tool pruning: stop loading tools that go unused. Every loaded tool's definition is sent with
every request. A tool that goes unused over p prompts spread across at least m sessions, or
over s sessions of any length (p = 10, m = 2, s = 5), is left out of the next sessions
through the agent's own settings. One command brings it back.
- Failure-loop intervention (the loop guard): step in when a turn is stuck. When a turn (the
agent's work on one prompt) keeps hitting the same failures, a judge model checks whether it is
stuck. If the judge is at least c sure (c = 0.7), the agent gets a redirect (a short note,
added to its context, to try another approach), at most r times per turn (r = 1). If the
turn is still stuck after that, TokenEconomizer tells you how to stop it; it never stops a turn
itself.
TokenEconomizer is a plugin for Claude Code, Codex, the GitHub Copilot CLI and Pi,
with experimental support for opencode, Cursor Agent, Grok Build, Hermes Agent and
the Antigravity CLI. Each italic
letter above is a setting, shown with its default (Settings), and each mechanism can be turned on or
off. The plugin announces each action in one line, and if any part of it fails, your session
carries on as if it were not installed. Its model calls (the fact proposer, and the judge with the
redirect it writes) run through your own agent, on the same plan or login, and their cost is
included in its reports. What it learns stays on your machine, in ~/.tokeneTop issues
#85Will other agents be supported?5 comments · 2026-10-30#167Windows: te launcher fails in Git Bash; lib/tokeneconomizer symlink checked out as plain file2 comments · 2026-11-08#166Support omp (oh-my-pi) sessions: history import and host detection2 comments · 2026-11-08#143Factory Droid 0.233.0 support: adapter ready and live injection verified2 comments · 2026-11-05#162Claude Code side calls: use --safe-mode so the judge and proposer don't load the user's customizations0 comments · 2026-11-07
Latest release
TokenEconomizer 0.1.0 v0.1.0 2026-10-26First release of TokenEconomizer, the plugin from TokenEconomizer: Experience-Driven Black-Box Cost Control for Coding Agents (arXiv 2610.22732). It makes Claude Code, Codex, the GitHub Copilot CLI and Pi cheaper to run in the repositories you work in often, without changing the agent. It learns from each finished session in a repository and changes what the next sessions there start with. In the paper's SWE-Bench runs: 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. Mechanisms - Micro-skil
相关报道 (5)
businessfocus唔想燒Token燒到破產?AI慳錢神器!微軟開源專案:TokenEconomizer 幫你的Agent 減肥打底,成本即減高達30%2026-11-03blog.csdnTokenEconomizer快速上手:5分钟装好Claude Code、Codex、Copilot CLI、Pi、opencode全平台指南2026-11-01blog.csdn为什么你的AI编码助手越用越贵?揭秘TokenEconomizer经验驱动省Token的新思路2026-11-01noteAI Agentの無駄な試行錯誤を減らす。MicrosoftのTokenEconomizerが実用的2026-10-30noteClaude Codeの「同じ失敗」に毎回課金しない——Microsoft TokenEconomizerがSWE-Benchで平均18〜31%削減2026-10-25
News & coverage (5)
Hacker NewsTokenEconomizer: Cut coding-agent token costs 18-31%▲ 2 · 1 comments · 2026-11-04ProPakistaniMicrosoft’s New Tool Can Cut AI Coding Costs by Up to 31%2026-10-31fourweekmbaMicrosoft’s Free Plugin Cuts Coding Agent Costs Up to 30.9%2026-10-31MarkTechPostMeet TokenEconomizer: Microsoft’s Plugin That Cuts Coding Agent Costs by Up to 30.9%2026-10-30DiarioBitcoinMicrosoft presenta TokenEconomizer para recortar hasta 30,9% el costo de agentes de código2026-10-30