Repository navigation
Description
Problem
RTK filters a command by the program at the start of the argv. A second shell — docker exec, kubectl exec, ssh, aws ssm, nix develop -c — hides that program, so the bytes that actually reach the model are the inner command's output and they are not filtered.
[hooks] transparent_prefixes is the only general mechanism, and it is an exact string. docker exec mycontainer can be configured; docker exec -it web bash -lc "…", kubectl exec -n prod pod -- …, and sshpass -p … ssh host … cannot. It also injects rtk into the remote argv, which changes the command that runs and fails when rtk is not on the far side.
Per-tool tickets already cover pieces of this (#275, #927, #2057, #2268, #4190). A filter inside each module will not cover the next wrapper (podman, nix, SSM, wsl).
What 1.1.0 does
rtk rewrite on 1.1.0:
| Command | Rewrite | Inner output |
|---|---|---|
docker exec web ls -la /var |
rtk docker exec … |
Passthrough. exec is not a filtered docker subcommand. |
docker exec -it web bash -lc "ls -la && git status" |
same, script untouched | The local bash -c rewriter does not see a script behind docker exec. |
kubectl exec -n prod pod -- ls -la |
none | The kubectl rule is only get|logs|describe|apply. |
ssh host "ls -la && df -h" |
rtk ssh … |
src/filters/ssh.toml strips banners and caps lines. The ls filter is not applied. |
aws ssm send-command … --parameters commands=ls |
rtk aws … |
The AWS JSON filter runs on the API response. send-command does not print the remote stdout. |
nix develop -c cargo test |
none | No rule. |
The local cases that do recurse are a different problem: quoted sh/bash/zsh/fish -c (one level), and the process wrappers timeout, time, nice, nohup. Those still run rtk on this machine.
Proposal
One exec-boundary parser, used by the rewriter and the runner, next to PROCESS_WRAPPERS and parse_shell_wrapper in src/discover/registry.rs.
It recognizes the inner argv and stops when it cannot parse it:
docker/podmanexec, anddocker compose exec, including flags and--kubectl/ocexec … -- <cmd>ssh [flags] host <cmd>andssh [flags] host -- <cmd>, when the remote command is argv rather than an interactive shellnix develop/nix shell/nix runwith-cor--commandaws ssmonly for an argv-shaped--parameters commands=…
The hook rewrites the outer command to rtk <tool> …. The runner parses the inner argv, selects the filter that rtk git or rtk ls would have used, and applies it to the captured stdout. The remote command is unchanged, so this works when rtk is not installed in the container or on the host.
Fail closed. An unparsed flag, a command buried in a JSON file, start-session, or an interactive SSH session stays on today's path. send-command stdout is an invocation id, so filtering it does not truncate the remote output. nix build is a build log, not an exec boundary.
Injecting rtk after the boundary stays the opt-in transparent_prefixes behavior. It changes the command that runs.
Non-goals
- A new filter module per tool.
- Rewriting the inner script of
docker exec container bash -lc "…". That is the existing shell-wrapper parser, and it should keep refusing anything it cannot attest. - Guessing a filter from output shape when the inner argv is not recognizable. Generic truncation already exists; this is about applying the inner command's own filter.
Next step
Happy to open the PR against develop as soon as this shape suits you. I would keep the first PR to the shared parser and one consumer (so review stays on the boundary, not on every tool at once), with tests for the fail-closed cases above.
Activity
rtk-wshm-sync-bot commentedon Nov 9, 2026
🔍 Automated Triage
featuremediumSummary
Well-researched proposal for a unified exec-boundary parser (docker/kubectl/ssh/nix/aws ssm exec) so inner command output gets filtered consistently instead of per-tool patches; author offers to PR.
📁 Relevant files
src/discover/registry.rssrc/filters/ssh.tomlSuggested Actions
docker exec#275, kubectl rewrite misses --context flag, exec subcommand, and variable assignments #927,kubectl execsupport — truncate output before reaching LLM context #2057, Built-in filters for ssh / dig / lsof / scp (custom TOML filters don't reach the PreToolUse hook) #2268, Hook rewrite coverage: openssl and awk unmapped; sshpass unusable as a transparent prefix #4190 when scoping the first PRparse_exec_boundaryfn beside PROCESS_WRAPPERS/parse_shell_wrapper in src/discover/registry.rsTriaged automatically by wshm · This is an automated analysis, not a human review.
BSD-Yassin commentedon Nov 9, 2026
I tried this against RTK 1.1.0. Same inner commands, stdout only. The last column is the size of this feature's output as a percentage of what RTK 1.1.0 prints.
nix shell -cis not rewritten in 1.1.0, so that column is the command's own stdout.docker execandkubectl execare rewritten, and the inner stdout is passed through.sshalready goes through the banner filter and the line cap.nix shell -c git log -n 120docker exec git log -n 120kubectl exec -- git log -n 120ssh git log -n 120nix shell -c find(tree, skip.git)docker exec findkubectl exec -- findssh findnix shell -c grep -Rdocker exec grep -Rkubectl exec -- grep -Rssh grep -Rnix shell -c journalctl -n 400ssh journalctl -n 400Rows are not the same corpus, so the percentage is only meaningful inside a row.
git log,find, andjournalctlare where the cut shows up. A smallgrepstays close to today's output: oversshit is 85.5% of the already capped text, and the grouped form uses more lines.The same comparison for several commands at once. RTK 1.1.0 leaves the whole stream unfiltered.
kubectl exec -- findkubectl exec -c -- findin three containersxargsofkubectl exec -- findansiblead-hocfindansiblead-hocjournalctl -n 80The remote argv is unchanged. The branch is here if you want to try it: https://github.com/BSD-Yassin/rtk/tree/feat/exec-boundary
BSD-Yassin commentedon Nov 24, 2026
Is nobody interested on that one ? I'll gladly take it on my own. As you can see, I'm proposing :