[FEATURE]: Support structured “action buttons” in agent responses (Cursor/Kiro-style) #4729

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

Originally created by @dl-alexandre on GitHub (Jan 11, 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

Context

OpenCode includes a Plan agent that is optimized for analysis and planning without making changes, and a Build agent for general development work. In Plan mode, tools that modify code or run shell commands (e.g., edits, patches, bash) are disabled or require permission to run. This mode is useful for analyzing code and proposing plans without executing them. Agents in OpenCode currently produce plain text or markdown responses only; there is no documented structured mechanism in the native agent output format for embedding interactive choice lists or selectable clarification prompts that clients can render as UI elements.

Problem

When the Plan agent or other agents need clarification from the user (e.g., to choose between several valid options before proceeding), OpenCode currently requires users to type follow-up natural language manually. There is no standard format in the agent output that encodes a machine-readable list of explicit choices for clients to render as interactive selections. This limits structured, multi-step workflows where the model’s next steps depend on a user’s selection.

Proposal

Define a structured output format extension that allows an agent to emit a clarification prompt with explicit choices. Instead of presenting options as plain text only, the agent could include a separate, machine-readable block with a question and a list of choices, where each choice has a stable identifier. Clients (TUI, Desktop, Web) could render these as interactive options that the user can select, and that can be fed back into the session as structured input.

Conceptual example:

{
  "clarificationPrompt": {
    "question": "Which layer should we optimize first in the plan?",
    "choices": [
      {
        "id": "opt1",
        "label": "Data access layer",
        "description": "Improve queries and caching"
      },
      {
        "id": "opt2",
        "label": "Business logic layer",
        "description": "Refactor core domain logic"
      },
      {
        "id": "opt3",
        "label": "API surface",
        "description": "Improve API routes and validation"
      }
    ]
  },
  "fallbackText": "I need clarification before finalizing the plan."
}

Goals

1.	Clear disambiguation: Users can select one of the provided choices instead of typing a manual text response.
2.	Structured interaction: Clients can parse choices programmatically to render UI controls.
3.	Backward compatibility: Clients that do not support structured choices should continue rendering text normally.

Out of scope for MVP

•	Direct execution of actions (e.g., apply patch) — this issue is strictly about structured clarification/option emission.
•	Arbitrary shell or side-effectful commands embedded in options.

Benefits

•	Enables agent-led clarification workflows without free-form text replies.
•	Lays groundwork for richer interactive agent experiences in OpenCode (e.g., guided multi-step tasks).
•	Makes sequences where the agent asks for information explicit and machine-parseable.

Acceptance criteria

•	Agents can include a clarification block (or equivalent) with a question and list of choices.
•	Supported clients render this as interactive selectable options.
•	Choice selection is fed back into the agent session as structured input (not free text).
•	Fallback to text/markdown when unsupported.

Rationale

OpenCode’s agent responses are currently plain text/markdown and do not include a built-in mechanism for agents to emit structured clarification prompts with selectable options. The permission system can ask for approvals on tools like file edits or bash, but that is distinct from a generalized choice/clarification output format for arbitrary agent questions. Introducing this mechanism would make multi-step planning and decision workflows clearer and more deterministic without changing existing response semantics.

Originally created by @dl-alexandre on GitHub (Jan 11, 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 ## Context OpenCode includes a Plan agent that is optimized for analysis and planning without making changes, and a Build agent for general development work. In Plan mode, tools that modify code or run shell commands (e.g., edits, patches, bash) are disabled or require permission to run. This mode is useful for analyzing code and proposing plans without executing them. Agents in OpenCode currently produce plain text or markdown responses only; there is no documented structured mechanism in the native agent output format for embedding interactive choice lists or selectable clarification prompts that clients can render as UI elements. ## Problem When the Plan agent or other agents need clarification from the user (e.g., to choose between several valid options before proceeding), OpenCode currently requires users to type follow-up natural language manually. There is no standard format in the agent output that encodes a machine-readable list of explicit choices for clients to render as interactive selections. This limits structured, multi-step workflows where the model’s next steps depend on a user’s selection. ## Proposal Define a structured output format extension that allows an agent to emit a clarification prompt with explicit choices. Instead of presenting options as plain text only, the agent could include a separate, machine-readable block with a question and a list of choices, where each choice has a stable identifier. Clients (TUI, Desktop, Web) could render these as interactive options that the user can select, and that can be fed back into the session as structured input. ## Conceptual example: ```json { "clarificationPrompt": { "question": "Which layer should we optimize first in the plan?", "choices": [ { "id": "opt1", "label": "Data access layer", "description": "Improve queries and caching" }, { "id": "opt2", "label": "Business logic layer", "description": "Refactor core domain logic" }, { "id": "opt3", "label": "API surface", "description": "Improve API routes and validation" } ] }, "fallbackText": "I need clarification before finalizing the plan." } ``` ## Goals 1. Clear disambiguation: Users can select one of the provided choices instead of typing a manual text response. 2. Structured interaction: Clients can parse choices programmatically to render UI controls. 3. Backward compatibility: Clients that do not support structured choices should continue rendering text normally. ## Out of scope for MVP • Direct execution of actions (e.g., apply patch) — this issue is strictly about structured clarification/option emission. • Arbitrary shell or side-effectful commands embedded in options. ## Benefits • Enables agent-led clarification workflows without free-form text replies. • Lays groundwork for richer interactive agent experiences in OpenCode (e.g., guided multi-step tasks). • Makes sequences where the agent asks for information explicit and machine-parseable. ## Acceptance criteria • Agents can include a clarification block (or equivalent) with a question and list of choices. • Supported clients render this as interactive selectable options. • Choice selection is fed back into the agent session as structured input (not free text). • Fallback to text/markdown when unsupported. ## Rationale OpenCode’s agent responses are currently plain text/markdown and do not include a built-in mechanism for agents to emit structured clarification prompts with selectable options. The permission system can ask for approvals on tools like file edits or bash, but that is distinct from a generalized choice/clarification output format for arbitrary agent questions. Introducing this mechanism would make multi-step planning and decision workflows clearer and more deterministic without changing existing response semantics.
yindo added the discussion label 2026-02-16 17:45:11 -05:00
yindo closed this issue 2026-02-16 17:45:11 -05:00
Author
Owner

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

This issue might be related to existing features and requests. Please check:

  • #7654: Questions from nested sub-agents don't appear in TUI - Related to structured agent interaction and user prompts
  • #7696: message actions on AI messages - Related to interactive UI elements in agent responses
  • #7638: Arrow keys cannot select answer to llm question - Related to interactive question selection
  • #7616: Question tool throws if header length is >= 12 chars - Related to question tool and structured output
  • #7739: Invisible text in question selector - Related to question/selection UI rendering

These issues touch on the question tool, interactive selection mechanics, and agent response interaction patterns that could inform or be complementary to structured action buttons implementation.

@github-actions[bot] commented on GitHub (Jan 11, 2026): This issue might be related to existing features and requests. Please check: - #7654: Questions from nested sub-agents don't appear in TUI - Related to structured agent interaction and user prompts - #7696: message actions on AI messages - Related to interactive UI elements in agent responses - #7638: Arrow keys cannot select answer to llm question - Related to interactive question selection - #7616: Question tool throws if header length is >= 12 chars - Related to question tool and structured output - #7739: Invisible text in question selector - Related to question/selection UI rendering These issues touch on the question tool, interactive selection mechanics, and agent response interaction patterns that could inform or be complementary to structured action buttons implementation.
Author
Owner

@dl-alexandre commented on GitHub (Jan 11, 2026):

I am now familiar with the question tool

@dl-alexandre commented on GitHub (Jan 11, 2026): I am now familiar with the question tool
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#4729