ToolsNews
TokenEconomizer cuts coding agent costs by 18–31%
An open-source plugin from Microsoft Research and UC Berkeley learns from past sessions in a repository and wastes fewer tokens in the ones that follow. On SWE-Bench tasks it cut mean cost by 18.4% to 30.9%.
By: Mikola Máté Patrik · · 2 min read

What it is
TokenEconomizer is a plugin that leaves the coding agent itself unchanged but learns how the repositories you work in often behave, and uses that to cut waste (GitHub). It runs with Claude Code, Codex, the GitHub Copilot CLI and Pi, with experimental opencode support. It needs no API key of its own: its model calls run through your agent on the same plan, and their cost is included in its reports. What it learns stays on your machine in ~/.tokeneconomizer.
Three mechanisms
- Micro-skills: sessions keep rediscovering the same facts (a build step that must run first, python -m pytest where pytest is missing, a required environment variable). The plugin learns these from repeated failures and states them at session start once three sessions confirm them.
- Tool pruning: every loaded tool's definition is sent with every request. Tools that go unused for a while are left out through the agent's own settings, and one command brings them back.
- Loop guard: when a turn keeps hitting the same failures, a judge model checks whether it is stuck. At 0.7 confidence or above the agent gets a short redirect note, but the plugin never stops a turn itself.
How much it saves
The paper ran five agent and model combinations on the same 277 SWE-Bench tasks from six repositories (arXiv). Mean cost fell by 18.4% to 30.9%, runs were cheaper in all 30 repository and combination cells, and Pass@1 improved in four of five combinations. Savings held on Web-Bench (16–21%) and on two security-auditing benchmarks (6–20%). Costs were computed with cache pricing, since most tokens in a session are cached re-reads.
Why it matters
Coding agents are built to finish tasks, not to keep them cheap: every turn pays again for instructions, tools and the conversation so far. If you work in the same codebase every day, TokenEconomizer targets exactly that repeated cost without swapping models or modifying the agent. Each mechanism can be toggled, and if the plugin fails, the session carries on as if it were not installed.
Produced with the help of AI, reviewed by an editor. How we make our articles
Reviewed and edited by the Neural Daily desk. About


