Skip to content

RTK emits a false "No hook installed" warning when the Claude Code hook is configured at the project level rather than globally #2024

@iangchan

Description

@iangchan

AI Slop bug report:

Version

rtk 0.39.0

Reproduction Steps

  1. Install the RTK hook in a project-level .claude/settings.json (not the global ~/.claude/settings.json):
    {
      "hooks": {
        "PreToolUse": [{
          "matcher": "Bash",
          "hooks": [{ "type": "command", "command": "rtk hook claude" }]
        }]
      }
    }
  2. Do NOT add the hook to ~/.claude/settings.json.
  3. Run any command that RTK intercepts (e.g., git show --stat HEAD).

Expected Behavior

No warning. The hook is installed and working — RTK is intercepting and rewriting Bash commands. Token savings are being recorded correctly (rtk gain shows saved tokens).

Actual Behavior

Every intercepted command emits this warning in its output:

[rtk] /!\ No hook installed — run `rtk init -g` for automatic token savings

Root Cause

RTK's "no hook installed" check only looks for a global hook registration. It does not check whether rtk hook claude is already running (which it demonstrably is, since the hook process itself is what emits the warning). Project-level Claude Code hooks are a valid and intentional installation path — teams version their .claude/settings.json alongside the codebase so all contributors get the hook automatically.

Impact

  • False warning pollutes every intercepted command's output.
  • Warning appears inside token-filtered output returned to the LLM, consuming the tokens RTK is trying to save.
  • No way to suppress it — rtk config exposes no option to disable this warning.

Suggested Fix

Before emitting the warning, check whether rtk hook claude is actually running (e.g., inspect RTK_HOOK_ACTIVE env var, or detect that stdin contains a hook payload). If the hook is active, suppress the warning regardless of global registration state. Alternatively, expose a [display] show_hook_warning = false config option.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions