RTK โ€“ Rust Token Killer

RTK is a high-performance CLI proxy written in Rust that sits between your shell and your AI coding assistant. Instead of dumping raw command output into the LLM context, RTK compresses it first โ€” stripping boilerplate, deduplicating repeated lines, and keeping only what matters.

The Problem It Solves

AI coding assistants read everything in the terminal. A git status on a large repo, a full cargo test run, or a verbose docker ps output can burn thousands of tokens on noise that the model doesn’t need. Over a 30-minute session this adds up fast โ€” one benchmark showed 118,000 tokens reduced to 23,900 for typical dev operations.

How It Works

RTK intercepts commands and applies four strategies per tool:

  • Filtering โ€” removes known boilerplate and progress lines
  • Grouping โ€” aggregates similar items (e.g. multiple changed files of the same type)
  • Truncation โ€” keeps the head and tail of long outputs, cuts the middle
  • Deduplication โ€” collapses repeated log lines with a count

It ships with handlers for 100+ tools: git, GitHub CLI, cargo, pytest, docker, AWS CLI, kubectl, and most common linters and package managers.

Integration

RTK works as a transparent hook in Claude Code, Cursor, Copilot, Cline, Gemini CLI, and others. The hook rewrites bash commands automatically โ€” git status becomes rtk git status without any change to your workflow.

# Install via Homebrew
brew install rtk

# Check savings
rtk gain

# Use directly or let the hook handle it
rtk cargo test

Why Rust?

The binary needs to be fast and dependency-free โ€” it runs on every command invocation. Rust gives both, and the resulting binary is cross-platform (macOS, Linux, Windows via WSL).

Bottom Line

RTK is a thin, invisible layer that makes AI-assisted development cheaper and faster by doing one thing well: reducing the token tax of standard dev tooling. The savings compound quickly across a full coding session.


Links: GitHub ยท Apache 2.0