500xEngineer.

All postsSHORT4 min read

My AI Agents Skipped 1.38 Billion Tokens With RTK. Here's the Catch

RTK is a free Rust CLI that trims shell output before your coding agent reads it. My Mac's numbers, what they really mean for your bill, and a service you can sell.

My coding agents skipped about 1.38 billion tokens of terminal output on one Mac, by RTK's own count. RTK is a free command-line tool that sits between an AI coding agent and your shell, and it trims what commands print before the agent reads it. Here's what that number means, what it doesn't, and how you could turn it into a small paid service.

Video not loading? Watch the Short on YouTube

What RTK does

When Claude Code (or Codex, Cursor, Copilot and the other agents RTK supports) runs a command like git status, it reads the output that comes back. Long test logs, search results and file listings all land in the model's context, and you pay for them as input tokens.

RTK's README puts it simply: "rtk filters and compresses command outputs before they reach your LLM context." After rtk init -g, a hook rewrites your agent's git status into rtk git status, and the agent gets a compact version without ever calling RTK itself. The README lists filters for git, grep and rg, ls, test runners like cargo test, pytest and npm test, linters, Docker and more, "100+ supported commands" in total, and 18 supported AI coding tools.

The project has been around since January 2026. The latest stable release is v1.1.0, published Oct 25, 2026, and it had about 85,500 GitHub stars when I checked.

My numbers

I read RTK's own tracking database on my Mac, the same data rtk gain summarizes (I run rtk 0.49.0). From Sept 14 to Nov 4, 2026:

  • 1,176,333 commands went through RTK
  • about 2.19 billion estimated tokens of raw output came in
  • about 812 million estimated tokens went to the agents
  • about 1.38 billion estimated tokens skipped, a 63% cut

Most of it came from search. rtk grep alone accounted for roughly 715 million of the skipped tokens.

Two notes on reading those numbers. RTK estimates tokens as bytes divided by 4, because it ships no tokenizer. Its docs say the percentage is reliable and the absolute counts are approximate. So treat 63% as solid and 1.38 billion as a ballpark.

The catch

RTK only shrinks one slice of what you pay for. Its README spells it out: bash output is "one contributor to input tokens, alongside your prompt, the system prompt and conversation history," and input tokens are "only part of the bill." So a 63% cut in shell output is a much smaller cut in cost. RTK says so itself: "A command showing 90% fewer output bytes does not make your session 90% cheaper."

Two more things to know before you install it:

  • The hook only fires on Bash tool calls. Claude Code's built-in Read, Grep and Glob tools don't pass through it by default. RTK suggests using shell commands or calling rtk read, rtk grep and rtk find directly. The full edition also has an opt-in engine feature that compresses an agent's own Read and MCP tool output.
  • There's another "rtk" on crates.io. That crate is Rust Type Kit, a different tool. Install with Homebrew, winget or the official install script, then run rtk gain. If it says "command not found" instead of showing a savings dashboard, you got the wrong one.

Try it in 10 minutes

  1. Install it: brew install rtk on macOS or Linux, or winget install rtk-ai.rtk on Windows.
  2. Hook it into your agent: rtk init -g for Claude Code, or the flag for your tool from the README (--codex, --gemini, --agent cursor and so on).
  3. Restart the agent and work normally for a day.
  4. Run rtk gain for the summary and rtk gain --daily for the trend.
  5. Run rtk discover to see which commands still go through unfiltered.

Here's how you get paid

My opinion, and no income is guaranteed: many dev teams using AI agents have no idea where their tokens go. That's an easy first engagement.

Sell a one-week agent cost audit:

  • Day one. Install RTK on the team's machines. For client work, use the Apache-2.0 edition (brew install rtk-ai/tap/rtk-oss). RTK's licensing page says to pick that edition "if you intend to redistribute RTK as part of a commercial offering," and the default build's engine licence doesn't cover offering RTK to third parties as a commercial service. The Apache edition keeps the hook, every filter, rtk gain and rtk discover.
  • The week. The team works as usual. You don't change their workflow.
  • The report. Export rtk gain --all --format json, show what got trimmed by command type, and add the rtk discover list of what's still unfiltered. Be honest about the bill: shell output is only part of it, so pair the report with their real usage numbers from their AI provider.

The report is the product. Once a team sees where the tokens go, the follow-up work, like tuning filters or cleaning up noisy test output, is easier to sell.

Daily email

Get each breakdown in your inbox.

One email each evening, right after the Short goes live: the AI tool it covers, the full write-up with sources, and how to get paid for it. Free, and you can unsubscribe anytime.

Read past emails on Substack

Sources

All postsWatch on YouTube