Reading the repo
Reading the repo
How to install on Windows
Experience-Driven Black-Box Cost Control for Coding Agents
Saved setup from 3 h ago
Will it work on my device?
Then run powershell -ExecutionPolicy Bypass -File .\setup.ps1. It stops at the first error and is safe to run again. Servers and tests aren't started; it lists them at the end. Read it first.
Needs Git: winget install Git.Git
git clone https://github.com/microsoft/TokenEconomizer.git cd TokenEconomizer
Node.js 22, Python >=3.10
winget install CoreyButler.NVMforWindows nvm install 22 nvm use 22 winget install Python.Python.3.10
npm install python -m venv .venv .venv\Scripts\Activate.ps1 pip install -e .
pytest
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.
Cursor Agent (experimental)
python scripts/build_plugin.py --out ~/.cursor/plugins/local/
Reload Cursor, confirm tokeneconomizer appears in Customize, then send a prompt in a repository.
Check its state from a terminal with ~/.tokeneconomizer/bin/te --host cursor status. Cursor's
published hooks provide session, prompt, tool-result and completion events. Its transcript format
and per-session token usage are not a supported public interface, so the adapter records needed
hook events locally and reports session cost as unavailable. Cursor support is macOS and Linux
only: on Windows, Cursor runs hook commands through PowerShell, and this plugin's launcher is a
POSIX shell script.
opencode (experimental)
git clone https://github.com/microsoft/TokenEconomizer.git
mkdir -p ~/.config/opencode/plugins
ln -s "$PWD/TokenEconomizer/plugin/opencode/tokeneconomizer.ts" ~/.config/opencode/plugins/
Start opencode and send a prompt, then check in the repository with
~/.tokeneconomizer/bin/te --host opencode status. opencode has no plugin commands, so the
plugin's commands run from a terminal.
Hermes Agent (experimental; micro-skills and the loop guard, on the classic CLI and one-shot runs)
git clone https://github.com/microsoft/TokenEconomizer.git
ln -s "$PWD/TokenEconomizer/plugin/hermes" ~/.hermes/plugins/tokeneconomizer
hermes plugins enable tokeneconomizer
hermes gateway restart
Link it rather than running hermes plugins install, which leaves the launchers behind when given
this directory and refuses the whole repository at its security scan. Send a prompt, then check in the repository with ~/.tokeneconomizer/bin/te --host hermes status.
If the install worked, the status command prints a short status block. refresh-catalog
records every tool a session loads (without a model call), so that tool pruning can consider all
of them. Keep the marketplace path absolute, as above: the Copilot CLI reads a relative path such
as ./TokenEconomizer as the name of a GitHub repository.
To update:
| Agent | Update |
|---|---|
| Claude Code, Copilot CLI, opencode | git pull in the clone |
| Hermes Agent | git pull in the clone, then hermes gateway restart |
| Codex | git pull in the clone, then the codex plugin add line again |
| Pi | pi update --extensions |
plugin/README.md walks through each agent in more detail, including
uninstalling, using Copilot with your own model key, and troubleshooting.
| Agent | Supported | Older versions | |---|---|---| | Claude Code | 2.1.300 to 2.1.310 | not supported | | Codex | 0.153.1 to 0.164.0 | not supported | | Copilot CLI | 1.0.83 to 1.0.102 | not supported | | Pi | 1.2.0 to 1.3.0 | 0.99.x: load the extension by path (below) | | Cursor Agent (experimental) | 3.24.9 and cursor-agent 2026.11.05, macOS and Linux (below) | not tested | | opencode (experimental) | 1.19.5 and 2.2.0 | not tested | | Hermes Agent (experimental) | 0.22.5 | not tested |
The commands above were tested on the oldest and newest version in each range; newer versions have not b
…
No reports for Windows yet.
Opens a chat with this manual already filled in, for Windows. It uses your own account; gitmanual sends nothing.