rtk
CLI proxy that reduces LLM token consumption by 60-90% on common dev commands. Single Rust binary, zero dependencies
Install
brew install rtkInstall command taken from the project's README or registry entry. Always review code before running it.
README excerpt
Read full README on GitHub →Agent-agnostic token optimization: compress, route, filter, and more.
One composable pipeline across everything your AI agent reads and sends — built on RTK's battle-tested bash-output compression (up to 90% smaller).
Website • Install • Troubleshooting • Architecture • Discord
English • Francais • 中文 • 日本語 • 한국어 • Espanol • Português
rtk filters and compresses command outputs before they reach your LLM context. Single Rust binary, 100+ supported commands, <10ms overhead.
What RTK Does
RTK intercepts shell commands and compresses their output before your agent reads it.
| Operation | What RTK does to the output |
|---|---|
ls / tree |
Tree format with file counts instead of one line per entry |
cat / read |
Smart file reading: signatures and structure over full bodies |
grep / rg |
Truncates long lines, groups matches by file |
ast-grep |
Groups structural matches by file, caps overflow |
git status |
Compact stat format, grouped by state |
git diff |
Reduced context, headers stripped |
git log |
Hash, author and subject only |
git add/commit/push |
Confirmation line instead of full progress output |
cargo test / npm test |
Failures only, passing tests collapsed to a count |
ruff check |
Grouped by rule and file |
sqlfluff lint |
Grouped by rule and file |
pytest |
Failures only, traceback trimmed |
go test |
NDJSON parsed, failures only |
docker ps |
Essential fields only |
How Savings Work
RTK reduces the bash output your agent reads. That is what RTK measures, and it is not the same as cutting your bill by the same amount.
Bash output is one contributor to input tokens, alongside your prompt, the system prompt and conversation history. Input tokens are in turn only part of the bill, which also counts output tokens. The reduction dilutes at every step.
The token counts RTK reports are estimated as bytes / 4 — RTK ships no tokenizer, so the percentages are reliable but the absolute token numbers are approximate.
Full explanation: How RTK Savings Work
Installation
brew install rtk # macOS / Linux
winget install rtk-ai.rtk # Windows
curl -fsSL https://raw.githubusercontent.com/rtk-ai/rtk/refs/heads/master/install.sh | sh
Then check you have the right package — another project named "rtk" exists on crates.io:
rtk --version # any current version
rtk gain # must show the savings dashboard, not "command not found"
Cargo, pre-built binaries, native Windows, WSL, and uninstall: Installation guide
What You Install
RTK ships as three downloads. The two rtk editions install a binary with the same name — hooks, scripts and agent config work unchanged across both — so they cannot be installed together. Uninstall one before installing the other.
flowchart TD
agent["Your coding agent"]
subgraph editions["Pick one · both install a binary named rtk"]
direction LR
full["<b>rtk</b>Apache-2.0 + BUSL-1.1hooks · filters · engine"]
oss["<b>rtk-oss</b>Apache-2.0 onlyhooks · filters"]
end
Similar plugs
Bash is all you need - A nano claude code–like 「agent harness」, built from 0 to 1
Documented system prompts from Anthropic - Claude Fable 5.1, Opus 5.5, Claude Design, Claude Code. OpenAI - ChatGPT GPT-6-Astra, Codex. Google - Gemini 3.8 Flash, 3.1 Pro,…
Wrap Antigravity, ChatGPT Codex, Claude Code, Grok Build, Muse Code, Devin as an OpenAI/Gemini/Claude/Codex compatible API service, allowing you to enjoy the free Gemini…