Problem
OpenCode has two main agent modes: Plan and Build. When using Plan mode, the agent creates a plan and then calls the plan_exit tool to request user approval. Currently, there's no way to get notified when the Plan agent finishes its work and is waiting for user input.
This is different from:
complete - fires when a session fully completes (Build mode finishing)
subagent_complete - fires when subagents (general, explore) finish
question - fires when the question tool is invoked
The plan_exit is a distinct event that indicates the Plan agent has produced a plan and is waiting for the user to either approve it or switch to Build mode.
Proposed Solution
Add a new event type plan_exit that hooks into the tool.execute.before event and detects when input.tool === "plan_exit".
Configuration
{
"events": {
"plan_exit": { "sound": true, "notification": true, "command": true }
},
"messages": {
"plan_exit": "Plan ready for review: {sessionTitle}"
}
}
Implementation Approach
Similar to how question is handled via tool.execute.before:
// In index.ts
"tool.execute.before": async (input) => {
if (input.tool === "question") {
await handleEvent(config, "question", projectName, null)
}
if (input.tool === "plan_exit") {
await handleEvent(config, "plan_exit", projectName, null)
}
}
Event Config
Following existing patterns:
// In config.ts
export type EventType = "permission" | "complete" | "subagent_complete" | "error" | "question" | "interrupted" | "user_cancelled" | "plan_exit"
// Default config
events: {
// ... existing events
plan_exit: { sound: true, notification: true, command: true },
}
messages: {
// ... existing messages
plan_exit: "Plan ready for review: {sessionTitle}",
}
Use Case
As a user, I want to:
- Switch to Plan mode and describe what I want
- Let the Plan agent work (may take a while for complex tasks)
- Get notified when it's done creating the plan
- Review the plan and decide whether to proceed
Currently, I have no notification when step 3 happens, so I need to keep checking the terminal.
Alternative Considered
I considered using subagent_complete, but:
- Plan is not a subagent - it's one of the two main agent modes
- Enabling
subagent_complete would also notify for "general" and "explore" subagents, which is not desired
Environment
- OpenCode version: latest
- opencode-notifier version: latest
- Platform: Linux (NixOS)
Problem
OpenCode has two main agent modes: Plan and Build. When using Plan mode, the agent creates a plan and then calls the
plan_exittool to request user approval. Currently, there's no way to get notified when the Plan agent finishes its work and is waiting for user input.This is different from:
complete- fires when a session fully completes (Build mode finishing)subagent_complete- fires when subagents (general, explore) finishquestion- fires when the question tool is invokedThe
plan_exitis a distinct event that indicates the Plan agent has produced a plan and is waiting for the user to either approve it or switch to Build mode.Proposed Solution
Add a new event type
plan_exitthat hooks into thetool.execute.beforeevent and detects wheninput.tool === "plan_exit".Configuration
{ "events": { "plan_exit": { "sound": true, "notification": true, "command": true } }, "messages": { "plan_exit": "Plan ready for review: {sessionTitle}" } }Implementation Approach
Similar to how
questionis handled viatool.execute.before:Event Config
Following existing patterns:
Use Case
As a user, I want to:
Currently, I have no notification when step 3 happens, so I need to keep checking the terminal.
Alternative Considered
I considered using
subagent_complete, but:subagent_completewould also notify for "general" and "explore" subagents, which is not desiredEnvironment