CLI proxy that reduces LLM token consumption by 60-90% on common dev commands. Single Rust binary, zero dependencies
★ 86,046⑂ 5,514👁 216⑃ 2,927● 1,977▤ 475◈ 82
86,046
stars
+76+723
5,514
forks
216
watchers
2,927
prs
1,977
issues
475
releases
82
discussions
README
高性能 CLI 代理,为你的智能体削减多达 90% 的 bash 输出
官网 •
安装 •
故障排除 •
架构 •
Discord
English •
Francais •
中文 •
日本語 •
한국어 •
Espanol
---
rtk 在命令输出到达 LLM 上下文之前进行过滤和压缩。单一 Rust 二进制文件,零依赖, 完整说明:RTK 的节省是如何计算的
安装
Homebrew(推荐)
bash
brew install rtk
winget(Windows)
Windows 上最简单的安装方式 — 一条命令,无需配置 PATH:
powershell
winget install rtk-ai.rtk
快速安装(Linux/macOS)
bash
curl -fsSL https://raw.githubusercontent.com/rtk-ai/rtk/refs/heads/master/install.sh | sh
Cargo
bash
cargo install --git https://github.com/rtk-ai/rtk rtk
Apache-2.0 版本(仅开源,允许商业使用)
同一个 rtk 二进制文件,构建时不包含 BUSL-1.1 压缩引擎:钩子重写系统和所有命令过滤器,仅遵循 Apache-2.0。
bash
curl -fsSL https://raw.githubusercontent.com/rtk-ai/rtk/refs/heads/master/install.sh | RTK_EDITION=oss sh
brew install rtk-ai/tap/rtk-oss
cargo install --git https://github.com/rtk-ai/rtk rtk --no-default-features
验证
bash
rtk --version 应显示 "rtk 0.27.x"
rtk gain 应显示 token 节省统计
快速开始
bash
1. 为对应的 AI 工具安装 hook
rtk init --global Claude Code(默认)
rtk init --agent trae Trae(项目级)
rtk init --global --agent trae Trae(全局)
2. 重启相应的 AI 工具,然后测试
git status 自动重写为 rtk git status
工作原理
没有 rtk: 使用 rtk:
Claude --git status-- shell -- git Claude --git status-- RTK -- git
^ | ^ | |
| ~2,000 tokens(原始) | | ~200 tokens | 过滤 |
+-----------------------------------+ +------- (已过滤)-----+----------+
四种策略:
1. 智能过滤 - 去除噪音(注释、空白、样板代码)
2. 分组 - 聚合相似项(按目录分文件,按类型分错误)
3. 截断 - 保留相关上下文,删除冗余
4. 去重 - 合并重复日志行并计数
命令
下列百分比是 bash 输出字节数的削减比例,由 RTK 的 字节数 / 4 估算器测得。参见节省是如何计算的。
文件
bash
rtk ls . 优化的目录树
rtk read file.rs 智能文件读取
rtk find ".rs" . 紧凑的查找结果
rtk grep "pattern" . 按文件分组的搜索结果
Git
bash
rtk git status 紧凑状态
rtk git log -n 10 单行提交
rtk git diff 精简 diff
rtk git push - "ok main"
测试
bash
rtk jest Jest 紧凑输出
rtk vitest Vitest 紧凑输出
rtk pytest Python 测试(-90%)
rtk go test Go 测试(-90%)
rtk test [args...] 仅显示失败(-90%),直接执行 argv
构建 & 检查
bash
rtk lint ESLint 按规则分组
rtk tsc TypeScript 错误分组
rtk cargo build Cargo 构建(-80%)
rtk ruff check Python lint(-80%)
容器
bash
rtk docker ps 紧凑容器列表
rtk docker logs 去重日志
rtk kubectl pods 紧凑 Pod 列表
分析
bash
rtk gain 节省统计
rtk gain --graph ASCII 图表(30 天)
rtk discover 发现遗漏的节省机会
文档
- TROUBLESHOOTING.md - 解决常见问题
- INSTALL.md - 详细安装指南
- ARCHITECTURE.md - 技术架构
贡献
欢迎贡献!请在 GitHub 上提交 issue 或 PR。
加入 Discord 社区。
Top issues
#845Feature: add support for kiro-cli29 comments · 2026-03-26#1313Feature request: lossless-only mode + honest account of silent failures truncation causes in agent contexts18 comments · 2026-04-14#2317Tool filters mask hard failures with benign summaries (pytest collection error -> "No tests collected")13 comments · 2026-06-07#996[Codex MacOS App] : RTK.md is not opened automatically10 comments · 2026-04-03#2898Feature Request: Add support for ZCode (Z.ai Agentic Development Environment)9 comments · 2026-07-08#2436[grep] header reports raw match counts even when --max caps output9 comments · 2026-06-14#1098Support for Flutter & Dart commands (flutter pub, flutter analyze, dart analyze)9 comments · 2026-04-09#3410The rewrite rule for `find` is unconditional, so `find … -delete` / `-exec` is captured and refused — the command silently does nothing and breaks `&&` chains8 comments · 2026-08-04
Discussions
#5027PHP version, return just the semver version1 comments · 2026-11-06#4972rtk-mcp: a Rust MCP server that runs commands through RTK0 comments · 2026-11-03#4946Would an opt-in Texio recipe complement RTK on named Markdown tasks?0 comments · 2026-11-02#4633Grep and RG optimizations.0 comments · 2026-10-17#4598How we verify RTK's output stays transparent, on every release0 comments · 2026-10-16#4592rtk is included in the AgentManager tool catalog0 comments · 2026-10-16#4511Request: review of RTK setup for a public benchmark1 comments · 2026-10-11#4379Comparing notes: compact tool output, structural navigation, and end-to-end agent speed0 comments · 2026-10-01
Latest release
v1.2.0 v1.2.0 2026-11-081.2.0 (2026-11-08) Features git: fold ls-tree path listings by directory (1816) Bug Fixes analytics: sum per-project ccusage rows in monthly economics (4771) cargo: keep nextest timeouts and retried failures (4697) cicd: build the deb, rpm and aarch64 Linux binaries as static musl (5017) dotnet: preserve discovery and classic TRX reports (4628) gain: distinguish filtered timings from passthrough lifetimes (4677) git: announce the cap on the filtered git log path (4152) hermes: close the rewrite's stdin and make its timeout configurable (3833) hook: honour opt-outs inside a quo
相关报道 (5)
News & coverage (17)
Hacker NewsRtk – reduce Claude Code token usage▲ 18 · 3 comments · 2026-02-28Hacker NewsCLI proxy that reduces LLM token consumption by 60-90% on common dev commands▲ 5 · 2 comments · 2026-04-10Hacker NewsRtk – High-performance CLI proxy to minimize LLM token consumption▲ 4 · 0 comments · 2026-02-18Hacker NewsShow HN: RTK – Wrap your CLI commands, save 60-90% of tokens in AI coding agents▲ 4 · 4 comments · 2026-02-11Hacker NewsRtk – CLI proxy that reduces LLM token consumption by 60-90%▲ 3 · 0 comments · 2026-03-17Hacker NewsRust Token Killer – High-performance CLI proxy to minimize LLM token consumption▲ 3 · 1 comments · 2026-02-19Hacker NewsRTK: Rust Token Killer▲ 2 · 2 comments · 2026-05-19labs.sogetiTHE HIDDEN COST OF AI CODING: HOW RTK HELPS DEVELOPERS REDUCE THE “TOKEN TAX” – PART 12026-07-15notertk: A CLI Proxy That Drastically Reduces Token Consumption for Claude Code2026-05-13korbenRTK - The Rust proxy that saves you up to 90% of tokens2026-05-04