From f3b2fccba787f1a8a861254347d16c09871e52a1 Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Sat, 13 Dec 2025 22:13:02 +0900 Subject: [PATCH] fix(hooks): fix agent-usage-reminder case-sensitivity bug in tool name matching MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Change TARGET_TOOLS and AGENT_TOOLS to Set for O(1) lookup - Normalize tool names to lowercase for case-insensitive comparison - Remove unnecessary parentSessionID guard that blocked main session triggers - Fixes issue where Glob/Grep tool calls weren't showing agent usage reminder 🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode) --- src/hooks/agent-usage-reminder/constants.ts | 19 ++++++++++--------- src/hooks/agent-usage-reminder/index.ts | 13 ++++--------- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/src/hooks/agent-usage-reminder/constants.ts b/src/hooks/agent-usage-reminder/constants.ts index 904914a..5ef7ba6 100644 --- a/src/hooks/agent-usage-reminder/constants.ts +++ b/src/hooks/agent-usage-reminder/constants.ts @@ -7,23 +7,24 @@ export const AGENT_USAGE_REMINDER_STORAGE = join( "agent-usage-reminder", ); -export const TARGET_TOOLS = [ - "Grep", +// All tool names normalized to lowercase for case-insensitive matching +export const TARGET_TOOLS = new Set([ + "grep", "safe_grep", - "Glob", + "glob", "safe_glob", - "WebFetch", + "webfetch", "context7_resolve-library-id", "context7_get-library-docs", "websearch_exa_web_search_exa", - "grep_app_searchGitHub", -] as const; + "grep_app_searchgithub", +]); -export const AGENT_TOOLS = [ - "Task", +export const AGENT_TOOLS = new Set([ + "task", "call_omo_agent", "background_task", -] as const; +]); export const REMINDER_MESSAGE = ` [Agent Usage Reminder] diff --git a/src/hooks/agent-usage-reminder/index.ts b/src/hooks/agent-usage-reminder/index.ts index 97284ca..bc7f324 100644 --- a/src/hooks/agent-usage-reminder/index.ts +++ b/src/hooks/agent-usage-reminder/index.ts @@ -11,7 +11,6 @@ interface ToolExecuteInput { tool: string; sessionID: string; callID: string; - parentSessionID?: string; } interface ToolExecuteOutput { @@ -60,19 +59,15 @@ export function createAgentUsageReminderHook(_ctx: PluginInput) { input: ToolExecuteInput, output: ToolExecuteOutput, ) => { - const { tool, sessionID, parentSessionID } = input; + const { tool, sessionID } = input; + const toolLower = tool.toLowerCase(); - // Only run in root sessions (no parent = main session) - if (parentSessionID) { - return; - } - - if ((AGENT_TOOLS as readonly string[]).includes(tool)) { + if (AGENT_TOOLS.has(toolLower)) { markAgentUsed(sessionID); return; } - if (!(TARGET_TOOLS as readonly string[]).includes(tool)) { + if (!TARGET_TOOLS.has(toolLower)) { return; }