rtk-ai / rtk
CLI proxy that reduces LLM token consumption by 60-90% on common dev commands. Single Rust binary, zero dependencies
AI Architecture Analysis
This repository is indexed by RepoMind. By analyzing rtk-ai/rtk in our AI interface, you can instantly generate complete architecture diagrams, visualize control flows, and perform automated security audits across the entire codebase.
Our Agentic Context Augmented Generation (Agentic CAG) engine loads full source files into context on-demand, avoiding the fragmentation of traditional RAG systems. Ask questions about the architecture, dependencies, or specific features to see it in action.
Repository Overview (README excerpt)
Crawler viewHigh-performance CLI proxy that reduces LLM token consumption by 60-90% Website • Install • Troubleshooting • Architecture • Discord English • Francais • 中文 • 日本語 • 한국어 • Espanol --- rtk filters and compresses command outputs before they reach your LLM context. Single Rust binary, zero dependencies, Estimates based on medium-sized TypeScript/Rust projects. Actual savings vary by project size. Installation Homebrew (recommended) Quick Install (Linux/macOS) > Installs to . Add to PATH if needed: > Cargo Pre-built Binaries Download from releases: • macOS: / • Linux: / • Windows: Verify Installation > **Name collision warning**: Another project named "rtk" (Rust Type Kit) exists on crates.io. If fails, you have the wrong package. Use above instead. Quick Start The hook transparently rewrites Bash commands (e.g., -> ) before execution. Claude never sees the rewrite, it just gets compressed output. **Important:** the hook only runs on Bash tool calls. Claude Code built-in tools like , , and do not pass through the Bash hook, so they are not auto-rewritten. To get RTK's compact output for those workflows, use shell commands ( / / , / , ) or call , , or directly. How It Works Four strategies applied per command type: • **Smart Filtering** - Removes noise (comments, whitespace, boilerplate) • **Grouping** - Aggregates similar items (files by directory, errors by type) • **Truncation** - Keeps relevant context, cuts redundancy • **Deduplication** - Collapses repeated log lines with counts Commands Files Git GitHub CLI Test Runners Build & Lint Package Managers Containers Data & Analytics Token Savings Analytics Global Flags Examples **Directory listing:** **Git operations:** **Test output:** Auto-Rewrite Hook The most effective way to use rtk. The hook transparently intercepts Bash commands and rewrites them to rtk equivalents before execution. **Result**: 100% rtk adoption across all conversations and subagents, zero token overhead. **Scope note:** this only applies to Bash tool calls. Claude Code built-in tools such as , , and bypass the hook, so use shell commands or explicit commands when you want RTK filtering there. Setup After install, **restart Claude Code**. OpenCode Plugin (Global) OpenCode supports plugins that can intercept tool execution. RTK provides a global plugin that mirrors the Claude auto-rewrite behavior by rewriting Bash tool commands to before they execute. This plugin is **not** installed by default. > **Note**: This plugin uses OpenCode's hook. Known limitation: plugin hooks do not intercept subagent tool calls (upstream issue). See OpenCode plugin docs for API details. **Install OpenCode plugin:** **What it creates:** • **Restart Required**: Restart OpenCode, then test with in a session. **Manual install (fallback):** Commands Rewritten | Raw Command | Rewritten To | |-------------|-------------| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commands already using , heredocs ( ), and unrecognized commands pass through unchanged. Configuration Config File (macOS: ): Tee: Full Output Recovery When a command fails, RTK saves the full unfiltered output so the LLM can read it without re-executing: Uninstall Documentation • **TROUBLESHOOTING.md** - Fix common issues • **INSTALL.md** - Detailed installation guide • **ARCHITECTURE.md** - Technical architecture • **SECURITY.md** - Security policy and PR review process • **AUDIT_GUIDE.md** - Token savings analytics guide Contributing Contributions welcome! Please open an issue or PR on GitHub. Join the community on Discord. License MIT License - see LICENSE for details.