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:
{
"$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:
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.idlefires when a session finishes its work.permission.askedfires 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.
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 accessSources
- OpenCode TUI:
tui.jsonand theattentionoptions. - OpenCode plugins: plugin folders, events, and the notification example.
- OpenCode version 2 plugin migration.
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().