界面已本地化;技能介绍与说明文档按所选语言由 AI 自动翻译,代码、命令、路径和专业术语保留原文,以原作者文档为准。
探索技能
开发与工程 · SKILL.md

rtk-token-optimizer

rtk-token-optimizer

【开发与工程】RTK CLI proxy that reduces LLM token consumption by 60-90% on common dev commands. Use when running git, cargo, npm, pytest, or any CLI tool inside an AI coding session. Rewrites verbose command outputs to compact summaries before they reach the context window. Supports Antigravity (Gemini), Claude Code, Cursor, Codex, Copilot, and 10+ other agents. …

独立 GitHub 快照 · 自动分类 · 以原作者文档为准

技能说明

GitHub

name: rtk-token-optimizer description: | RTK CLI proxy that reduces LLM token consumption by 60-90% on common dev commands. Use when running git, cargo, npm, pytest, or any CLI tool inside an AI coding session. Rewrites verbose command outputs to compact summaries before they reach the context window. Supports Antigravity (Gemini), Claude Code, Cursor, Codex, Copilot, and 10+ other agents. Source: https://github.com/rtk-ai/rtk — offline-capable single Rust binary, zero deps. triggers:

  • rtk
  • token savings
  • context reduction
  • LLM token
  • git log verbose
  • cargo test output
  • npm install output
  • reduce output
  • compress tool output

RTK Token Optimizer Skill

RTK is a CLI proxy that intercepts shell commands and returns compact, LLM-optimized summaries instead of raw verbose output — saving 60-90% of token consumption.

Local Reference

sap-router-skill\bundled\tools\rtk\

What RTK Does

RTK wraps common dev commands and returns only what matters to the LLM:

CommandWithout RTKWith RTK
git log --oneline -5050 lines of SHAs + messages10-line summary
cargo test200+ lines of test outputPASSED: 47/47 or compact failure
npm install300+ lines of progressinstalled 142 packages
pytest -vFull verbose outputSummary table

Installation (Antigravity / Gemini)

RTK supports Google Antigravity via .agents/rules/antigravity-rtk-rules.md:

# Install RTK binary (Windows - via cargo)
cargo install rtk

# Or download pre-built binary
# https://github.com/rtk-ai/rtk/releases

# Initialize for Antigravity
rtk init --agent antigravity

This creates .agents/rules/antigravity-rtk-rules.md in your project, which instructs Antigravity to route shell commands through rtk.

Initialization for All Supported Agents

rtk init -g                    # Claude Code (global)
rtk init -g --gemini           # Gemini CLI (global)
rtk init -g --copilot          # GitHub Copilot (global)
rtk init -g --agent cursor     # Cursor (global)
rtk init -g --codex            # Codex (global)
rtk init --agent antigravity   # Antigravity (project-scoped)
rtk init --agent kilocode      # Kilo Code (project-scoped)
rtk init --agent cline         # Cline / Roo Code (project-scoped)

RTK Usage in Sessions

# RTK transparently intercepts these:
rtk git log --oneline -20
rtk cargo test
rtk npm install
rtk pytest tests/

# Analytics
rtk gain          # Token savings summary for current session
rtk gain --30d    # 30-day savings report

# Discovery
rtk discover      # Show which commands RTK optimizes in your project
rtk verify        # Verify hook is active for current agent

# Telemetry (opt-in only)
rtk telemetry status
rtk telemetry enable   # explicit opt-in
rtk telemetry disable

Config (~/.config/rtk/config.toml)

[hooks]
exclude_commands = ["curl", "playwright"]  # skip rewrite for these

[tee]
enabled = true          # save raw output on failure
mode = "failures"       # "failures" | "always" | "never"

Integration with SAP Router Skill

In the SAP Router context, RTK is especially useful for:

  • git log when reviewing transport histories
  • abaplint output compression (ABAP linting runs)
  • pytest for SAP skill test runner output (driver.py)
  • Healthcheck output: python scripts/healthcheck.py — RTK can compress the 35-MCP probe output

SAP Router + RTK pattern:

# Instead of:
python scripts/healthcheck.py  # → verbose 35-MCP output

# Via RTK:
rtk python scripts/healthcheck.py  # → compact summary

Token Saving Estimates

ToolAvg Savings
git log/status/diff65-85%
cargo/rust70-90%
npm/yarn/pnpm60-75%
pytest/unittest70-85%
make/gradle55-70%

Uninstall

rtk init -g --uninstall    # Remove hooks
cargo uninstall rtk

References

我的收藏