by microsoft
Experience-Driven Black-Box Cost Control for Coding Agents
# Add to your Claude Code skills
git clone https://github.com/microsoft/TokenEconomizerGuides for using ai agents skills like TokenEconomizer.
See how TokenEconomizer compares with popular alternatives.
TokenEconomizer is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by microsoft. Experience-Driven Black-Box Cost Control for Coding Agents. It has 2,936 GitHub stars.
TokenEconomizer's catalog security scan is still queued. You can run an instant dependency and prompt-injection check now with the "Scan for vulnerabilities" button above.
Clone the repository with "git clone https://github.com/microsoft/TokenEconomizer" and add it to your Claude Code skills directory (see the Installation section above).
TokenEconomizer is primarily written in Python. It is open-source under microsoft on GitHub, so you can review or fork the full source.
Yes. SkillsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh TokenEconomizer against similar tools.
No comments yet. Be the first to share your thoughts!
Available after the catalog security scan passes.
⚠️ Third-Party Software Notice
This skill is third-party open-source software developed and hosted independently on GitHub. SkillsLLM is an informational directory and does not control or maintain the underlying repository.
Any security checks, ratings, or warnings displayed by SkillsLLM are automated and limited in scope. They do not constitute a security certification or guarantee that the software is safe, error-free, or free from malicious code, vulnerabilities, compromised dependencies, or prompt-injection risks.
Review the source code, permissions, dependencies, and configuration before installing or running any third-party skill. Use is at your own risk. To the maximum extent permitted by applicable law, SkillsLLM is not liable for losses arising from third-party software.
The deep catalog scan for this skill is still queued. Run an instant dependency check now instead.
TokenEconomizer makes coding agents cheaper to run in the repositories you work in often, without changing the agent itself. It learns from the sessions an agent has already run in a repository, and uses that experience to cut waste in the sessions that follow. It has three mechanisms:
python -m pytest where pytest is missing, npx tsc where tsc is), an environment
variable a command needs, where generated files live. Micro-skills learns such facts, in any
language, from two sources: failures that repeat across sessions, and a model that reviews the
recent sessions every k sessions (k = 3) and proposes facts. A fact is stated at the start
of each session once three sessions have confirmed it, and dropped when later sessions
contradict it.TokenEconomizer is a plugin for Claude Code, Codex, the GitHub Copilot CLI and Pi,
with experimental support for opencode. Each italic letter above is a setting, shown with its
default (Settings), and each mechanism can be turned on or off. The plugin announces
each action in one line, and if any part of it fails, your session carries on as if it were not
installed. Its model calls (the fact proposer, and the judge with the redirect it writes) run
through your own agent, on the same plan or login, and their cost is included in its reports.
What it learns stays on your machine, in ~/.tokeneconomizer.
The paper ran five agent–model combinations on the same 277 SWE-Bench tasks from six repositories.
Each task ran as its own session, and each repository's tasks ran in order, starting with nothing
learned. Costs include every model call TokenEconomizer made. Within each repository and
combination, cost fell by 5–40%. The savings held on Web-Bench (16–21% lower) and on two
security-auditing benchmarks where every task is in a new repository (6–20% lower). The
project page has interactive charts, per-repository numbers
and nine annotated runs, and experiments/ reruns the SWE-Bench and
Web-Bench experiments.
Coding agents are built to finish tasks, not to keep them cheap. Every turn pays again for the agent's instructions, every loaded tool, and the conversation so far. Developers use the same agent on the same repository again and again, so much of that cost repeats: the same facts rediscovered, the same unused tools sent, the same kinds of failing loops. TokenEconomizer leaves the agent's model, weights and code alone and learns across a repository's sessions instead of treating each one on its own, so whatever the plugin spends is paid back over the sessions that follow. Four principles guide the mechanisms:
You need one of these agents, signed in any way it supports, and Python 3.10 or newer on
PATH. The plugin needs no API key of its own and never handles credentials, so any plan or
login works.
Run these commands in the folder where you want to keep the clone. Claude Code, Codex, the Copilot CLI and opencode run the plugin from the clone, so leave it in place. Then start the agent in one of your repositories.
Claude Code
git clone https://github.com/microsoft/TokenEconomizer.git
claude plugin marketplace add "$PWD/TokenEconomizer"
claude plugin install tokeneconomizer@tokeneconomizer
Start claude, trust the folder (Yes, I trust this folder), and run
/tokeneconomizer:status, allowing its script if asked. Once per machine, and again after Claude
Code updates, run /tokeneconomizer:toolprune refresh-catalog.
Codex
git clone https://github.com/microsoft/TokenEconomizer.git
codex plugin marketplace add "$PWD/TokenEconomizer"
codex plugin add tokeneconomizer@tokeneconomizer
Start codex, choose Trust and continue for the folder, then at Hooks need review
choose Trust all and continue. The hooks take effect from your next Codex session, so quit
(/exit), start codex again, and check with $tokeneconomizer:status.
Copilot CLI
git clone https://github.com/microsoft/TokenEconomizer.git
copilot plugin marketplace add "$PWD/TokenEconomizer"
copilot plugin install tokeneconomizer@tokeneconomizer
Start copilot, choose Yes, and remember this folder for future sessions, and run
/tokeneconomizer:status, choosing Yes to run its script. Once per machine, and again after
Copilot updates, run /tokeneconomizer:toolprune refresh-catalog.
Pi
pi install git:github.com/microsoft/TokenEconomizer
Start pi and run /te status.
opencode (experimental)
git clone https://github.com/microsoft/TokenEconomizer.git
mkdir -p ~/.config/opencode/plugins
ln -s "$PWD/TokenEconomizer/plugin/opencode/tokeneconomizer.ts" ~/.confi