The AI Loadout

MCP servers and skills

TokenEconomizer on GitHub: what it does and how to use it with AI agents

A plugin that makes Claude Code, Codex and Copilot CLI cheaper to run in repos you use often.

Stars, license and last push from the GitHub API, checked 2026-11-01

Repomicrosoft/TokenEconomizer
Stars3,400+
LicenseApache-2.0
Last push2026-10-31
LanguagePython

What TokenEconomizer does

TokenEconomizer comes from Microsoft Research and UC Berkeley. It learns from the sessions an agent has already run in a repo and cuts waste in later ones, without changing the agent. It does three things. Micro-skills remember repo facts that sessions keep rediscovering, like python -m pytest working where pytest does not. Tool pruning stops loading tools a repo never uses, since every loaded tool is sent with every request. The loop guard spots a turn that keeps hitting the same failure and nudges the agent to try another way, once per turn. It never stops a turn itself. What it learns stays on your machine in ~/.tokeneconomizer. On 277 SWE-Bench tasks the authors measured 18.4% to 30.9% lower mean cost across five agent and model combinations. Those are their own numbers from the paper.

Who it is for

Anyone paying per token, or hitting plan limits, with Claude Code, Codex, the GitHub Copilot CLI or Pi in the same few repos every day. opencode support is experimental.

How to use TokenEconomizer with Claude Code, Codex or Cursor

  1. You need Python 3.10 or newer. Clone it and keep the folder: git clone https://github.com/microsoft/TokenEconomizer.git
  2. Claude Code: claude plugin marketplace add "$PWD/TokenEconomizer", then claude plugin install tokeneconomizer@tokeneconomizer
  3. Start claude in one of your repos, trust the folder, run /tokeneconomizer:status, then once per machine run /tokeneconomizer:toolprune refresh-catalog
  4. Codex: codex plugin marketplace add "$PWD/TokenEconomizer", then codex plugin add tokeneconomizer@tokeneconomizer. Trust the folder and its hooks, quit and restart Codex, then check with $tokeneconomizer:status

Tip: Check the supported versions table in the README first. As of Nov 1, 2026 it lists Claude Code 2.1.300 to 2.1.310 and Codex 0.153.1 to 0.164.0, and says newer versions have not been tested yet.

The loadout for this repo

See the full tool stack, prompts and costs in Best AI coding agent setup.

Related repos

  • OpenAI Codex CLI: OpenAI's open-source coding agent that runs in your terminal.
  • agent-desktop: Lets your AI agent see and click desktop apps through the accessibility tree instead of screenshots.

TokenEconomizer FAQ

Is TokenEconomizer free?

Yes. It is open source under the Apache 2.0 license. It needs no API key of its own and uses your existing agent login.

How much does TokenEconomizer save?

The authors report 18.4% to 30.9% lower mean cost on 277 SWE-Bench tasks across five agent and model combinations, with Pass@1 up in four of five. Savings grow as it learns a repo, so your results depend on how often you work there.

Which agents does TokenEconomizer work with?

Claude Code, Codex, the GitHub Copilot CLI and Pi, with experimental support for opencode.

Star counts change daily. Always read a repo's license and code before running it. All repos