RTK
RTK (Rust Token Killer) is an open source CLI proxy written in Rust that intercepts shell command output and compresses it before it reaches an AI coding agent's Context Window. It sits as a transparent hook between the agent and the underlying tools (git, cargo, npm, docker, kubectl, AWS CLI, etc.)
Canonical version: RTK.
RTK (Rust Token Killer) is an open source CLI proxy written in Rust that intercepts shell command output and compresses it before it reaches an AI coding agent's Context Window. It sits as a transparent hook between the agent and the underlying tools (git, cargo, npm, docker, kubectl, AWS CLI, etc.), so prompts and workflows stay unchanged.
The premise; most of the tokens burned in an AI coding session are not reasoning, they are noise from verbose command output. A typical git diff or cargo test floods the context with boilerplate the model never needs. RTK attacks that noise at the source instead of touching the prompt.
How it works
A single Rust binary, zero dependencies, sub-10ms overhead. After rtk init -g, an auto-rewrite hook transparently maps git status to rtk git status (and similar) per supported command. The agent never sees the difference. Four compression strategies; boilerplate filtering, similar-line grouping, intelligent truncation, repetition deduplication. Each command type has its own optimization logic instead of a generic compressor.
Reported savings
git diff: ~12 000 → ~960 tokens (~92%)npm test: ~6 000 → ~600 tokens (~90%)cargo test: ~91.8% reductiongit status: ~80.8%find: ~78.3%- 12-file refactoring session: 74 700 → 6 960 tokens
- Korben's own measured average over months of use; ~81.5%
- Marketing claim across 2 900+ real-world commands; ~89% average noise removed
Useless on already-short outputs. The payoff scales with how verbose the underlying tool is. Particularly relevant for autonomous agent loops where noise accumulates across iterations and pollutes the signal as much as the budget.
Integrations
13+ AI clients via hooks or plugins; Claude Code (via Claude Code Hooks of type PreToolUse), GitHub Copilot, Cursor, Codex, Gemini CLI, Cline, Windsurf, and others. 100+ commands covered across git, cargo, npm, pip, docker, kubectl, AWS CLI, and test runners.
Observability
rtk gain— total token savings per command, with historyrtk discover— flags commands that ran without optimization (missed opportunities)rtk session— adoption rate inside a given Claude Code session
Install
brew install rtk # macOS
cargo install --git https://github.com/rtk-ai/rtk # any platform
rtk init -g # install the rewrite hook
A curl install script is also published for other platforms.
Pricing & license
RTK itself is free, MIT/Apache-2.0 licensed (the repo lists both; LICENSE file says MIT, GitHub footer Apache-2.0). A paid RTK Cloud tier with team features is announced at ~$15/dev/month.
Why it matters
Different category from a model-routing proxy. Those reroute requests between providers; RTK reshapes the inputs before they reach whichever model is on the other end. The two can stack, and both can sit in front of the same Claude Code install.
The deeper insight; context window pressure is rarely caused by your prompts. It is caused by the tools your agent reaches for. Optimize the tooling layer, not the prompt layer.
References
- GitHub: https://github.com/rtk-ai/rtk
- Site: https://www.rtk-ai.app/
- Docs: https://www.rtk-ai.app/docs/
- Korben review (FR): https://korben.info/rtk-proxy-rust-economiser-tokens.html
Related
- Claude Code
- Claude Code Hooks
- Context Window
- AI Tokenization
- How Coding Agents Work
- Rust
- LiteLLM Claude Code Proxy
About Sébastien
I'm Sébastien Dubois, and I'm on a mission to help knowledge workers escape information overload. After 20+ years in IT and seeing too many brilliant minds drowning in digital chaos, I've decided to help people build systems that actually work. Through the Knowii Community, my courses, products & services and my Website/Newsletter, I share practical and battle-tested systems.
I write about Knowledge Work, Personal Knowledge Management, Note-taking, Lifelong Learning, Personal Organization, Productivity, and more. I also craft lovely digital products and tools.
If you want to follow my work, then become a member and join our community.
Ready to get to the next level?
If you're tired of information overwhelm and ready to build a reliable knowledge system:
- 📚 KM for Beginners — 10+ hours of structured video lessons
- 🚀 Obsidian Starter Kit — Ready-made vault with 40+ templates
- 💼 Knowledge Worker Kit — Complete guides + lifetime community
- 🦉 1-on-1 Coaching — Personalized guidance
- 🎯 Join Knowii — Community + ALL courses & tools
Found this valuable? Share it with someone who needs it.