
中文版
TokenEconomizer(GitHub:https://github.com/microsoft/TokenEconomizer ,2026-10-13 创建,今晨抓取时已 4,897★)是微软研究院与 UC Berkeley 联合出品的编码 Agent 成本控制插件:不改 Agent 本身,而是从它在同一个仓库里跑过的会话中学习经验,把后续会话里的浪费砍掉。论文已挂 arXiv(2610.22732),Apache 2.0 开源。
它有三招:微技能——记住这个仓库的做事方式,比如先跑哪条构建命令、哪条命令的拼写才管用,三个会话确认过的事实会在每次会话开始时注入,之后被推翻就丢弃;工具剪裁——长期不用的工具不再随每个请求发定义,通过 Agent 自身的设置排除,一条命令就能恢复;失败循环干预——一轮对话反复撞同一个错误时,由裁判模型判断是否卡住,给一次换思路的提示,之后仍卡住只会告诉你怎么停下来,绝不替你停。
按论文在 SWE-Bench 277 个任务上的实测,五组 Agent×模型组合的平均成本降低 18.4%~31%,30 个仓库×组合单元全部更便宜,Pass@1 在五组里有四组还提高了。支持 Claude Code、Codex、GitHub Copilot CLI 与 Pi,opencode、Cursor Agent、Grok Build 与 Hermes Agent 为实验性支持。插件自身不需要 API Key,不碰你的凭据,学到的东西只存在本机 ~/.tokeneconomizer。
为什么值得了解
- 对每天重度用编码 Agent 的人,这是直接省钱的方案:成本按缓存价实算、包含插件自己的模型调用,省下来的数是真金白银,不是纸面 token
- 思路值得借鉴:不改模型、不改 Agent,只从历史会话里学“这个仓库的做事方式”,越用越省
- 但它只在“常去的仓库”上划算,新仓库从零学起收益有限;且微技能默认关闭,想省最多要手动打开
English Version
TokenEconomizer (GitHub: https://github.com/microsoft/TokenEconomizer , created 2026-10-13, 4,897 stars at this morning’s fetch) is a cost-control plugin for coding agents from Microsoft Research and UC Berkeley: instead of changing the agent, it learns from the sessions the agent has already run in a repository and cuts the waste out of the sessions that follow. The paper is on arXiv (2610.22732), Apache 2.0 licensed.
It works three ways. Micro-skills remember how a repository works — which build step must run first, the exact spelling of a command that works here — and a fact confirmed by three sessions is stated at the start of each session, then dropped if later sessions contradict it. Tool pruning stops sending the definitions of tools that go unused, removing them through the agent’s own settings, with one command to bring them back. Failure-loop intervention has a judge model check whether a turn is stuck on the same failures, gives it one redirect to try another approach, and after that only tells you how to stop it — it never stops a turn itself.
Per the paper’s measurement on 277 SWE-Bench tasks, mean cost fell 18.4–30.9% across five agent–model combinations, cheaper in all 30 repository × combination cells, and Pass@1 rose in 4 of 5. It supports Claude Code, Codex, the GitHub Copilot CLI and Pi, with experimental support for opencode, Cursor Agent, Grok Build and Hermes Agent. The plugin needs no API key of its own, never handles credentials, and everything it learns stays on your machine in ~/.tokeneconomizer.
Why it’s worth knowing
- For anyone using coding agents heavily every day, this saves real money: costs are computed at cache pricing and include the plugin’s own model calls, so the savings are actual spend, not paper tokens
- The idea is worth borrowing: change neither the model nor the agent, just learn “how this repository works” from past sessions, and it gets cheaper the more you use it
- It only pays off in repositories you visit often, though — a brand-new repository starts from zero — and micro-skills is off by default, so turn it on manually for the biggest savings

评论(0)
暂无评论