alexgreensh/token-optimizer
Find the ghost tokens. Fix them. Survive compaction. Avoid context quality decay.
What it solves
Token Optimizer reduces the cost and context waste associated with AI coding assistants. It targets three types of waste: structural (bloated configurations and unused skills), runtime (verbose tool outputs and redundant file re-reads), and behavioral (incorrect model routing and retry loops). Unlike simple command compressors, it ensures that savings survive session compaction and provides a live dashboard to track actual dollar savings.
How it works
The tool operates as an external process with zero baseline context overhead, using hooks to automatically compress and manage context in the background. It employs nine active compression features, including delta diffs for file re-reads, skeleton maps for structure, and archiving large tool results to disk. It also implements "Smart Compaction" by creating checkpoints before auto-compaction and restoring them after, ensuring continuity. A local SQLite database tracks every session, which is then visualized in an auto-regenerating HTML dashboard.
Who it’s for
Developers using AI coding assistants such as Claude Code, GitHub Copilot, OpenCode, OpenClaw, Codex, and Hermes who want to lower their API costs and prevent context window saturation.
Highlights
- Comprehensive Compression: Covers eight surfaces including bash/command output, search/grep results, tabular/JSON data, and file re-reads.
- Session Continuity: Uses checkpoints and cross-session hints to maintain work across compactions and cold resumes.
- Live Cost Tracking: Provides a dashboard with per-turn token breakdowns, dollar savings across pricing tiers, and quality scoring (S–F).
- Zero Overhead: Runs as an external process with no dependencies, no telemetry, and no context injection.
- Model Routing: Includes a
routecommand to suggest the appropriate model tier and effort level for a specific task before execution.
Related
- Project
- Project
- Project
- Project
- Project