Every time your AI agent runs a CLI command, it reads the full raw output — and that output is noisy. A simple git status returns 15 lines of boilerplate. A test failure from cargo test dumps 200+ lines. Over a 30-minute session, you're burning tens of thousands of tokens on noise the LLM doesn't need.
RTK (Rust Token Killer) is a single binary that intercepts that output, strips the noise, and hands back only what matters. Here's exactly how it works — and how to wire it up on Windows with Cursor.
The Problem: Raw CLI Output Is a Token Furnace
Consider what happens when an AI agent runs git status without RTK:
On branch main
Your branch is up to date with 'origin/main'.
Changes not staged for commit:
(use "git add <file>..." to update staging area)
(use "git restore <file>..." to discard changes in working directory)
modified: src/components/Header.tsx
modified: src/pages/index.tsx
Untracked files:
(use "git add <file>..." to include in what will be committed)
src/utils/helper.ts
no changes added to commit (use "git add" and/or "git commit -a")
~200 tokens. Half of it is git telling you how to use git. The AI doesn't need a tutorial — it needs the diff list.
With rtk git status:
M src/components/Header.tsx
M src/pages/index.tsx
? src/utils/helper.ts
~20 tokens. Same information, 90% smaller.
How RTK Works: The Proxy Pattern
RTK applies four strategies per command type:
- Smart Filtering — removes comments, help text, boilerplate
- Grouping — aggregates similar items (files by directory, errors by type)
- Truncation — keeps relevant context, cuts redundancy
- Deduplication — collapses repeated log lines with counts
The agent never sees the rewrite. It just receives a much shorter answer.
Real Savings Over a Session
Here's what a typical 30-minute Claude Code / Cursor session looks like with and without RTK:
| Command | Frequency | Standard | With RTK | Savings |
|---|---|---|---|---|
git status | 10x | 3,000 | 600 | -80% |
cat / read | 20x | 40,000 | 12,000 | -70% |
cargo test / npm test | 5x | 25,000 | 2,500 | -90% |
grep / rg | 8x | 16,000 | 3,200 | -80% |
| Total | ~118,000 | ~23,900 | -80% |
That's not just cost savings — it's a context window that stays clean longer, meaning the AI retains more useful history and makes fewer mistakes from lost context.
Installation on Windows
RTK ships as a single .exe. No installer, no runtime, no dependencies.
Step 1: Download rtk-x86_64-pc-windows-msvc.zip from the releases page, extract the rtk.exe.
Step 2: Place it somewhere permanent, e.g. C:\tools\rtk\
Step 3: Add that folder to your system PATH (search "Environment Variables" → System Variables → Path → Edit → New).
Step 4: Open a new terminal and verify:
rtk --version
# rtk 0.31.0
rtk gain
# No tracking data yet. Run some rtk commands to start tracking savings.
Wiring It Up with Cursor on Windows
RTK's bash hook — the mechanism that automatically rewrites git status to rtk git status — requires Unix. On Windows, it silently falls back to --claude-md mode, which writes instructions to a markdown file but doesn't intercept anything automatically.
rtk init -g --agent cursor
# Output:
# [warn] Hook-based mode requires Unix (macOS/Linux).
# Windows: use --claude-md mode for full injection.
# Falling back to --claude-md mode.
# [ok] Created C:\Users\you\.claude\CLAUDE.md with rtk instructions
The hook file (rtk-rewrite.sh) gets created but won't execute on Windows. To make RTK actually work with Cursor, you need to tell the agent explicitly via Cursor Rules.
Go to Cursor Settings → Rules for AI and add:
When executing CLI commands, always use the rtk prefix:
- git status/diff/log/add/commit/push/pull → rtk git ...
- cat/head/tail → rtk read ...
- grep/rg → rtk grep ...
- ls → rtk ls ...
- cargo test/build/clippy → rtk cargo ...
- npm test / pytest / go test → rtk test ...
- When in doubt, prefix any CLI command with rtk.
This is a one-time setup. Cursor Agent will now use rtk across all sessions automatically — no bash hook needed.
Verify It's Working
Open a repo in Cursor, ask the agent to check git status. Watch the terminal panel — you should see rtk git status being called, not plain git status. Output will be the compressed 3-line version, not the 15-line boilerplate.
After a few commands, run:
rtk gain
You'll see a breakdown of tokens saved per command type, with running totals. Over a week of active development, the numbers get surprisingly large.
Worth It?
RTK is a zero-config, zero-dependency tool that does one thing well: it makes every CLI call cheaper for your AI agent. On Mac/Linux it's completely transparent via hooks. On Windows it needs a one-time Cursor Rule — a minor setup cost for a tool that then runs silently in the background indefinitely.
If you're doing serious AI-assisted development, it's one of the highest-ROI additions to your workflow.