rtk icon indicating copy to clipboard operation
rtk copied to clipboard

Feature request: disable rtk hook for one process tree

Open ioamas opened this issue 3 months ago • 1 comments

Feature request: a way to make rtk hook stand down for a single process tree

rtk version: 0.45.0 (Homebrew) Context: Claude Code PreToolUse hook (rtk hook claude)

WHAT I'M DOING

I run an agent orchestrator that spawns claude as a child process. It has its own permission layer, and it needs to see the command the model actually wrote. rtk's hook rewrites that command before my layer sees it, and I'd like a way to opt those specific child processes out — without changing anything about my own interactive sessions, where I want rtk exactly as it is.

WHAT I TRIED

RTK_DISABLED=1 does not affect the hook. Same output either way:

$ echo '{"session_id":"s1","cwd":"/tmp","hook_event_name":"PreToolUse", "tool_name":"Bash","tool_input":{"command":"npm run build"}}'
| RTK_DISABLED=1 rtk hook claude

{"hookSpecificOutput":{"hookEventName":"PreToolUse", "permissionDecisionReason":"RTK auto-rewrite", "updatedInput":{"command":"rtk npm run build"}, "permissionDecision":"allow"}}

The config has [hooks] exclude_commands and transparent_prefixes, but those are global and per-command-pattern. I don't want to exclude a command everywhere — I want the same commands filtered normally in my own shell and left alone in one spawned process tree. An env var is the natural scope for that, since a parent controls its children's environment and nothing else's.

THE ASK

An env var that makes rtk hook <agent> a no-op — read stdin, print nothing, exit 0 — so the host CLI proceeds as if the hook were not installed. Something like:

RTK_HOOK_DISABLED=1

Extending RTK_DISABLED=1 to cover the hook path would work equally well if that matches the intended meaning of the existing variable.

SECOND, SMALLER POINT

The hook returns "permissionDecision":"allow" for some commands. npm run build above returns it; git status returns a rewrite with no permissionDecision field at all.

In Claude Code that field is a real permission vote, not a formatting hint — an "allow" from a hook can approve a tool call. If the intent is only to rewrite the command, omitting permissionDecision (as the git status path already does) would leave the host's own permission rules in charge. If auto-approval is intended, an opt-in config flag would make it a visible choice.

Not urgent, and the inconsistency between the two commands is what made me think it might be unintentional.

Thanks — rtk is genuinely useful, and this is the only friction I've hit.

ioamas avatar Aug 31 '26 18:08 ioamas

Closing as a duplicate of #1153, which asks for the same environment-variable bypass of the rewrite and hook path and carries the fuller discussion plus two candidate PRs. The smaller point you raised is already handled on current develop: the hook only asserts a permission decision for an explicit user-configured allow rule, otherwise it leaves the host's own rules in charge. Please follow up on #1153.

KuSh avatar Sep 19 '26 02:09 KuSh