alexgreensh/token-optimizer
Find the ghost tokens. Fix them. Survive compaction. Avoid context quality decay.
What it solves
AI coding assistants waste tokens on verbose command output, bloated configs, stale memory, and other inefficiencies, and they can lose work when the context window is compacted. Token Optimizer cuts that waste and keeps your session context alive across compactions, so you pay less and lose less.
How it works
It installs as a plugin or script that hooks into supported coding tools (Claude Code, Codex, OpenCode, etc.). It runs automatically in the background: it compresses command output, search results, file re-reads, and other large outputs; it checkpoints before auto-compaction and restores after; it scores context quality; and it tracks token and dollar savings on a live dashboard. You can run commands like /token-optimizer for a full audit, or let it run on its own.
Who it’s for
Developers who use AI coding assistants and want to cut token costs, preserve their work across session compactions, and get visibility into where their tokens go. It supports Claude Code, Codex, OpenCode, Hermes, Cursor, and other platforms.
Highlights
- Smart Compaction: checkpoints before auto-compact, restores after
- Active Compression: 9 features enabled by default, covering delta diffs, skeletons, bash/search compression, and more
- Quality Scoring: real-time context quality grades (S–F) based on 7 signals
- Session Database: full audit trail in SQLite, zero network
- Progressive Disclosure: large outputs archived, expand on demand
- Context Intel Digest: post-compaction re-orientation without re-reading everything
- Model Routing Nudges: suggests the right model tier for each task
- Dashboard: live view of tokens, cost, and session health
Related
- Project
- Project
- Project
- Project
- Dispatch