Stop feeding your AI agent junk tokens
Why I started using rtk, a CLI tool that cuts 89% of terminal noise before it reaches your model.
If you use Claude Code, Cursor, Aider, or any AI coding agent, there’s a problem you probably haven’t thought about: most of the tokens your agent consumes aren’t your code. They’re noise.
Every git status, every cargo test, every ls -la, the agent runs these commands, reads the full output, and stuffs it into the context window. That output is full of boilerplate, progress bars, formatting junk, and information the model doesn’t need.
The result? Your context window fills up faster.
The numbers are kind of wild
A typical 2-hour coding session involves around 60 CLI commands. That’s roughly 210K tokens of raw terminal output, enough to overflow a 200K context window on its own.
Here’s what that looks like in practice:
cargo testwith all tests passing? ~4,800 tokens of output. The agent only needed to know “262 passed, 0 failed.”git push? 15 lines about enumerating objects, counting objects, delta compression. The agent needed: “pushed to main.”ls -la? Full permissions, timestamps, owner info. The agent just needed the file list.
Most of this output is completely useless for the model’s reasoning. But it still eats your tokens, your rate limits, and your session length.
rtk: a CLI proxy that fixes this
rtk (Rust Token Killer) is an open-source CLI tool that sits between your AI agent and your terminal. It intercepts command outputs and compresses them before they reach the context window.
It’s not doing anything too magical. It filters noise, groups related output, truncates redundancy, and deduplicates repeated lines. The kind of thing you’d do if you were manually cleaning up terminal output before pasting it into a prompt, except it happens automatically.
Some real examples:
cargo testoutput goes from ~4,800 tokens → 11 tokens. Just:✓ cargo test: 262 passedgit pushgoes from ~200 tokens → ~10 tokens. Just:ok ✓ maingit diffgoes from ~21,500 tokens → ~1,259 tokens. Keeps the actual changes, drops the noise.git statusgoes from ~120 tokens → ~30 tokens. Clean, grouped output.
Across a real session of ~2,900 commands, rtk measured 89% average noise reduction. That translates to roughly 3x longer sessions before you hit context limits or rate caps.
If you’re on a pay-per-token setup, this directly cuts your bill. If you’re on a flat-rate plan with caps, it stretches your limits.
It works with Claude Code (and probably your tool too?)
rtk is built and tested for Claude Code, that’s where the auto-rewrite hook lives and where it works out of the box. If you’re using other tools like Cursor, Aider, Gemini CLI, or Windsurf, you could likely get it working with some customization since the core idea is the same: compress CLI output before it hits the context window. But I’ve only tested it with Claude Code.
If you get rtk to work with tools other than Claude Code, please let me know in the comments.
Installation (30 seconds)
Option 1: One-liner (Linux/macOS)
curl -fsSL https://raw.githubusercontent.com/rtk-ai/rtk/refs/heads/master/install.sh | shOption 2: Via Cargo
cargo install --git https://github.com/rtk-ai/rtkOption 3: Pre-built binaries
Download from GitHub Releases, available for macOS (Intel + Apple Silicon), Linux, and Windows.
Setup (one command)
After installing, run:
rtk init --globalThat’s it. This installs a hook that automatically rewrites your agent’s CLI commands to their rtk equivalents. You don’t need to change how you work. The agent runs git status, the hook transparently converts it to rtk git status, and the compressed output is what lands in the context window.
If you want to verify it’s working:
rtk gainThis shows you exactly how many tokens rtk has saved, broken down by command. You can also run rtk gain --graph for a visual breakdown over time.
That’s it
rtk is open source (MIT), written in Rust, and doesn’t phone home or require any accounts. It just compresses CLI output so your AI agent can focus on what matters.
GitHub: github.com/rtk-ai/rtk
Website: rtk-ai.app


