From 35edcecd8f1ef214d2528de37565926b3eeb9003 Mon Sep 17 00:00:00 2001 From: ismeth Date: Thu, 26 Feb 2026 16:15:00 +0100 Subject: [PATCH] fix(agent-usage-reminder): skip reminders for non-orchestrator subagents --- src/hooks/agent-usage-reminder/hook.ts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/hooks/agent-usage-reminder/hook.ts b/src/hooks/agent-usage-reminder/hook.ts index bc7f3243..ef2a7b3d 100644 --- a/src/hooks/agent-usage-reminder/hook.ts +++ b/src/hooks/agent-usage-reminder/hook.ts @@ -6,6 +6,8 @@ import { } from "./storage"; import { TARGET_TOOLS, AGENT_TOOLS, REMINDER_MESSAGE } from "./constants"; import type { AgentUsageState } from "./types"; +import { getSessionAgent } from "../../features/claude-code-session-state"; +import { getAgentConfigKey } from "../../shared/agent-display-names"; interface ToolExecuteInput { tool: string; @@ -26,6 +28,23 @@ interface EventInput { }; } +/** + * Only orchestrator agents should receive usage reminders. + * Subagents (explore, librarian, oracle, etc.) are the targets of delegation, + * so reminding them to delegate to themselves is counterproductive. + */ +const ORCHESTRATOR_AGENTS = new Set([ + "sisyphus", + "sisyphus-junior", + "atlas", + "hephaestus", + "prometheus", +]); + +function isOrchestratorAgent(agentName: string): boolean { + return ORCHESTRATOR_AGENTS.has(getAgentConfigKey(agentName)); +} + export function createAgentUsageReminderHook(_ctx: PluginInput) { const sessionStates = new Map(); @@ -60,6 +79,12 @@ export function createAgentUsageReminderHook(_ctx: PluginInput) { output: ToolExecuteOutput, ) => { const { tool, sessionID } = input; + + const agent = getSessionAgent(sessionID); + if (agent && !isOrchestratorAgent(agent)) { + return; + } + const toolLower = tool.toLowerCase(); if (AGENT_TOOLS.has(toolLower)) {