Skip to main content

RTK - Rust Token Killer

RTK is a high-performance CLI tool written in Rust that dramatically reduces LLM token consumption by filtering and compressing command outputs before they reach your AI coding assistant’s context.
Token Savings: RTK achieves 60-90% reduction in tokens on common development operations.A typical 30-minute Claude Code session goes from ~150,000 tokens down to ~45,000 tokens - a 70% reduction.

Why RTK Matters

AI coding assistants like Claude Code, Cursor, and Copilot consume massive amounts of tokens when reading command outputs. Every git status, npm test, or ls -la sends verbose output into the LLM context - wasting tokens, hitting rate limits, and slowing down your workflow. RTK sits between your AI assistant and the shell, intelligently filtering outputs to preserve only what matters:
Without RTK:
  ┌──────────┐  git status     ┌──────────┐  git status  ┌──────────┐
  │  Claude  │ ─────────────── │  shell   │ ──────────── │   git    │
  │   LLM    │                 │          │              │  (CLI)   │
  └──────────┘                 └──────────┘              └──────────┘
        ▲                                                      │
        │              ~2,000 tokens (raw output)              │
        └──────────────────────────────────────────────────────┘

With RTK:
  ┌──────────┐  git status     ┌──────────┐  git status  ┌──────────┐
  │  Claude  │ ─────────────── │   RTK    │ ──────────── │   git    │
  │   LLM    │                 │  (proxy) │              │  (CLI)   │
  └──────────┘                 └──────────┘              └──────────┘
        ▲                           │  ~2,000 tokens raw       │
        │                           └──────────────────────────┘
        │  ~200 tokens (filtered)   filter · group · dedup · truncate
        └───────────────────────────────────────────────────────

Key Benefits

Massive Token Savings

Save 60-90% of tokens on common operations like git log, cargo test, npm install.

Zero Workflow Changes

Install once with hooks, and all commands are automatically optimized - no manual prefixing needed.

Lightning Fast

Written in Rust with <10ms startup time. No performance overhead in your development workflow.

Analytics Built-In

Track your savings with rtk gain - see exactly how many tokens you’ve saved over time.

Token Savings Examples (30-min Session)

Here’s what RTK saves you in a typical Claude Code coding session:
OperationFrequencyStandardRTKSavings
ls / tree10×2,000400-80%
cat / read20×40,00012,000-70%
grep / rg16,0003,200-80%
git status10×3,000600-80%
git diff10,0002,500-75%
git log2,500500-80%
npm test25,0002,500-90%
docker ps900180-80%
Total~99,400~22,880-77%
Name Collision Alert: There are TWO different projects named “rtk”:
  1. Rust Token Killer (this project) - LLM token optimizer from rtk-ai/rtk
  2. Rust Type Kit (reachingforthejack/rtk) - DIFFERENT PROJECT
Verify you have the correct one:
rtk --version   # Should show "rtk 0.24.0" or higher
rtk gain        # Should show token savings stats
If rtk gain doesn’t work, you installed the wrong package.

How It Works

RTK applies four intelligent strategies based on command type:
1

Smart Filtering

Removes noise like comments, whitespace, boilerplate progress bars, and redundant metadata.
2

Grouping

Aggregates similar items - files by directory, errors by type, commits by author.
3

Truncation

Keeps relevant context, cuts redundancy. Show first/last 10 lines instead of 1000.
4

Deduplication

Collapses repeated log lines with counts: Error: timeout (×347) instead of 347 lines.

Real-World Example

Standard git push output (15 lines, ~200 tokens):
$ git push
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 8 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 342 bytes | 342.00 KiB/s, done.
Total 3 (delta 2), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.
To github.com:user/repo.git
   abc1234..def5678  main -> main
RTK git push output (1 line, ~10 tokens - 95% reduction):
$ rtk git push
ok main

Use Cases

AI Coding Sessions

Maximize your Claude Code, Cursor, or Copilot rate limits by sending 70% fewer tokens.

Monorepo Development

Work in large codebases without overwhelming your LLM with verbose ls, tree, or find outputs.

Test-Driven Development

See only test failures, not the 200+ lines of passing test noise. Works with cargo test, npm test, pytest, go test.

Git-Heavy Workflows

Condense git log, git diff, git status into compact summaries that preserve all critical info.

Supported Commands

RTK optimizes 50+ commands across multiple ecosystems:

Git Operations

git status, git diff, git log, git add, git commit, git push, git pull, git branch, git fetch, git stash

Test Runners

cargo test, npm test, pytest, go test, vitest, playwright test

Package Managers

npm install, pnpm list, pip install, cargo build

Linters & Type Checkers

eslint, ruff check, tsc, mypy, golangci-lint, cargo clippy

Containers

docker ps, docker logs, kubectl get pods, kubectl logs

And More

ls, tree, grep, cat, curl, wget, gh pr list, prisma migrate, next build View full command reference →

Next Steps

Install RTK

Get RTK installed in under 5 minutes with Homebrew, cargo, or pre-built binaries.

Quick Start

Follow our 5-minute guide to install, verify, and start saving tokens immediately.