How to get OpenCode notifications

Updated 21 October 2026

OpenCode keeps working while you’re in another window, so you need to know when it’s done or waiting for your approval. OpenCode 2 can alert you itself once you turn it on; plugins add more control, and OpenCode 1 needs one. Here’s every option, and how to answer OpenCode without going back to the terminal.

The short answer

OptionWorks inAnswer from it?
Built-in alerts (attention in cli.json)OpenCode 2 terminalNo
A notification plugin from npmOpenCode 1 and 2No
A small plugin you writeOpenCode 1No
Agent PetsOpenCode in Chrome, Arc, Brave, EdgeYes: Allow, Always, Deny and reply from any tab

Not sure which version you have? Run opencode --version.

When OpenCode needs you

OpenCode is permissive by default. In OpenCode 2, the only built-in rule that asks is reading .env files; everything else runs, even outside the project, unless you add ask rules. For example, to approve every shell command except routine Git:

opencode.jsonc{
  "$schema": "https://opencode.ai/config.json",
  "permissions": [
    { "action": "shell", "resource": "*", "effect": "ask" },
    { "action": "shell", "resource": "git status *", "effect": "allow" },
    { "action": "shell", "resource": "git diff *", "effect": "allow" }
  ]
}

OpenCode 1 uses a permission object instead, and by default asks before touching a directory outside the project. Either way, the other moment you care about is when a session finishes and waits for your next message.

1. Turn on built-in alerts (OpenCode 2)

OpenCode 2’s terminal app can send a system notification and play a sound when it needs attention, normally only when the terminal isn’t focused. Turn both on in ~/.config/opencode/cli.json:

~/.config/opencode/cli.json{
  "attention": {
    "notifications": true,
    "sound": true
  }
}

You can swap any sound for your own file under attention.sounds, separately for permission, question, done, error and subagent_done. These alerts come from the terminal app, so opencode run and the desktop and web apps don’t use them.

Nothing on macOS? Check that your terminal app is allowed to send notifications in System Settings → Notifications, and that Focus or Do Not Disturb isn’t on.

2. Use a notification plugin from npm

For more control, such as the project name in the title, per-event sounds or running your own command, use opencode-notifier. It alerts you when OpenCode needs permission, finishes, hits an error or asks a question, on macOS, Linux and Windows, and supports both versions. Add it to your OpenCode config and restart OpenCode:

~/.config/opencode/opencode.json{
  "plugins": ["@mohak34/opencode-notifier@latest"]
}

On OpenCode 1 the key is "plugin" instead of "plugins". On OpenCode 2, turn the built-in alerts off so you don’t get each one twice: add "-opencode.notifications" to the plugins list in cli.json, after any "*" entry.

3. Write a small plugin (OpenCode 1)

OpenCode 1 loads every file in ~/.config/opencode/plugins/ at startup. Save this as notify.js there and restart OpenCode:

~/.config/opencode/plugins/notify.jsexport const Notify = async ({ $ }) => {
  const notify = (message) =>
    process.platform === "darwin"
      ? $`osascript -e ${`display notification "${message}" with title "OpenCode"`}`
      : $`notify-send OpenCode ${message}`;

  return {
    event: async ({ event }) => {
      if (event.type === "session.idle") await notify("Done. Your turn.");
      if (event.type === "permission.asked") await notify("Needs your permission.");
    },
  };
};

session.idle fires when a session finishes responding, and permission.asked when OpenCode stops for approval. OpenCode 2 doesn’t run plugins written this way; its plugins use a new Plugin.define API, so use the built-in alerts or the npm plugin there.

No notification on macOS? osascript notifications come from Script Editor. Run osascript -e 'display notification "test"' once and allow Script Editor in System Settings → Notifications. On Linux, notify-send needs a desktop notification daemon, which SSH sessions and containers don’t have.

4. Answer OpenCode from your browser with Agent Pets

A notification still sends you back to the terminal to type an answer. If you spend the wait in Chrome, Agent Pets brings OpenCode to you:

npx getagentpets init installs its OpenCode plugin for you, for OpenCode 1 and 2. It runs entirely on your computer: your code and prompts never leave your machine, and OpenCode’s own prompt keeps working as usual.

Get Agent Pets — was $25, now $6Get Agent Pets — $25

Questions

Does OpenCode send desktop notifications by itself?

OpenCode 2’s terminal app does once you set attention.notifications to true in ~/.config/opencode/cli.json, normally only while the terminal isn’t focused. OpenCode 1 needs a plugin.

Why does OpenCode rarely ask me for permission?

OpenCode allows most actions by default. OpenCode 2 only asks before reading .env files, and OpenCode 1 before touching directories outside the project, plus anything you set to ask.

Why do I get every OpenCode notification twice?

OpenCode 2’s built-in alerts and a notification plugin are both on. Add "-opencode.notifications" to the plugins list in cli.json to keep only the plugin’s.

Can I approve OpenCode permission requests without going back to the terminal?

Not with a notification: it only tells you to go back. Agent Pets puts Allow, Always and Deny on a pet on every Chrome page and on its desktop notification.

Sources: OpenCode’s documentation on CLI settings, CLI plugins, permissions and OpenCode 1 plugins; the opencode-notifier README.

More guides