HubLensLLMrtk-ai/rtk
39

// summary

RTK is a high-performance CLI proxy that filters and compresses command outputs to significantly reduce LLM token consumption. It supports over 100 common commands and integrates seamlessly with major AI coding tools through transparent shell hooks. By removing noise and summarizing data, it helps developers maintain context while minimizing costs and latency.

// technical analysis

RTK (Rust Token Killer) is a high-performance CLI proxy designed to significantly reduce LLM token consumption by filtering and compressing command-line output. By acting as a transparent middleware between AI coding agents and the shell, it optimizes data streams from over 100 common commands, achieving 60-90% token savings with less than 10ms of overhead. The project prioritizes efficiency and seamless integration, utilizing a Rust-based binary and automated shell hooks to ensure that AI assistants receive only the most relevant information without requiring manual intervention from the user.

// key highlights

01
Reduces LLM token usage by 60-90% by filtering, grouping, and truncating verbose command outputs.
02
Supports over 100 common CLI commands across development, testing, and infrastructure tools.
03
Features a transparent auto-rewrite hook that intercepts shell commands and routes them through RTK without changing user workflows.
04
Provides built-in analytics via the 'rtk gain' command to track token savings and identify optimization opportunities.
05
Includes a 'tee' mechanism that automatically saves full, unfiltered output logs when commands fail, ensuring context is preserved for debugging.
06
Offers broad compatibility with 12 major AI coding tools, including Claude Code, Cursor, Copilot, and Windsurf.

// use cases

01
Transparently rewrite shell commands to provide compact, token-efficient output for LLMs
02
Aggregate and filter logs, test results, and file listings to reduce context window usage
03
Track and analyze token savings across various development workflows and AI agents

// getting started

To begin, install the binary via Homebrew, curl, or Cargo, then run 'rtk init -g' to set up the auto-rewrite hook for your preferred AI agent. Once initialized, restart your AI tool to allow it to automatically use RTK-optimized outputs for shell commands. You can verify the installation and view your token savings by running 'rtk gain'.