# TokenEconomizer: a Microsoft Research plugin that learns from past sessions to cut coding-agent costs

Canonical: https://theagenticweekly.com/news/microsoft-tokeneconomizer-coding-agent-cost-plugin · Evidence: Reported · First seen: 2026-11-01 03:06 UTC · Source published: 2026-10-13 04:16 UTC · Brief published: 2026-11-01 05:02 UTC · Updated: 2026-11-01 05:02 UTC · Author: Agentic Weekly

> TokenEconomizer is an Apache-2.0 plugin from Microsoft Research, Microsoft Security and UC Berkeley for Claude Code, Codex, the GitHub Copilot CLI and Pi that learns from earlier sessions in a repository to cut waste; its README reports "18.4–30.9% lower mean cost across five agent–model combinations" on SWE-Bench tasks. It had about 3.2k GitHub stars when we checked on Nov 1, 2026.

## What changed

- TokenEconomizer is a plugin for Claude Code, Codex, the GitHub Copilot CLI and Pi, with experimental opencode support. It leaves the agent's model and code alone and instead learns across the sessions an agent has already run in a repository.
- Micro-skills: it records repository facts (a build step that must run first, the command spelling that works, a needed environment variable) and states a fact at session start once three sessions have confirmed it, dropping it when later sessions contradict it.
- Tool pruning: a loaded tool that goes unused over 10 prompts across at least 2 sessions, or over 5 sessions, is left out of later sessions through the agent's own settings, and one command brings it back.
- Loop guard: when a turn keeps hitting the same failures, a judge model checks whether it is stuck and, at 0.7 confidence or more, adds one redirect note; the README says it never stops a turn itself.
- Its own model calls run through your existing agent login and are counted in its cost reports; it needs Python 3.10 or newer, no separate API key, and keeps what it learns in ~/.tokeneconomizer on your machine.
- The README lists tested version ranges (Claude Code 2.1.300 to 2.1.310, Codex 0.153.1 to 0.164.0, Copilot CLI 1.0.83 to 1.0.102, Pi 1.2.0 to 1.3.0) and says newer versions have not been tested yet.

## In the source's words

> "18.4–30.9% lower mean cost across five agent–model combinations"
> (TokenEconomizer README, on its SWE-Bench measurement, https://github.com/microsoft/TokenEconomizer)

> "Coding agents are built to finish tasks, not to keep them cheap."
> (TokenEconomizer README, https://github.com/microsoft/TokenEconomizer)

## Early verdict

Worth trying if you run Claude Code, Codex or Copilot CLI on the same repositories every day: it targets repeated rediscovery, unused tool definitions and stuck loops, and every action is reversible per the README. (Basis: Based only on the project's README as read on Nov 1, 2026; we have not run it.)

## What we have not verified

- We did not install or run the plugin; all cost and Pass@1 figures (SWE-Bench, Web-Bench and the security-auditing benchmarks) are the authors' own results from the README and paper.
- We did not check whether it works on agent versions newer than the tested ranges, which the README says are untested.
- The repository was created on Oct 13, 2026; we first saw it on Nov 1, 2026 (UTC) when it surfaced in a GitHub new-repos sweep, so this is not a same-day report.

## Timeline

- Source published: 2026-10-13 04:16 UTC
- First seen by our watcher: 2026-11-01 03:06 UTC (via GitHub new repos: topic coding-agent)
- Brief published: 2026-11-01 05:02 UTC

## Sources

- [TokenEconomizer repository and README (GitHub)](https://github.com/microsoft/TokenEconomizer) (primary source) (fetched 2026-11-01)
- [TokenEconomizer paper (arXiv 2610.22732)](https://arxiv.org/abs/2610.22732) (primary source) (fetched 2026-11-01)

## Related

- [Claude Code: verdict and setup guide](https://theagenticweekly.com/tools/claude-code)
- [Codex CLI: verdict and setup guide](https://theagenticweekly.com/tools/codex-cli)
- [GitHub Copilot: verdict and setup guide](https://theagenticweekly.com/tools/github-copilot)
- [opencode: verdict and setup guide](https://theagenticweekly.com/tools/opencode)
- [Claude Code vs Codex CLI](https://theagenticweekly.com/compare/claude-code-vs-codex-cli)
- [Claude Code vs Cursor](https://theagenticweekly.com/compare/claude-code-vs-cursor)
- [Claude Code vs Gemini CLI](https://theagenticweekly.com/compare/claude-code-vs-gemini-cli)
- [Alternatives to Claude Code](https://theagenticweekly.com/alternatives/claude-code)
- [All news briefs](https://theagenticweekly.com/news)
- [This week's releases](https://theagenticweekly.com/this-week)
- [New AI models this week](https://theagenticweekly.com/models/this-week)

## How to cite

Agentic Weekly, "TokenEconomizer: a Microsoft Research plugin that learns from past sessions to cut coding-agent costs", published 2026-11-01 05:02 UTC, https://theagenticweekly.com/news/microsoft-tokeneconomizer-coding-agent-cost-plugin
