bug(hooks): exclude_commands has no effect on rtk rewrite or hook output in 0.36.0
#1335 opened on Apr 15, 2026
Description
Environment
- rtk 0.36.0 (Homebrew, /opt/homebrew/bin/rtk)
- macOS darwin 25.3.0 (arm64)
- Claude Code 2.1.109, hook
rtk-rewrite.sh(shipped byrtk init -g) - Config path:
~/Library/Application Support/rtk/config.toml(macOSdirs::config_dir())
Repro
- Write
~/Library/Application Support/rtk/config.toml:[hooks] exclude_commands = ["^curl", "curl"] rtk config→ prints the value back, confirming config is loaded.strings $(which rtk) | grep exclude_commands→ symbol present in binary.rtk rewrite "curl http://example.com"→ printsrtk curl http://example.com(exit 0).
Expected
rtk rewrite "curl ..." exits 1 (command excluded) per PR #342 test test_rewrite_excludes_curl, and the Claude Code hook passes curl through unchanged.
Actual
Both the CLI rewrite subcommand and the installed Claude Code hook rewrite curl despite exclude_commands = ["curl"]. Only rtk proxy curl ... reliably bypasses filtering.
Also tried
Project-local .rtk/filters.toml with match_command = "^curl .*/health" — verified + trusted via rtk trust, but only applies to unhandled commands; does not override the built-in curl → rtk curl rewrite.
Likely cause
src/hooks/rewrite_cmd.rs reads config.hooks.exclude_commands and passes it to registry::rewrite_command. The top-level src/rewrite_cmd.rs (the rtk rewrite CLI subcommand) does not appear to thread the exclude list through the same path — two separate code paths, only one wired. Same shape as #1134 (config surface present, wiring absent).
Related
- #243 (open — @nhumrich's 2026-03-27 comment matches this exactly)
- #219 (open — purportedly "fixed in v0.26.0" but still reported broken)
- #917 (open — adjacent tokenizer bug on env-var-prefixed commands)
Downstream tracking
dbl-0/ha-config#1907