TL;DR: RTK is a CLI proxy tool written in Rust. When LLM coding tools like Claude Code, Cursor, and Gemini CLI execute commands, RTK automatically filters and compresses the output, reducing token consumption by 60-90%. It ships as a single binary with zero dependencies, supports 100+ commands, and installs with just one command.

If you use AI coding assistants like Claude Code, Cursor, or Gemini CLI every day, you've definitely felt this pain point: every time the AI runs commands like git status, ls, cat, or cargo test, the full raw output gets stuffed into the LLM context window, burning through tokens like crazy.

A single 30-minute coding session can consume roughly 118,000 tokens — and 94,100 of those are redundant noise.

RTK is built to solve exactly this problem. Written in Rust, it's compact (a single static binary with zero dependencies). It intercepts command output along the execution path, intelligently filters out noise, and keeps only what matters. That 30-minute session drops from 118,000 tokens to about 23,900 — an 80% savings.

What Is RTK?

RTK stands for "Rust Token Killer" — it's a CLI proxy layer that sits between you and the LLM. It's not an LLM, not an IDE plugin, just a very clever middleman.

  Without RTK:                             With RTK:

  Claude  --git status-->  shell  -->  git       Claude  --git status-->  RTK  -->  git
    ^                                   |           ^                      |          |
    |        ~2,000 tokens (raw)         |           |   ~200 tokens         | Smart    |
    +-----------------------------------+           +------- (compressed) ---+ filtering+

When AI tools execute commands, RTK:

  1. Smart filtering — strips comments, whitespace, boilerplate text
  2. Smart grouping — aggregates similar items by directory or type (files grouped by directory, errors grouped by type)
  3. Smart truncation — keeps key context, cuts redundancy
  4. Dedup & merge — collapses repeated log lines into counts

Project info:

Attribute Value
GitHub rtk-ai/rtk
Language Rust
License Apache 2.0
Stars 68,000+
Latest version 0.28.2
Dependencies Zero (single static binary)

Installing RTK

RTK is dead simple to install. No runtime dependencies — it's a standalone binary.

macOS / Linux

Recommended: Homebrew

brew install rtk

Quick install script:

curl -fsSL https://raw.githubusercontent.com/rtk-ai/rtk/refs/heads/master/install.sh | sh

Installs to ~/.local/bin. Make sure that path is in your PATH: bash echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc source ~/.bashrc

Install from Cargo:

cargo install --git https://github.com/rtk-ai/rtk

Windows

Download rtk-x86-64-pc-windows-msvc.zip from GitHub Releases, extract it, and place rtk.exe in a PATH directory (e.g. C:\Users\<you>\.local\bin).

⚠️ Don't double-click the exe to run it. RTK needs to be executed from a command line (PowerShell/CMD/Windows Terminal).

Verify Installation

rtk --version   # Should show "rtk 0.28.2"
rtk gain        # Should show token savings stats

Name collision warning: There's another project called "rtk" (Rust Type Kit) on crates.io. If rtk gain errors out, you installed the wrong one. Use the cargo install --git method above instead.

Quick Start: Wire Up Your AI Tool in 3 Minutes

Once installed, just one step enables RTK for your AI coding tool:

# Claude Code / Copilot (default)
rtk init -g

# Gemini CLI
rtk init -g --gemini

# Codex (OpenAI)
rtk init -g --codex

# Cursor
rtk init -g --agent cursor

# Windsurf
rtk init -g --agent windsurf

# Cline / Roo Code
rtk init --agent cline

# Kilo Code
rtk init --agent kilocode

# Google Antigravity
rtk init --agent antigravity

What the -g (or --global) flag does: It automatically rewrites your AI tool's config file, replacing common commands (like git status) with rtk git status. Restart your AI tool and you're good to go.

# Restart Claude Code, then test
git status  # Automatically rewritten to rtk git status

