Skip to content

rtk verify and the "No hook installed" banner reject a native hook that carries any documented flag #4211

Open

Description

@vpan-utbm

Summary

Hook detection accepts the native inline hook only when the command string is exactly rtk hook claude. Adding any argument — including the two flags documented in rtk hook --help, --ultra-compact and --skip-env — makes RTK consider the hook absent.

The hook itself still works perfectly; only the detection is wrong. The result is a permanent SKIP RTK hook not installed in rtk verify plus the recurring [rtk] /!\ No hook installed — run 'rtk init -g' banner, on an installation that is correct and active.

This is distinct from #913 / #1734 / #3731, which are about other agents (OpenCode, Codex, Cursor) not being recognised. Here it is the Claude native hook, in the very form rtk init -g writes, that is rejected as soon as it carries a documented flag.

Environment

  • RTK 0.49.0 (rtk-x86_64-unknown-linux-musl.tar.gz, binary in ~/.local/bin/rtk)
  • Linux 6.1.0 (Debian), Claude Code 2.1.280
  • Hook installed in ~/.claude/settings.json:
    { "hooks": { "PreToolUse": [ { "matcher": "Bash", "hooks": [
        { "type": "command", "command": "rtk hook claude --ultra-compact --skip-env" } ] } ] } }

Reproduction

probe() {  # $1 = command string to put in settings.json
  H=$(mktemp -d); mkdir -p "$H/.claude"
  printf '{"hooks":{"PreToolUse":[{"matcher":"Bash","hooks":[{"type":"command","command":"%s"}]}]}}' "$1" \
    > "$H/.claude/settings.json"
  printf '%-45s -> %s\n' "$1" "$(HOME=$H rtk verify 2>&1 | grep -E 'native binary hook|not installed' | head -1)"
}
probe 'rtk hook claude'
probe 'rtk hook claude --ultra-compact'
probe 'rtk hook claude --skip-env'
probe 'rtk hook claude --ultra-compact --skip-env'
probe '/usr/local/bin/rtk hook claude'
probe 'rtk  hook  claude'
probe 'rtk --ultra-compact hook claude'

Observed on 0.49.0:

command in settings.json result
rtk hook claude PASS native binary hook registered in settings.json
rtk hook claude (doubled spaces) PASS
/usr/local/bin/rtk hook claude (absolute path) PASS
rtk hook claude --ultra-compact SKIP RTK hook not installed
rtk hook claude --skip-env SKIP
rtk hook claude --ultra-compact --skip-env SKIP
rtk --ultra-compact hook claude (flag before subcommand) SKIP

A path prefix and repeated whitespace are tolerated, so the matcher does normalise somewhat — but any extra token, in any position, fails. There is no placement of the flags that keeps both the flags and the detection.

Meanwhile the hook is demonstrably live:

$ echo '{"tool_name":"Bash","tool_input":{"command":"git status"}}' \
  | rtk hook claude --ultra-compact --skip-env
{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecisionReason":"RTK auto-rewrite",
 "updatedInput":{"command":"rtk git status"},"permissionDecision":"allow"}}

Expected

Any command whose resolved invocation is rtk hook claude should be recognised regardless of the flags it carries — --ultra-compact and --skip-env are documented options of that exact subcommand, so a hook using them is a supported configuration, not an unknown one.

The same predicate appears to back the [rtk] /!\ No hook installed banner, so fixing it once should silence both.

Impact

Low severity, but it is self-defeating in two ways: the warning tells users to run rtk init -g, which would overwrite their flagged hook with the bare form and silently drop --ultra-compact/--skip-env; and the banner itself spends tokens on every affected install, which is the opposite of what RTK is for. It also makes rtk verify unusable as a health check for anyone who tuned their hook.

Activity

  1. KuSh commented on Sep 24, 2026

    @KuSh
    Collaborator

    The same detector (hook_check::binary_hook_registered) also fails the other way. It ignores the group matcher and the hook type, so a registration Claude Code never runs on Bash counts as installed and the banner stays silent. With #4151, rtk init --show checks both and reports it correctly, so once it merges the two disagree.

    Probed with rtk ls . (banner) and rtk init --show, LC_ALL=C, fresh HOME, on develop f5e104e and on #4151's head:

    ~/.claude/settings.json banner (both) --show develop --show #4151
    {} (control) No hook installed [warn] [warn]
    matcher: "Bash", rtk hook claude none [ok] [ok]
    matcher: "Read", rtk hook claude none [ok] [warn]
    matcher: "Bash", type: "prompt", command: "rtk hook claude" none [ok] [warn]

    Reading through hook_already_present (which after #4151 applies Claude's matcher rules and the command/type check) would make the banner and --show agree on matcher and type; the flag handling this issue is about still needs its own fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions