TokenEconomizer: will it cut your agent bill?
TL;DR · 💸 Pricing
Yes, if you stay in one repo
A free plugin cut cost per task in tests. Less help if you switch repos daily, and it is tested on older versions.
Read the full short answer
Short answer: probably yes, if you work in the same repo day after day with Claude Code, Codex or Copilot CLI. Microsoft Research and UC Berkeley's free plugin cut mean cost per task by 18.4% to 30.9% in their tests, and success rates mostly went up. If you jump to a new repo every day, expect much less. And there's a catch nobody is mentioning: the current Claude Code (2.1.326), Codex (0.169.0) and Copilot CLI (1.0.112) are all newer than the versions the plugin says it was tested on.
Checked Nov 17, 2026 against the Microsoft Research post (Nov 16), the TokenEconomizer repo and its plugin README, and the npm registry for current agent versions. Savings figures are the researchers' own benchmark results, not our tests.
What it actually does
Coding agents start every session from scratch. The researchers profiled Claude Code on 60 SWE-Bench tasks and found three kinds of waste:
- Relearning the repo. Once a repo had five finished tasks, 30% of tool calls repeated something from an earlier task in that repo.
- Paying for tools it never uses. The agent got 23 tool descriptions on every turn, and 16 were never called.
- Getting stuck. The 17% of tasks that failed ate 32% of the spend.
TokenEconomizer reads each finished session's log and fixes those three, using only hooks and settings the agent already has:
| Part | What it does | Default | Extra model calls? |
|---|---|---|---|
| Tool pruning | Leaves out tools, packages or MCP servers that went unused in this repo (after about 10 prompts over 2+ sessions, or 5 sessions). Core run-command and edit tools always stay. toolprune restore gives them back. | On | None |
| Loop guard | When a turn keeps hitting the same failure, a judge model checks if it is stuck. If it is at least 70% sure, the agent gets a short "try another way" note. It never stops a turn itself. | On | Only on turns that look stuck (about 1,500-token prompts) |
| Micro-skills | One-line repo facts (like the right test command) added at session start once three sessions confirm them. | Off | Yes, every 3 sessions |
Its model calls go through your own agent's CLI (claude -p, codex exec, copilot -p), so they bill to your existing plan or key. The README says those calls are not sent file contents or your prompts. What it learns stays on your machine. License: MIT.
The numbers, per agent
| Agent + model (SWE-Bench, 277 tasks) | Cost per task | Pass@1 |
|---|---|---|
| Claude Code + Opus 4.8 | 30.9% lower | -1.0 point |
| Codex + GPT-5.6 Sol | 26.1% lower | +1.6 |
| Codex + GPT-5.6 Terra | 24.7% lower | +0.9 |
| Claude Code + Sonnet 5 | 23.6% lower | +1.3 |
| Copilot CLI + Sonnet 5 | 18.4% lower | +2.6 |
- Cheaper in all 30 repo and agent combinations they tested.
- Web development (Web-Bench, sequential tasks in one app): 16.0% to 21.2% lower.
- Security audits, a new repo every task: 6.4% to 19.6% lower. Less history, less to learn from.
- It gets worse before it gets better. Early tasks can cost more while it learns. With Claude Code, every repo was cheaper overall by the sixth task.
- Turning down reasoning effort saved as much or more in their tests, but success rates dropped a lot. TokenEconomizer did not have that trade-off.
Note the models: these runs used Opus 4.8, Sonnet 5 and GPT-5.6, not today's Opus 5.5, Fable 5.2 or GPT-6.1. Source: Microsoft Research and the repo README.
What would it save you?
A rough estimate from the researchers' numbers. Everything runs in your browser.
Benchmark tasks are not your tasks. Treat this as a ceiling-ish guess, and check real numbers with /tokeneconomizer:status after a week.
The catch: your agent is probably too new
The plugin's README (checked Nov 17, 2026) lists the versions it was tested on. The latest releases on npm today are past every range:
| Agent | Tested range | Latest on npm (Nov 17) |
|---|---|---|
| Claude Code | 2.1.300 to 2.1.310 | 2.1.326 |
| Codex | 0.153.1 to 0.164.0 | 0.169.0 |
| Copilot CLI | 1.0.83 to 1.0.102 | 1.0.112 |
| Cursor Agent | 3.24.9 and cursor-agent 2026.11.05 (experimental) | Not checked |
"Not tested" is not "broken". But two things make it matter:
- It fails quietly by design. If any part breaks, your session carries on as if it were not installed. Safe, but a silent failure just looks like "no savings".
- Claude Code 2.1.326 changed hooks and settings. Its Nov 16 release notes (summary) say a hook's
"decision": "block"now holds in more cases and Code Mode can now run with agent teams. The plugin leans on hooks and settings files, so this is exactly the kind of change to watch.
What to do: after installing, run /tokeneconomizer:status (Codex: $tokeneconomizer:status) and confirm it shows session costs, not an error. Or check from a terminal for free: ~/.tokeneconomizer/bin/te --host claude status. The repo was updated today, so the version table may catch up soon.
Who should install it
- Yes: you pay per token (API key, Copilot credits, Cursor's prepaid credit for Claude or GPT) and live in one or two repos. This is where the 18 to 31% shows up as money.
- Yes, for limits: you hit Claude Code's 5-hour window or Codex's weekly limit. 25% fewer tokens means about 1.33x as much work before the wall. Your bill does not change.
- Maybe: you use Cursor Agent or Antigravity CLI. Support is experimental, Cursor shows no session cost, and Antigravity CLI gets no tool pruning.
- Skip for now: you hop between new repos all day, or you can't run Python 3.10+. Gains need history in the same repo.
Install it (Claude Code and Codex)
Needs Python 3.10+. Keep the clone where it is: the plugin runs from it.
git clone https://github.com/microsoft/TokenEconomizer.git
# Claude Code
claude plugin marketplace add /path/to/TokenEconomizer
claude plugin install tokeneconomizer@tokeneconomizer
# then inside Claude Code, once per machine:
# /tokeneconomizer:status
# /tokeneconomizer:toolprune refresh-catalog
# Codex
codex plugin marketplace add /path/to/TokenEconomizer
codex plugin add tokeneconomizer@tokeneconomizer
# trust the folder and hooks, restart Codex, then:
# $tokeneconomizer:status
- Don't skip
refresh-catalogon Claude Code. The README says without it the plugin only sees the few tools Claude Code defers. Run it again after Claude Code updates. - Each slash command costs one model turn. The same commands are free from a terminal via
~/.tokeneconomizer/bin/te. - Want to approve what it removes?
/tokeneconomizer:config set toolprune=propose, thentoolprune apply. - Try it for one session first:
claude --plugin-dir /path/to/TokenEconomizer/plugin. - Heads up: on Claude Code, its deny rules go in your repo's
.claude/settings.local.json. That is the same file where "don't ask again" can save passwords. Check that file isn't in git.
Copilot CLI, Copilot in VS Code, Cursor, Pi and the experimental agents have their own steps in the plugin README.
Free tricks that work without the plugin
The plugin automates three habits. You can do a manual version today on any agent:
- Write down the boring facts. Test command, build command, the folder that matters. Put them in
AGENTS.mdorCLAUDE.mdso the agent stops rediscovering them. That is micro-skills by hand. - Turn off MCP servers you don't use in this repo. Every loaded tool's description rides along on every turn. In the study, 16 of 23 tools were never called.
- Kill loops early. If the agent hits the same error three times, stop it and give it a new direction. Failed tasks were 17% of tasks but 32% of spend.
- Don't switch models mid-session. You lose the prompt cache and pay full price to reload context. See Fable 5.2 vs Opus 5.5.
- Use the cheap model for routine work. Our cost per task guide shows how far apart models are.
What we could not confirm
- Whether the plugin works correctly on Claude Code 2.1.326, Codex 0.169.0 or Copilot CLI 1.0.112. The README says newer versions have not been tested. We have not run it ourselves.
- Savings on today's models (Opus 5.5, Fable 5.2, GPT-6.1). The study used Opus 4.8, Sonnet 5 and GPT-5.6.
- Savings on your own repos and tasks. SWE-Bench is Python bug fixes in six open-source projects.
- The repo's badge says Apache 2.0, but its LICENSE file and GitHub both say MIT. We went with MIT.
Ready to try one?
Every tool here can be cancelled monthly, so the fastest way to decide is a real task on each.
Claude Code
OpenAI Codex
GitHub Copilot
FAQ
What is TokenEconomizer?
A free, open-source (MIT) plugin from UC Berkeley, Microsoft Research and Microsoft Security, released with a Microsoft Research post on Nov 16, 2026. It learns from your past coding agent sessions in a repository and uses that to waste fewer tokens in later sessions, without changing the agent or the model. It has three parts: tool pruning (leaves out tools you never use in that repo), a loop guard (spots a turn stuck on the same failure and nudges it), and micro-skills (one-line repo facts, off by default).
How much does TokenEconomizer save?
In the researchers' tests on 277 SWE-Bench bug-fix tasks across six repositories, mean cost per task fell 18.4% to 30.9% across five agent and model combinations, and success rate rose in four of the five. Savings were smaller on web development (16.0% to 21.2%) and on security audits where every task was a new repository (6.4% to 19.6%). These are the authors' benchmark numbers, not our tests.
Does TokenEconomizer work with Claude Code, Codex, Cursor and Copilot?
Fully supported: Claude Code, Codex, GitHub Copilot CLI and Pi. Experimental: Cursor Agent, Grok Build, opencode, Hermes Agent, Antigravity CLI and Factory Droid. There is also a GitHub Copilot in VS Code install path. On Cursor Agent, session cost is not available, and on Antigravity CLI tool pruning is not available.
Which versions does TokenEconomizer support?
As of Nov 17, 2026 its README lists Claude Code 2.1.300 to 2.1.310, Codex 0.153.1 to 0.164.0 and Copilot CLI 1.0.83 to 1.0.102, and says newer versions have not been tested. The current releases on npm are newer: Claude Code 2.1.326, Codex 0.169.0 and Copilot CLI 1.0.112. If a part of the plugin fails, the session carries on as if it were not installed, so a silent failure looks like no savings. Check /tokeneconomizer:status.
Does TokenEconomizer save money on a Claude Pro or ChatGPT Plus subscription?
Not in dollars: your subscription price stays the same. What it can do is stretch your limits. If a task uses 25% fewer tokens, the same 5-hour or weekly allowance fits about 1.33 times as much work. On pay-per-token setups (an API key, Copilot credits, Cursor's prepaid credit for third-party models) the savings show up on the bill.
Does TokenEconomizer cost anything to run?
The plugin is free and needs no API key of its own. With the default settings it only calls a model when a turn looks stuck (a judge call and a short redirect), through your own agent's CLI, so that small cost is billed to your existing plan or key. The researchers say their reported savings already subtract the plugin's own model calls. Micro-skills adds more calls and is off by default.
Is TokenEconomizer safe to install?
It runs from a local clone, keeps what it learns on your machine (under ~/.tokeneconomizer), and its model calls are not sent file contents or your prompts, per its README. On Claude Code it writes deny rules into the repo's .claude/settings.local.json and adds settings files it creates to .git/info/exclude. That is the same file where Claude Code can save secrets from 'don't ask again', so it is worth checking that file is not committed.
Ship your app: the rest of the stack
Picked your AI coding tool? These are the usual next costs. Free tiers first, and prices checked Oct 20, 2026 on each vendor's pricing page.
Code review
- CodeRabbitAI review on every pull request, in GitHub or GitLabFree for public repos; Essentials $24/user/mo billed annually ($30 monthly)
Hosting
- VercelNext.js and front-end appsHobby free (personal, non-commercial); Pro $20/mo per developer seat
- Netlify referralStatic sites and front ends, unlimited Pro membersFree; Personal $9/mo; Pro $20/mo with unlimited members
- RailwayBack ends, workers and databases with no server setupFree trial $5 credit; Hobby $5/mo incl. $5 usage; Pro $20/mo
- RenderHeroku-style web services, cron jobs and PostgresHobby $0 + compute; Pro $25/mo + compute
Database and auth
Domain name
- Cloudflare RegistrarDomains at cost with no markupWholesale price per TLD
- PorkbunCheap domains with free WHOIS privacyVaries by TLD
- NamecheapPopular registrar with hosting and email add-onsVaries by TLD
Editorial disclosure
Rankings are not for sale. Sponsored placements and affiliate links are always labeled, and they never change our recommendations, quiz results, prices, or comparison data. Links marked "referral" are affiliate links (Netlify): if you buy through them, we may earn a commission at no extra cost to you. Every other link is a plain link that pays us nothing, and pricing source links are never affiliate links. Editorial policy.