What is RTK?
RTK (Rust Token Killer) is a high-performance CLI proxy that minimizes LLM token consumption by filtering and compressing command outputs. It achieves 60-90% token savings on common development operations through:- Smart Filtering: Removes noise (comments, whitespace, boilerplate)
- Grouping: Aggregates similar items (files by directory, errors by type)
- Truncation: Keeps relevant context, cuts redundancy
- Deduplication: Collapses repeated log lines with counts
Command Categories
File Operations
Directory listing, file reading, search, and find operations
Git
All git operations with ultra-compact output
Testing
Test runners showing failures only (90% savings)
JavaScript/TypeScript
Modern JS stack: ESLint, TypeScript, Next.js, Vitest, Playwright
Python
Ruff, pytest, pip, mypy with JSON/text parsers
Go
Go test, build, vet, golangci-lint with NDJSON streaming
Containers
Docker and Kubernetes with compact container lists
GitHub
GitHub CLI with compact PR/issue/run views
Global Flags
All RTK commands support these global flags:Increase verbosity level. Use multiple times for more detail:
-v: Basic debug info-vv: Detailed execution traces-vvv: Maximum verbosity
Enable ultra-compact mode:
- ASCII icons instead of Unicode emoji
- Inline format with minimal whitespace
- Extra token savings (10-15% on top of default)
Common Patterns
Exit Code Preservation
All RTK commands preserve the original command’s exit code, making them safe for CI/CD:Fallback to Raw Commands
If RTK’s filter fails, it automatically falls back to raw command execution:Tee Output Recovery
On command failure, RTK saves full unfiltered output to~/.local/share/rtk/tee/ so LLMs can read details without re-running:
Proxy Mode
Bypass RTK filtering but still track usage metrics:Token Savings by Operation
Typical 30-minute Claude Code session:| Operation | Frequency | Standard | RTK | Savings |
|---|---|---|---|---|
ls / tree | 10× | 2,000 | 400 | -80% |
cat / read | 20× | 40,000 | 12,000 | -70% |
grep / rg | 8× | 16,000 | 3,200 | -80% |
git status | 10× | 3,000 | 600 | -80% |
git diff | 5× | 10,000 | 2,500 | -75% |
npm test | 5× | 25,000 | 2,500 | -90% |
pytest | 4× | 8,000 | 800 | -90% |
docker ps | 3× | 900 | 180 | -80% |
| Total | ~118,000 | ~23,900 | -80% |
Performance Targets
RTK maintains strict performance constraints:- Startup time: <10ms (zero-overhead CLI experience)
- Memory: <5MB resident
- Binary size: <5MB stripped
- Token savings: 60-90% across all commands
Next Steps
File Operations
Start with file operations (ls, read, grep, find)
Git Commands
Explore git command optimizations
