AgentsAutonomy & tool use
Microsoft and UC Berkeley release TokenEconomizer, an open-source plugin that learns from past sessions to cut coding-agent costs
TokenEconomizer is an open-source plugin from UC Berkeley and Microsoft. It learns from the logs of past coding-agent sessions to reduce repeated waste. On SWE-Bench it cut mean per-task cost by 18.4–30.9% across Claude Code, Codex and Copilot CLI.
From the Microsoft Research article of November 16, 2026 and cited sources: On 277 SWE-Bench tasks, the plugin lowered mean cost per task by 18.4–30.9% across Claude Code, Codex and GitHub Copilot CLI. [2] [6] [7]
SOURCES[2] arXiv 2610.22732 (abstract) arxiv.org[6] arXiv 2610.22732 (HTML) arxiv.org[7] TokenEconomizer project page tokeneconomizer.github.io
AI-assisted, not human-edited. Methodology Corrections Who owns this site
- What happened
- On 277 SWE-Bench tasks, the plugin lowered mean cost per task by 18.4–30.9% across Claude Code, Codex and GitHub Copilot CLI. [2] [6] [7]
- Original source
- Microsoft Research article, company source
- Brief by
- AT Pulse research desk AI-assisted; publisher and contact on the desk page
- When
- November 16, 2026 article published
- Covered
- Nov 18 edition
- Evidence
- 11 sources across 9 sites
QuietHow it’s measured
Hacker News · 2 likes
Reach blends public engagement (views, likes, comments, shares, stars) from the platforms where the story or its original source lives: YouTube, Hacker News, GitHub, Substack and similar. A video and the article written from its transcript share one score, taken from the video. Platforms with no data are left out rather than counted as zero, and the age of a story never lowers its score.

On 277 SWE-Bench tasks, the plugin lowered mean cost per task by 18.4–30.9% across Claude Code, Codex and GitHub Copilot CLI. It was cheaper than the default in all 30 repository-and-setting pairs. First-attempt success (Pass@1) rose in four of five settings and fell 1.0 point in one Claude Code setting. [2] [6] [7]
The plugin works from outside the agent and does not modify the agent or the model. After each session it reads the logs and adjusts the next one in three ways. It saves verified one-line facts about the repository so the agent doesn't rediscover them, removes tool descriptions the agent rarely uses, and uses a judge model to send a short redirect note when the agent is stuck in a failure loop. [1] [3]
Lowering reasoning effort to medium saved a similar 16.8–28.9%, but it cost 1.8–10.3 points of Pass@1. Low effort saved more but lost 4.6–10.0 points. TokenEconomizer reached comparable savings without that accuracy loss. [6]
the savings match lowering reasoning effort without its reported accuracy loss. Implication: teams that run agents repeatedly in the same repositories might cut spending without changing models.
Read the full assessment
So far, every figure comes from the authors' own measurements.
Researching is done; writing the dossier now.
Executive brief
A plugin that sits outside the agent and only reads past session logs cut the average cost of each task by 18.4–30.9% on 277 SWE-Bench tasks. It worked across Claude Code, Codex and GitHub Copilot CLI, and success rates did not fall. TokenEconomizer comes from UC Berkeley, Microsoft Research and Microsoft Security.
Read the full section
A plugin that sits outside the agent and only reads past session logs cut the average cost of each task by 18.4–30.9% on 277 SWE-Bench tasks. It worked across Claude Code, Codex and GitHub Copilot CLI, and success rates did not fall. It made no changes to the agent or the model (arXiv). TokenEconomizer comes from UC Berkeley, Microsoft Research and Microsoft Security. It removes three kinds of repeated waste: rediscovering facts about a repository, sending descriptions of tools that never get used, and getting stuck in failure loops. It is MIT-licensed and keeps what it learns on the developer's machine (GitHub). The authors are the only ones who have measured these results so far.
What changed and event timeline

Paper posted
The first version of "TokenEconomizer: Experience-Driven Black-Box Cost Control for Coding Agents" went up on arXiv. It has 11 authors, including Ion Stoica, Bin Yu and Jianfeng Gao ().
Trade coverage begins
MarkTechPost covered the release as a cost-control plugin for coding agents. Other outlets followed and repeated the paper's 18.4–30.9% headline (;).
Microsoft Research blog
Microsoft published its official write-up. It covers where the waste comes from, the three mechanisms, and results on SWE-Bench, Web-Bench and security auditing ().
Capabilities and access
- Primary support: Claude Code 2.1.300–2.1.310, Codex 0.153.1–0.164.0, Copilot CLI 1.0.83–1.0.102 and Pi 1.2.0–1.3.0. Older versions are not supported (GitHub).
- Experimental support: opencode, Cursor Agent, Grok Build, Hermes Agent, Antigravity CLI and Factory Droid.
- Setup: no separate API key. Learned data is stored in
~/.tokeneconomizer(GitHub).
Read the full section
- Primary support: Claude Code 2.1.300–2.1.310, Codex 0.153.1–0.164.0, Copilot CLI 1.0.83–1.0.102 and Pi 1.2.0–1.3.0. Older versions are not supported (GitHub).
- Experimental support: opencode, Cursor Agent, Grok Build, Hermes Agent, Antigravity CLI and Factory Droid. Several of these, plus Pi, do not support tool pruning (GitHub).
- Setup: no separate API key. The judge and fact-proposer calls run through the user's own agent login, and their cost appears in the plugin's reports. Learned data is stored in
~/.tokeneconomizer(GitHub).
Technical analysis for researchers and developers
- The controller only uses interfaces the agent already exposes. It reads logs after each session and adjusts the next session (MSR blog).
- These are one-line facts about a repository, such as how to run its tests.
- Tools the agent rarely uses are removed based on its history.
Read the full section
- Black-box design. The controller only uses interfaces the agent already exposes. It reads logs after each session and adjusts the next session (MSR blog).
- Micro-skills. These are one-line facts about a repository, such as how to run its tests. A note is added only after several sessions confirm it and is removed if later evidence contradicts it.
- Tool pruning. Tools the agent rarely uses are removed based on its history. Core tools for running commands and editing files always stay, and pruned tools can come back.
- Failure-loop intervention. A judge model decides whether the agent is stuck. If so, the agent gets a short redirect note. If it stays stuck, the plugin alerts the developer rather than stopping the run (GitHub).
- Protocol. Each repository's tasks run in order, starting with no history, using three seeds per configuration (arXiv HTML). The paper does not name the judge model.
Claims and evidence

