Sub-Agents Constantly Trigger OS Notifications #9177

Open
opened 2026-02-16 18:11:49 -05:00 by yindo · 2 comments
Owner

Originally created by @JuliaBonita on GitHub (Feb 12, 2026).

Originally assigned to: @rekram1-node on GitHub.

Description

PROBLEM: Recently, with Claude (maybe others, too) the sub-agents started becoming more active and constantly triggering the OS notifications as the sub-agents complete their sub-tasks. So now every session is filled with constant OS notifications. This creates so many false positives that the OS notifications are essentially meaningless now for their intended purpose.

SOLUTION: The OS notifications should only be triggered when the primary LLM is actually finished with the task and/or waiting for a response from the user.

OpenCode version

LATEST

Operating System

MacOS

Terminal

WizTerm

Originally created by @JuliaBonita on GitHub (Feb 12, 2026). Originally assigned to: @rekram1-node on GitHub. ### Description PROBLEM: Recently, with Claude (maybe others, too) the sub-agents started becoming more active and constantly triggering the OS notifications as the sub-agents complete their sub-tasks. So now every session is filled with constant OS notifications. This creates so many false positives that the OS notifications are essentially meaningless now for their intended purpose. SOLUTION: The OS notifications should only be triggered when the primary LLM is actually finished with the task and/or waiting for a response from the user. ### OpenCode version LATEST ### Operating System MacOS ### Terminal WizTerm
yindo added the bug label 2026-02-16 18:11:49 -05:00
Author
Owner

@rekram1-node commented on GitHub (Feb 12, 2026):

What "notifications" are u using plugins? Or the desktop app? What are u referring to.

@rekram1-node commented on GitHub (Feb 12, 2026): What "notifications" are u using plugins? Or the desktop app? What are u referring to.
Author
Owner

@JuliaBonita commented on GitHub (Feb 12, 2026):

Yes, it's a plugin with this code:

export const NotificationSoundPlugin = async ({ project, client, $, directory, worktree }) => {
  return {
    event: async ({ event }) => {
      if (event.type === "session.idle") {
        const result = await $`osascript -e 'tell application "System Events" to get name of first application process whose frontmost is true'`.text();
        const focusedApp = result.trim().toLowerCase();

        const terminalApps = ['opencode', 'terminal', 'iterm', 'iterm2', 'warp', 'alacritty', 'kitty'];
        const isTerminalFocused = terminalApps.some(app => focusedApp.includes(app));

        if (!isTerminalFocused) {
          const timestamp = new Date().toLocaleTimeString();
          const message = `${timestamp}`;
          await $`/usr/local/bin/alerter -title OpenCode -subtitle "Agent Ready" -message ${message} -sound Blow -group opencode-idle -timeout 0`.quiet();
        }
      }
    }
  };
};

How do I update the plugin to only trigger the notification when the main LLM agent actually needs attention?

@JuliaBonita commented on GitHub (Feb 12, 2026): Yes, it's a plugin with this code: ``` export const NotificationSoundPlugin = async ({ project, client, $, directory, worktree }) => { return { event: async ({ event }) => { if (event.type === "session.idle") { const result = await $`osascript -e 'tell application "System Events" to get name of first application process whose frontmost is true'`.text(); const focusedApp = result.trim().toLowerCase(); const terminalApps = ['opencode', 'terminal', 'iterm', 'iterm2', 'warp', 'alacritty', 'kitty']; const isTerminalFocused = terminalApps.some(app => focusedApp.includes(app)); if (!isTerminalFocused) { const timestamp = new Date().toLocaleTimeString(); const message = `${timestamp}`; await $`/usr/local/bin/alerter -title OpenCode -subtitle "Agent Ready" -message ${message} -sound Blow -group opencode-idle -timeout 0`.quiet(); } } } }; }; ``` How do I update the plugin to only trigger the notification when the main LLM agent actually needs attention?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#9177