<!-- Source: https://moriblink.com/opencode-notifications -->
<!-- Title: OpenCode notifications on Mac: permission and finish alerts -->

[Home](https://moriblink.com/) / [Guides](https://moriblink.com/guides) / OpenCode notifications

# OpenCode notifications on Mac

Get an alert when an OpenCode session finishes or asks for permission. Turn on the built-in attention setting, or add a small plugin.

Updated 26 October 2026

## Quick answer

OpenCode’s terminal interface has built-in attention alerts for questions, permission requests, session errors, and completed sessions. They are off by default. Turn them on in `~/.config/opencode/tui.json`:

```json
{
  "$schema": "https://opencode.ai/tui.json",
  "attention": {
    "enabled": true,
    "notifications": true,
    "sound": true
  }
}
```

Desktop notifications are sent only when the terminal is not in focus. Sounds play when an event happens. The `tui.json` file is separate from `opencode.json`.

## Build a small notification plugin

For your own notification text, use a plugin. OpenCode loads plugins from `~/.config/opencode/plugins/` (all projects) and `.opencode/plugins/` (one project) at startup. Save this as `~/.config/opencode/plugins/notification.js`, then restart OpenCode:

```javascript
export const NotificationPlugin = async ({ $ }) => {
  const notify = (message) =>
    $`osascript -e ${`display notification "${message}" with title "OpenCode"`}`.nothrow().quiet()

  return {
    event: async ({ event }) => {
      if (event.type === "session.idle") await notify("Session finished")
      if (event.type === "permission.asked") await notify("OpenCode needs permission")
    },
  }
}
```

- `session.idle` fires when a session finishes its work. `permission.asked` fires when OpenCode asks for permission.
- `.nothrow().quiet()` keeps a failed notification from throwing into the agent loop.
- The official plugin documentation has a shorter version of this example for `session.idle`.

**OpenCode 1 and 2:** this plugin uses the OpenCode 1 plugin API. OpenCode’s migration guide says that version 1 plugins do not run in version 2. In version 2, plugins subscribe to events through `ctx.event.subscribe()`. Check `opencode --version` before you choose.

If the notification does not appear, give Script Editor notification permission. `osascript` sends notifications through Script Editor. Run `osascript -e 'display notification "test"'` once, then allow it in System Settings → Notifications.

## The OpenCode desktop app

The OpenCode desktop app can send system notifications automatically when a response is ready or when a session errors. You do not need a plugin for that.

## How MoriBlink handles OpenCode

OpenCode has MoriBlink’s most complete connection: live observation, tested with OpenCode 1.19.3. A one-time setup installs a small user-level plugin. Then MoriBlink shows each project that OpenCode reports, and you approve each one before capture starts.

- Live status for each session: running, waiting for approval, waiting for an answer, finished, or failed.
- Mori appears on your display for approvals, questions, completions, and failures. Click Mori to open the session.
- An execution waterfall for each turn shows tool calls, builds, tests, approval waits, and exit codes on one time axis.
- The plugin uses only event hooks. It does not change tool arguments or output, and a capture failure does not affect the agent.
- Prompts, transcripts, file contents, and successful tool output are left out. History stays on your Mac.

## See every agent in one place

MoriBlink follows your OpenCode sessions live, tells you the moment one needs you, and shows where a slow run spent its time.

[Get early access](https://moriblink.com/#download)

## Sources

- [OpenCode TUI](https://opencode.ai/docs/tui/): `tui.json` and the `attention` options.
- [OpenCode plugins](https://opencode.ai/docs/plugins/): plugin folders, events, and the notification example.
- [OpenCode version 2 plugin migration](https://opencode.ai/v2/docs/build/plugins/migrate-v1).

Checked against the official documentation on 26 October 2026.

## Questions

### Does OpenCode have built-in notifications?

Yes. Set attention.enabled to true in tui.json. The TUI then alerts you for questions, permissions, session errors, and completed sessions. Desktop notifications appear only when the terminal is not in focus.

### Which OpenCode plugin event means a session is finished?

Use session.idle. For permission requests, use permission.asked. Both are listed in the OpenCode 1 plugin documentation.

### Do OpenCode 1 plugins work in OpenCode 2?

No. The OpenCode migration guide says version 1 plugin implementations do not run in version 2. Version 2 plugins subscribe to events through ctx.event.subscribe().

Contact: [support@moriblink.com](mailto:support@moriblink.com)