- Cost and success on SWE-Bench: 18.4–30.9% lower mean cost per task, cheaper than the default in all 30 repository × setting pairs, and Pass@1 (first-attempt success) up in 4 of 5 settings (project page).
- Comparison with lowering reasoning effort: medium effort saved 16.8–28.9% but cost 1.8–10.3 points of Pass@1. Low effort saved 31.0–45.5% but cost 4.6–10.0 points (arXiv HTML).
- Other workloads: 16.0–21.2% lower cost on Web-Bench and 6.4–19.6% on security auditing (MSR blog).
Read the full section
- Cost and success on SWE-Bench: 18.4–30.9% lower mean cost per task, cheaper than the default in all 30 repository × setting pairs, and Pass@1 (first-attempt success) up in 4 of 5 settings (project page). One Claude Code setting lost 1.0 point (arXiv HTML).
- Comparison with lowering reasoning effort: medium effort saved 16.8–28.9% but cost 1.8–10.3 points of Pass@1. Low effort saved 31.0–45.5% but cost 4.6–10.0 points (arXiv HTML).
- Other workloads: 16.0–21.2% lower cost on Web-Bench and 6.4–19.6% on security auditing (MSR blog).
- Who measured this: all figures come from the authors. No independent replication was found. Better Stack's guide explains the method but did not test it (Better Stack).
Context and prior work
- Diagnosis. Profiling Claude Code on 60 SWE-Bench tasks found three patterns (MSR blog):
- 30% of tool calls repeated an action from earlier tasks in the same repository.
- 16 of the 23 tool descriptions sent on every turn were never called.
Read the full section
- Diagnosis. Profiling Claude Code on 60 SWE-Bench tasks found three patterns (MSR blog):
- 30% of tool calls repeated an action from earlier tasks in the same repository.
- 16 of the 23 tool descriptions sent on every turn were never called.
- The 17% of tasks that failed used 32% of the spending.
- Baselines. Three fixed-strategy tools each saved money in some repositories but not others: RTK (compresses command output), Serena (language-server code navigation) and Aider's RepoMap (project page).
- Related work. Other research also blames prompts, reasoning effort and harness design for coding-agent waste (Weinberger & Hozez).
Limitations, safety and contested findings
- Wrong decisions are possible. The authors say each mechanism can make incorrect calls, though recovery mechanisms exist (arXiv HTML).
- SWE-Bench sequences are independent bug fixes, not continuous developer sessions. Testing beyond the three main agents was limited (arXiv HTML).
- Warm-up cost. Early tasks can cost more while the plugin learns.
Read the full section
- Wrong decisions are possible. The authors say each mechanism can make incorrect calls, though recovery mechanisms exist (arXiv HTML).
- Benchmark realism. SWE-Bench sequences are independent bug fixes, not continuous developer sessions. Testing beyond the three main agents was limited (arXiv HTML).
- Warm-up cost. Early tasks can cost more while the plugin learns. Cumulative costs only dropped below the default by the sixth task in each repository (MSR blog).
- Smaller gains in new code. Security auditing, where every task is in a new repository, saved as little as 6.4%.
- Inaccurate press coverage. Some summaries say the plugin sits between the agent and the LLM API. The primary sources describe a log-reading controller instead (alphasignal).
Business and practitioner implications
- Teams that repeatedly use agents in the same repositories benefit most. The plugin needs no model change and no new vendor account (GitHub).
- Its savings are similar to dropping to medium reasoning effort, without the reported accuracy loss.
- Run your own baseline on comparable tasks, include the plugin's own judge costs, and allow enough sessions for it to learn (Better Stack).
Read the full section
- Where it pays off. Teams that repeatedly use agents in the same repositories benefit most. The plugin needs no model change and no new vendor account (GitHub).
- Versus cheaper settings. Its savings are similar to dropping to medium reasoning effort, without the reported accuracy loss.
- Check it yourself. Run your own baseline on comparable tasks, include the plugin's own judge costs, and allow enough sessions for it to learn (Better Stack).
- Version pinning. Supported agent versions are narrow, so upgrading an agent may break compatibility.