Skip to content

Need config to suppress warnings like "No hook installed — run rtk init -g for automatic token savings" #682

Closed

Description

@fondoger

I'm using rtk in Windows with my Claude Code. According to the guidance, I added rtk's instructions to my CLAUDE.md instead of configuring Claude Code Hooks.

But every time when Claude Code run some bash command with rtk, it will print a warning message like below:

● Let me check the current state of these files.
● Bash(rtk git log --oneline -20)
  ⎿  [rtk] /!\ No hook installed — run `rtk init -g` for automatic token savings               !!!!!! Unexpected warnings.
     7cb555668 Fix some package versions
     f214d1b2e Fix csproj
     … +18 lines (ctrl+o to expand)
● Searched for 1 pattern (ctrl+o to expand)

Activity

  1. Macho0x commented on Mar 18, 2026

    @Macho0x

    I have the same but I'm running Opencode -- I do not have Claude installed. As you can see on my screenshot my token saver is indeed working but I am still receiving the same warning.

    Image
  2. btbxbob commented on Mar 19, 2026

    @btbxbob

    it wasted a lot token than reduce it now.

    # Commits final advanced resource seed fix
    $ rtk git add tests/functional/advanced-resources.test.js && rtk git commit -m "fix(tests): seed missing glass for advanced tech flow" && rtk git status --short
    [rtk] /!\ No hook installed — run `rtk init -g` for automatic token savings
    ok 1 file changed, 1 insertion(+)
    [rtk] /!\ No hook installed — run `rtk init -g` for automatic token savings
    ok
    [rtk] /!\ No hook installed — run `rtk init -g` for automatic token savings
     M target/.rustc_info.json
    ?? jenkins.cookies
    ?? test-game-analysis.js
    ?? tests/experience.test.js
    
  3. fondoger commented on Mar 19, 2026

    @fondoger
    Author

    I believe this issue needs an urgent fix for Windows users.

  4. aimardcr commented on Mar 19, 2026

    @aimardcr

    Getting the same issue here for Windows

  5. added
    effort-small
    enhancement
    good first issue
    on Mar 20, 2026
  6. pszymkowiak commented on Mar 20, 2026

    @pszymkowiak
    Collaborator

    wshm · Automated triage by AI

    🔍 Automated Triage

    ✨ Category feature
    🟢 Priority low
    🎯 Confidence 91%

    Summary

    Request for a config option to suppress the 'No hook installed' warning; PR #776 is already in progress addressing this.

    This looks like a simple fix that could be auto-resolved. Repo maintainers can use /wshm fix to attempt it.


    Triaged automatically by wshm · This is an automated analysis, not a human review.

  7. ursoos commented on Mar 21, 2026

    @ursoos

    Same problem for win 11.

  8. added a commit that references this issue on Mar 21, 2026
    02ea499
  9. mvanhorn commented on Mar 21, 2026

    @mvanhorn
    Contributor

    Implemented in #776 - adds hooks.suppress_hook_warning config option and RTK_SUPPRESS_HOOK_WARNING env var to disable the warning permanently.

  10. 16 remaining items

  11. nidhi-singh02 commented on May 6, 2026

    @nidhi-singh02

    Should be resolved in 0.37.2

    i am on version 0.38.0, i am still facing this issue on mac via codex, pfa the snippet below

    do i need to enable any settings/config for this ? TIA

    Image
  12. killo3967 commented on May 6, 2026

    @killo3967

    Summary

    rtk gain and rtk log still show:

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

    even when RTK is installed, working, and being used from OpenCode.

    This is confusing in the OpenCode setup, because the warning suggests that RTK is not properly installed or not active, while in practice RTK itself works and records savings.

    Related: #603

    Actual problem being reported

    This is not a report that RTK itself is broken.

    RTK works correctly in my setup.

    The problem is that the warning message:

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

    still appears in commands like:

    • rtk gain
    • rtk log

    even when using the OpenCode plugin flow.

    That warning is misleading for OpenCode users, because it implies that automatic integration is missing, when the OpenCode integration does not use the same mechanism as the classic Claude Code hook.

    Environment

    • OS: Windows 11
    • Shell: PowerShell
    • OpenCode: 0.38
    • RTK: installed and working
    • Plugin path: C:\Users\tomas\.config\opencode\plugins\rtk.ts

    Context

    Issue #603 already states that the No hook installed message is checking for the Claude Code hook specifically, not the OpenCode plugin.

    If that is the intended current behavior, then the problem is that rtk gain / rtk log are still surfacing a warning that is not accurate for OpenCode users.

    In other words:

    • RTK works
    • OpenCode support exists via plugin
    • but RTK still emits a warning that sounds like the setup is incomplete or broken

    Plugin used

    import type { Plugin } from "@opencode-ai/plugin"
    
    // RTK OpenCode plugin — rewrites commands to use rtk for token savings.
    // Requires: rtk >= 0.23.0 in PATH.
    //
    // This is a thin delegating plugin: all rewrite logic lives in `rtk rewrite`,
    // which is the single source of truth (src/discover/registry.rs).
    // To add or change rewrite rules, edit the Rust registry — not this file.
    
    export const RtkOpenCodePlugin: Plugin = async ({ $ }) => {
      try {
        if (process.platform === "win32") {
          await $`where.exe rtk`.quiet()
        } else {
          await $`which rtk`.quiet()
        }
      } catch {
        console.warn("[rtk] rtk binary not found in PATH — plugin disabled")
        return {}
      }
    
      return {
        "tool.execute.before": async (input, output) => {
          const tool = String(input?.tool ?? "").toLowerCase()
    
          if (!["bash", "shell", "powershell", "cmd"].includes(tool)) return
    
          const args = output?.args
          if (!args || typeof args !== "object") return
    
          const command = (args as Record<string, unknown>).command
          if (typeof command !== "string" || !command) return
    
          try {
            const result = await $`rtk rewrite ${command}`.quiet().nothrow()
            const rewritten = String(result.stdout).trim()
    
            if (rewritten && rewritten !== command) {
              ;(args as Record<string, unknown>).command = rewritten
            }
          } catch {
            // rtk rewrite failed — pass through unchanged
          }
        },
      }
    }

    Evidence that RTK is working

    Example output from rtk gain:

    RTK Token Savings (Global Scope)
    ════════════════════════════════════════════════════════════
    
    Total commands:    547
    Input tokens:      488.6K
    Output tokens:     245.7K
    Tokens saved:      243.0K (49.7%)
    Total exec time:   65m5s (avg 7.1s)
    Efficiency meter: ████████████░░░░░░░░░░░░ 49.7%
    
    [warn] No hook installed — run `rtk init -g` for automatic token savings
    

    This clearly shows that RTK is active and collecting savings, yet the warning still claims that no hook is installed.

    Expected behavior

    One of these should happen:

    1. rtk gain / rtk log should detect the OpenCode plugin integration and avoid showing the warning in that context, or
    2. the warning text should be made more precise, for example clarifying that it refers only to the classic hook mechanism and may not apply to OpenCode plugin users.

    Actual behavior

    rtk gain and rtk log still show:

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

    even though RTK is installed and functioning.

    Why this matters

    For OpenCode users, this warning strongly suggests that the setup is incomplete or broken.

    That leads to unnecessary debugging, confusion, and duplicate support requests, especially on Windows where users may already be dealing with plugin-specific setup changes such as replacing which with where.exe.

    Suggested fix

    Possible options:

    • suppress the warning when OpenCode plugin integration is detected
    • add explicit detection for OpenCode plugin mode
    • change the warning text to something like:
    [warn] No classic shell hook installed. This warning may not apply if you are using OpenCode plugin integration.
    

    Questions

    1. Is this warning expected to remain visible for OpenCode users even when RTK is working?
    2. Is there a plan to distinguish classic hook mode from OpenCode plugin mode in rtk gain / rtk log?
    3. Would you accept a PR to improve the warning text or detection logic?
  13. tangrufus commented on May 21, 2026

    @tangrufus

    +1 for RTK_SUPPRESS_HOOK_WARNING especially rtk doesn't detect hooks in claude plugins

  14. ramarivera commented on Jun 8, 2026

    @ramarivera

    sorry for pinging @aeppling / @pszymkowiak but any chance you would take a PR for this issue? if so more than happy to raise one because i cna almost imagine the gains i havev from rtk are being cancelled out by this warning

  15. added a commit that references this issue on Aug 13, 2026
    4e258e7
  16. Omzig commented on Aug 14, 2026

    @Omzig

    i have this problem in the github copilot GUI chat, because hooks are disabled in my org for the GUI right now because it is still preview

  17. added a commit that references this issue on Sep 3, 2026
    dfb8886
  18. removed
    resolved-pending-close
    on Sep 5, 2026
  19. added a commit that references this issue on Sep 16, 2026
    0e7a41e
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

    area:configeffort-smallenhancementgood first issueplatform:windowspriority:low

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions