RTK
你的 AI 代理正淹没在噪音中。
RTK 帮它清理。
干净的上下文。
更强的代理。
示意图:密集的 token 网格占满 AI 上下文窗口的 86%,接近自动压缩。它流经 RTK 过滤器,滤除 CLI 输出噪音并保留有意义的内容:同一窗口回落到 73% 占用,留出思考空间。
这些公司的开发者已 star
另有 1,100 家公司
01 / 问题所在
代理读到的一切,都由你买单
每一轮,代理都会把完整上下文重新发给模型:系统提示、工具、记忆、对话,以及它读过的每条日志、每个文件和每个网页。这些你每次都要付费。
示意图:一次编码会话中进入上下文窗口的 token,逐层显示:工具列表与系统提示、对话、终端输出、读取的文件、网页与 MCP 结果。使用 RTK 后,对话和工具返回的所有内容都会缩小;工具列表与系统提示保持不变。总量从 323k 降至 200k token,减少 38%。
示意示例。
02 / 核心
The compressor with 4M+ downloads
它重写你的 shell 命令,并在代理读取之前清除输出中的噪音。
为开发者而生
日常使用中的实时 rtk gain:41,502 条命令,节省 470 万 token。
03 / RTK Engine
完整的成本削减引擎
56% less command output on average, up to 90% on the noisiest. And with RTK Engine: route, build, plug in, share — in any agent.
阅读 RTK Engine 发布公告压缩与过滤核心
1200 行的 lockfile 变成一份简短的包名列表。
路由
4000 行的文件由小模型总结;代理得到的是答案,不是文件。
构建
“diff 保持原样,其余全部压缩。”
接入
有人为自己的技术栈写了一个方法,任何 pipeline 都能使用。
分享
团队负责人分享 pipeline,其他人放进去就能用。
任何代理
同一个文件,一个人在 Claude Code 里用,另一个人在 Cursor 里用。
04 / 按你的方式来
一个文件,任何代理。
一条规则说明 RTK 在哪里起作用、何时、做什么。从内置 pipeline 开始,改一行,或自己写一个,然后作为一个文件分享。
RTK 自己的 pipeline 也用同样的格式编写,没有人从空白页开始。rtk pipeline show rtk:default 会打印今天实际运行的内容。
一个 pipeline 文件:它扩展内置的 rtk:posthook 与 rtk:proxy pipeline,并添加一条规则——在哪:代理读取文件之前;何时:文件超过 350 行;做什么:把读取路由到更便宜的模型。
运行于 Claude CodeCursorCodexGemini CLI +14
Acts in the agent — hooks on the API traffic — RTK Proxy, optional
05 / 实测证据
展示你的收益,分享你的 pipeline
运行 rtk gain 查看 RTK 为你节省了多少,再用一条命令分享背后的 pipeline。
示意图:rtk gain 显示 RTK 为你节省了多少,这里是 470 万 token、命令输出减少 44%。rtk pipeline share 把背后的 pipeline 变成一个私有或公开的链接,可在 Claude Code、Cursor、Codex 等 18 个代理中运行。
社区 pipeline
RTK 用户分享的 pipeline,在 GitHub 上带有 rtk-pipeline 标签。一条命令即可安装,也可以发布你自己的。
rtk pipeline add github:user/repo- 安装一个 pipeline。RTK 会先展示其规则,并在安装前征求确认。
rtk pipeline share publish- 将你的 pipeline 发布到 GitHub,附带它测得的节省量。
安装前请先审查。pipeline 可以改写代理运行的命令,并把内容发送给它声明的模型。RTK 不审核共享的 pipeline,其节省数据由作者自行报告。
浏览社区 pipeline#show-your-gains 频道查看其他开发者的节省数据 兼容你的 AI 编程工具链
- Claude Code
- Cursor
- GitHub Copilot
- Codex
- Gemini CLI
- Windsurf
- Cline
- OpenCode
Fewer tokens. Lower bill. Same answers.
06 / 开始使用
30 秒即可运行
安装、激活钩子,之后每条命令都会被自动压缩。
从 0.x 升级?在你添加一行之前,一切保持不变。
快速安装
适用于 Linux 与 macOS 的一行命令。
$ curl -fsSL https://raw.githubusercontent.com/rtk-ai/rtk/refs/heads/master/install.sh | sh Homebrew
macOS 与 Linux。
$ brew install rtk-ai/tap/rtk $ brew upgrade rtk-ai/tap/rtk 然后激活自动重写钩子
$ rtk init --global --agent <name> 安装全局 shell 钩子()适用于 Aider、Gemini CLI、Codex、Windsurf 以及任何终端 AI 工具。
完整安装指南 →常见问题
高频提问
What is RTK (Rust Token Killer)?
RTK is a cost reduction engine for AI coding agents. It cleans what your agent reads at every tool call — shell output, file reads, search results, web pages, MCP calls — cutting up to 90% of command output noise, and it can hand heavy work to cheaper models. The battle-tested Bash compressor developers starred is the core of the engine. RTK is free to use, written in Rust, with the CLI open source under Apache 2.0, and works with Claude Code, Cursor, and 18 AI coding agents.
What is RTK Engine?
RTK Engine turns the battle-tested compressor into a full cost reduction engine. RTK can now compress every tool's output, not just shell commands, route heavy work to cheaper models, and let you build your own pipeline, plug in new methods, and share your setup as one file that works in any supported agent. Upgrading changes nothing: RTK works exactly as before until you add a line.
What is a pipeline?
One file of rules. Each rule reads like a sentence: where RTK acts, when, and what it does — for example, when the agent reads a file longer than 350 lines, send it to a cheaper model. RTK's own behaviour is written in the same format, so you never start from a blank page: pick a built-in pipeline, change one line, or write your own.
Can I share a pipeline with my team?
Yes. A pipeline is one file: share it, drop it in, and it works in any supported agent. The same file can be used in Claude Code by one person and Cursor by another.
Do I need to change anything when I upgrade to RTK Engine?
No. Install, run rtk init, and RTK works exactly as before. Nothing changes until you add a line to a pipeline. The compressor you already rely on is the core of the engine, not a feature that moved.
How many tokens does RTK actually save?
On the commands RTK rewrites, output drops by 56% on average, and by up to 90% on the noisiest ones. Across the community that adds up to billions of tokens saved. The exact figure depends on the command, so the benchmarks page publishes the methodology and the per-command results, and the blog covers what independent studies measured, including the cases where RTK did not come out ahead. For your own numbers, run rtk gain after a few days of use.
Is RTK free? Are there usage limits?
RTK is completely free. It is open source under the Apache 2.0 license, with source code available on GitHub at github.com/rtk-ai/rtk. There are no usage limits, no API keys required and no accounts. Routing to a cheaper model is optional and uses a model key you provide. Telemetry is opt-in: it is off until you explicitly enable it, and it collects no personal data. For teams, RTK Pro is available at pro.rtk-ai.app.
Which AI coding tools and commands does RTK support?
RTK works with 18 AI coding agents, including Claude Code (Anthropic), Cursor, GitHub Copilot, Codex, Gemini CLI, Windsurf, Cline and Aider — and the engine acts on every tool an agent uses: shell commands, file reads, search, web fetches and MCP calls. On the shell side it covers 125+ commands: cargo test, pytest, go test, git diff, git status, git log, grep, find, ls, pnpm list, tsc, eslint, prisma, docker, kubectl, and more.
How does RTK work without changing my workflow?
Running rtk init --global installs hooks inside your agent that act around each tool call: shell commands are automatically rewritten to rtk equivalents, and output is compressed before it enters the context window. If you turn it on, the RTK Proxy also acts on the API traffic, trimming what the agent sends to the model. You continue using your normal commands, with no manual changes to prompts or workflows needed.
Does RTK affect code quality or AI reasoning accuracy?
No. RTK removes verbose boilerplate and repetitive output noise, not meaningful content. Test failures, error messages, diffs, and stack traces are preserved in full. The AI receives the same essential information with far less noise around it, which leaves more of the context window for reasoning.
RTK Pro
为你的团队打造的 AI 控制层
RTK 运行在每位开发者的机器上。RTK Pro 把这些机器连成统一的控制层,用成本分析、安全护栏与治理让整个团队一次就位。
-
可观测性
覆盖整个团队的详细分析:按项目和开发者查看用量与成本。看清真正的开销,并定义真实的 token 效率指标。
-
安全
每一位接入的开发者都在护栏之后工作:阻止密钥泄露,拦截危险操作,对敏感数据做匿名化。
-
治理
细粒度 RBAC、ACL 与项目管理。新成员只需连接一次即可全部就位:压缩、护栏、可观测性、skills、MCP。
CLI 始终保持免费与开源。