
Rtk
- 389 installs
- 40 repo stars
- Updated August 4, 2026
- akillness/oh-my-skills
rtk is an oh-my-skills agent skill (version 1.0) that installs, verifies, and configures Rust Token Killer—a CLI proxy that rewrites git, read, grep, and test commands into token-optimized output for AI coding agents.
About
rtk is an oh-my-skills installation and operations skill (version 1.0) for Rust Token Killer, a high-performance CLI proxy from the akillness/rtk fork of rtk-ai/rtk that compresses verbose shell output before it reaches AI agents. The skill verifies installations with rtk gain, repairs the common cargo install rtk name-collision with Rust Type Kit, supports Homebrew, install.sh, or Cargo install paths, and runs rtk init for Claude Code, Codex, Gemini CLI, Cursor, Copilot, Windsurf, Cline, and OpenCode. Developers reach for rtk when agent sessions waste context on git log, cargo test, or pytest output and need hook-based or direct rtk git status, rtk read, rtk grep, and rtk test wrappers.
- Slice and reducer scaffolding
- createAsyncThunk patterns
- Typed useSelector and useDispatch
- Entity adapters for normalized lists
- Store provider and middleware setup
Rtk by the numbers
- 389 all-time installs (skills.sh)
- Ranked #666 of 2,245 Frontend Development skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/akillness/oh-my-skills --skill rtkAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 389 |
|---|---|
| repo stars | ★ 40 |
| Last updated | August 4, 2026 |
| Repository | akillness/oh-my-skills ↗ |
How do you reduce shell output tokens in AI agent sessions?
Structure Redux Toolkit slices, async thunks, typed hooks, and store setup in React apps when state grows beyond local component state.
Who is it for?
Developers running Claude Code, Cursor, or Codex who hit context limits from verbose git diff, test suite, and lint command output.
Skip if: Developers whose agents use only built-in Read and Grep tools without shell hooks and who do not execute bash commands in sessions.
When should I use this skill?
Agent sessions lose context to verbose git status, cargo test, pytest, or lint output and rtk installation or hook setup is needed.
What you get
Installed rtk binary, agent-specific hook configuration, and verified rtk gain token savings on git, read, grep, and test commands.
- rtk binary installation
- agent hook configuration
- rtk gain verification report
By the numbers
- Skill version 1.0 targeting akillness/rtk fork of rtk-ai/rtk
- Supports rtk init configuration for 8 coding agents
- Ships 3 wrapper scripts and 4 reference documentation files
Files
rtk - Rust Token Killer for AI Coding Agents
Keyword:rtk·rust token killer·rtk init·rtk gain
>
The target repository is theakillness/rtkfork ofrtk-ai/rtk. The fork tracks upstream code, while the bundledinstall.shstill downloads release artifacts fromrtk-ai/rtk.
RTK is a high-performance CLI proxy that rewrites common shell commands into token-optimized equivalents before their output reaches an AI agent. Use this skill to verify the right RTK binary, install or repair it, choose the correct rtk init mode for the user's agent, and fall back to direct rtk commands when no automatic hook exists.
When to use this skill
- Verify whether RTK is already installed and whether it is the correct project
- Repair the common
cargo install rtkname-collision mistake - Install RTK with Homebrew, the repository
install.sh, or Cargo - Initialize RTK for Claude Code, Codex, Gemini CLI, Cursor, Copilot, Windsurf, Cline, or OpenCode
- Explain when
rtk init -gis better than local project setup - Use direct
rtkwrappers such asrtk git status,rtk read,rtk grep,rtk test, orrtk lint - Diagnose why automatic rewriting is not happening
- Explain why built-in file tools do not pass through shell hooks and when to use direct
rtkcommands instead
Instructions
Step 1: Verify the current installation before reinstalling anything
Run the local status helper first:
bash scripts/check-status.sh --showInterpret the result in this order:
1. If rtk gain works, the correct RTK is already installed. Do not reinstall unless the user wants an upgrade. 2. If rtk --version works but rtk gain fails, the user likely has the wrong rtk package, usually Rust Type Kit. 3. If rtk is missing entirely, move to installation.
The install and verification decision tree lives in references/install-and-verify.md.
Step 2: Install or repair RTK with the narrowest method that fits
Use the wrapper:
bash scripts/install.shImportant installer choices:
- Default
autoprefers Homebrew on macOS when available, then the fork'sinstall.sh, then Cargo - Use
--method brewwhen Homebrew is available and the user wants a standard system-managed install - Use
--method scriptfor the repository install script path - Use
--method cargowhen the user explicitly wants a git-source build or is working from the fork - Use
--force-uninstall-wrongwhen the user already installed the wrongrtk
Examples:
bash scripts/install.sh --method brew
bash scripts/install.sh --method script
bash scripts/install.sh --method cargo --repo akillness/rtk
bash scripts/install.sh --force-uninstall-wrongKeep these installation rules explicit:
- Always verify with
rtk gainafter installation - Treat
cargo install rtkas unsafe unless the user already confirmed the correct package - If the install script path is used, remember the script still pulls release artifacts from
rtk-ai/rtk
Step 3: Choose the correct rtk init mode for the agent
Use the init wrapper instead of hand-building flags:
bash scripts/init-agent.sh --agent claude --globalDefault mapping:
- Claude Code:
--agent claude --globalfor hook-first setup - Codex:
--agent codex --globalor local--agent codex --local - Gemini CLI:
--agent gemini --global - Cursor:
--agent cursor --global - Copilot:
--agent copilot --global - OpenCode:
--agent opencode --global - Windsurf:
--agent windsurf --local - Cline / Roo Code:
--agent cline --local
Good follow-up checks:
bash scripts/init-agent.sh --agent claude --global --auto-patch
bash scripts/init-agent.sh --agent codex --global
bash scripts/init-agent.sh --agent opencode --global
bash scripts/init-agent.sh --agent claude --showRead references/platform-init.md when the user needs the per-agent hook type, scope, or uninstall behavior.
Step 4: Use direct RTK commands when hooks are absent or insufficient
Automatic rewrite only applies where the agent actually executes shell commands through a supported hook or plugin. Prompt-only integrations such as Codex, Windsurf, and Cline still benefit from explicit rtk commands, but they do not transparently mutate built-in file tools.
Use direct commands when:
- The agent uses a built-in
Read,Grep, orGlobtool instead of shell - The workflow is in Codex and the user wants compact output immediately
- The user wants deterministic verification independent of hook state
Common commands:
rtk git status
rtk read src/main.rs
rtk grep "pattern" .
rtk test cargo test
rtk lint
rtk gainThe command families and config knobs are summarized in references/commands-and-config.md.
Step 5: Diagnose failures explicitly
Use bash scripts/check-status.sh --show as the first diagnostic pass, then branch:
- Wrong binary installed: fix the name collision and reinstall
- Hook missing or stale: rerun the correct
rtk initmode - Agent still verbose: confirm whether the task used shell commands or built-in tools
- PATH issue: ensure
~/.local/binor~/.cargo/binis onPATH - Windows wrapper failure: recommend RTK
0.23.1+
The troubleshooting matrix is in references/troubleshooting.md.
Examples
Example 1: Verify whether the correct RTK is already installed
bash scripts/check-status.sh --showExample 2: Install from the fork-aware script path
bash scripts/install.sh --method script --repo akillness/rtkExample 3: Repair the wrong cargo install rtk package
bash scripts/install.sh --force-uninstall-wrong --method cargoExample 4: Claude Code global hook setup
bash scripts/init-agent.sh --agent claude --global --auto-patchExample 5: Codex global prompt setup
bash scripts/init-agent.sh --agent codex --globalExample 6: OpenCode plugin install
bash scripts/init-agent.sh --agent opencode --globalExample 7: Use RTK directly for compact output
rtk read Cargo.toml
rtk grep "rtk init" README.md
rtk test cargo testExample 8: Temporarily bypass rewrite for one command
RTK_DISABLED=1 git statusBest practices
1. Check rtk gain before reinstalling; it is the quickest way to distinguish the correct RTK from the wrong package. 2. Use the lightest install path that meets the user's needs: Homebrew for convenience, install script for release binaries, Cargo for source-driven workflows. 3. Treat rtk init -g as the normal path for hook-capable agents and local rules files as the normal path for Windsurf and Cline. 4. Use rtk init --show after setup or upgrades so stale hook state is visible immediately. 5. Remember that built-in read/search tools do not pass through shell hooks; switch to shell commands or direct rtk wrappers when token savings matter. 6. Keep RTK_DISABLED=1 in mind for one-off passthrough commands instead of uninstalling hooks. 7. Re-run the installer plus rtk init after RTK upgrades because hook artifacts can change between releases. 8. When users say "RTK is broken", separate installation correctness, hook registration, and actual command path before proposing a fix.
References
- references/install-and-verify.md
- references/platform-init.md
- references/commands-and-config.md
- references/troubleshooting.md
- scripts/install.sh
- scripts/init-agent.sh
- scripts/check-status.sh
- RTK Repository Fork
- Upstream RTK Project
interface:
display_name: "RTK"
short_description: "Install and operate RTK for AI coding agents"
default_prompt: "Use $rtk to install, initialize, verify, or troubleshoot Rust Token Killer for my coding agent setup."
{
"skill_name": "rtk",
"evals": [
{
"id": 1,
"prompt": "RTK가 이미 깔려있는지 먼저 확인하고 싶은데 뭘 보면 돼?",
"expected_output": "The skill checks rtk gain before reinstalling and treats it as the correctness signal.",
"assertions": [
"The response recommends checking `rtk gain`",
"The response says not to reinstall if `rtk gain` already works"
]
},
{
"id": 2,
"prompt": "cargo install rtk 했는데 gain 명령이 없어. 어떻게 고쳐?",
"expected_output": "The skill identifies the wrong package collision and repairs it.",
"assertions": [
"The response explains that the wrong `rtk` package may be installed",
"The response recommends uninstalling or reinstalling with a repo-specific method"
]
},
{
"id": 3,
"prompt": "Claude Code 전체 프로젝트에 RTK 자동 적용하고 싶어.",
"expected_output": "The skill recommends global Claude init and mentions verification.",
"assertions": [
"The response recommends `rtk init -g` or the wrapper equivalent",
"The response mentions `rtk init --show` or equivalent verification"
]
},
{
"id": 4,
"prompt": "Codex에서 RTK는 어떻게 붙여? Claude hook처럼 자동이야?",
"expected_output": "The skill explains Codex init and clarifies that it is not the same transparent hook path.",
"assertions": [
"The response recommends `rtk init --codex` or `rtk init -g --codex`",
"The response clarifies that Codex is prompt-guided or not the same transparent hook path"
]
},
{
"id": 5,
"prompt": "OpenCode나 Gemini도 RTK 설정할 수 있어?",
"expected_output": "The skill covers agent-specific init for OpenCode or Gemini.",
"assertions": [
"The response includes `--opencode` or `--gemini` init guidance",
"The response mentions plugin or hook scope"
]
},
{
"id": 6,
"prompt": "Codex Read나 Grep 같은 기본 툴도 RTK가 자동으로 줄여줘?",
"expected_output": "The skill explains the built-in tool limitation and direct RTK fallback.",
"assertions": [
"The response says built-in file or search tools do not automatically pass through shell hooks",
"The response recommends direct commands such as `rtk read` or `rtk grep`"
]
}
]
}
RTK Commands And Config
Use this file when the user asks what RTK can optimize, how to call it directly, or how to control rewrite behavior.
Direct command families
Files
rtk ls .
rtk read file.rs
rtk read file.rs -l aggressive
rtk smart file.rs
rtk find "*.rs" .
rtk grep "pattern" .
rtk diff file1 file2Git
rtk git status
rtk git log -n 10
rtk git diff
rtk git commit -m "msg"
rtk git pushTest runners
rtk test cargo test
rtk vitest run
rtk pytest
rtk go test
rtk cargo test
rtk playwright testBuild and lint
rtk lint
rtk tsc
rtk next build
rtk cargo build
rtk cargo clippy
rtk ruff checkAnalytics
rtk gain
rtk gain --graph
rtk discoverWhen direct RTK commands matter
Use explicit rtk commands when:
- The agent does not support transparent shell hooks
- The task is running through built-in read or grep style tools
- You want deterministic compact output regardless of hook state
- You are testing RTK itself
Rewrite behavior and escape hatches
One-off passthrough
RTK_DISABLED=1 git statusUser config
RTK stores user-owned config in:
~/.config/rtk/config.tomlUseful control surface:
exclude_commandsto keep specific commands from being rewritten
Important caveat for coding agents
Hook rewriting only affects shell-command execution paths. It does not automatically compress built-in file or search tools such as:
- Codex
Read,Grep,Glob - Claude Code non-Bash tools
- Similar native tool calls in other agents
For those cases, use shell commands or direct RTK commands such as rtk read, rtk grep, and rtk find.
RTK Install And Verify
Use this file when the user needs installation choices, verification logic, or a fix for the wrong rtk package.
Decision order
1. Check rtk --version 2. Check rtk gain 3. Check which rtk 4. Install or repair only if rtk gain fails or rtk is missing
The key signal is simple:
rtk gainworks: correct RTK already installedrtk --versionworks butrtk gainfails: likely the wrong packagertkmissing: install required
Safe install methods
Homebrew
brew install rtkUse this when Homebrew is present and the user wants a standard package-manager install.
Repository install script
curl -fsSL https://raw.githubusercontent.com/akillness/rtk/refs/heads/master/install.sh | shNotes:
- The fork's
install.shstill downloads release artifacts fromrtk-ai/rtk - Default install target is
~/.local/bin - The script works well for Linux and macOS release installs
Cargo from git
cargo install --git https://github.com/akillness/rtkUse this when the user wants source-driven installation from the fork or is working on RTK itself.
Dangerous install path
Avoid this unless the user already proved it resolves to Token Killer:
cargo install rtkThat name can resolve to the unrelated Rust Type Kit package. If the user already ran it and rtk gain fails, uninstall first:
cargo uninstall rtkVerification checklist
Run these after any install:
rtk --version
rtk gain
which rtkExpected outcome:
rtk --versionprints a version stringrtk gainprints token-savings stats instead ofnot a rtk commandwhich rtkpoints at the intended binary path
PATH fixes
If the binary installed but is not found:
install.sh path
export PATH="$HOME/.local/bin:$PATH"Cargo path
export PATH="$HOME/.cargo/bin:$PATH"Use shell profile files such as ~/.zshrc or ~/.bashrc if the change should persist.
RTK Platform Init Matrix
Use this file when the user needs the exact rtk init command, scope, or integration type for a specific agent.
Agent matrix
| Agent | Command | Scope | Integration type |
|---|---|---|---|
| Claude Code | rtk init -g | Global recommended | PreToolUse shell hook |
| Claude Code | rtk init | Local optional | Project instructions only |
| Codex | rtk init --codex | Local | AGENTS.md + RTK.md guidance |
| Codex | rtk init -g --codex | Global | ~/.codex/AGENTS.md + ~/.codex/RTK.md |
| Gemini CLI | rtk init -g --gemini | Global only | Gemini hook |
| Cursor | rtk init -g --agent cursor | Global only | hooks.json shell hook |
| GitHub Copilot | rtk init -g --copilot | Global only | Copilot hook or deny-with-suggestion |
| Windsurf | rtk init --agent windsurf | Local only | .windsurfrules |
| Cline / Roo Code | rtk init --agent cline | Local only | .clinerules |
| OpenCode | rtk init -g --opencode | Global only | TypeScript plugin |
Useful variants
Claude Code
rtk init -g
rtk init -g --auto-patch
rtk init -g --no-patch
rtk init -g --hook-only
rtk init -g --uninstall
rtk init --showCodex
rtk init --codex
rtk init -g --codex
rtk init -g --codex --uninstallCodex is prompt-guided, not a transparent shell-hook rewrite path. Direct rtk commands still matter.
Gemini CLI
rtk init -g --gemini
rtk init -g --gemini --uninstallCursor
rtk init -g --agent cursorWindsurf / Cline
rtk init --agent windsurf
rtk init --agent clineThese are project-local rules files and should not be treated as global hook installs.
OpenCode
rtk init -g --opencodeThis installs the OpenCode plugin to ~/.config/opencode/plugins/rtk.ts.
After any init
Run:
rtk init --showUse this to confirm that the relevant hook, prompt file, or plugin is present.
RTK Troubleshooting
Use this file when the user says RTK is installed but not working as expected.
Symptom: rtk gain is missing
Likely cause
The wrong rtk package is installed.
Fix
cargo uninstall rtk
bash scripts/install.sh --force-uninstall-wrong
rtk gainSymptom: rtk command not found after install
Likely cause
The binary directory is not on PATH.
Fix
export PATH="$HOME/.local/bin:$PATH"
export PATH="$HOME/.cargo/bin:$PATH"Apply only the path that matches the install method.
Symptom: Claude Code is still verbose
Checks
rtk gain
rtk init --showThen ask:
1. Was the action executed through the Bash tool? 2. Was rtk init -g run and was settings patching accepted? 3. Did Claude Code restart after hook changes?
Symptom: Codex still uses raw output
Codex is not a transparent shell-hook integration. rtk init --codex installs prompt guidance, not command mutation for built-in tools.
Use:
rtk read path/to/file
rtk grep "pattern" .
rtk git statusSymptom: OpenCode did not pick up RTK
Checks
rtk init -g --opencode
ls -la ~/.config/opencode/plugins/rtk.tsThen restart OpenCode.
Symptom: Windows wrappers fail for Node-based tools
Likely cause
Older RTK versions did not resolve .CMD and .BAT wrappers correctly.
Fix
Use RTK 0.23.1+ and reinstall:
cargo install --git https://github.com/akillness/rtk
rtk --versionSymptom: A single command should bypass RTK
Use:
RTK_DISABLED=1 <your command>Do this before suggesting uninstall or config changes.
#!/usr/bin/env bash
set -euo pipefail
SHOW=0
usage() {
cat <<'EOF'
Usage: bash scripts/check-status.sh [--show]
Options:
--show Also run rtk init --show when RTK is installed
-h, --help Show this help
EOF
}
while [[ $# -gt 0 ]]; do
case "$1" in
--show)
SHOW=1
shift
;;
-h|--help)
usage
exit 0
;;
*)
printf '[rtk-status][error] Unknown argument: %s\n' "$1" >&2
exit 1
;;
esac
done
say() {
printf '[rtk-status] %s\n' "$*"
}
warn() {
printf '[rtk-status][warn] %s\n' "$*" >&2
}
if ! command -v rtk >/dev/null 2>&1; then
warn "rtk is not installed or not on PATH."
exit 0
fi
say "binary: $(command -v rtk)"
say "version: $(rtk --version)"
if rtk gain >/dev/null 2>&1; then
say "verification: correct RTK detected because 'rtk gain' succeeded."
else
warn "'rtk gain' failed. This often means the wrong rtk package is installed."
fi
case ":${PATH}:" in
*":$HOME/.local/bin:"*) say "path: ~/.local/bin present" ;;
*) warn "path: ~/.local/bin not detected" ;;
esac
case ":${PATH}:" in
*":$HOME/.cargo/bin:"*) say "path: ~/.cargo/bin present" ;;
*) warn "path: ~/.cargo/bin not detected" ;;
esac
if [[ "$SHOW" -eq 1 ]]; then
say "running: rtk init --show"
rtk init --show || true
fi
#!/usr/bin/env bash
set -euo pipefail
AGENT="claude"
SCOPE=""
AUTO_PATCH=0
NO_PATCH=0
HOOK_ONLY=0
SHOW=0
UNINSTALL=0
usage() {
cat <<'EOF'
Usage: bash scripts/init-agent.sh [options]
Options:
--agent claude|codex|gemini|cursor|copilot|windsurf|cline|opencode
--global Force global setup
--local Force local setup
--auto-patch Pass --auto-patch when supported
--no-patch Pass --no-patch when supported
--hook-only Pass --hook-only for Claude hook-first installs
--show Run rtk init --show instead of installing
--uninstall Uninstall the selected integration
-h, --help Show this help
EOF
}
die() {
printf '[rtk-init][error] %s\n' "$*" >&2
exit 1
}
log() {
printf '[rtk-init] %s\n' "$*"
}
have_cmd() {
command -v "$1" >/dev/null 2>&1
}
while [[ $# -gt 0 ]]; do
case "$1" in
--agent)
AGENT="${2:-}"
shift 2
;;
--global)
SCOPE="global"
shift
;;
--local)
SCOPE="local"
shift
;;
--auto-patch)
AUTO_PATCH=1
shift
;;
--no-patch)
NO_PATCH=1
shift
;;
--hook-only)
HOOK_ONLY=1
shift
;;
--show)
SHOW=1
shift
;;
--uninstall)
UNINSTALL=1
shift
;;
-h|--help)
usage
exit 0
;;
*)
die "Unknown argument: $1"
;;
esac
done
have_cmd rtk || die "rtk is not installed. Run bash scripts/install.sh first."
if [[ "$SHOW" -eq 1 ]]; then
exec rtk init --show
fi
case "$AGENT" in
claude)
: "${SCOPE:=global}"
;;
codex|gemini|cursor|copilot|opencode)
: "${SCOPE:=global}"
;;
windsurf|cline)
: "${SCOPE:=local}"
;;
*)
die "Unsupported agent: $AGENT"
;;
esac
if [[ "$AGENT" =~ ^(gemini|copilot|opencode|cursor)$ ]] && [[ "$SCOPE" != "global" ]]; then
die "$AGENT setup is documented as global-only."
fi
if [[ "$AGENT" =~ ^(windsurf|cline)$ ]] && [[ "$SCOPE" != "local" ]]; then
die "$AGENT setup is project-scoped and should stay local."
fi
cmd=(rtk init)
if [[ "$SCOPE" == "global" ]]; then
cmd+=(-g)
fi
case "$AGENT" in
claude)
;;
codex)
cmd+=(--codex)
;;
gemini)
cmd+=(--gemini)
;;
cursor)
cmd+=(--agent cursor)
;;
copilot)
cmd+=(--copilot)
;;
windsurf)
cmd+=(--agent windsurf)
;;
cline)
cmd+=(--agent cline)
;;
opencode)
cmd+=(--opencode)
;;
esac
if [[ "$AUTO_PATCH" -eq 1 ]]; then
cmd+=(--auto-patch)
fi
if [[ "$NO_PATCH" -eq 1 ]]; then
cmd+=(--no-patch)
fi
if [[ "$HOOK_ONLY" -eq 1 ]]; then
cmd+=(--hook-only)
fi
if [[ "$UNINSTALL" -eq 1 ]]; then
cmd+=(--uninstall)
fi
log "Running: ${cmd[*]}"
exec "${cmd[@]}"
#!/usr/bin/env bash
set -euo pipefail
METHOD="auto"
REPO="akillness/rtk"
FORCE_UNINSTALL_WRONG=0
SKIP_VERIFY=0
usage() {
cat <<'EOF'
Usage: bash scripts/install.sh [options]
Options:
--method auto|brew|script|cargo
--repo <owner/name> Default: akillness/rtk
--force-uninstall-wrong Try cargo uninstall rtk before reinstalling
--skip-verify Skip final rtk gain verification
-h, --help Show this help
EOF
}
log() {
printf '[rtk-install] %s\n' "$*"
}
warn() {
printf '[rtk-install][warn] %s\n' "$*" >&2
}
die() {
printf '[rtk-install][error] %s\n' "$*" >&2
exit 1
}
have_cmd() {
command -v "$1" >/dev/null 2>&1
}
have_correct_rtk() {
have_cmd rtk && rtk gain >/dev/null 2>&1
}
have_wrong_rtk() {
have_cmd rtk && ! rtk gain >/dev/null 2>&1
}
while [[ $# -gt 0 ]]; do
case "$1" in
--method)
METHOD="${2:-}"
shift 2
;;
--repo)
REPO="${2:-}"
shift 2
;;
--force-uninstall-wrong)
FORCE_UNINSTALL_WRONG=1
shift
;;
--skip-verify)
SKIP_VERIFY=1
shift
;;
-h|--help)
usage
exit 0
;;
*)
die "Unknown argument: $1"
;;
esac
done
case "$METHOD" in
auto|brew|script|cargo) ;;
*)
die "Unsupported method: $METHOD"
;;
esac
if have_correct_rtk; then
log "Correct RTK already installed: $(rtk --version)"
exit 0
fi
if have_wrong_rtk; then
warn "rtk exists but 'rtk gain' failed. This is often the wrong package."
if [[ "$FORCE_UNINSTALL_WRONG" -eq 1 ]]; then
if have_cmd cargo; then
cargo uninstall rtk || true
log "Attempted cargo uninstall for the wrong RTK package."
else
warn "cargo is unavailable, so automatic uninstall was skipped."
fi
else
warn "Continuing without uninstall. Re-run with --force-uninstall-wrong if PATH shadowing persists."
fi
fi
choose_auto_method() {
if [[ "$(uname -s)" == "Darwin" ]] && have_cmd brew; then
printf 'brew\n'
return
fi
if have_cmd curl; then
printf 'script\n'
return
fi
if have_cmd cargo; then
printf 'cargo\n'
return
fi
die "Need one of: Homebrew, curl, or cargo."
}
install_with_brew() {
have_cmd brew || die "brew is not installed."
if brew list rtk >/dev/null 2>&1; then
log "Updating existing Homebrew RTK formula."
brew upgrade rtk || brew reinstall rtk
else
log "Installing RTK with Homebrew."
brew install rtk
fi
}
install_with_script() {
have_cmd curl || die "curl is required for --method script."
local url="https://raw.githubusercontent.com/${REPO}/refs/heads/master/install.sh"
log "Installing RTK via ${url}"
curl -fsSL "$url" | sh
}
install_with_cargo() {
have_cmd cargo || die "cargo is required for --method cargo."
log "Installing RTK from git repository https://github.com/${REPO}"
cargo install --git "https://github.com/${REPO}" --force
}
if [[ "$METHOD" == "auto" ]]; then
METHOD="$(choose_auto_method)"
log "Auto-selected install method: ${METHOD}"
fi
case "$METHOD" in
brew) install_with_brew ;;
script) install_with_script ;;
cargo) install_with_cargo ;;
esac
if [[ "$SKIP_VERIFY" -eq 1 ]]; then
log "Skipping verification by request."
exit 0
fi
have_cmd rtk || die "Installation completed but 'rtk' is still not on PATH."
log "Installed binary: $(command -v rtk)"
rtk --version
rtk gain >/dev/null
log "Verification passed: 'rtk gain' works."
Experiment 0 - baseline
Score: 4/6 Change: Initial operational draft only. Reasoning: Establish the baseline before tightening install verification and platform-specific guidance. Result: The draft covered installation and init basics but left the wrong-package repair path and direct-command fallback too implicit. Remaining failures: Verification-first behavior and the built-in-tool limitation were not explicit enough.
Experiment 1 - keep
Score: 6/6 Change: Added rtk gain verification-first guidance, wrong-package repair, agent-specific init mapping, built-in-tool fallback, and focused wrapper scripts plus references. Reasoning: The baseline risk was that users would reinstall blindly or assume Codex behaved like Claude hooks. Result: All six binary evals passed. Remaining failures: None in the current eval suite.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>rtk skill autoresearch</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
:root {
--bg: #eef5ef;
--panel: #fbfefb;
--ink: #172218;
--muted: #56665a;
--line: #bfd2c1;
--keep: #166534;
--base: #8a5a12;
}
body {
margin: 0;
padding: 32px;
font-family: "IBM Plex Sans", "Helvetica Neue", sans-serif;
background:
radial-gradient(circle at top right, rgba(38, 166, 91, 0.13), transparent 30%),
linear-gradient(180deg, #f7fbf7, var(--bg));
color: var(--ink);
}
.wrap {
max-width: 980px;
margin: 0 auto;
}
h1, h2 {
margin: 0 0 12px;
}
p {
color: var(--muted);
line-height: 1.5;
}
.grid {
display: grid;
gap: 16px;
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
margin: 24px 0;
}
.card {
background: var(--panel);
border: 1px solid var(--line);
border-radius: 18px;
padding: 18px;
box-shadow: 0 12px 24px rgba(28, 50, 30, 0.06);
}
table {
width: 100%;
border-collapse: collapse;
background: var(--panel);
border: 1px solid var(--line);
border-radius: 18px;
overflow: hidden;
}
th, td {
padding: 12px 14px;
border-bottom: 1px solid var(--line);
text-align: left;
vertical-align: top;
font-size: 14px;
}
th {
background: #e4f0e5;
}
.status-keep { color: var(--keep); font-weight: 700; }
.status-baseline { color: var(--base); font-weight: 700; }
code {
background: #edf5ee;
padding: 2px 6px;
border-radius: 6px;
}
</style>
</head>
<body>
<div class="wrap">
<h1>rtk skill autoresearch</h1>
<p>Baseline versus improved prompt behavior for the local <code>rtk</code> skill. Open alongside <code>results.json</code> for the current experiment log.</p>
<div class="grid">
<div class="card">
<h2>Baseline</h2>
<p>Experiment 0 scored 4/6. It covered installation and init basics, but not the wrong-package repair path or the built-in-tool fallback.</p>
</div>
<div class="card">
<h2>Final</h2>
<p>Experiment 1 scored 6/6 after making `rtk gain` the first decision point and clarifying agent-specific integration boundaries.</p>
</div>
<div class="card">
<h2>Focus</h2>
<p>Binary evals concentrated on verification-first behavior, package-collision repair, per-agent init mapping, and direct RTK use when shell hooks do not apply.</p>
</div>
</div>
<table>
<thead>
<tr>
<th>Experiment</th>
<th>Status</th>
<th>Score</th>
<th>Summary</th>
</tr>
</thead>
<tbody>
<tr>
<td>0</td>
<td class="status-baseline">baseline</td>
<td>4 / 6</td>
<td>Initial draft defined RTK at a high level but did not make verification and non-hook tool paths operational enough.</td>
</tr>
<tr>
<td>1</td>
<td class="status-keep">keep</td>
<td>6 / 6</td>
<td>Kept mutation added the `rtk gain` gate, repair steps, per-agent init wrapper, and direct-command fallback guidance.</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>
{
"skill_name": "rtk",
"status": "complete",
"updated_at": "2026-04-08T09:30:00Z",
"evals": [
{
"id": "verify-first",
"question": "Does the skill check `rtk gain` before reinstalling and use it as the correctness signal?"
},
{
"id": "wrong-package-repair",
"question": "Does the skill identify the `cargo install rtk` name collision and provide a repair path?"
},
{
"id": "claude-init",
"question": "Does the skill recommend the correct global Claude Code initialization flow and post-init verification?"
},
{
"id": "codex-init",
"question": "Does the skill explain Codex setup with `--codex` and clarify that it is not the same transparent hook path as Claude?"
},
{
"id": "other-agents",
"question": "Does the skill cover agent-specific setup for Gemini CLI or OpenCode with the correct scope?"
},
{
"id": "direct-command-fallback",
"question": "Does the skill explain that built-in file or search tools bypass shell hooks and recommend direct `rtk` commands?"
}
],
"experiments": [
{
"experiment": 0,
"score": 4,
"max_score": 6,
"pass_rate": 0.6667,
"status": "baseline",
"description": "Initial draft established the broad RTK use case but under-specified verification-first behavior, Codex limitations, and built-in tool fallback guidance.",
"kept": true,
"per_eval": {
"verify-first": false,
"wrong-package-repair": false,
"claude-init": true,
"codex-init": true,
"other-agents": true,
"direct-command-fallback": true
}
},
{
"experiment": 1,
"score": 6,
"max_score": 6,
"pass_rate": 1.0,
"status": "keep",
"description": "Kept mutation: raised `rtk gain` verification to Step 1, added wrong-package repair, clarified Codex and built-in-tool limits, and moved platform specifics into scripts plus references.",
"kept": true,
"per_eval": {
"verify-first": true,
"wrong-package-repair": true,
"claude-init": true,
"codex-init": true,
"other-agents": true,
"direct-command-fallback": true
}
}
]
}
experiment score max_score pass_rate status description
0 4 6 0.6667 baseline Initial draft covered basic install and init flows but did not strongly center verification-first behavior, Codex non-hook caveats, or the direct-rtk fallback for built-in tools.
1 6 6 1.0000 keep Added verification-first guidance, wrong-package repair, agent-specific init mapping, direct-command fallback, and focused scripts plus references.
---
name: rtk
description: >
Install and use RTK Rust Token Killer for AI coding agents. Use when you need
to install RTK, run `rtk init`, or reduce command output tokens for Claude Code,
Codex, Gemini, Cursor, Copilot, Windsurf, Cline, or OpenCode.
allowed-tools: Bash Read Write Edit Glob Grep WebFetch
compatibility: Works on common local AI coding environments with RTK-supported agents.
license: MIT
metadata:
tags: rtk, token-optimization, claude-code, codex, gemini, opencode
version: "0.1"
source: https://github.com/akillness/rtk
---
# rtk
RTK compresses shell output before it reaches an AI agent.
## Instructions
1. Install RTK if it is missing.
2. Run `rtk init` for the user's agent.
3. Use `rtk` commands for compact output.
## Examples
```bash
brew install rtk
rtk init -g
rtk git status
```
N:rtk
D:[rtk] Install, initialize, verify, and troubleshoot RTK Rust Token Killer for AI coding agents. Covers correct-package verification with rtk gain, Homebrew or install.sh or Cargo installation, agent-specific rtk init flows for Claude Code Codex Gemini Cursor Copilot Windsurf Cline and OpenCode, and direct rtk wrapper commands when built-in tools bypass hooks.
G:rtk rust-token-killer token-optimization claude-code codex gemini opencode cursor copilot shell-hooks
U[8]:
Verify whether the installed rtk is the correct Token Killer package before changing anything
Repair the common cargo install name-collision mistake when rtk gain is missing
Install RTK with Homebrew the repo install.sh or Cargo depending on environment and user preference
Choose the correct rtk init mode for Claude Code Codex Gemini Cursor Copilot Windsurf Cline and OpenCode
Use rtk init --show and local status checks to diagnose stale hooks or missing plugin state
Use direct rtk wrappers like rtk read rtk grep rtk git status rtk test and rtk lint when hooks do not apply
Explain that built-in Read Grep and Glob style tools do not pass through shell-hook rewriting
Use RTK_DISABLED=1 and config.toml exclusions when the user needs selective passthrough
S[6]{n,action,details}:
1,Check first,run bash scripts/check-status.sh --show and trust rtk gain as the correctness signal
2,Install narrowly,use bash scripts/install.sh with auto brew script or cargo instead of reinstalling blindly
3,Fix collisions,if rtk exists but gain fails repair the wrong package before continuing
4,Initialize agent,run bash scripts/init-agent.sh with the right --agent and scope flags
5,Use directly,call rtk read rtk grep rtk git status or rtk test when hook coverage is absent
6,Diagnose precisely,separate wrong binary PATH issues hook registration and non-shell tool paths
R[8]:
rtk gain is the fastest way to confirm the correct RTK installation
cargo install rtk is unsafe unless the user already proved it is the right package
Global hook mode is the default for Claude Code Gemini Cursor Copilot OpenCode and usually Codex
Windsurf and Cline are rules-file integrations and should stay project-scoped
Prompt-only integrations such as Codex still benefit from direct rtk commands but do not rewrite built-in tools
After upgrades rerun rtk init or at least rtk init --show because hook artifacts can drift
Keep RTK_DISABLED=1 for one-off raw commands instead of uninstalling RTK entirely
The akillness fork tracks upstream while the bundled install.sh still downloads upstream release binaries
E[6]{type,command}:
Status,bash scripts/check-status.sh --show
Install,bash scripts/install.sh --method script --repo akillness/rtk
Fix wrong package,bash scripts/install.sh --force-uninstall-wrong --method cargo
Claude init,bash scripts/init-agent.sh --agent claude --global --auto-patch
Codex init,bash scripts/init-agent.sh --agent codex --global
Direct use,rtk read Cargo.toml
Related skills
How it compares
Pick rtk over manual output truncation when you need persistent agent hooks that automatically compress git, test, and lint shell output across sessions.
FAQ
How does rtk verify the correct binary is installed?
The rtk skill runs rtk gain via scripts/check-status.sh. If rtk --version works but rtk gain fails, the wrong rtk package—usually Rust Type Kit—was installed via cargo install rtk.
Which agents does rtk init support?
The rtk skill configures rtk init for Claude Code, Codex, Gemini CLI, Cursor, Copilot, Windsurf, Cline, and OpenCode using global or local hook modes per agent.
When should developers use direct rtk commands instead of hooks?
The rtk skill recommends direct rtk read, rtk grep, and rtk git commands when agents use built-in Read or Grep tools that bypass shell hooks, or in prompt-only integrations like Codex.