Overview
If you develop daily with Claude Code, Codex, or Cursor, you may have noticed the problem: your AI assistant spends huge amounts of time “reading” command output — the file lists from git status, the compilation spam from cargo test, the tables from docker ps — instead of actually reasoning about your code. That output eats the context window, degrading reasoning quality, ending sessions early, and sending API bills soaring.
RTK (Rust Token Killer) exists precisely for this. It is a high-performance CLI proxy that intercepts and compresses command output, cutting AI coding assistants’ token consumption by 60-90 percent. The project has passed 44,000 stars on GitHub and is one of 2026’s fastest-growing open-source AI infrastructure projects. Repository: github.com/rtk-ai/rtk. Website: rtk-ai.app.
The Project in Brief
RTK comes from the independent team rtk-ai, first released in January 2026 under Apache-2.0. Written entirely in Rust with zero external dependencies, it ships as a single binary. As of May 2026 it counts 44,000+ stars, 2,700 forks, 60+ releases (latest v0.28.2), 110+ watchers, an active Discord, and a place in the official Homebrew repository. The mission: keep AI coding assistants focused on reasoning and code, not on parsing the noise of command output.
How It Works
RTK’s approach is elegant. It sits as a transparent proxy layer between the AI assistant and the real command:
# without RTK:
Claude → git status → shell → git → 2,000 tokens (raw output) → Claude
# with RTK:
Claude → git status → shell → hook auto-rewrite → rtk git status → git → 200 tokens (compressed) → Claude
The key is that Claude Code’s PreToolUse hook transparently rewrites Bash commands (like git status) into rtk git status before execution. Claude never knows the rewrite happened — it only sees the compressed output. The entire process adds under 10 milliseconds.
The Four Compression Strategies
RTK combines four tactics depending on the command type: smart filtering removes comments, blank lines, and boilerplate — roughly 90 percent of cargo build’s compiler warnings aren’t needed; grouping aggregates similar entries — directory trees grouped by folder, errors merged by type, cutting line counts dramatically; truncation keeps the relevant skeleton of very long listings; and deduplication collapses repeated log lines into one line plus a count.
The Savings, Measured
Official benchmarks on a mid-sized TypeScript/Rust project:
| Operation | Frequency | Raw (tokens) | With RTK | Saved |
|---|---|---|---|---|
| ls / tree | 10x | 2,000 | 400 | -80% |
| cat / read | 20x | 40,000 | 12,000 | -70% |
| grep / rg | 8x | 16,000 | 3,200 | -80% |
| git status | 10x | 3,000 | 600 | -80% |
| git diff | 5x | 10,000 | 2,500 | -75% |
| git log | 5x | 2,500 | 500 | -80% |
| git add/commit/push | 8x | 1,600 | 120 | -92% |
| cargo test / npm test | 5x | 25,000 | 2,500 | -90% |
| ruff check | 3x | 3,000 | 600 | -80% |
| pytest | 4x | 8,000 | 800 | -90% |
| go test | 3x | 6,000 | 600 | -90% |
| docker ps | 3x | 900 | 180 | -80% |
In total, a typical 30-minute Claude Code session drops from about 150K tokens to about 45K — roughly 80 percent saved. For API-billed users, a ten-person team conservatively saves about $1,750 per month.
Installation
# macOS (recommended)
brew install rtk
# Linux / macOS (one-line script)
curl -fsSL https://raw.githubusercontent.com/rtk-ai/rtk/master/install.sh | sh
# build from source (needs the Rust toolchain)
cargo install --git https://github.com/rtk-ai/rtk
# or grab a prebuilt binary from GitHub Releases
Integrating with your AI tool takes one command:
# for Claude Code / GitHub Copilot
rtk init -g
# or for other AI tools
rtk init -g --gemini # Gemini CLI
rtk init -g --codex # Codex (OpenAI)
rtk init --agent cursor # Cursor
rtk init --agent cline # Cline / Roo Code
Restart your AI tool and the hook works automatically on every Bash call. Everything is transparent.
Core Commands at a Glance
Git operations: rtk git status compresses status output; rtk git log -n 10 renders one line per commit; rtk git diff produces a refined diff; and mutations return one-liners — rtk git add → ok, rtk git commit -m "msg" → ok abc1234, rtk git push → ok main.
Test output: rtk cargo test emits only failing tests (-90%); rtk pytest and rtk go test compress to NDJSON summaries (-90%); rtk jest shows failures only; and rtk err <cmd> extracts errors from any command.
Linting: rtk lint groups ESLint by rule/file; rtk tsc groups TypeScript errors by file; rtk cargo clippy, rtk ruff check, and rtk golangci-lint run compress their warnings by 80-85 percent.
Containers and cloud: rtk docker ps trims the container list; rtk docker logs <container> deduplicates logs; rtk kubectl pods condenses the pod view; rtk aws sts get-caller-identity returns one line; rtk aws logs get-log-events keeps only timestamps and messages.
Efficiency analytics: rtk gain tallies your token savings; rtk gain --graph renders a 30-day ASCII trend; rtk discover finds further optimizable commands; and rtk session analyzes RTK adoption inside your AI tools.
Who Benefits Most
Claude Code users (the top recommendation): RTK’s deepest integration is with Claude Code — the PreToolUse hook rewrites every Bash command automatically with zero manual effort, and the official numbers show that 30-minute session dropping from ~150K to ~45K tokens. API-billed users: if you call coding assistants via API (Aider, Gemini CLI, direct API), every line of command output costs money — RTK cuts 60-90 percent without changing your workflow, conservatively ~$1,750 monthly for a ten-person team. Large-project teams: the bigger the repo, the longer the output — on monorepos with hundreds of files, git diff and git status alone can hit tens of thousands of tokens, where RTK’s compression is most dramatic.
Technical Highlights
- Pure Rust: zero external dependencies, one binary does everything
- Sub-10ms overhead: compression barely affects command speed
- Transparent hooks: the Claude Code PreToolUse hook rewrites commands invisibly
- 100+ supported commands: git, tests, Docker, K8s, AWS, builds, linting, and more
- Broad AI-tool support: Claude Code, Copilot, Gemini CLI, Codex, Cursor, Windsurf, Cline, Kilo Code
- Automatic fallback: failing commands restore full output so debug information is never lost
Limits to Know
- RTK’s hooks only intercept Bash tool calls. Claude Code’s built-in Read, Grep, and Glob tools bypass the Bash hook entirely — for those, use
rtk read,rtk grep, andrtk findmanually. - A same-named crate “rtk” (Rust Type Kit) exists on crates.io — verify the right package installed by checking that
rtk gainworks. - Compression is lossy — some debugging scenarios need the full raw output. RTK provides a tee mode that preserves complete output for troubleshooting.
The Bottom Line
RTK is a small-but-beautiful piece of open-source infrastructure. Its core idea — compress command output before it enters the context window — sounds simple and delivers dramatically in practice, and the 44,000-plus stars confirm the community agrees. For any developer using an AI coding assistant, and especially for Claude Code users, RTK is nearly a free performance upgrade: one command to install, then invisible in operation, while cutting token consumption 60-90 percent, tripling effective session length, and shrinking API bills. Try it.
Tags: RTK, CLI tools, token optimization, AI coding, open source, Rust, 2026