RTK: the hook that quietly trims your agent's token bill
RTK (Rust Token Killer) is a CLI proxy that compresses the output of your dev
commands before it ever reaches the model. The trick: one Claude Code
PreToolUse hook silently rewrites every shell call — git status becomes
rtk git status — so you change nothing and pay zero token overhead. Two days
in, it’s already shaved 34% off my command output, with git diff alone
landing at 49%.
How it disappears into your workflow. You wire it once — a PreToolUse
matcher on Bash that pipes through rtk hook claude — and from then on every
command is rewritten transparently. Under the hood RTK strips whitespace,
truncates long lines, and groups output by file, so the model sees the signal
without the slop. The agent never knows; it just gets leaner tool results.
The receipts. rtk gain keeps the score:
rtk gainRTK Token Savings (Global Scope)════════════════════════════════════════════════════════════
Total commands: 115Input tokens: 46.3KOutput tokens: 30.6KTokens saved: 15.8K (34.2%)Total exec time: 1.5s (avg 13ms)Efficiency meter: ████████░░░░░░░░░░░░░░░░ 34.2%
By Command─────────────────────────────────────────────────────────────────────── # Command Count Saved Avg% Time Impact─────────────────────────────────────────────────────────────────────── 1. rtk git diff 3 9.0K 49.4% 4ms ██████████ 2. rtk grep 20 1.1K 21.0% 2ms █░░░░░░░░░ 3. rtk ls -la docs/adr/ 2 898 55.6% 1ms █░░░░░░░░░ 4. rtk git diff HEAD 1 884 10.1% 10ms █░░░░░░░░░ 5. rtk ls -la . 2 735 73.4% 1ms █░░░░░░░░░ 6. rtk ls -la apps/site/... 2 390 68.2% 2ms ░░░░░░░░░░ 7. rtk ls -la /home/ngoc... 1 344 73.3% 2ms ░░░░░░░░░░ 8. rtk ls -la src/assets... 1 303 66.7% 1ms ░░░░░░░░░░ 9. rtk ls -la ../vi/ 1 195 68.2% 2ms ░░░░░░░░░░10. rtk ls -la apps/site/... 1 171 73.1% 2ms ░░░░░░░░░░───────────────────────────────────────────────────────────────────────Why 34% and not the marketed 60–90%. That number is a blended floor, not a
verdict. Cheap commands like git status compress to almost nothing; git diff
saves 49%, ls around 70%. And two days in, only ~115 of my ~4,800 recent
commands have routed through the hook — so rtk discover still sees ~387K
tokens sitting unrouted. What grows with time isn’t the percentage, it’s the
coverage.
Worth knowing. RTK doesn’t wrap everything yet — bun run, pkill, and
bunx still pass through raw. Run rtk discover on your own history to see
where your tokens leak. One gotcha: there’s a name collision with another rtk
(Rust Type Kit) — if rtk gain errors out, you’ve got the wrong binary.
- ai
- claude
- workflow