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
I want the agent to call a script after a task ends to automatically commit and push everything and open a PR.
Currently, it works by giving the instructions to the agent, but it consumes more and a lot of tokens. Also the output is not always consistent. Sometimes it doesn't set the assignee or labels, sometimes it randomly does nothing at all and I have to follow prompt to run the GitHub stuff.
And it's not efficient to let AI handle a simple task that can be run programmatically.
Based on my analysis of the opencode plugin system, I've identified several issues that could prevent plugins from loading or working properly:
Issues Found:
Plugin Hook Structure Mismatch in Documentation vs. Implementation
Documentation shows tool.execute.before as nested hooks in /packages/web/src/content/docs/docs/plugins.mdx:96-106
But implementation expects flat hook names like "tool.execute.before" in /packages/opencode/src/plugin/index.ts:25-36
Missing Error Handling in Plugin Loading
Plugin loading in /packages/opencode/src/plugin/index.ts:20-35 lacks error handling
If a plugin fails to load or export properly, it could silently fail or crash the loading process
Inconsistent Plugin Discovery Paths
Global plugins search in ~/.config/opencode/plugin/.ts via /packages/opencode/src/config/config.ts:108
Project plugins search in .opencode/plugin/.ts via /packages/opencode/src/config/config.ts:109
But documentation mentions .opencode/plugin directory, not specific file patterns
Plugin Configuration Loading Issues
Config loading at /packages/opencode/src/config/config.ts:475-482 tries to resolve plugin paths but catches errors silently
This could mask actual plugin loading failures
Event System Integration
Plugin initialization in /packages/opencode/src/plugin/index.ts:59-68 subscribes to all bus events
But there's no verification that plugins actually get called properly
No Plugin Validation or Loading Logs
Missing debug logging to help troubleshoot plugin loading issues
No validation that exported functions match the Plugin interface
Main Problem Areas:
config.ts:105-111 - Plugin discovery and path resolution
plugin/index.ts:20-35 - Plugin loading loop with no error handling
plugin/index.ts:42-57 - Hook triggering mechanism
plugin/index.ts:59-68 - Event subscription for plugins
The most likely cause of user reports is that plugins are failing to load due to path resolution issues or silent failures in the loading process, with no debugging information to help users understand what went wrong.
importtype{Plugin}from"@opencode-ai/plugin"exportconstSayNotificationPlugin: Plugin=async({ app, client, $ })=>{console.log("Say Notification Plugin initialized!")return{event: async({ event })=>{// Trigger when session becomes idle (user stops interacting)if(event.type==="session.idle"){try{// Use macOS say command to announce session completionawait$`say "Your opencode session is now idle and ready for new input"`}catch(error){console.error("Failed to use say command:",error)}}},}}
prompt:
can you create an example plugin in typescript that calls macos' "say" command with a message when the session is idle?
rmoriz (11:46 PM)
I'll create an example TypeScript plugin that uses macOS's say command when a session becomes idle.
claude-sonnet-4 (11:46 PM)
Reacted by Christopher Carroll Smith and ikkun1222
JavaScript plugins are supported, but there's a discrepancy in the current implementation. The config only searches for .ts files, but the
documentation shows JavaScript examples. This might be one of the issues causing plugin loading problems.
Here's the JavaScript version I created. The main differences from TypeScript:
• No type imports needed
• Same functionality and structure
• Works with Bun's native JavaScript support
However, I noticed the config currently only searches for .ts files in /packages/opencode/src/config/config.ts:108-109. This should
probably
be updated to also include .js files to match the documentation.
The JavaScript plugin should work if you manually add it to your config or if the search pattern gets updated to include .js files.
claude-sonnet-4 (11:55 PM)
Activity
fahmi-grande commentedon Aug 1, 2025
Up for this. Claude Code hooks can do so much things right now. especially for this
PreToolUsethdxr commentedon Aug 1, 2025
we'll have something better than hooks - likely tomorrow
SquallLeonhart13 commentedon Aug 1, 2025
better than hooks? Bold statement
I added claude likes hooks to the best of my (claude) ability no promises. Testing now with our new platform that helps capture hook event data to make a principle engineer, we are in early beta if you guys want to check us out https://github.com/principle-md/opencode-with-hooks/releases/tag/v0.4.0
https://principle-md.com
ofonseca-pyming commentedon Aug 4, 2025
With plugins you can extend beyond the execution of user-defined shell commands:
https://opencode.ai/docs/plugins/
rmoriz commentedon Aug 8, 2025
Did someone get the plugin approach to work? even the examples (notification) won't work for me. Neither in a project, nor globally (v0.4.1)
asafyish commentedon Aug 9, 2025
I also tried using simple plugins, nothing works.
I have a plugin in ~/.config/opencode/plugin - but it doesn't load, no errors in the logs.
darrenhinde commentedon Aug 9, 2025
Also having the same issue, tried both in project and the global level.
rmoriz commentedon Aug 9, 2025
let's use opencode to debug 😎
https://opencode.ai/s/U09ntSBv
rmoriz commentedon Aug 9, 2025
this works for me:
Write .opencode/plugin/say-notification.ts
prompt:
rmoriz commentedon Aug 9, 2025
TODO:
asafyish commentedon Aug 10, 2025
The problem I had was indeed js file instead of ts.
rekram1-node commentedon Aug 29, 2025
Closing since js files are supported and docs have been updated: https://opencode.ai/docs/plugins/
docs: flatten changelog and roadmap URLs (anomalyco#1473)
feat(desktop): GPT Live calls, Voice tab and narrower resizable panel…