Find the ghost tokens haunting your context window
A plugin for agent IDEs that hunts the token bloat most tools ignore and proves whether the trimming actually saved money.

What it does
Token Optimizer plugs into Claude Code, OpenCode, OpenClaw, and Codex to audit what is eating your context window. The author claims most optimizers only compress command output—roughly 15–25% of context—while leaving the remaining 75–85% untouched; this tool targets that remainder, including bloated configs, unused skills, duplicate system prompts, and stale memory. After each session it renders a local dashboard breaking down tokens, estimated spend, and turns, with the goal of keeping your work alive across compactions.
The interesting bit
Instead of treating context as a static blob to compress, the tool acts like a session-life-support system: it tries to checkpoint and restore work across compactions, and it grades its own trimming with a v6 dual-score quality engine rather than blindly deleting text. That turns an invisible cost center into something you can measure and argue with.
Key highlights
- Native plugins per platform (Python for Claude Code, TypeScript for OpenCode/OpenClaw) with no cross-platform bridging
- Live, fully local dashboard tracking tokens, dollars, and turns after every session
- Zero runtime dependencies and zero telemetry
- Model-family-specific MRCR quality curves for supported providers
- 257 tests according to the repo badge
Caveats
- Licensed under PolyForm Noncommercial, so commercial use is restricted
- Windows installation is finicky; mixing the plugin installer with the bash script triggers
EBUSYfile-locking errors - Claude Code users must manually enable auto-update for third-party marketplace plugins or risk missing fixes
Verdict
Grab it if you spend hours in agent IDEs and suspect your context window is bleeding money. Pass if you need a commercially open license or prefer to ignore what’s happening behind the prompt.
Frequently asked
- What is alexgreensh/token-optimizer?
- A plugin for agent IDEs that hunts the token bloat most tools ignore and proves whether the trimming actually saved money.
- Is token-optimizer open source?
- Yes — alexgreensh/token-optimizer is an open-source project tracked on heatdrop.
- What language is token-optimizer written in?
- alexgreensh/token-optimizer is primarily written in Python.
- How popular is token-optimizer?
- alexgreensh/token-optimizer has 1.7k stars on GitHub and is currently cooling off.
- Where can I find token-optimizer?
- alexgreensh/token-optimizer is on GitHub at https://github.com/alexgreensh/token-optimizer.