OpenSource-Hub
R

rtk

SHA-256
51.2k stars·Developer Tools·SHA-256 checksum verified

CLI proxy that reduces LLM token consumption by 60-90% on common dev commands. Single Rust binary, zero dependencies.

Smart Download

Download Download Version

v0.40.0 · 3.9 MB

CLI proxy that cuts LLM token consumption by 60-90% on dev commands. Auto-installs into AI tools, zero config.

Core Features

  • Smart filtering: removes 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
  • Automatic hook integration into Claude Code, Copilot, Gemini CLI, Cursor, Windsurf and more

What It Can't Do

  • rtk only intercepts commands executed through the shell. Built-in AI tool tools like Read, Grep, and Glob bypass the hook; use rtk read, rtk grep, or rtk find manually. There is a name collision on crates.io with 'Rust Type Kit'; if `rtk gain` fails, you have the wrong package. Windows users should use WSL for full hook system support.

Use Cases

  • Dramatically reduce token consumption and cost when using AI coding assistants
  • Optimize test and build logs in CI/CD pipelines to reduce noise for LLM processing

Detailed Introduction

rtk is a high-performance CLI proxy that sits between your AI development tools (Claude Code, Copilot, Gemini CLI, etc.) and shell commands. It filters and compresses command outputs before they reach your LLM context, cutting token usage by 60-90% on average. Built in Rust as a single binary with zero dependencies, rtk supports over 100 commands including git, test runners, linters, package managers, Docker, kubectl, and AWS CLI. It uses four strategies: smart filtering, grouping, truncation, and deduplication. With under 10ms overhead, it's transparent to your workflow. Unlike traditional token reduction methods that require manual prompt engineering or complex pipelines, rtk works automatically via shell hooks or direct command wrappers. Compared to alternatives like LLM context compression tools or ad-hoc grep/sed scripts, rtk is purpose-built for developer command-line workflows, requiring no configuration and delivering consistent savings across projects.

Tags

CLI proxytoken optimizationLLM cost reductionRustdeveloper toolsAI assistant enhancement

Getting Started

1

Download installer

Click the button above to download the installer for your system

2

Install the software

Install the appropriate package for your distro (dpkg / rpm / AppImage)

3

Install via Homebrew: brew install rtk

4

Or run quick install script: curl -fsSL https://raw.githubusercontent.com/rtk-ai/rtk/refs/heads/master/install.sh | sh

5

Verify installation: rtk --version should show a version number

Install Guide
  1. Install via Homebrew: brew install rtk
  2. Or run quick install script: curl -fsSL https://raw.githubusercontent.com/rtk-ai/rtk/refs/heads/master/install.sh | sh
  3. Verify installation: rtk --version should show a version number

Latest Release Notes

## [0.40.0](https://github.com/rtk-ai/rtk/compare/v0.39.0...v0.40.0) (2026-05-13)

### Features

* **gradlew:** Gradle support for Android/Kotlin developers ([833026b](https://github.com/rtk-ai/rtk/commit/833026b893822be4e1c64d22d640e979cd9eff51))

* **hermes:** add Hermes Agent support via rtk init --agent hermes ([55f998d](https://github.com/rtk-ai/rtk/commit/55f998d08cd80ece970fe5e61eaae3533512288b))

* **hooks:** add transparent_prefixes config for wrapper commands ([998f1ee](https://github.com/rtk-ai/rtk/commit/998f1ee0a3cf8d73ea0d6d87c121117f351e4992))

* **init:** add --dry-run flag to preview changes without writing ([172ec54](https://github.com/rtk-ai/rtk/commit/172ec54580ddb0d737ef3e3be8a075eaeeb0a01b))

### Bug Fixes

* **cicd:** pr-target clean msg + git app token ([e4c3ed7](https://github.com/rtk-ai/rtk/commit/e4c3ed7d889ede726df7986ade94a4714c7c7f99))

* **cicd:** set release-please target-branch to master [skip ci] ([0c6a838](https://github.com/rtk-ai/rtk/commit/0c6a838594e87346b67bd13c092b8a46a783af87))

* correct ARCHITECTURE.md path in README links ([2a41e03](https://github.com/rtk-ai/rtk/commit/2a41e039903049543aa6c69482747eddcce9ee5a))

* don't inject -json for go test -bench runs ([380a7c9](https://github.com/rtk-ai/rtk/commit/380a7c9f1189fafe7d0b878b3821a720ac6ab4b2))

* **dotnet:** format build/test/restore output sections ([106305b](https://github.com/rtk-ai/rtk/commit/106305b1978ad5fdd47139d3543cfa53a5e8172e))

* **dotnet:** format warnings section in build/test/restore outputs ([c5245d7](https://github.com/rtk-ai/rtk/commit/c5245d74fafc066072615d804c27d5c2892db7d9))

* **dotnet:** move build/test/restore status line to the bottom ([ed161b0](https://github.com/rtk-ai/rtk/commit/ed161b0a33a2a784bb933792501aa2747b0df3c3)), closes [#1574](https://github.com/rtk-ai/rtk/issues/1574)

* **gradlew:** use resolved_command for system gradle fallback ([9e3a5ae](https://github.com/rtk-ai/rtk/commit/9e3a5ae68d4adc3d7fc374f36235cb5164e6efc8))

* **hooks:** address transparent prefix review ([fdf0ed0](https://github.com/rtk-ai/rtk/commit/fdf0ed0b597f1ebdc96a2793df2725a1e62bc65c))

* **hooks:** compose env and transparent prefixes ([b234bc6](https://github.com/rtk-ai/rtk/commit/b234bc6db1ab301334412409a4cfd67fe99c58f0))

* **hooks:** make Cursor preToolUse rewrites work and stay visible ([f00977a](https://github.com/rtk-ai/rtk/commit/f00977aa338ce6bafe8df69c271679951310b045))

* minor code cleanup, avoid duplicating logic ([20cac8a](https://github.com/rtk-ai/rtk/commit/20cac8a4e7c2b7e0e2675dbcab4fbd0fb1ad79ed))

* new rewite_command test call after rebase ([5cfb8e1](https://github.com/rtk-ai/rtk/commit/5cfb8e1d2bdf85d60633868cb420aba9a7b923f4))

File Integrity

SHA-256 checksum verified

Checksum extracted from GitHub official Release page

SHA256 Checksum

a75d210a445874106bc16da2b4efba01d36d297afa33ec134728f2d5f42ef5af

This checksum is extracted from the GitHub Release page. Verify file integrity after download.

All SHA-256 checksums on this platform are extracted from the project's official GitHub Release page, without any modification. You can independently verify them on the GitHub Releases page.

Open Source Transparency

View GitHub Source
Environment Guide

Uninstall Info

If installed via Homebrew, run brew uninstall rtk. If via the install script, delete ~/.local/bin/rtk and remove any PATH additions. For Cargo installs, run cargo uninstall rtk. Also remove any rtk initialization lines from AI tool shell config files (e.g., .bashrc or .zshrc).

No Extra Dependencies

Ready to use after download. No additional runtime required.

Project Info
LicenseApache-2.0
Last Updated2026-05-20T06:29:34Z
GitHub RepositoryOfficial Website

Similar Projects