Lemonaid supports OpenCode sessions via plugin events and session DB watching.
- OpenCode plugin emits events to
lemonaid opencode notifywhen a session goes idle or asks permission - Lemonaid stores notification metadata (
cwd,session_id,tty,switch_source) in the inbox DB - The unified watcher reads OpenCode session activity from
~/.local/share/opencode/opencode.db - When OpenCode resumes work (user/assistant activity, tool calls), the notification auto-marks as read
- When OpenCode completes a turn (
step-finishwithreason: "stop"), the watcher marks the session unread again
lemonaid opencode --helpIf this fails, reinstall your local editable tool:
cd ~/play/lemonaid
uv tool install --editable . --reinstallCreate ~/.config/opencode/plugins/lemonaid.js (global) or .opencode/plugins/lemonaid.js (project):
export const LemonaidPlugin = async ({ $ }) => ({
event: async ({ event }) => {
if (event.type === "session.idle" || event.type === "permission.asked") {
await $`lemonaid opencode notify ${JSON.stringify(event)}`
}
},
})Restart OpenCode after adding the plugin.
# synthetic event (smoke test)
lemonaid opencode notify '{"type":"session.idle","properties":{"sessionID":"ses_test123"}}'
# verify in inbox
lemonaid inbox list --json- Ensure plugin path is exactly
~/.config/opencode/plugins/lemonaid.js - Fully restart OpenCode after plugin changes
- Check logs:
rg 'lemonaid\.opencode|opencode\.notify|watcher' /tmp/lemonaid.log
# Manually trigger a notification
lemonaid opencode notify '{"type":"session.idle","properties":{"sessionID":"ses_abc123"}}'
# Mark a session notification as read
lemonaid opencode dismiss --session-id ses_abc123- OpenCode DB:
~/.local/share/opencode/opencode.db - Session table:
session - Activity stream used by watcher:
message+part
- Channel format:
opencode:<full_session_id> - Resume command from history:
opencode --session <session_id> - Notifications include terminal metadata when available for tmux/wezterm switching