How to cut Claude Code token use by up to 90% with RTK (setup in 10 minutes)
If you use Claude Code on a real project, a big share of your tokens never comes from your prompts. It comes from command output: a long git log , a test run that prints every passing case, a lint pass that repeats the same warning over and over. The agent reads all of it, every time, and you pay f

Posted on Oct 27 • Originally published at dedupedai.com
If you use Claude Code on a real project, a big share of your tokens never comes from your prompts. It comes from command output: a long git log, a test run that prints every passing case, a lint pass that repeats the same warning over and over. The agent reads all of it, every time, and you pay for it in context and in limits.
RTK is a single Rust binary that sits between your agent and the shell. When Claude Code runs git status, pytest or npm test, RTK filters and compresses the output before the model sees it. The README claims up to 90% smaller output across 100+ supported commands. You do not change how you prompt: the agent keeps typing normal commands.
Here is the setup in about ten minutes, how to check it is really saving tokens, and the one gotcha that makes people think it is broken.
brew install rtk # macOS / Linux winget install rtk-ai.rtk # Windows Enter fullscreen mode Exit fullscreen mode There is also an install script on the repo if you do not use a package manager.
Then check you got the right package, because another project named "rtk" exists on crates.io:
rtk --version rtk gain # must show the savings dashboard, not "command not found" Enter fullscreen mode Exit fullscreen mode If rtk gain prints a dashboard, you are good.
rtk init -g Enter fullscreen mode Exit fullscreen mode That adds a PreToolUse hook to Claude Code (the same command covers Copilot in VS Code with --copilot ). Restart Claude Code, then ask it to run git status. Behind the scenes the call is rewritten to rtk git status and the agent receives the compact version. It never has to call rtk itself.
Using something else? The same idea works across 18 tools:
rtk init -g --codex # Codex rtk init -g --gemini # Gemini CLI rtk init -g --agent cursor # Cursor rtk init -g --agent windsurf # Windsurf rtk init --agent cline # Cline / Roo Code Enter fullscreen mode Exit fullscreen mode Step 3: check the savings are real After a few sessions:
rtk gain # summary rtk gain --graph # last 30 days as an ASCII graph rtk gain --daily # day by day rtk discover # commands you ran that RTK could have compressed but did not Enter fullscreen mode Exit fullscreen mode rtk discover is the useful one. It tells you where you are still leaking tokens.
This trips up most people. The hook only fires on Bash tool calls. Claude Code's built-in Read, Grep and Glob tools do not pass through the shell, so RTK never sees them.
A line in your CLAUDE.md like "use rg and cat through Bash for search and reading" is enough for most projects.
RTK applies four strategies depending on the command:
Need the raw output once? rtk bypass <command> runs it unfiltered and still tracks it.
Does it break Claude's prompt cache? No, according to the README: output is filtered once per command, stored in history, and cached normally on later calls. Smaller outputs also make cache writes and reads cheaper.
Each page has who it is for, the steps and a prompt you can paste into your coding agent.
Use case: Cut your coding agent's token use from command output
Use case: Set up RTK for Codex, Gemini CLI, Cursor and other agents
Get one email every Monday with the week's hottest AI repos and exactly how to use them: subscribe free at dedupedai.com