Skip to main content
Integrate OpenCode with cmux to receive visual notifications when the agent needs your attention. Similar to Claude Code integration, OpenCode can trigger notifications that appear as blue rings on workspace tabs.

How it works

OpenCode uses a hook system to notify external tools when certain events occur. cmux provides a notify command that OpenCode hooks can call to create notifications.

Setup

1

Verify cmux CLI is available

The cmux CLI is installed with the app. Verify it’s in your PATH:
If not found, add cmux to your PATH:
2

Configure OpenCode hooks

OpenCode supports custom hooks in its configuration. Add a notification hook that calls cmux:Create ~/.opencode/hooks.sh:
Make it executable:
3

Configure OpenCode to use the hook

Edit your OpenCode config (typically ~/.opencode/config.json):
4

Test the integration

Run an OpenCode command and verify that notifications appear in cmux:
You should see a notification in the cmux sidebar when OpenCode is waiting.

Using the notify command

The cmux notify command sends a notification to the current workspace (or a specific workspace if targeted).

Basic usage

Options

  • --title: Notification title (default: “Notification”)
  • --subtitle: Short summary text
  • --body: Full notification message
  • --workspace <id>: Target a specific workspace by ID or index
  • --surface <id>: Target a specific surface/tab within the workspace
If --workspace and --surface are omitted, cmux routes the notification to the workspace where the command was executed (via CMUX_WORKSPACE_ID and CMUX_SURFACE_ID environment variables).

Examples

Environment variables

cmux automatically sets these variables in each terminal session:
  • CMUX_WORKSPACE_ID: The current workspace ID
  • CMUX_SURFACE_ID: The current surface (tab) ID
  • CMUX_SOCKET_PATH: Path to the cmux control socket
You can use these in your hook scripts to ensure notifications route to the correct workspace.

Advanced integration

Progress indicators

For long-running operations, you can combine notifications with progress indicators:

Status badges

Add persistent status badges to workspace tabs:

Custom notification scripts

Create reusable notification scripts for common events:
~/bin/notify-success
~/bin/notify-error
Use in your workflows:

Viewing notifications

Use the cmux keyboard shortcuts to navigate notifications:
  • Cmd+I: Open the notifications panel
  • Cmd+Shift+U: Jump to the latest unread notification
Or use the CLI:

Troubleshooting

Verify the socket connection:
Check the socket path:
If the socket doesn’t exist, cmux may not be running.
The socket file must be owned by your user. Check:
If it’s owned by another user, quit cmux and restart it.
Verify the environment variables are set:
You can override them explicitly: