{"name":"TokenEconomizer: Cut Coding-Agent Costs Across Sessions","description":"TokenEconomizer learns from prior repository sessions to reduce coding-agent waste through micro-skills, tool pruning and failure-loop intervention. It plugs into Claude Code, Codex, GitHub Copilot CLI and Pi, with experimental support for other agents.","github":"https://github.com/microsoft/TokenEconomizer","url":"https://osrepos.com/repo/microsoft-tokeneconomizer","source":"osrepos.com","sourceDescription":"This repository profile is provided by osrepos.com, an open source repository discovery platform.","repositoryProfile":"https://osrepos.com/repo/microsoft-tokeneconomizer","generatedFor":"open source discovery and AI-assisted research","markdown":"https://osrepos.com/repo/microsoft-tokeneconomizer.md","json":"https://osrepos.com/repo/microsoft-tokeneconomizer.json","topics":["python","coding-agent","developer-tools","claude-code","token-optimization","tool-pruning"],"keywords":["python","coding-agent","developer-tools","claude-code","token-optimization","tool-pruning"],"stars":null,"summary":"TokenEconomizer learns from prior repository sessions to reduce coding-agent waste through micro-skills, tool pruning and failure-loop intervention. It plugs into Claude Code, Codex, GitHub Copilot CLI and Pi, with experimental support for other agents.","content":"## Overview\n\nTokenEconomizer is a plugin for Claude Code, OpenAI Codex, GitHub Copilot CLI and Pi that controls coding-agent costs by learning from earlier sessions in the same repository. It targets repeated waste: agents relearning project conventions, loading tools they do not use, and spending turns stuck in failure loops. Experimental adapters extend support to several other coding agents.\n\nIt works around the existing agent rather than changing its model or code. Session history informs repository-specific micro-skills, tool pruning and loop intervention; learned data stays on the machine. The project reports lower costs in its SWE-Bench experiments, but those results are from the authors' evaluation and may not predict savings for every team's workload.\n\n## Key Features\n\n- **Micro-skills** learn recurring repository facts, such as reliable test commands, from repeated failures and periodic model review; facts can be dropped when later sessions contradict them.\n- **Tool pruning** leaves out tools that have gone unused across prompts and sessions, using each supported agent's own settings. Removed tools can be restored.\n- **Failure-loop intervention** detects repeated failures and can ask a judge model whether a turn is stuck, then add a redirect to try another approach. It does not stop turns itself.\n- Each mechanism can be enabled or disabled separately, and the README documents adjustable thresholds and defaults.\n- Model calls use the agent's own plan or login, and their cost is included in reports. No separate API key is required by the plugin.\n- Repository-specific learning data is stored locally under `~/.tokeneconomizer`; the plugin is designed to let sessions continue if part of it fails.\n- The repository includes experiment code for rerunning its SWE-Bench and Web-Bench evaluations, separate from the installable plugin.\n\n## Use Cases\n\n- Developers repeatedly using an agent on the same codebase can avoid paying for rediscovering its build steps, test commands and environment requirements.\n- Teams whose agent sessions load many tools can use pruning to reduce repeated tool-definition overhead, where the agent adapter supports it.\n- Developers handling long, repetitive debugging sessions can use loop intervention to prompt a change of approach while retaining control over whether to stop the turn.\n- Researchers or engineering teams evaluating cost controls can inspect and rerun the included benchmark experiments, rather than relying only on the reported summary results.\n\n## Our Take\n\nTokenEconomizer is a practical, reversible cost-control layer for repeat use of coding agents, and its active but very young development makes it promising rather than mature infrastructure.\n\n**Good fit if:**\n- Your team repeatedly uses Claude Code, Codex, GitHub Copilot CLI or Pi in the same repositories and wants to reduce repeated context and tool overhead.\n- You can run Python 3.10 or newer and, where required by the project, Node.js, and are comfortable with a plugin that learns from local session data.\n- You want an Apache-2.0 project with benchmark and test code available for inspection.\n\n**Look elsewhere if:**\n- Your workflow uses an agent without a supported adapter, or depends on tool pruning in an adapter where that feature is unavailable.\n- You need a long-established release history or tightly validated compatibility across agent versions; this project is new and its listed tested versions are specific.\n- You need the plugin to terminate stuck turns automatically. Its loop guard redirects or reports the issue, leaving interruption to you.\n\n## Project Health\n\n| Signal | Value |\n|---|---|\n| Status | **New**: less than six months old and changing fast |\n| Last commit | 2026-11-16 (today) |\n| Commits, last 90 days | 100+ |\n| Releases, last 12 months | 1 (latest v0.1.0, 2026-10-26) |\n| Contributors | 35 (top contributor: 50% of commits) |\n| Issues closed, last 90 days | 31+ (typically closed in 1 day) |\n| Pull requests merged, last 90 days | 72 (typically merged in 1 day) |\n| Project age | 33 days |\n\nChecked on 2026-11-16 with the GitHub API.\n\n## Project Facts\n\n- Language: Python\n- License: Apache-2.0\n- Stars: 6.6k\n- Forks: 425\n- Topics: agentic-ai, agentic-coding, ai-coding, ai-coding-assistant, anthropic, artificial-intelligence, claude-code, codex\n- Archived: no\n\n## What You Need\n\nDetected in the repository:\n\n- Node.js (from package.json)\n- Python >=3.10 (from pyproject.toml)\n- A test suite and automated checks on GitHub Actions\n\n## Getting Started\n\nFor Pi, install the plugin with:\n\n```sh\npi install git:github.com/microsoft/TokenEconomizer\n```\n\nThen start Pi and run `/te status`. For other agents, version details, setup steps and permissions, see the [repository README](https://github.com/microsoft/TokenEconomizer#quick-start) and [plugin guide](https://github.com/microsoft/TokenEconomizer/blob/main/plugin/README.md).\n\n## License in Plain Words\n\n**Apache-2.0** (permissive).\n\n- Commercial use: yes\n- Modify and redistribute: yes\n- You must keep: the license, the NOTICE file and a note of your changes\n- Share your changes: no\n- Includes an explicit patent grant from the contributors\n\nA summary, not legal advice: the LICENSE file is what applies.\n\n## Considerations\n\nThe project is very new and changing quickly. It has recent development activity, a first release, and contributions from a broad group rather than depending mostly on one person; however, its short history means compatibility and behavior may still change. The measured issue and pull-request handling is brisk, but that does not establish long-term maintenance.\n\nPython 3.10 or newer is required, and the repository also identifies Node.js as a runtime requirement. The README gives agent-specific tested versions and marks several adapters experimental; some do not support tool pruning, and experimental integrations can have limitations around session events, token usage or platform support. The paid proposer and judge calls can add costs, although their costs are included in reports. The software is licensed under Apache-2.0; review that license and your organization's policies before adoption.","metrics":{"detailViews":5,"githubClicks":3},"dates":{"published":null,"modified":"2026-11-16T02:39:34.000Z"}}