[FEATURE:] Add configurable hooks for custom commands on task events (similar to Claude Code) #4634

Closed
opened 2026-02-16 17:44:52 -05:00 by yindo · 2 comments
Owner

Originally created by @Decade-qiu on GitHub (Jan 10, 2026).

Originally assigned to: @thdxr on GitHub.

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

I would like to request support for configurable hooks, similar to the Hooks feature in Claude Code: https://code.claude.com/docs/en/hooks.

Hooks would allow users to define custom commands/scripts that automatically execute at specific points during a task's lifecycle, such as:

  • On successful task completion (e.g., run a notification script, trigger a deployment, or perform cleanup)
  • On task error/failure (e.g., send an alert, log details to an external service, or attempt automatic recovery)
  • When user confirmation is required (e.g., pause execution and run a custom command to prompt the user via another tool/integration)
  • more ......
Originally created by @Decade-qiu on GitHub (Jan 10, 2026). Originally assigned to: @thdxr on GitHub. ### Feature hasn't been suggested before. - [x] I have verified this feature I'm about to request hasn't been suggested before. ### Describe the enhancement you want to request I would like to request support for **configurable hooks**, similar to the Hooks feature in Claude Code: https://code.claude.com/docs/en/hooks. Hooks would allow users to define custom commands/scripts that automatically execute at specific points during a task's lifecycle, such as: - **On successful task completion** (e.g., run a notification script, trigger a deployment, or perform cleanup) - **On task error/failure** (e.g., send an alert, log details to an external service, or attempt automatic recovery) - **When user confirmation is required** (e.g., pause execution and run a custom command to prompt the user via another tool/integration) - more ......
yindo added the discussion label 2026-02-16 17:44:52 -05:00
yindo closed this issue 2026-02-16 17:44:52 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 10, 2026):

This issue might be a duplicate of or closely related to existing issues. Please check:

  • #2185: Hooks for commands (Plugin Commands) - An earlier request for hooks functionality focused on plugin command interception and lifecycle

While #2185 is more specific to plugin command hooks, #7640 appears to be a broader feature request for task lifecycle hooks (like Claude Code's implementation). These two issues could potentially be consolidated or addressed as part of a comprehensive hooks system.

@github-actions[bot] commented on GitHub (Jan 10, 2026): This issue might be a duplicate of or closely related to existing issues. Please check: - #2185: Hooks for commands (Plugin Commands) - An earlier request for hooks functionality focused on plugin command interception and lifecycle While #2185 is more specific to plugin command hooks, #7640 appears to be a broader feature request for task lifecycle hooks (like Claude Code's implementation). These two issues could potentially be consolidated or addressed as part of a comprehensive hooks system.
Author
Owner

@Decade-qiu commented on GitHub (Jan 11, 2026):

I've implemented this feature using OpenCode's plugin system. My plugin opencode-message-notify (https://github.com/Decade-qiu/opencode-message-notify) provides hooks for:

  • Task completion - Sends detailed Agent messages
  • Permission requests - Notifies when confirmation is required
  • Usage statistics - Tracks cost, tokens, cache usage
  • iOS notifications - Via Bark app

Moreover, plugin docs lack detailed explanations of event types and input (output) types. I had to log events during development to understand what data was available. It would be helpful to document key events with their input/output types and field meanings more clearly.

@Decade-qiu commented on GitHub (Jan 11, 2026): I've implemented this feature using OpenCode's plugin system. My plugin `opencode-message-notify` ([https://github.com/Decade-qiu/opencode-message-notify](https://github.com/Decade-qiu/opencode-message-notify)) provides hooks for: - **Task completion** - Sends detailed Agent messages - **Permission requests** - Notifies when confirmation is required - **Usage statistics** - Tracks cost, tokens, cache usage - **iOS notifications** - Via Bark app > Moreover, plugin docs lack detailed explanations of event types and input (output) types. I had to log events during development to understand what data was available. It would be helpful to document key events with their input/output types and field meanings more clearly.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#4634