You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hooks are probably hidden gems for a client/server architecture CLI like opencode. It's bit different that the current event system hooks in that we can inject other behaviors (like inline linting) or pass messages to a UI framework.
Claude Code has these hooks:
• PreToolUse: runs before a tool is called; can block or modify tool execution (e.g., validate or restrict commands).
• PostToolUse: runs after a tool completes successfully; can provide feedback or take actions based on tool results.
• Notification: runs when Claude Code sends notifications (e.g., when awaiting input or permission).
• Stop: runs when Claude Code finishes responding; can block or allow the session to end.
Maybe a middle ground we can take advantage of for /share as well, as the websocket sends some simple key values:
Activity
thdxr commentedon Jul 1, 2025
we're likely going to have a plugin system where you can define these in typescript instead of the awkward hooks format claude code has
we actually have some experimental command based hooks here: https://raw.githubusercontent.com/sst/opencode/refs/heads/dev/packages/opencode/config.schema.json
haydnhkim commentedon Jul 3, 2025
It would be nice to have a hook that matches Claude Code's
PreToolUse.ghost91- commentedon Aug 6, 2025
@monotykamary is this already solved by the new plugin functionality? Or are any particular hooks still missing?
monotykamary commentedon Aug 6, 2025
Oh probably; this issue can probably be closed. Probably deserves a documentation update for all of the events that opencode has:
installation.updatedlsp.client.diagnosticsmessage.updatedmessage.removedmessage.part.updatedmessage.part.removedstorage.writefile.editedserver.connectedpermission.updatedpermission.repliedsession.updatedsession.deletedsession.idlesession.errorfile.watcher.updatedide.installedchore: rename openwrk to openwork-orchestrator (anomalyco#573)