[FEATURE]: opencode web support for initial prompt (prefill and optional auto-submit) #9209

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

Originally created by @kdawgwilk on GitHub (Feb 12, 2026).

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

Summary

Please add support for starting OpenCode Web with an initial prompt so integrations can deep-link users directly into a session with context already prepared.

Use case

We launch OpenCode Web from another orchestrator (Borg/Daytona sandbox flow) and want to:

  1. Open the correct session in Web UI.
  2. Prefill an initial prompt (or optionally auto-submit it).
  3. Keep state shared with CLI run/session history.

Today we can deep-link to a session, but we can’t reliably pass an initial prompt at launch.

Requested behavior

Support one or both of these patterns:

1) CLI flag(s)

  • opencode web --session <sessionId> --initial-prompt "<text>"
  • Optional: --auto-submit (default off)

2) URL/query param support

  • Example: /session/<id>?prompt=<urlencoded>
  • Optional: &submit=1 for auto-send

Expected UX

  • If initial-prompt/prompt is present:
    • Prompt appears in composer on load.
    • If auto-submit/submit=1, it is sent once after hydration.
  • If session exists, prompt is added in that session.
  • If no session is provided, behavior should be explicit (new session or error).

Why this matters

This enables reliable integrations from sandbox/platform UIs and “Open in OpenCode” actions without extra manual copy/paste by users.

Notes

  • A max prompt length and clear escaping behavior would help.
  • For URL-based prompt passing, guidance on security/privacy considerations would be useful (since URLs may be logged).
Originally created by @kdawgwilk on GitHub (Feb 12, 2026). Originally assigned to: @adamdotdevin 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 ## Summary Please add support for starting OpenCode Web with an initial prompt so integrations can deep-link users directly into a session with context already prepared. ## Use case We launch OpenCode Web from another orchestrator (Borg/Daytona sandbox flow) and want to: 1. Open the correct session in Web UI. 2. Prefill an initial prompt (or optionally auto-submit it). 3. Keep state shared with CLI `run`/session history. Today we can deep-link to a session, but we can’t reliably pass an initial prompt at launch. ## Requested behavior Support one or both of these patterns: ### 1) CLI flag(s) - `opencode web --session <sessionId> --initial-prompt "<text>"` - Optional: `--auto-submit` (default off) ### 2) URL/query param support - Example: `/session/<id>?prompt=<urlencoded>` - Optional: `&submit=1` for auto-send ## Expected UX - If `initial-prompt`/`prompt` is present: - Prompt appears in composer on load. - If `auto-submit`/`submit=1`, it is sent once after hydration. - If session exists, prompt is added in that session. - If no session is provided, behavior should be explicit (new session or error). ## Why this matters This enables reliable integrations from sandbox/platform UIs and “Open in OpenCode” actions without extra manual copy/paste by users. ## Notes - A max prompt length and clear escaping behavior would help. - For URL-based prompt passing, guidance on security/privacy considerations would be useful (since URLs may be logged).
yindo added the discussionweb labels 2026-02-16 18:11:54 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#9209