⚠️ The hook only applies to Bash tool calls. Claude Code's built-in tools (like Read, Grep, Glob) don't go through the Bash hook, so they won't be auto-rewritten. To get compressed output in those cases too, use shell commands directly (cat/rg/find) or manually call rtk read, rtk grep, rtk find.

Commands Supported by RTK

RTK supports compressed output for over 100 commands, covering file operations, Git, testing, building, package management, cloud services, and more.

File Operations

rtk ls .                        # Smart directory tree (token -80%)
rtk read file.rs                # Smart file reading
rtk read file.rs -l aggressive  # Function signatures only (strips bodies)
rtk smart file.rs               # 2-line heuristic code summary
rtk find "*.rs" .               # Compressed find results
rtk grep "pattern" .            # Grouped search results
rtk diff file1 file2            # Compressed diff (exit 1 when files differ)

Git Operations

rtk git status                  # Compact status
rtk git log -n 10               # One-line commits
rtk git diff                    # Compressed diff
rtk git add                     # → "ok"
rtk git commit -m "msg"         # → "ok abc1234"
rtk git push                    # → "ok main"
rtk git pull                    # → "ok 3 files +10 -2"

The git push comparison is striking:

# git push (15 lines, ~200 tokens)          # rtk git push (1 line, ~10 tokens)
Enumerating objects: 5, done.               ok main
Counting objects: 100% (5/5), done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 456 bytes | 456.00 KiB/s, done.
...

15 lines compressed down to 1 line — 95% fewer tokens.

Test Runners

rtk pytest                      # Python tests (-90%)
rtk cargo test                  # Rust tests (-90%)
rtk go test                     # Go tests (NDJSON, -90%)
rtk jest                        # Jest compact output
rtk vitest                      # Vitest compact output
rtk playwright test             # E2E test results (failures only)
rtk err <cmd>                   # Extract errors from any command
rtk test <cmd>                  # Generic test wrapper — failures only (-90%)

Build & Lint

rtk tsc                         # TypeScript errors grouped by file
rtk cargo build                 # Cargo build (-80%)
rtk cargo clippy                # Cargo clippy (-80%)
rtk ruff check                  # Python linting (JSON, -80%)
rtk golangci-lint run           # Go linting (JSON, -85%)
rtk next build                  # Next.js build compression
rtk prettier --check .          # Files that need formatting

Docker & Containers

rtk docker ps                   # Compact container list
rtk docker images               # Compact image list
rtk docker logs <container>     # Deduplicated logs
rtk kubectl pods                # Compact pod list
rtk kubectl logs <pod>          # Deduplicated logs

AWS CLI

rtk aws sts get-caller-identity # One-line identity
rtk aws ec2 describe-instances  # Compact instance list
rtk aws lambda list-functions   # Name/runtime/memory (keys stripped)
rtk aws s3 ls                   # Truncated list + tee recovery
rtk aws dynamodb scan           # Expanded type annotations

Data Analysis

rtk json config.json            # Structure display (values stripped)
rtk deps                        # Dependency summary
rtk env -f AWS                  # Filtered environment variables
rtk log app.log                 # Deduplicated logs
rtk summary <long command>      # Heuristic summary

Token Savings Analysis: How Much Does RTK Save You?

RTK comes with detailed built-in statistics so you can see exactly how much you're saving:

rtk gain                        # Summary stats
rtk gain --graph                # ASCII chart (last 30 days)
rtk gain --history              # Recent command history
rtk gain --daily                # Daily breakdown
rtk gain --all --format json    # JSON export (for dashboards)

rtk discover                    # Discover untapped savings opportunities
rtk discover --all --since 7    # All projects, last 7 days

rtk session                     # Show recent session RTK adoption rate

Global Flags

-u, --ultra-compact    # ASCII icons + inline format (extra token savings)
-v, --verbose          # Increase verbosity (-v, -vv, -vvv)

Real-World: A Day with RTK + Claude Code

Let's say you're a full-time developer on a Rust project. Here's what a day looks like:

Morning: Code Review

