RTK使用体验

0 阅读1分钟

RTK是一个减少命令输出的工具,实际作用在于,使用LLM时,会通过各种命令获取信息,比如git、find、grep等等,RTK的核心就是压缩和过滤这些命令的输出。

安装

Homebrew(推荐)

shell brew install rtk 

快速安装(Linux/macOS)

shell curl -fsSL https://raw.githubusercontent.com/rtk-ai/rtk/refs/heads/master/install.sh | sh 

验证

plain rtk --version # 应显示 "rtk 0.27.x" 
rtk gain # 应显示 token 节省统计 

快速开始

    # 1. 为 Claude Code 安装 hook(推荐) 
    rtk init --global
    # 2. 重启 Claude Code,然后测试 
    git status # 自动重写为 rtk git status 

工作原理

没有 rtk:                                  使用 rtk:

 Claude --git status--> shell --> git Claude  --git status-->  RTK  -->  git
   ^                               |     ^                      |          |
   |      ~2,000 tokens(原始)     |     |   ~200 tokens        |  过滤     |
   +------------------------------+      +------- (已过滤)-----+----------+

使用效果

前后对比

正常的git命令

image.png 使用了rtk的git命令

image.png 能显著看到输出量的减少

统计看板

image.png

能直观看出他的token节省量

缺点

image.png 对codex的支持不友好,但社区已经在解决中了 相关issue: github.com/rtk-ai/rtk/…

reference:github.com/rtk-ai/rtk/…