[FEATURE]: Add a TUI flag/endpoint that auto-submits the initial prompt #2606

Closed
opened 2026-02-16 17:36:25 -05:00 by yindo · 1 comment
Owner

Originally created by @2mawi2 on GitHub (Nov 5, 2025).

Originally assigned to: @rekram1-node 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

We’re integrating the OpenCode TUI inside our own IDE-style workspace. When a user clicks “start OpenCode,” we launch the CLI in a terminal pane and feed it an initial task so it can begin coding immediately. Other agent CLIs let us do this by piping stdin or using a flag that both injects and submits the first prompt. OpenCode’s --prompt/-p flag only pre-fills the textbox, so the text just sits there until someone manually presses Enter. To work around that, we currently simulate bracketed paste + Enter from outside the process, but that’s brittle and timing-sensitive.

Could you provide a supported way to auto-submit the initial prompt when launching the TUI (e.g., opencode --prompt "…" --auto-submit, or a documented /tui/submit-prompt hook we can call immediately)? That would let IDE integrations start OpenCode sessions deterministically without faking user keystrokes.

Originally created by @2mawi2 on GitHub (Nov 5, 2025). Originally assigned to: @rekram1-node 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 We’re integrating the OpenCode TUI inside our own IDE-style [workspace](https://github.com/2mawi2/schaltwerk). When a user clicks “start OpenCode,” we launch the CLI in a terminal pane and feed it an initial task so it can begin coding immediately. Other agent CLIs let us do this by piping stdin or using a flag that both injects and submits the first prompt. OpenCode’s `--prompt/-p` flag only pre-fills the textbox, so the text just sits there until someone manually presses Enter. To work around that, we currently simulate bracketed paste + Enter from outside the process, but that’s brittle and timing-sensitive. Could you provide a supported way to auto-submit the initial prompt when launching the TUI (e.g., `opencode --prompt "…" --auto-submit`, or a documented `/tui/submit-prompt` hook we can call immediately)? That would let IDE integrations start OpenCode sessions deterministically without faking user keystrokes.
yindo added the discussion label 2026-02-16 17:36:25 -05:00
yindo closed this issue 2026-02-16 17:36:25 -05:00
Author
Owner

@rekram1-node commented on GitHub (Nov 5, 2025):

Yeah the -p / --prompt flag is supposed to auto submit. We are adding that back

@rekram1-node commented on GitHub (Nov 5, 2025): Yeah the -p / --prompt flag is supposed to auto submit. We are adding that back
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2606