add-rtk
Install rtk token-compression proxy into agent containers. Routes Bash tool calls through rtk for 60–90% token savings on dev commands (git, cargo, pytest, docker, kubectl, etc.).
pinned to #a30547fupdated 2 weeks ago
Ask your AI client: “install skills/add-rtk”.
Requires the metahub MCP server installed in your client. Set up MCP.
mh install skills/add-rtkmetahub onboarded this repo on the author's behalf.
If you own github.com/nanocoai/nanoclaw on GitHub, claim the listing to take over publishing. Your claim preserves the existing eval history and badges; only the curator label is replaced with verified-publisher on your next publish.
Stars
30,187
Last commit
2 weeks ago
Latest release
published
- #ai-agents
- #ai-assistant
- #claude-code
- #claude-skills
- #openclaw
About this skill
Pulled from SKILL.md at publish time.
Install [rtk](https://github.com/rtk-ai/rtk) — a CLI proxy delivering 60–90% token savings on common dev commands (git, cargo, pytest, docker, kubectl, etc.) — and wire it transparently into agent containers via the Claude Code `PreToolUse` hook.
Evaluation report
WarningsAutomated checks the publisher passed at publish time — structure, docs, safety, and whether the artifact behaves as claimed.a30547f· 2 weeks ago
Kind-specific
31Skill: SKILL.md present
found at .claude/skills/add-rtk/SKILL.md · frontmatter source: SKILL.md
Skill: body content present
538 words · 4,108 chars · 11 sections · 16 code blocks
Skill: triggers declaredwarn
No `trigger` phrases in SKILL.md frontmatter
Add `trigger:` lines so Claude knows when to activate this skill — e.g. `when building MCP servers` or `for diagram creation`.
Skill: allowed-tools scope
no allowed-tools restriction (Claude may use anything)
Release history
1- releasecurrenta30547fwarn2 weeks ago
Contents
Install rtk — a CLI proxy delivering 60–90% token savings on common dev commands (git, cargo, pytest, docker, kubectl, etc.) — and wire it transparently into agent containers via the Claude Code PreToolUse hook.
What this sets up
rtkbinary at~/.local/bin/rtkon the host~/.local/bin/rtkmounted read-only at/usr/local/bin/rtkinside the target agent group's containersPreToolUsehook in the agent group'ssettings.jsonso every Bash call is automatically filtered through rtk — no CLAUDE.md instructions needed
Step 1 — Install rtk on the host
curl -fsSL https://raw.githubusercontent.com/rtk-ai/rtk/refs/heads/master/install.sh | sh
If the script put the binary elsewhere, move it:
find ~/.local ~/.cargo/bin ~/bin -name rtk 2>/dev/null
mv "$(which rtk 2>/dev/null)" ~/.local/bin/rtk
Verify:
~/.local/bin/rtk --version
chmod +x ~/.local/bin/rtk # if needed
Step 2 — Identify the target agent group
ncl groups list
Note the group ID (e.g. ag-1776342942165-ptgddd). Repeat Steps 3–5 for each group.
Step 3 — Mount rtk into the container config
additional_mounts is a JSON array column on container_configs. Read the current value, merge in the rtk entry, and write the merged array back.
Read current mounts first:
pnpm exec tsx scripts/q.ts data/v2.db \
"SELECT additional_mounts FROM container_configs WHERE agent_group_id = '<group-id>'"
Build the merged array: keep every existing entry, drop any entry whose containerPath is /usr/local/bin/rtk (so re-running replaces rather than duplicates), then add the rtk entry:
{"hostPath":"/home/<user>/.local/bin/rtk","containerPath":"/usr/local/bin/rtk","readonly":true}
Write the merged array back:
pnpm exec tsx scripts/q.ts data/v2.db \
"UPDATE container_configs SET additional_mounts = '<merged-json>' WHERE agent_group_id = '<group-id>'"
Verify:
pnpm exec tsx scripts/q.ts data/v2.db \
"SELECT additional_mounts FROM container_configs WHERE agent_group_id = '<group-id>'"
Step 4 — Add the PreToolUse hook to settings.json
Each agent group has a settings.json at:
data/v2-sessions/<group-id>/.claude-shared/settings.json
This file is mounted at /home/node/.claude/settings.json inside the container and is read by Claude Code for hooks, env, and model config.
Add the PreToolUse entry with jq. This drops any existing rtk Bash hook first, then appends a fresh one, so it is safe to re-run without creating duplicates:
SETTINGS="data/v2-sessions/<group-id>/.claude-shared/settings.json"
jq '.hooks.PreToolUse = ((.hooks.PreToolUse // [])
| map(select((.hooks // []) | any(.command == "rtk hook claude") | not)))
+ [{"matcher":"Bash","hooks":[{"type":"command","command":"rtk hook claude"}]}]' \
"$SETTINGS" > /tmp/rtk-settings.json && mv /tmp/rtk-settings.json "$SETTINGS"
Step 5 — Restart the container
ncl groups restart --id <group-id>
Verify
Confirm the binary is executable inside the container so a missing or non-executable mount surfaces immediately rather than as a silent hook failure:
docker exec "$(docker ps --filter "name=<group-id>" --format '{{.Names}}' | head -1)" rtk --version
Then ask the agent to run git status or any other supported command. rtk intercepts it silently. Check savings with:
~/.local/bin/rtk gain
Troubleshooting
rtk: command not found inside the container
Mount wasn't applied or container wasn't restarted:
pnpm exec tsx scripts/q.ts data/v2.db \
"SELECT additional_mounts FROM container_configs WHERE agent_group_id = '<group-id>'"
# Look for entry with /usr/local/bin/rtk
ncl groups restart --id <group-id>
Hook not firing
Verify the hook is in settings.json:
jq '.hooks.PreToolUse' data/v2-sessions/<group-id>/.claude-shared/settings.json
If missing, re-run Step 4.
Binary won't execute — permission denied
chmod +x ~/.local/bin/rtk
Reviews
No reviews yet. Be the first.
Related
Planning With Files
Claude Code skill implementing Manus-style persistent markdown planning — the workflow pattern behind the $2B acquisition.
orchestration-patterns
>
migration-patterns
>
mh install skills/add-rtk