rtk: CLI proxy that reduces LLM token consumption by 60-90% on common dev commands
rtktoken-optimizationcli-toolrustclaude-codedeveloper-tooling
Abstraction: Rust CLI proxy compressing dev-command output for LLMs
Key points:
- rtk (by Patrick Szymkowiak et al.) filters and compresses command outputs before they reach LLM context; single Rust binary, zero deps, 100+ commands, <10ms overhead, Apache 2.0.
- Claimed 60-90% token savings: e.g.
git push200→10 tokens,pytest/cargo test-90%,git add/commit/push-92%; example workload ~118,000→~23,900 tokens (-80%). - Four strategies: smart filtering (remove noise), grouping (aggregate similar items), truncation, deduplication (collapse repeated lines with counts).
- Installs a PreToolUse hook (native binary since v0.37.2, no shell/jq) that transparently rewrites Bash commands (
git status→rtk git status) for 100% adoption; only affects Bash tool calls, not Read/Grep/Glob. - Supports 14 AI coding tools: Claude Code, Copilot, Cursor, Gemini CLI, Codex, Windsurf, Cline, OpenCode, etc.
- Telemetry off by default (opt-in, GDPR); tee saves full unfiltered output on command failure. Version referenced: 0.28.2.
Connections: Rtk · Claude Code · Github · Token Optimization · Agentic Coding · Context Engineering
Source: https://github.com/rtk-ai/rtk