CLI proxy that reduces LLM token consumption by 60-90% on common dev commands. Single Rust binary, z
CLI proxy that reduces LLM token consumption by 60-90% on common dev commands. Single Rust binary, z
High-performance CLI proxy that cuts up to 90% of the bash output your agent reads
Website • Install • Troubleshooting • Architecture • Discord
English • Francais • 中文 • 日本語 • 한국어 • Espanol • Português
rtk filters and compresses command outputs before they reach your LLM context. Single Rust binary, 100+ supported commands, <10ms overhead.
RTK intercepts shell commands and compresses their output before your agent reads it.
| Operation | What RTK does to the output |
|---|---|
ls / tree |
Tree format with file counts instead of one line per entry |
cat / read |
Smart file reading: signatures and structure over full bodies |
grep / rg |
Truncates long lines, groups matches by file |
git status |
Compact stat format, grouped by state |
git diff |
Reduced context, headers stripped |
git log |
Hash, author and subject only |
git add/commit/push |
Confirmation line instead of full progress output |
cargo test / npm test |
Failures only, passing tests collapsed to a count |
ruff check |
Grouped by rule and file |
sqlfluff lint |
Grouped by rule and file |
pytest |
Failures only, traceback trimmed |
go test |
NDJSON parsed, failures only |
docker ps |
Essential fields only |
RTK cuts up to 90% of the bash output your agent reads. That is what RTK measures, and it is not the same as cutting your bill by 90%.
Bash output is one contributor to input tokens, alongside your prompt, the system prompt and conversation history. Input tokens are in turn only part of the bill, which also counts output tokens. The reduction dilutes at every step.
The token counts RTK reports are estimated as bytes / 4 — RTK ships no tokenizer, so the percentages are reliable but the absolute token numbers are approximate.
Full explanation: How RTK Savings Work
brew install rtkcurl -fsSL https://raw.githubusercontent.com/rtk-ai/rtk/refs/heads/master/install.sh | shInstalls to
~/.local/bin. Add to PATH if needed:echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc # or ~/.zshrc
cargo install --git https://github.com/rtk-ai/rtkDownload from releases:
rtk-x86_64-apple-darwin.tar.gz / rtk-aarch64-apple-darwin.tar.gzrtk-x86_64-unknown-linux-musl.tar.gz / rtk-aarch64-unknown-linux-gnu.tar.gzrtk-x86_64-pc-windows-msvc.zipWindows users: Extract the zip and place
rtk.exesomewhere in your PATH (e.g.C:\Users\<you>\.local\bin). Run RTK from Command Prompt, PowerShell, or Windows Terminal — do not double-click the.exe(it will flash and close). The full hook system works natively on Windows (and in WSL). See Windows setup below for details.
rtk --version # Should show "rtk 0.28.2"
rtk gain # Should show the savings dashboardName collision warning: Another project named "rtk" (Rust Type Kit) exists on crates.io. If
rtk gainfails, you have the wrong package. Usecargo install --gitabove instead.
…Hook-based agents rewrite Bash commands (e.g., git status -> rtk git status) before execution. Plugin-based agents, including Hermes, use their plugin API to rewrite commands before execution. The agent receives compact output without needing to call rtk explicitly.
Important: the hook only runs on Bash tool calls. Claude Code built-in tools like Read, Grep, and Glob do not pass through the Bash hook, so they are not auto-rewritten. To get RTK's compact output for those workflows, use shell commands (cat/head/tail, rg/grep, find) or call rtk read, rtk grep, or rtk find directly.
Without rtk: With rtk:
Claude --git status--> shell --> git Claude --git status--> RTK --> git
^ | ^ | |
| full raw output | | compact output | filter |
+-----------------------------------+ +------- (filtered) ---+----------+Four strategies applied per command type:
Does RTK break Claude's prompt cache? No. RTK filters output once per command. The result is stored in history and cached normally on subsequent API calls, so the cache keeps working as expected. Smaller outputs also mean cheaper cache writes and reads. See Troubleshooting for details.
Percentages below are reductions in bash output, not reductions in your bill. See How Savings Work.
rtk ls . # Compact directory tree
rtk read file.rs # Smart file reading
rtk read file.rs -l aggressive # Signatures only (strips bodies)
rtk smart file.rs # 2-line heuristic code summary
rtk find "*.rs" . # Compact find results
rtk grep "pattern" . # Grouped search results
rtk diff file1 file2 # Condensed diff (exit 1 if files differ)rtk git status # Compact status
rtk git log -n 10 # One-line commits
rtk git diff # Condensed 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"rtk gh pr list # Compact PR listing
rtk gh pr view 42 # PR details + checks
rtk gh issue list # Compact issue listing
rtk gh run list # Workflow run status……rtk pnpm list # Compact dependency tree
rtk uv run pytest # Preserve uv env, keep program output
rtk pip list # Python packages (auto-detect uv)
rtk pip outdated # Outdated packages
rtk bundle install # Ruby gems (strip Using lines)
rtk prisma generate # Schema generation (no ASCII art)rtk bun install # Strip progress and version lines
rtk bun test # Failures only (-90%)
rtk bun build # Errors only when writing to disk, else passthrough
rtk bunx tsc # Smart routing to tsc filter
rtk deno test # Failures only (-90%)
rtk deno lint # Strip download lines + tee recovery
rtk deno check # Strip download lines + tee recoveryrtk aws sts get-caller-identity # One-line identity
rtk aws ec2 describe-instances # Compact instance list
rtk aws lambda list-functions # Name/runtime/memory (strips secrets)
rtk aws logs get-log-events # Timestamped messages only
rtk aws cloudformation describe-stack-events # Failures first
rtk aws dynamodb scan # Unwraps type annotations
rtk aws iam list-roles # Strips policy documents
rtk aws s3 ls # Truncated with recall recoveryrtk docker ps # Compact container list
rtk docker images # Compact image list
rtk docker logs <container> # Deduplicated logs
rtk docker compose ps # Compose services
rtk kubectl pods # Compact pod list
rtk kubectl logs <pod> # Deduplicated logs
rtk kubectl services # Compact service list
rtk oc get pods # OpenShift pod summary
rtk oc get services # OpenShift service list
rtk oc logs <pod> # Deduplicated logsrtk pulumi preview # Strip header/URL/duration noise
rtk pulumi up # Compact apply output
rtk pulumi destroy # Compact destroy output
rtk pulumi refresh # Drift summary
rtk pulumi stack # Stack metadata (strips owner/timestamps)rtk json config.json # Structure without values
rtk deps # Dependencies summary
rtk env -f AWS # Filtered env vars
rtk log app.log # Deduplicated logs
rtk curl <url> # Truncate + save full output
rtk wget <url> # Download, strip progress bars
rtk summary <long command> # Heuristic summary
rtk proxy <command> # Raw passthrough + trackingrtk gain # Summary stats
rtk gain --graph # ASCII graph (last 30 days)
rtk gain --history # Recent command history
rtk gain --daily # Day-by-day breakdown
rtk gain --all --format json # JSON export for dashboards
rtk discover # Find missed savings opportunities
rtk discover --all --since 7 # All projects, last 7 days
rtk session # Show RTK adoption across recent sessions-u, --ultra-compact # ASCII icons, inline format (further output reduction)
-v, --verbose # Increase verbosity (-v, -vv, -vvv)Directory listing:
# ls -la (45 lines) # rtk ls (12 lines)
drwxr-xr-x 15 user staff 480 ... my-project/
-rw-r--r-- 1 user staff 1234 ... +-- src/ (8 files)
... | +-- main.rs
+-- Cargo.tomlGit operations:
# git push (15 lines) # rtk git push (1 line)
Enumerating objects: 5, done. ok main
Counting objects: 100% (5/5), done.
Delta compression using up to 8 threads
...Test output:
# cargo test (200+ lines on failure) # rtk test cargo test (~20 lines)
running 15 tests FAILED: 2/15 tests
test utils::test_parse ... ok test_edge_case: assertion failed
test utils::test_format ... ok test_overflow: panic at utils.rs:18
...The most effective way to use rtk. The hook transparently intercepts Bash commands and rewrites them to rtk equivalents before execution.
Result: 100% rtk adoption across all conversations and subagents, with no
The rewrite rule for `find` is unconditional, so `find … -delete` / `-exec` is captured and refused — the command silently does nothing and breaks `&&` chains
rtk compacts machine-bound git output (--porcelain / --name-only / piped), silently corrupting consumers
hook claude: JSON-escaped command occasionally corrupts \b into a raw backspace, causing Claude Code to reject the tool call
bug(rewrite): npm run lint forced into rtk lint on Biome projects
rtk find: `--max 0` prints an empty first line before `+N more`
Bug winget package stuck at v0.48.0 — v0.49.0 and v0.50.0 never published
.claude/bash-snapshots/claudecode/
Efficiency drop after Claude Code 2.1.160 — native tools replacing Bash calls?
Windows: arguments to cmd.exe itself get backslash-escaped quotes cmd does not decode (`rtk cmd /c` with a quoted path)
`kubectl --no-headers` is compacted even though it requests parseable output, while every other output-format flag is passed through