Skip to content

Commit f3b2fcc

Browse files
committed
fix(hooks): fix agent-usage-reminder case-sensitivity bug in tool name matching
- Change TARGET_TOOLS and AGENT_TOOLS to Set<string> 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)
1 parent 2c6dfea commit f3b2fcc

File tree

2 files changed

+14
-18
lines changed

2 files changed

+14
-18
lines changed

src/hooks/agent-usage-reminder/constants.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,24 @@ export const AGENT_USAGE_REMINDER_STORAGE = join(
77
"agent-usage-reminder",
88
);
99

10-
export const TARGET_TOOLS = [
11-
"Grep",
10+
// All tool names normalized to lowercase for case-insensitive matching
11+
export const TARGET_TOOLS = new Set([
12+
"grep",
1213
"safe_grep",
13-
"Glob",
14+
"glob",
1415
"safe_glob",
15-
"WebFetch",
16+
"webfetch",
1617
"context7_resolve-library-id",
1718
"context7_get-library-docs",
1819
"websearch_exa_web_search_exa",
19-
"grep_app_searchGitHub",
20-
] as const;
20+
"grep_app_searchgithub",
21+
]);
2122

22-
export const AGENT_TOOLS = [
23-
"Task",
23+
export const AGENT_TOOLS = new Set([
24+
"task",
2425
"call_omo_agent",
2526
"background_task",
26-
] as const;
27+
]);
2728

2829
export const REMINDER_MESSAGE = `
2930
[Agent Usage Reminder]

src/hooks/agent-usage-reminder/index.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ interface ToolExecuteInput {
1111
tool: string;
1212
sessionID: string;
1313
callID: string;
14-
parentSessionID?: string;
1514
}
1615

1716
interface ToolExecuteOutput {
@@ -60,19 +59,15 @@ export function createAgentUsageReminderHook(_ctx: PluginInput) {
6059
input: ToolExecuteInput,
6160
output: ToolExecuteOutput,
6261
) => {
63-
const { tool, sessionID, parentSessionID } = input;
62+
const { tool, sessionID } = input;
63+
const toolLower = tool.toLowerCase();
6464

65-
// Only run in root sessions (no parent = main session)
66-
if (parentSessionID) {
67-
return;
68-
}
69-
70-
if ((AGENT_TOOLS as readonly string[]).includes(tool)) {
65+
if (AGENT_TOOLS.has(toolLower)) {
7166
markAgentUsed(sessionID);
7267
return;
7368
}
7469

75-
if (!(TARGET_TOOLS as readonly string[]).includes(tool)) {
70+
if (!TARGET_TOOLS.has(toolLower)) {
7671
return;
7772
}
7873

0 commit comments

Comments
 (0)