Receber por email
← Voltar para o catálogo

add-rtk

Instala o proxy de compressão de tokens rtk nos contêineres do agente. Ele encaminha chamadas de ferramentas Bash através do rtk, economizando 60-90% de tokens em comandos de desenvolvimento como git, cargo, pytest, docker e kubectl.

29.9kestrelas
Atualizado há 4 meses

Ver no GitHub ↗ Licença: MIT

Como adicionar

/plugin marketplace add nanocoai/nanoclaw

O comando exato pode variar conforme o repositório. Confira o README no GitHub.

Para o autor da skill

Cole no README do seu repo

Mostra que sua skill está catalogada na Skillteca, gera backlink e tráfego rastreável.

[![Skillteca](https://www.skillteca.com.br/api/badge/add-rtk/svg)](https://www.skillteca.com.br/skills/add-rtk)

Skills relacionadas

Ver todas de Desenvolvimento →

Alerta por categoria

Receba novas skills de Desenvolvimento toda segunda

1 email curto, só com as skills novas de Desenvolvimento. 4 minutos de leitura, sem spam, cancela com 1 clique.

Você confirma o email no primeiro envio. Sem spam. Cancela com 1 clique.

Ler descrição completa

Add rtk

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

  • rtk binary at ~/.local/bin/rtk on the host
  • ~/.local/bin/rtk mounted read-only at /usr/local/bin/rtk inside the target agent group's containers
  • PreToolUse hook in the agent group's settings.json so 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 column not exposed via ncl config update. Update it directly via the DB helper, merging with any existing mounts.

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>'"

Then write the merged array (include all existing entries plus the rtk entry):

pnpm exec tsx scripts/q.ts data/v2.db \
  "UPDATE container_configs SET additional_mounts = '<merged-json>' WHERE agent_group_id = '<group-id>'"

The rtk entry to append: {"hostPath":"/home/<user>/.local/bin/rtk","containerPath":"/usr/local/bin/rtk","readonly":true}

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 using jq to merge safely:

SETTINGS="data/v2-sessions/<group-id>/.claude-shared/settings.json"

jq '.hooks.PreToolUse = [{"matcher":"Bash","hooks":[{"type":"command","command":"rtk hook claude"}]}]' \
  "$SETTINGS" > /tmp/rtk-settings.json && mv /tmp/rtk-settings.json "$SETTINGS"

If PreToolUse already exists, append instead of overwriting:

jq '.hooks.PreToolUse += [{"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>

No --message needed — the hook is transparent and requires no agent awareness.

Verify

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
Compartilhar X LinkedIn