opencode icon indicating copy to clipboard operation
opencode copied to clipboard

[FEATURE]: OpenCode REPL mode, a simpler alternative to the TUI

Open tnglemongrass opened this issue 2 months ago • 3 comments

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

This ticket is about exploring the idea of a simpler variant of the interactive TUI mode, that looks and feels closer to using a typical REPL (bash, python, ...):

  • One-dimensional output, relies on the terminal for managing scrollback buffer.
  • Readline-shortcuts, including typical Ctrl-R for backward history search.
  • Prompt-like interaction, alternating between asking for user input and showing output.

Sample Usage / Output

opencode repl
opencode> create a react component
...opencode output...
opencode> add styling with tailwind
...opencode output...
opencode> /exit

The prompt part opencode> might be used to instead show mode (build> ), show additionally model name (build@gpt-5> or gpt-5@build> ), or even context information gpt-5@build[21k/16%]> .

Why?

Mockup with existing functionality opencode run and --continue

  • There are two commands that can already do most of the heavy-lifting:
    • opencode run "first user prompt"
    • opencode run --continue "follow-up user prompts"
Image

This is a small wrapper script opencode-repl.sh that demonstrates what I have in mind:

#!/bin/bash

echo -ne "\033[32mopencode\033[0m> "
read userInput

opencode run "$userInput"

while true; do
    echo -ne "\033[32mopencode\033[0m> "
    read userInput

    if [ "$userInput" = "exit" ]; then
        break
    fi

    opencode run --continue "$userInput"
done

Integration in opencode itself would allow for a much tighter integration though (streaming, mode and model switching, ctrl-c handling, tab-tab preview/completion for slash commands ...).

tnglemongrass avatar Nov 15 '25 21:11 tnglemongrass