Token-Saver
Token-Saver
Content-aware output compression for AI coding assistants.
Token-Saver is a Claude Code and Antigravity CLI plugin that intercepts the
verbose terminal output your agent reads — git diff, pytest, npm
install, terraform plan, kubectl — and compresses it deterministically
before it reaches the model. 36 specialized processors understand the shape
of each tool’s output, so errors, diffs, and stack traces survive while
progress bars, passing tests, and installation logs are dropped.
No LLM calls. No network access. Fully offline and deterministic — the same input always produces the same output.
Results
| Command | Raw Output | Compressed | Savings |
|---|---|---|---|
git diff (5 files, 20 context lines each) |
2,270 tokens | 546 tokens | 76% |
pytest (500 tests, 2 failures) |
6,744 tokens | 307 tokens | 95% |
npm install (220 packages) |
3,843 tokens | 4 tokens | 99.9% |
cargo build (120 crates) |
934 tokens | 21 tokens | 98% |
docker build (20 steps) |
1,682 tokens | 207 tokens | 88% |
curl download (100 progress lines) |
2,122 tokens | 0 tokens | 100% |
These six rows are a sample. The full set of 22 measured scenarios — sorted by ratio, with methodology and reproduction steps — is on the Benchmarks page, and it’s gated by CI: a code change that makes any of them compress worse fails the build.
Install
From Anthropic’s official community marketplace:
/plugin marketplace add anthropics/claude-plugins-community
/plugin install token-saver@claude-community --scope project
Or from the self-hosted marketplace (this repo, always current — the official mirror is a periodic snapshot):
/plugin marketplace add ppgranger/token-saver
/plugin install token-saver
See the full README for manual installation, Antigravity CLI setup, and upgrading from v1.x.
Documentation
- Benchmarks — every measured scenario, methodology, and how to reproduce them.
- How It Compares — vs
cc_token_saver_mcp,token-optimizer-mcp, and Claude Context Mode. - FAQ — privacy, precision guarantees, platform support, and common questions.
- Processor reference — what each of the 36 processors keeps and drops.
Processors
One page per tool family, documenting exactly what’s kept, what’s dropped, and which config knobs are available:
- Ansible Processor — Handles `ansible-playbook` and `ansible` command output.
- Build Output Processor — Handles build tool output across all major ecosystems.
- Cargo Clippy Processor — Dedicated processor for Rust clippy lint output with multi-line block awareness.
- Cargo Processor — Dedicated processor for Rust's cargo build system.
- Cloud CLI Processor — Handles cloud provider CLI output.
- Database Query Processor — Handles database query result output.
- Docker Processor — Handles Docker CLI and Docker Compose output. Supports global options (`--context`, `-H`, `--host`).
- Environment Processor — Handles environment variable listing commands.
- File Content Processor — Content-aware compression for file viewing commands. Instead of blind head/tail truncation, detects content type and applies a specialized strategy.
- File Listing Processor — Handles directory listing commands.
- Generic Processor (Fallback) — Universal fallback processor. Applies to any command not recognized by specialized processors, and also serves as a second-pass cleaner after specialized processors.
- Git Processor — Handles all common git subcommands, including those with global options (`-C`, `--no-pager`, `-c`, `--git-dir`, `--work-tree`).
- GitHub CLI Processor — Handles GitHub CLI (`gh`) output.
- Go Processor — Dedicated processor for Go toolchain commands.
- Helm Processor — Handles Helm CLI output for chart management operations.
- JQ/YQ Processor — Compresses large JSON and YAML outputs from jq and yq.
- Kubernetes Processor — Handles kubectl and oc (OpenShift) commands. Supports global options (`-n`, `--namespace`, `--context`, `-A`, `--all-namespaces`, `--kubeconfig`).
- Lint Output Processor — Handles linter and static analysis output.
- Maven/Gradle Processor — Dedicated processor for Maven and Gradle build output.
- Network Processor — Handles HTTP client output.
- Package List Processor — Handles package listing commands. Runs at high priority (15) to intercept `pip list`/`npm ls` before the build processor.
- Python Install Processor — Dedicated processor for Python package installation output.
- SSH Processor — Handles non-interactive SSH and SCP command output.
- Search Processor — Handles search tool output.
- Structured Log Processor — Processor for JSON Lines log output from log tailing tools.
- Syslog Processor — Handles system log output from `journalctl` and `dmesg`.
- System Info Processor — Handles disk and file counting commands.
- Terraform Processor — Handles Terraform and OpenTofu commands.
- Test Output Processor — Handles test runner output across all major ecosystems.
Why It Exists
Every CLI command an AI coding assistant runs burns tokens, and most of that output is noise. There are three common ways to attack this: summarize with another LLM (accurate-ish, costs a second inference call, non-deterministic), truncate blindly (free, but loses the one stack-trace line that mattered), or parse the format you already know. Token-Saver is the third approach, applied to 36 command families — deterministically, in milliseconds, with no extra inference cost.
Source, issue tracker, and the complete README: github.com/ppgranger/token-saver.