One Command Saved Me 2.8M Claude Code Tokens
Every command Claude Code runs dumps its output into the context window. A passing test suite, a lint run, an ls of an assets folder. Most of that output is noise, but Claude reads all of it. It clutters the conversation and pushes it toward compaction sooner.
RTK (Rust Token Killer) fixes this. Itโs a CLI proxy that sits between Claude and your shell and filters command output down to what the agent actually needs.
Setup
I installed it with Homebrew seven months ago. Since then, all Iโve done is keep it up to date along with the rest of my system dependencies.
brew install rtkrtk init -grtk init -g handles the setup for you, so thereโs nothing to paste. For reference, this is the PreToolUse hook it adds to your global Claude Code settings:
{ "hooks": { "PreToolUse": [ { "matcher": "Bash", "hooks": [{ "type": "command", "command": "rtk hook claude" }] } ] }}Thatโs it.
It just works
This is the part I like most. I donโt think about RTK and neither does Claude. When Claude runs git status, the hook rewrites it to rtk git status before it executes. Same for grep, ls, go test, eslint, gh, and a long list of other commands. Claude gets the compact output, and nobody had to change their habits.
Hereโs git status in this blogโs repo while I was writing this post. Without RTK, Claude reads all of this:
On branch mainYour branch is up to date with 'origin/main'.
Untracked files: (use "git add <file>..." to include in what will be committed) content/attachments/posts/one-command-saved-me-2-8m-claude-code-tokens/ content/posts/one-command-saved-me-2-8m-claude-code-tokens.md
nothing added to commit but untracked files present (use "git add" to track)With RTK, it reads this:
* main...origin/main?? content/attachments/posts/one-command-saved-me-2-8m-claude-code-tokens/?? content/posts/one-command-saved-me-2-8m-claude-code-tokens.mdSame information, without the hints written for humans. Claude already knows how to git add a file.
What if RTK cuts something Claude actually needs? When it truncates output, it saves the full version to a log file and leaves a note telling Claude where to find it:
[see remaining: tail -n +1 "~/Library/Application Support/rtk/tee/1795025400_ls-hidden.log"]Claude can read the rest whenever it needs to, and rtk bypass <cmd> runs any command with no filtering at all.
I stopped babysitting terminal output. The cost is about 321ms per command on average, which Iโve never noticed.
The numbers
RTK tracks everything it filters. Run rtk gain to see your savings:
RTK Token Savings (Global Scope)โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Total commands: 33747Input tokens: 10.8MOutput tokens: 8.1MTokens saved: 2.8M (25.5%)Total exec time: 155m21s (avg 321ms)Efficiency meter: โโโโโโโโโโโโโโโโโโโโโโโโ 25.5%Excluded: 300 oversized outputs (input past the ~30k-char agent cap)
By Commandโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ # Command Count Saved Total% Time Impactโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ 1. rtk read 6272 2.2M 29.0% 0ms โโโโโโโโโโ 2. rtk grep 11184 1.7M 6.9% 408ms โโโโโโโโโโ 3. rtk go test ./... 29 1.5M 100.0% 1.7s โโโโโโโโโโ 4. rtk lint eslint 4 1.0M 99.9% 8.1s โโโโโโโโโโ 5. rtk ls Assets 14 308.7K 98.7% 27ms โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโThatโs 2.8M tokens saved across almost 34,000 commands, and itโs only the last 90 days, since RTK keeps 90 days of history by default. Iโve been running it since April 2026, so the real number is higher.
2.8M is also the conservative number. Claude Code cuts off any command output past about 30,000 characters, so RTK leaves those 300 oversized outputs out of the total. It only takes credit for tokens Claude would actually have read. The per-command rows still include those big outputs, so donโt add them up. The total at the top is the real number.
Some commands get trimmed, and some get almost erased:
- Trimmed.
readandgrepcut 7โ29% per call, but Claude runs them constantly. Thatโs over 17,000 calls between them. - Erased.
go testandeslintoutput shrinks by more than 99%. A passing test suite doesnโt need hundreds of lines ofokoutput, so RTK collapses it to a summary. Claude gets the part that matters.
Those savings also compound. Command output stays in the context for the rest of the session, so itโs sent again with every turn after it. Trimming it once keeps the whole conversation lighter.
Putting 2.8M in perspective
After this post went out, someone asked me how much RTK actually cuts into my usage window. Fair question, so I ran rtk cc-economics, which compares RTKโs savings against your Claude Code usage:
Token breakdown: Input: 37.4M Output: 8.5M Cache writes: 45.5M Cache reads: 1698.9M
RTK commands: 33775Tokens saved: 2.8MRTK estimates thatโs 0.9% of my total usage. Under 1% looked small at first, until I saw where my usage actually goes: 1.7 billion cache-read tokens. Every turn, Claude Code re-sends the whole conversation, and that dwarfs everything else. RTK only touches one slice of it, the command output, and only for commands it supports.
So 2.8M isnโt a big dent in my usage window, and I wonโt pretend it is. What it is: 2.8M tokens of noise that never made it into a conversation. Within the slice RTK touches, it cuts a quarter overall and more than 99% on the noisiest commands. Thatโs the part I notice day to day, a cleaner context I donโt have to babysit. The estimate also prices each saved token once, so it doesnโt count the turns where that output would have been re-read.
The percentage only grows as RTK supports more commands, which is where you come in.
Finding what it missed
RTK doesnโt support every command. When it sees one it doesnโt know, it passes the output through untouched, so nothing breaks. You just donโt get the savings. rtk discover scans your Claude Code history and shows you both the commands RTK doesnโt handle yet and the ones that slipped past it:
Scanned: 24 sessions (last 30 days), 2304 Bash commandsAlready using RTK: 856 commands (37.2%)
MISSED SAVINGS -- Commands RTK already handlesCommand Count RTK Equivalent Est. Savingsgrep -n 46 rtk grep ~11.2K tokenscat 20 rtk read ~8.1K tokenscurl -s 20 rtk curl ~3.3K tokensgit add 17 rtk git ~3.0K tokensls -la 16 rtk ls ~2.8K tokensTotal: 176 commands -> ~33.1K tokens saveableIn my last 30 days, 37% of my Bash commands went through RTK. Most of the rest were commands RTK doesnโt support yet, like Python heredocs, pnpm build, and sips, and those passed through as normal. The commands it could have filtered but missed only add up to about 33K tokens.
The bigger opportunity is the unsupported list. Every command on it is a filter waiting to be written, and discover points you to the issue tracker to request one. You donโt need to know Rust to start, either. RTK reads custom filters from a filters.toml, globally or per project in .rtk/filters.toml, where you can match a command, strip noisy lines, and cap the output length. For anything more involved, rtk plugins new scaffolds a Rust plugin. If a filter works well for you, send it upstream so everyone gets the savings.
A few more commands
rtk gain --historyshows recent commands and how much each one saved.rtk bypass <cmd>runs a command without filtering, which helps when you need to see the raw output.- If
rtk gainfails, checkwhich rtk. Thereโs an unrelated Rust Type Kit that also installs asrtk.
Wrapping up
Most tools that save tokens ask you to change how you work. RTK doesnโt. I installed it, ran one command, and seven months later itโs still saving me tokens on every session. It wonโt double your usage window, but it keeps every conversation cleaner, and it gets better with every command the community adds. If you use Claude Code, itโs an easy win.
Check out RTK on GitHub, install it, and start saving tokens for yourself. And while youโre there, give the project a star.
If you want more ways to tune Claude Code, check out Tuning Your Claude Code Settings.
Sign-Up for New Posts
Stay in the loop and get the latest blog posts about Claude Code sent to your inbox.
Or use the