Skip to content

[FEATURE]: Paint an editable home prompt before the TUI finishes loading #53696

Description

@Nowaker

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

Running opencode shows a blank terminal until the CLI, the server worker, plugins and providers have loaded. That takes 2-5 s on a fast machine, longer under load or with many plugins (see #46976, #48051). Two things go wrong while it loads:

  1. You can't start typing. Keys typed meanwhile are echoed by the tty in cooked mode, so they appear as raw text on the blank screen. An Enter becomes a line feed, and an early paste can be mangled.
  2. You don't see anything that looks like OpenCode until the very end.

Proposal: paint the home screen with a working prompt the moment opencode starts, before anything else loads.

  • The entrypoint puts the tty in raw mode at once, reads tui.json with plain file I/O, and paints the same home screen at the same positions: logo, prompt box with placeholder, tab agents / ctrl+p commands, cwd and version in the footer, plus a small "Loading…" spinner.
  • The agent, model, variant and theme colors come from a small cache the TUI writes on each run. The cache sits beside the database the process would open (opencode.tui-startup.json next to opencode.db), so OPENCODE_DB, data directories and channels never share one. Nothing on this path opens SQLite.
  • The prompt is a real editor: the input_* keybinds including tui.json overrides, word wrap, click to move the caret, selection, paste and undo. A worker thread reads and paints keys while the main thread is still evaluating the CLI; the main thread alone can't, since module evaluation blocks it for 0.3-1.7 s.
  • When the TUI's renderer starts, the typed text, caret and selection hand over to the real prompt exactly. Nothing visibly changes except the model line and tips filling in.
  • Enter while loading shows "OpenCode still loading, will submit shortly" under the prompt and submits once loaded, but only if the agent/model/variant that loads matches the cached one shown. Otherwise it shows "Not submitted: agent/model/variant changed" in red, and you press Enter again.
  • --mini and startup.instant_prompt: false keep only the invisible part: early keys are captured and placed in the prompt when it appears, and an Enter typed during startup is dropped (startup.early_input).

Measured with a pty harness, --pure, the screen is typable 70-140 ms after opencode is run on Linux x64 and two Apple Silicon Macs, versus 2-5 s before. Keystroke-to-paint while loading is about 10 ms median.

I have a working implementation and will open a PR referencing this issue. It also moves the home and prompt layout numbers into a constants-only module (packages/tui/src/layout.ts) and the keybind defaults into config/keybind-definitions.ts, so the early screen and the real TUI read the same values.

Activity

  1. github-actions commented on Oct 7, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    For keybind-related issues, please also check our pinned keybinds documentation: #4997

  2. opencode-agent commented on Oct 7, 2026

    @opencode-agent
    Contributor

    Thanks for the detailed proposal. I could confirm the current behavior on v2.0.24 (Linux x64, no plugins). After running opencode2, the terminal shows only Starting background server... until the TUI takes over the screen (about 0.5 s here, longer with plugins). Anything typed in that window is echoed raw, and Enter becomes a line feed. Those keystrokes also don't reach the prompt once the home screen appears: they are lost. A maintainer will review the proposal and the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions