A plugin that cuts coding-agent token costs by learning from repeated sessions in the same repository
TokenEconomizer, published by researchers from Microsoft Research, Microsoft Security, and UC Berkeley, is a plugin that lowers operating costs without modifying the agent itself. It learns from previous sessions in the same repository and cuts three types of waste in subsequent sessions. It removes definitions for tools that are never called from the agent’s own settings; they can be restored with a single command. It uses a judge model to detect a stuck turn and give the agent a one-time redirection note, but does not stop the turn itself. Its optional micro-skills feature also learns information that would otherwise be rediscovered in every session, such as the repository’s working test command, and reminds the agent at the start of each session.
The measurement comes from the team’s paper (arXiv 2610.22732); Microsoft Research published the same results on its blog on November 16. Across 277 SWE-Bench tasks from six repositories and five agent-model combinations, average costs fell by 18.4% to 30.9%. Costs decreased in all 30 repository-combination cells. Pass@1 improved in four of the five combinations, but dropped by 1 point with Claude Code and Opus 4.8. The cost includes the plugin’s own model calls. In the comparison reported by MarkTechPost, RTK increased costs in 12 of the same 30 cells, and Aider RepoMap did so in 15. Savings on Web-Bench were 16–21%. Savings were lowest on short security-audit tasks (ReposVul); the blog puts the range at 6.4–19.6%. The team’s profiling findings also show where the waste comes from: 30% of tool calls were repeated, 16 of 23 tool definitions went unused, and the 17% of tasks that failed consumed 32% of the spending.
Itai Spector’s independent review highlights three details. Micro-skills, one of the biggest sources of savings, are disabled by default in the installed version. The tests used a previous generation of models. Claude Code also now handles some of this work itself. The gains accumulate over time: the first tasks cost more in most repositories, but from the sixth task onward, they were all cheaper. It works with Claude Code, Codex, GitHub Copilot CLI, and Pi; support for opencode, Cursor Agent, Grok Build, Hermes Agent, and Antigravity CLI is experimental. What it learns stays local, in the ~/.tokeneconomizer directory. It’s an Apache-2.0-licensed project with about 8,000 stars and a six-week history.
Teams that run long sessions in the same repositories every day and pay by the token. Also useful for teams with many MCP tools installed that they rarely use.
Savings start after the first few tasks, so teams working only in new repositories or on short tasks will benefit less. It uses hooks, so installation requires trusting the directory and allowing its script to run. Judge and micro-skills calls use your agent and plan; their costs are included in the reports. The cloned directory must stay in place. The project is very new, so its long-term maintenance is uncertain.
git clone https://github.com/microsoft/TokenEconomizer.git claude plugin marketplace add "$PWD/TokenEconomizer" claude plugin install tokeneconomizer@tokeneconomizer