rtk-ai/rtk

Persistent "No hook installed" warning on Windows after rtk init -g --opencode

Open

#913 建立於 2026年3月29日

在 GitHub 查看
 (11 留言) (9 反應) (1 負責人)Rust (48,085 star) (2,914 fork)batch import
bugeffort-smallgood first issueresolved-pending-close

描述

Description

After running rtk init -g --opencode (and also rtk init -g), the command rtk gain still shows this warning:

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

This warning appears every time even though:

  • The OpenCode plugin has been installed successfully (rtk init --show shows [ok] OpenCode: plugin installed)
  • rtk --version works correctly (currently v0.34.1)
  • rtk gain successfully shows token savings statistics
  • Cursor hook is also installed and working

Steps to Reproduce

  1. Install RTK on Windows (rtk-x86_64-pc-windows-msvc.zip)
  2. Add C:\rtk to PATH
  3. Run rtk init -g --opencode
  4. Restart OpenCode
  5. Run rtk gain

→ Warning still appears.

Expected Behavior

rtk gain should recognize that the OpenCode plugin is installed and not show the "No hook installed" warning (or show a more accurate message for OpenCode/Windows).

Actual Behavior

The warning persists, which is confusing even though token savings are working and the plugin is active.

Environment

  • OS: Windows 11
  • RTK Version: 0.34.1
  • Tool: OpenCode (with custom plugin rtk.ts)
  • Other hooks: Cursor hook also installed

Additional Context

According to the troubleshooting docs, OpenCode uses a custom tool.execute.before plugin instead of native Unix-style hooks. The detection logic in rtk gain seems to only check for native hooks, causing this misleading warning on Windows.

It would be great if RTK could:

  • Better detect OpenCode plugin installation on Windows, or
  • Show a more specific message like "OpenCode plugin installed (native hook not available on Windows)" when the plugin is present.

Thanks!

貢獻者指南