# rtk

> Single Rust binary that filters and compresses shell command output (git, tests, linters, etc.) before AI coding agents read it, with under 10ms overhead.

Stars: 84.9k · Language: Rust · License: Apache-2.0 · Categories: AI

- Repository: https://github.com/rtk-ai/rtk
- Website: https://www.rtk-ai.app
- Page: https://www.trmn.sh/tools/rtk

## Install

- Homebrew: `brew install rtk`
- winget: `winget install rtk-ai.rtk`
- Cargo: `cargo install --git https://github.com/rtk-ai/rtk`

## Overview

rtk (Rust Token Killer) is a CLI proxy that sits between an AI coding agent and the shell. It intercepts commands such as `git status`, `cargo test` or `docker ps` and compresses their output before it enters the LLM context. It ships as a single Rust binary, supports 100+ commands, and reports under 10ms overhead. The README claims up to 90% reduction in bash output, and notes that this is a reduction in bash output only, not in the total bill. Token counts are estimated as bytes / 4, so percentages are reliable while absolute numbers are approximate.

Compression uses four strategies applied per command type: smart filtering (removing comments, whitespace, boilerplate), grouping (files by directory, errors by type), truncation, and deduplication of repeated log lines with counts. Examples: `git log` keeps hash, author and subject; `git push` becomes a confirmation line; `pytest`, `cargo test`, `go test` and `jest` show failures only; `ruff check`, `eslint` and `sqlfluff lint` group results by rule and file; `ls` and `tree` produce a tree with file counts. Commands can also be called directly, for example `rtk read file.rs -l aggressive`, `rtk grep`, `rtk gh pr list`, `rtk tsc`, and `rtk gain` for a savings dashboard.

Setup is done with `rtk init`, which installs a hook for a specific agent: Claude Code / Copilot, Gemini CLI, Codex, Cursor, Windsurf, Cline / Roo Code, Kilo Code, Antigravity, Kimi, Pi, Hermes, Factory Droid, Trae and others. After restart, the agent's Bash calls are rewritten automatically (`git status` becomes `rtk git status`). The hook only applies to Bash tool calls, so built-in tools such as Claude Code's Read, Grep and Glob are not rewritten. It targets developers who run agentic coding tools and want smaller command output in context. It runs on macOS, Linux and Windows.

### Installation

```bash
# via Homebrew
brew install rtk
```

```bash
# via winget
winget install rtk-ai.rtk
```

```bash
# via Cargo
cargo install --git https://github.com/rtk-ai/rtk
```

## Alternatives

- [Goose](https://www.trmn.sh/tools/goose.md): Open source AI agent for desktop, CLI, and API with 15+ provider integrations and Model Context Protocol extensions (Rust, 55.9k stars)
- [herdr](https://www.trmn.sh/tools/herdr.md): Terminal multiplexer written in Rust that runs coding agents in persistent panes, tracks working/blocked/idle state, and manages local and SSH machines. (Rust, 46.3k stars)
- [Codewhale](https://www.trmn.sh/tools/codewhale.md): Rust terminal coding agent that reads a repo, edits files, runs commands and checks results using hosted or local models (Ollama, vLLM, SGLang). (Rust, 41.1k stars)
- [AIChat](https://www.trmn.sh/tools/aichat.md): LLM CLI with a shell assistant, chat REPL, RAG, function calling and agents, supporting 20+ providers including OpenAI, Claude, Gemini and Ollama. (Rust, 10.5k stars)
- [code2prompt](https://www.trmn.sh/tools/code2prompt.md): CLI and TUI that converts a codebase into a single LLM prompt with a source tree, Handlebars templates, git context, and token estimates. (Rust, 7.7k stars)

---

Canonical: https://www.trmn.sh/tools/rtk
