rtk

Filters and compresses command outputs to significantly reduce LLM token consumption for developers using AI coding assistants.

A high-resolution social sharing image preview for rtk tool.

The gist

rtk is an open-source, high-performance CLI proxy built by rtk-ai that optimizes command outputs before they reach large language model (LLM) contexts. It addresses the problem of high token consumption and context window limitations in AI coding sessions by filtering and compressing verbose command-line results.

What it does

  • Filters and compresses outputs from over 100 common developer commands like ls, git status, and cargo test.
  • Transparently rewrites shell commands to their optimized rtk equivalents for various AI coding tools.
  • Applies smart filtering, grouping, truncation, and deduplication strategies to reduce token count by 60-90%.
  • Provides token savings analytics and history to track usage and value delivered.
  • Supports integration with popular AI coding assistants including Claude Code, GitHub Copilot, and Gemini CLI.
  • Offers ultra-compact output modes for even greater token efficiency.

How it works

The tool acts as a proxy, intercepting bash commands before execution and processing their output to optimize for LLM consumption. It takes raw command output as input and produces a significantly compressed version. rtk is delivered as a single Rust binary CLI tool, installable via Homebrew or direct script, and operates as an open-source project under the MIT License.

Best for

Developers leveraging AI coding assistants like Claude Code or GitHub Copilot who want to reduce LLM token costs and improve the relevance of command output in their AI's context.

Watch out for

The automatic command rewriting hook system is not fully supported on native Windows environments, requiring explicit rtk command calls. Built-in tools within some AI assistants (e.g., Claude Code's Read or Grep) may bypass the Bash hook and need explicit rtk command usage.