# RTK — CLI Proxy That Cuts LLM Token Usage by 60-90% > RTK is a single-binary CLI proxy written in Rust that sits between your AI coding agent and shell commands, intelligently compressing tool outputs to reduce LLM token consumption by 60-90% with zero configuration. ## Install Save as a script file and run: # RTK — CLI Proxy That Cuts LLM Token Usage by 60-90% ## Quick Use ```bash # Install RTK curl -fsSL https://rtk.sh | bash # Use RTK as a prefix for any command rtk ls -la rtk git diff rtk cat large-file.txt # Or set it as your shell proxy for AI agents export RTK_ENABLED=1 ``` ## Introduction RTK intercepts shell command output between your AI coding agent and the terminal, intelligently compressing verbose results so the LLM sees only what matters. Written in Rust as a single static binary with zero dependencies, it drops into any workflow without configuration changes. ## What RTK Does - Intercepts CLI output and compresses it before it reaches the LLM context window - Reduces token consumption by 60-90% on common dev commands like `git diff`, `find`, and `ls` - Ships as a single Rust binary with no runtime dependencies - Works transparently with Claude Code, Cursor, Codex CLI, and other AI coding agents - Preserves semantic meaning while stripping noise, whitespace, and repetitive patterns ## Architecture Overview RTK acts as a lightweight proxy layer that wraps shell commands. When the AI agent issues a command, RTK executes it, captures stdout/stderr, applies format-aware compression heuristics (different strategies for JSON, diffs, directory listings, logs), and returns the compressed output. The compression is deterministic and lossless in terms of actionable information. ## Self-Hosting & Configuration - Install with a one-line curl command or download the binary from GitHub releases - No configuration file required; works out of the box with sensible defaults - Set `RTK_ENABLED=1` to enable proxy mode for all commands - Customize compression levels via `RTK_LEVEL` environment variable (1-5) - Supports allowlist and blocklist patterns for selective command interception ## Key Features - Zero-config single binary with sub-millisecond overhead per command - Format-aware compression: understands git diffs, JSON, file trees, and log output - Reduces AI coding costs proportionally to token savings - Open source under MIT license with an active contributor community - Compatible with any AI agent that shells out to the terminal ## Comparison with Similar Tools - **Native context management** — Built into some agents but lacks cross-tool portability - **Manual prompt trimming** — Requires user intervention; RTK automates it - **Output piping with grep/sed** — Loses structure; RTK preserves semantic content - **LLM context window expansion** — Costs more tokens; RTK reduces the need ## FAQ **Q: Does RTK change the meaning of command output?** A: No. RTK strips formatting noise and repetitive patterns but preserves all actionable information the LLM needs to make decisions. **Q: Does it work with any AI coding agent?** A: Yes, it works with any tool that executes shell commands, including Claude Code, Cursor, Codex CLI, and custom agent setups. **Q: What is the performance overhead?** A: Sub-millisecond per command invocation. The Rust binary is compiled to native code with no garbage collection pauses. **Q: Is it open source?** A: Yes, RTK is fully open source under the MIT license. ## Sources - https://github.com/rtk-ai/rtk - https://rtk.sh --- Source: https://tokrepo.com/en/workflows/asset-27408fd9 Author: Script Depot