# Check today's commits
git log --oneline --since="today"   # RTK compresses to one-line summaries

# Browse PR list
gh pr list                          # RTK outputs a compact PR table

# View PR details
gh pr view 42                       # RTK outputs PR details + check status

Mid-Morning: Feature Development

# Explore project structure
ls -la                              # RTK directory tree (~150 tokens vs ~800)

# Read core files
read src/main.rs                    # RTK smart read (keeps signatures + key logic)

# Run tests
cargo test                          # RTK shows failures only (-90%)

# Commit and push
git commit -m "feat: add auth"      # RTK → "ok abc1234"
git push                            # RTK → "ok main"

Afternoon: CI Debugging

# Check CI results
gh run list                         # RTK compact workflow status

# Debug failures
docker ps                           # RTK compact container list
docker logs my-container            # RTK deduplicated logs

# Fix and retest
rtk test pytest                     # Generic test wrapper, failures only

Total Savings for the Day?

Scenario Raw Tokens RTK Tokens Savings
Directory/file browsing 50,000 10,000 -80%
Git operations 18,100 3,700 -80%
Test runs 41,000 4,100 -90%
Build/Lint 18,000 3,600 -80%
Other 10,000 2,000 -80%
Total 137,100 23,400 -83%

At Claude 3.5 Sonnet pricing ($10 per million tokens), you save roughly $1.14 per day. Over 20 working days that's ~$22.80 per month. Not huge for one person — but what about a team of 10? $228/month, $2,736/year.

And with pricier models like Claude Opus, the savings get even more significant.

How RTK Works Under the Hood

RTK's design philosophy is straightforward: don't do what the LLM can already do, only strip what the LLM doesn't need to see.

// Pseudocode: RTK's core processing pipeline
fn process_command(cmd: &str, output: &str) -> String {
    match cmd_type(cmd) {
        CmdType::GitStatus => compact_git_status(output),
        CmdType::TestRunner => failures_only(output),
        CmdType::FileList => group_by_dir(output),
        CmdType::Logs => deduplicate(output),
        CmdType::Build => errors_only(output),
        _ => heuristic_summary(output),
    }
}

RTK applies a different compression strategy for each command type:

  • git status — keeps only the modified file list, drops detailed staged/unstaged status notes
  • cargo test — shows only failing tests, passes get collapsed into a one-line summary
  • ls/find — groups by directory, shows filenames only, no permissions/sizes/dates
  • docker logs — removes duplicate lines, shows the first occurrence + a count
  • aws describe-* — strips metadata, keeps only key attributes (and auto-filters sensitive info)

The entire RTK binary compiles down to just a few megabytes, with startup overhead under 10ms — basically imperceptible.

Use Cases and Limitations

✅ Great Fit

  • Heavy AI coding assistant users: 4+ hours daily with Claude Code, Cursor, Gemini CLI
  • Multi-language projects: Rust/Go/Python/TypeScript mixed projects, all test runners covered
  • Team collaboration: unified token budgets, reduced LLM call costs in CI/CD
  • Cloud deployment: using AI tools in CI pipelines (pay-per-token)

⚠️ Things to Watch

  • Hooks only cover Bash calls: Claude Code's built-in tools don't pass through RTK
  • Over-compression can lose context: complex debugging may need --verbose for full output
  • Takes getting used to: shorter AI output means you may need to adjust how you prompt the AI

Summary

RTK is one of the most practical, immediately useful AI coding helper tools I've come across. No hype, no fancy UI — just a quiet Rust binary working in the background, saving you tokens and money every day.

30 seconds to install, permanent benefits. That's the open-source spirit — solving real pain points with minimal code.

Get started:

brew install rtk      # macOS
rtk init -g           # Enable Claude Code integration
# Restart Claude Code and start enjoying token savings

If your AI coding tool runs dozens or hundreds of commands every day, RTK is absolutely worth trying. 68K+ GitHub Stars already prove its value — now it's your turn.


Related links: