
A 30-minute Claude Code session on a TypeScript project burns roughly 118,000 tokens just from shell commands — git operations, test runs, lint checks, file reads. Most of that is noise: 262 passing test names nobody reads, verbose git headers, npm asset manifests nobody asked for. RTK (Rust Token Killer) is a single Rust binary that intercepts that output before it reaches the LLM. Same session, compressed: 23,900 tokens. That 80% drop is real, measurable, and it works today.
Why CLI Output Is So Expensive
The problem is structural. CLI tools are designed for humans who skim, not LLMs that tokenize everything. When Claude Code runs cargo test on a project with 262 passing tests, the raw output costs 4,823 tokens. When it runs git diff on a large change, you are looking at 21,500 tokens. A cat on a 1,295-line file costs 10,176 tokens. None of those numbers reflect actual information — they reflect verbosity designed for terminals, not context windows.
RTK’s answer is command-specific compression. Not generic truncation — per-command rules that know what matters. A test runner collapse removes individual passing test names and replaces them with a count summary. A git diff compression keeps headers and changed hunks, drops repeated context lines. A file read extracts structural skeleton: imports, type signatures, function names.
| Command | Raw Tokens | RTK Tokens | Savings |
|---|---|---|---|
cargo test (262 passing) | 4,823 | 11 | 99% |
git diff (large change) | 21,500 | 1,259 | 94% |
cat (1,295-line file) | 10,176 | 504 | 95% |
| Average (2,900+ commands) | — | — | 89% |
Real-world user data holds up. One developer tracked 15,720 commands over several weeks and reported 138 million tokens saved at 88.9% efficiency. Another measured 24.6 million tokens saved across 7,061 commands over 15 days at 83.7% efficiency. The benchmarks are not cherry-picked.
Setup in Three Commands
RTK integrates with Claude Code via a PreToolUse hook — the same hook system Claude Code uses for any pre-execution rewriting. Claude Code never knows RTK is running. The hook intercepts every Bash call, rewrites git status to rtk git status transparently, and returns compressed output.
cargo install rtk # or: brew install rtk
rtk init --global # installs hook, patches ~/.claude/settings.json
rtk init --show # verify it is active
rtk init --global creates ~/.claude/hooks/rtk-rewrite.sh, patches ~/.claude/settings.json, and adds a minimal ~/.claude/RTK.md. From that point on, every Bash command Claude Code runs passes through RTK. Zero prompt changes required, zero workflow changes. It also works with Cursor, GitHub Copilot, Codex, and OpenClaw.
Additional flags worth knowing:
rtk init -g --auto-patch # skip the Patch settings.json prompt
rtk init -g --hook-only # install hook only, skip CLAUDE.md updates
rtk init -g --uninstall # full removal
The Caveat Worth Knowing
RTK’s transparency is also its main risk. The compression is invisible — if RTK strips a critical stack trace line, neither you nor the LLM knows it happened. One skeptical developer summarized it directly: The AI agent has no idea the text was compressed. If RTK strips a critical line of context, both of you are operating completely in the dark.
This is a real concern. There are sessions where you want the full output:
- Debugging non-obvious failures where the error is buried in verbose output
- Complex Rust borrow checker errors — compiler messages are dense and meaningful
- Sessions where you are investigating the output format itself
Bypass RTK for a single command with RTK_DISABLE=1 cargo test, or uninstall entirely if a session requires full visibility. The tool is not all-or-nothing.
What It Is (And Is Not)
RTK is MIT-licensed, Rust-native, single binary, zero dependencies. It processes locally — no data leaves your machine, no SaaS subscription. It hit 51,000 GitHub stars since launching in January 2026. The project is actively maintained and supports 30+ commands: git, cargo, npm, pytest, go test, ls, find, grep, curl, Docker, kubectl, and more.
What it does not cover: Claude Code’s native Read, Grep, and Glob tools bypass the Bash hook entirely. Native Windows falls back to instruction-based mode, which is less effective. And it only handles CLI output — paste-buffer content is outside scope.
For developers running Claude Code on macOS or Linux, those limitations are largely non-issues. The supported commands cover the bulk of what burns tokens in a typical session. The Claude Code sub-agent model routing post covers the cost angle from the model selection side — RTK and model routing together make a meaningful dent in daily API spend.
The Bottom Line
If you are paying for Claude Pro or API access and running Claude Code daily, RTK is a three-command install that immediately cuts token consumption by 60 to 90 percent. The math is straightforward: 118,000 tokens becomes 23,900. At scale across a team, that is significant. For individual developers, it extends how long a session stays coherent before hitting context limits.
Start with the GitHub repo and the DEV Community breakdown. If you want the counterargument before committing, the skeptic’s take is worth reading too.













