Skip to content
Thyago Coan
Projects

RTK — Rust Token Killer

A token-optimized CLI proxy for agentic coding tools. Runs your dev commands, strips the output to what the model actually needs, and reports the saving.

activeRust · CLI · LLM tooling

Coding agents spend an enormous share of their context on command output that carries very little signal — build logs, git status boilerplate, dependency trees, test runners narrating every passing case. You pay for all of it.

RTK sits in front of those commands. It runs the real thing, filters the output down to the load-bearing parts, and hands that to the model instead.

#Usage

The core idea is that it's a drop-in prefix. Same command, less output:

rtk git status
rtk cargo build

In Claude Code it doesn't even need the prefix — a hook rewrites commands transparently, so git status becomes rtk git status with no overhead in the prompt itself.

#Measuring the saving

A tool that claims a reduction should be able to show it, so accounting is built in rather than bolted on:

rtk gain              # token savings analytics
rtk gain --history    # per-command history with savings
rtk discover          # scan session history for missed opportunities
rtk proxy <cmd>       # run unfiltered, for debugging the filter itself

rtk discover is the one that surprised me most in daily use: pointing it at existing history surfaces the commands where filtering would have paid off but wasn't applied.

#Notes

  • Written in Rust, so the proxy overhead stays well below the latency of the command it's wrapping.
  • Filters are per-command rather than generic — cargo output and git output fail in different ways and need different rules.
  • rtk proxy exists because the hardest bug class here is a filter that removes something that mattered. Having an unfiltered escape hatch makes that debuggable.