What it does
LLM coding assistants pour verbose CLI output (git log, pytest, npm test, directory trees) straight into the context window and burn tokens on noise — boilerplate, repetition, irrelevant progress. RTK intercepts those outputs before they reach the model and compresses them by 60–90%, so the same context window holds a longer session at lower cost.
Features
- 100+ supported commands — git, cargo, npm, pytest, docker, AWS CLI, kubectl, with domain-specific compression per tool
- Smart filtering — strips noise and boilerplate
- Grouping — aggregates similar items
- Truncation — preserves relevant context
- Deduplication — collapses repeated lines
- Auto-rewrite hook — transparently rewrites commands to RTK equivalents
rtk gain/rtk discover— analyze token savings and command coverage- Tee recovery — full output is saved on failure so the LLM can re-read it
Supported AI tools
Claude Code (PreToolUse hook), GitHub Copilot (VS Code/CLI), Cursor, Gemini CLI, Codex, Windsurf, Cline / Roo Code, OpenCode, Kilo Code, Google Antigravity.
Before / After
Before: git log, pytest, npm test output flows into the LLM context unfiltered — the window fills fast, sessions stay short, costs add up.
After: One rtk init -g registers the hook in Claude Code — output reaches the model already compressed by 60–90%, sessions run longer, costs drop.
When to use it
- Long debugging sessions where repeated test runs flood the context window.
- Large monorepos where verbose commands (
git log,git status, directory trees) hit the LLM frequently. - Anyone trying to stretch a 5-hour limit, an API budget, or a fixed context window further.