A curated awesome-list of tools, papers, benchmarks and vendor pages on what AI tokens cost, where they get wasted, and how to cut spend.
microsoft/TokenEconomizer
A plugin for Claude Code, Codex, Copilot CLI and Pi that learns from past sessions in a repository to cut coding-agent token costs.
- Stars
- 4,883
- Forks
- 298
- Open issues
- 6
- Last commit
- yesterday
What is it?
TokenEconomizer lowers the cost of running coding agents in a repository you work in often, without changing the agent or its model. It records what happened in earlier sessions and uses that history to reduce waste in later ones. It has three mechanisms: micro-skills, which remember repository facts such as the correct test command and inject them at session start once several sessions confirm them; tool pruning, which removes tools that go unused through the agent's own settings and can be restored with one command; and a loop guard, which uses a judge model to detect a stuck turn and sends the agent a redirect, while leaving the decision to stop to the user.
The plugin supports Claude Code, Codex, GitHub Copilot CLI and Pi, with experimental support for opencode. Each mechanism can be toggled, and thresholds such as how many unused prompts trigger pruning are configurable. Its own model calls run through the user's existing agent login, and what it learns is stored locally in ~/.tokeneconomizer.
The accompanying paper reports on SWE-Bench tasks across five agent and model combinations, with mean cost lower by 18.4% to 30.9%. These figures come from the authors' measurements.
Key features
- 01Injects learned repository facts such as build steps and test commands at session start.
- 02Removes unused tools through the agent's own settings, with a one-command restore.
- 03Detects stuck turns with a judge model and redirects the agent up to a configurable number of times.
- 04Works with Claude Code, Codex, GitHub Copilot CLI and Pi.
- 05Stores learned data locally and keeps every action reversible.
Use cases
- Reducing token spend when a team repeatedly runs a coding agent on the same codebase.
- Cutting cost on long SWE-style tasks where the agent re-discovers the same repository facts.
- Stopping an agent from looping on the same failing command without manual intervention.
Quick start
- 1
Clone the repository
git clone https://github.com/microsoft/TokenEconomizer.git - 2
Add the plugin marketplace to Claude Code
claude plugin marketplace add "$PWD/TokenEconomizer" - 3
Install the plugin
claude plugin install tokeneconomizer@tokeneconomizer - 4
Start Claude Code and check the plugin status
/tokeneconomizer:status
Things to know
- Supports only specific tested versions of each agent; older versions are not supported.
- Requires Python 3.10 or newer and one of the supported coding agents.
- Experimental support for opencode, tested only on two versions.
Featured in Repolode Weekly
- Issue #3 · Big MoE models streamed from SSD, and millisecond Rust rebuilds
A Microsoft plugin for Claude Code, Codex, Copilot CLI and Pi that learns from past sessions to cut token costs. It injects facts like build and test commands at session start and uses a judge model to catch stuck turns.
In collections
Topics
FAQ
- What is TokenEconomizer?
- A plugin for Claude Code, Codex, Copilot CLI and Pi that learns from past sessions in a repository to cut coding-agent token costs. TokenEconomizer lowers the cost of running coding agents in a repository you work in often, without changing the agent or its model. It records what happened in earlier sessions and uses that history to reduce waste in later ones. It has three mechanisms: micro-skills, which remember repository facts such as the correct test command and inject them at session start once several sessions confirm them; tool pruning, which removes tools that go unused through the agent's own settings and can be restored with one command; and a loop guard, which uses a judge model to detect a stuck turn and sends the agent a redirect, while leaving the decision to stop to the user.
- Is TokenEconomizer free to use? What license does it have?
- TokenEconomizer is open source under the Apache-2.0 license. Check the license terms before using it in commercial products.
- Is TokenEconomizer still maintained?
- Actively maintained. The last commit to TokenEconomizer was on Nov 6, 2026.
- What can I use TokenEconomizer for?
- Reducing token spend when a team repeatedly runs a coding agent on the same codebase. Cutting cost on long SWE-style tasks where the agent re-discovers the same repository facts. Stopping an agent from looping on the same failing command without manual intervention.
- How do I install TokenEconomizer?
- Clone the repository: git clone https://github.com/microsoft/TokenEconomizer.git Add the plugin marketplace to Claude Code: claude plugin marketplace add "$PWD/TokenEconomizer" Install the plugin: claude plugin install tokeneconomizer@tokeneconomizer Start Claude Code and check the plugin status: /tokeneconomizer:status
- Where can I get TokenEconomizer?
- The source code and installation instructions are on GitHub: https://github.com/microsoft/TokenEconomizer
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A local desktop kernel that plugs multiple native coding agents (Claude Code, Pi, OpenCode, Cursor CLI and more) into the official Codex Desktop UI with task handoff between them.
A plugin for AI coding agents that keeps earlier images out of each request and lets the model pull back only the ones it needs.
A zero-dependency plugin that trims an AI coding agent's token use by tightening its prose, code style, and oversized tool output.
A cross-tool skill that makes AI coding agents write less code and less prose, cutting output tokens and LLM API costs.
An agent skill that trims bloated skill files to save tokens, fixes mismatches with the tool they teach, and tests that slimmer versions still work.