rtk-ai/rtk

bug(hooks): exclude_commands has no effect on rtk rewrite or hook output in 0.36.0

Open

#1335 opened on Apr 15, 2026

View on GitHub
 (1 comment) (0 reactions) (1 assignee)Rust (48,085 stars) (2,914 forks)batch import
bugeffort-smallgood first issueresolved-pending-close

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 by rtk init -g)
  • Config path: ~/Library/Application Support/rtk/config.toml (macOS dirs::config_dir())

Repro

  1. Write ~/Library/Application Support/rtk/config.toml:
    [hooks]
    exclude_commands = ["^curl", "curl"]
    
  2. rtk config → prints the value back, confirming config is loaded.
  3. strings $(which rtk) | grep exclude_commands → symbol present in binary.
  4. rtk rewrite "curl http://example.com" → prints rtk 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

Contributor guide