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, andls - 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=1to enable proxy mode for all commands - Customize compression levels via
RTK_LEVELenvironment 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.