[PR #9864] feat: pass plan metadata in question event for plugin access #13250

Open
opened 2026-02-16 18:18:07 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/9864

State: open
Merged: No


Closes #9865

Summary

When plan_exit is called, plugins listening to the question.asked event now receive the plan content and path via a new metadata field. This enables plugins to intercept the plan approval dialog and show custom UI for plan review.

Changes

  • Add optional metadata field to QuestionRequest schema
  • Update Question.ask() to accept and pass through metadata
  • plan_exit tool includes planPath, planRelativePath, and planContent in metadata

Example Plugin Usage

event: async ({ event }) => {
  if (event.type !== "question.asked") return
  if (event.properties.questions?.[0]?.header !== "Build Agent") return

  const { planPath, planContent } = event.properties.metadata ?? {}
  if (planContent) {
    // Show custom plan review UI
  }
}

Breaking Changes

None - metadata is optional and existing code is unaffected.

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/9864 **State:** open **Merged:** No --- Closes #9865 ## Summary When `plan_exit` is called, plugins listening to the `question.asked` event now receive the plan content and path via a new `metadata` field. This enables plugins to intercept the plan approval dialog and show custom UI for plan review. ## Changes - Add optional `metadata` field to `QuestionRequest` schema - Update `Question.ask()` to accept and pass through metadata - `plan_exit` tool includes `planPath`, `planRelativePath`, and `planContent` in metadata ## Example Plugin Usage ```typescript event: async ({ event }) => { if (event.type !== "question.asked") return if (event.properties.questions?.[0]?.header !== "Build Agent") return const { planPath, planContent } = event.properties.metadata ?? {} if (planContent) { // Show custom plan review UI } } ``` ## Breaking Changes None - metadata is optional and existing code is unaffected.
yindo added the pull-request label 2026-02-16 18:18:07 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13250