You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add wrappers for top unhandled commands: node, ssh, bun run, python, cat heredoc #1802
Running rtk discover on a real-world Claude Code session history (1277 sessions, 5255 Bash commands, last 30 days) reveals significant token-savings potential in commands RTK does not yet handle.
Top unhandled commands (by frequency)
Command
Count (30d)
Example
node
132
node dev-server.mjs
open
117
open "/path/to/file"
ssh
79
ssh -o StrictHostKeyChecking=no host 'cmd'
pkill
34
pkill -f "swift /tmp/find_videos"
ln
32
ln -s /src /dst
bun run
29
bun run dev
cat <<EOF
29
heredoc-style file creation
python / python3
39
python -m playwright install chromium
vercel
21
vercel --version
Estimated savings
rtk discover estimates ~50K additional tokens/month if these commands had RTK-equivalents (filtering output, suppressing progress bars, compacting JSON, etc.).
rtk pkill / rtk ln / rtk open — even minimal compacting helps when called frequently
Why this matters
Even at the current ~1-2% adoption rate of RTK in mixed sessions, these top-9 unhandled commands account for roughly 5x the savings of all currently-handled commands combined for this user's profile. Users who do a lot of dev-server / SSH-driven workflows would benefit disproportionately.
Reproducing the data
Anyone with active RTK + Claude Code can reproduce:
rtk discover
The "TOP UNHANDLED COMMANDS" section is the input for prioritisation.
docker compose (vs docker-compose) is the modern form — rtk docker apparently doesn't match the two-word subcommand yet.
Heredoc / multi-line continuations (\<newline>echo, \<newline>git clone, for f; do node…) showed up 200+ times — these slip past the hook entirely because they aren't recognised as single rewritable commands. Probably out of scope for this issue but worth flagging.
Hook adoption note
Re #1643: same artefact here. rtk discover reports 0.1% adoption because the hook was installed mid-window (2 days before running discover). Post-hook rtk gain shows 46% efficiency on 23 281 commands. The "1.5M tokens saveable" number is mostly pre-hook traffic.
Reproduced rtk discover on a larger sample (rtk 0.39.0, last 30d):
Scanned: 605 sessions, 20471 Bash commands
Already using RTK: 5468 commands (26.7%)
Total saveable on existing filters: ~647K tokens
The "TOP UNHANDLED" list shows two high-frequency commands not in the original wishlist:
Command
Count (30d)
Example
timeout
213 (95+69+49 across 60/30/120)
timeout 60 node --test scripts/__tests/...
dig +short
82
dig +short webmail.example.com A
Suggested wrappers
rtk timeout <secs> <cmd> — pass-through to inner command but route its output through whatever rtk filter matches (e.g. timeout 60 node script.js → effectively timeout 60 rtk node script.js). Today the outer timeout blocks any rewrite of the inner command.
rtk dig <args> — strip the verbose default output (HEADER, QUESTION, ANSWER sections, stats) when +short isn't used; pass through cleanly when +short is present. Heavily used in DNS / hosting workflows.
Why timeout matters disproportionately
It's effectively a rewrite-blocker for many tests/dev-server invocations. In this dataset, ~213 timeout-wrapped commands wrap node, npx jest, npx playwright — none of which currently benefit from RTK filtering because the outer command isn't detected as a known wrapper.
Other observations from this sample
docker compose (161×) — rewrites correctly to rtk docker compose via the hook, but the resulting rtk docker compose <subcmd> sometimes errors with no configuration file provided when run outside a project dir. Probably benign, but worth a sanity check that rtk docker compose is a real first-class subcommand and not just an unintended pass-through.
Follow-up: transparent_prefixes (0.40) doesn't help with the biggest offender
Configured [hooks].transparent_prefixes on 0.42.0 and tested each candidate:
Prefix
Rewrite working?
env, env VAR=val
✅
nice (no args)
✅
nice -n 10
❌
time
✅
nohup
✅
stdbuf -i0
❌
timeout 60 / gtimeout 30
❌
The parser appears to stop at the first prefix-arg that is numeric or flag-style (-n 10, -i0). The biggest real-world offender — timeout <secs> <cmd> — therefore can't benefit from transparent_prefixes. Same for nice -n N and stdbuf -iN.
Suggested fix: the transparent-prefix parser should consume known numeric/flag arguments per prefix (e.g. timeout <DURATION>, gtimeout <DURATION>, nice [-n <N>], stdbuf [-iN] [-oN] [-eN]) before looking for the inner command. Could be a static per-prefix arg-grammar or a more permissive "skip until a token that looks like a known command" heuristic.
Until then, timeout-wrapped commands stay invisible to RTK — and timeout is by far the highest-frequency wrapper in dev-server / test workflows.
Feature request to add RTK wrappers for high-frequency unhandled commands (node, ssh, bun run, python, etc.) backed by real usage data showing ~50K token/month savings potential; partially overlaps with #2073.
Triaged automatically by wshm · This is an automated analysis, not a human review.
Activity
LuisEduardo100 commentedon May 14, 2026
+1 — data from another real-world session (2486 sessions, 21759 Bash commands, last 30 days, RTK 0.39.0):
Top unhandled commands (this user)
sshssh -o BatchMode=yes -o StrictHostKeyChecking=no host …nodenode diag_today_leads.jsssh kvm2ssh kvm2 'docker ps --format "{{.Names}}…"'sshpasssshpass -p '***' ssh user@host …python3python3 /home/.../script.pypnpm(passthrough)pnpm --filter @scope/pkg testgit checkoutgit checkout --theirs pnpm-lock.yamlgit mergegit merge --no-ff -X theirs branchgit rev-parsegit rev-parse HEADdocker composedocker compose versionNotes specific to this profile
sshpass+ssh kvm2). A heavy infra/ops workflow — the existing Add wrappers for top unhandled commands: node, ssh, bun run, python, cat heredoc #1802 proposal forrtk ssh <host> <cmd>would land hard here, especially if it can apply RTK rewrites to the remote command (e.g.ssh host 'rtk docker ps').git rev-parse/git merge/git checkoutshow up becausertk gitcurrently only covers a subset of subcommands — passthrough-with-filtering for the rest would help (feat(discover): track passthrough git/cargo/pnpm subcommands #888 territory).docker compose(vsdocker-compose) is the modern form —rtk dockerapparently doesn't match the two-word subcommand yet.\<newline>echo,\<newline>git clone,for f; do node…) showed up 200+ times — these slip past the hook entirely because they aren't recognised as single rewritable commands. Probably out of scope for this issue but worth flagging.Hook adoption note
Re #1643: same artefact here.
rtk discoverreports 0.1% adoption because the hook was installed mid-window (2 days before runningdiscover). Post-hookrtk gainshows 46% efficiency on 23 281 commands. The "1.5M tokens saveable" number is mostly pre-hook traffic.Happy to share more raw breakdowns if useful.
Jochiej commentedon May 27, 2026
Additional data — heavier-user sample (4x larger)
Reproduced
rtk discoveron a larger sample (rtk 0.39.0, last 30d):The "TOP UNHANDLED" list shows two high-frequency commands not in the original wishlist:
timeout60/30/120)timeout 60 node --test scripts/__tests/...dig +shortdig +short webmail.example.com ASuggested wrappers
rtk timeout <secs> <cmd>— pass-through to inner command but route its output through whateverrtkfilter matches (e.g.timeout 60 node script.js→ effectivelytimeout 60 rtk node script.js). Today the outertimeoutblocks any rewrite of the inner command.rtk dig <args>— strip the verbose default output (HEADER, QUESTION, ANSWER sections, stats) when+shortisn't used; pass through cleanly when+shortis present. Heavily used in DNS / hosting workflows.Why
timeoutmatters disproportionatelyIt's effectively a rewrite-blocker for many tests/dev-server invocations. In this dataset, ~213
timeout-wrapped commands wrapnode,npx jest,npx playwright— none of which currently benefit from RTK filtering because the outer command isn't detected as a known wrapper.Other observations from this sample
docker compose(161×) — rewrites correctly tortk docker composevia the hook, but the resultingrtk docker compose <subcmd>sometimes errors withno configuration file providedwhen run outside a project dir. Probably benign, but worth a sanity check thatrtk docker composeis a real first-class subcommand and not just an unintended pass-through.Jochiej commentedon May 27, 2026
Follow-up:
transparent_prefixes(0.40) doesn't help with the biggest offenderConfigured
[hooks].transparent_prefixeson 0.42.0 and tested each candidate:env,env VAR=valnice(no args)nice -n 10timenohupstdbuf -i0timeout 60/gtimeout 30The parser appears to stop at the first prefix-arg that is numeric or flag-style (
-n 10,-i0). The biggest real-world offender —timeout <secs> <cmd>— therefore can't benefit fromtransparent_prefixes. Same fornice -n Nandstdbuf -iN.Reproduction:
Suggested fix: the transparent-prefix parser should consume known numeric/flag arguments per prefix (e.g.
timeout <DURATION>,gtimeout <DURATION>,nice [-n <N>],stdbuf [-iN] [-oN] [-eN]) before looking for the inner command. Could be a static per-prefix arg-grammar or a more permissive "skip until a token that looks like a known command" heuristic.Until then,
timeout-wrapped commands stay invisible to RTK — andtimeoutis by far the highest-frequency wrapper in dev-server / test workflows.pszymkowiak commentedon May 27, 2026
🔍 Automated Triage
featuremediumSummary
Feature request to add RTK wrappers for high-frequency unhandled commands (node, ssh, bun run, python, etc.) backed by real usage data showing ~50K token/month savings potential; partially overlaps with #2073.
Triaged automatically by wshm · This is an automated analysis, not a human review.
guillaumejay commentedon Jul 4, 2026
Same pattern here:
cat > /tmp/pr-body.md <<'EOF' ... EOF— 14 occurrences/30d in a separatertk discoverscan, mainly building PR/commit message bodies beforegh pr create/git commit -F.