← 返回
未分类 中文

RTK Integration

Integrate RTK (Rust Token Killer) to reduce LLM token consumption by 60-90% on shell commands. Use when setting up RTK for the first time, checking token sav...
集成RTK (Rust Token Killer),可将shell命令的LLM token消耗降低60-90%。用于首次设置RTK、检查token节省情况等场景。
davydenkovm
未分类 clawhub v1.1.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 749
下载
💾 0
安装
1
版本
#latest

概述

RTK Integration

RTK filters and compresses shell command outputs before they reach the LLM context window. Works with any agent/model (Claude, MiniMax, GPT, Gemini, OpenClaw, etc.) — model-agnostic.

Setup

1. Install RTK (auto — run on skill install)

When this skill is installed, immediately run the setup script to install RTK if not already present:

bash skills/rtk-integration/scripts/rtk-setup.sh

The script handles installation automatically (Linux/macOS), adds RTK to PATH, and verifies the install.

Manual install if needed:

# Linux/macOS
curl -fsSL https://raw.githubusercontent.com/rtk-ai/rtk/refs/heads/master/install.sh | sh
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc && source ~/.bashrc

# macOS Homebrew
brew install rtk

# Verify
rtk --version && rtk gain

2. Initialize hooks (optional, for Claude Code / OpenCode auto-rewriting)

rtk init --global          # Claude Code hook
rtk init --global --opencode  # OpenCode hook

> ⚠️ For OpenClaw agents: hooks don't auto-apply. Use rtk explicitly (see below).

3. Check token savings

rtk gain

For config customization, see references/config.md.


Core Rule: Always Use RTK Prefixes

When executing shell commands, always prefer the RTK version over the raw command. RTK adds <10ms overhead and reduces output by 60–90%.

See the full command reference: references/commands.md

Quick reference (most common)

# Files
rtk ls .
rtk read <file>
rtk grep "<pattern>" .
rtk find "*.ts" .
rtk diff file1 file2

# Git (most impactful — use on EVERY git operation)
rtk git status
rtk git diff
rtk git log -n 10
rtk git add .          # outputs just "ok"
rtk git commit -m "msg"  # outputs "ok <hash>"
rtk git push           # outputs "ok main"
rtk git pull

# Tests — show failures only (-90%)
rtk test npm test
rtk test npx jest
rtk vitest run
rtk playwright test
rtk pytest
rtk go test
rtk cargo test

# Build & lint
rtk tsc
rtk next build
rtk lint
rtk lint biome
rtk cargo build
rtk cargo clippy
rtk ruff check .

# Docker
rtk docker ps
rtk docker logs <container>

# Package managers
rtk pnpm install
rtk npm install
rtk yarn install

When NOT to use RTK

  • Interactive commands (ssh, vim, htop) — use directly
  • Already-compressed output (jq-piped JSON, single-line results)
  • When you need the full raw output for debugging

rtk gain — Token Savings Report

Run rtk gain whenever user asks about token savings. Output example:

📊 RTK Token Savings
════════════════════════════════
Total commands:    1,247
Input tokens:      4.8M
Output tokens:     0.6M
Tokens saved:      4.2M (87.5%)

By Command:
rtk git status    215    1.4M    80.8%
rtk grep          227    786K    49.5%
rtk find          324    6.8M    78.3%

版本历史

共 1 个版本

  • v1.1.0 当前
    2026-05-01 19:59 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

developer-tools

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 668 📥 324,210
security-compliance

Skill Vetter

spclaudehome
AI智能体技能安全预审工具。安装ClawdHub、GitHub等来源技能前,检查风险信号、权限范围及可疑模式。
★ 1,215 📥 266,573
ai-intelligence

ontology

oswalpalash
类型化知识图谱,用于结构化智能体记忆与可组合技能。支持创建/查询实体(人员、项目、任务、事件、文档)及关联...
★ 712 📥 243,881