You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
When launching opencode (TUI) at a project, it is easy to forget the exact ses_... id of a previous session. Today the only ways to resume one are:
Run opencode first, then use the in-TUI /sessions picker
Pass the opaque ses_... id explicitly via -s / --session
I would like a startup-time entry point that opens the session picker, the same way Claude Code does with claude --resume ("Opens the session picker" per the Claude Code CLI help text). This drops the user straight into the existing session picker for the current project, so they can resume a conversation without first entering an unrelated TUI session.
Proposed shape
I am flexible on the exact flag layout and would like the maintainers' input during the design review. Two reasonable options, both scoped to the current project / working directory:
Option A: new -r, --resume flag (Claude Code parity)
opencode --resume -> open session picker for the current project, then load the chosen session into the TUI
-s / --session semantics are unchanged: it still requires a ses_... id and continues the given session (or errors)
Option B: extend -s, --session to accept no value
opencode -s / opencode --session (no value) -> open session picker
opencode -s ses_xxx (with value) -> current behavior
Optional: also add --resume as an alias for the no-value form
I'd prefer Option A for two reasons:
It mirrors Claude Code and keeps -s / --session semantically simple ("give me a session id, I will continue it").
--resume is discoverable on its own in opencode --help, while "no-value -s" is more of a quirky shorthand.
Inverting the flag to an explicit --resume also keeps the "give an id" path loud and explicit, which is preferable to silent fallback.
Scope
Picker contents: only sessions belonging to the current project / working directory, matching the existing TUI /sessions behavior. Cross-project listing is being discussed in [FEATURE]: Cross-project session list / picker for TUI #31932; this proposal intentionally does not overlap with it.
Filter / search: reuse the existing TUI /sessions dialog (or the same underlying GET /session?directory=&search= query) instead of introducing a new picker
Fork support: --resume --fork should fork the resumed session, mirroring the existing --session --fork behavior.
Headless / non-interactive: out of scope for this proposal. The headless path already has a clean way to continue a known session via opencode run -s ses_xxx "...", and combining --resume with opencode run would force an interactive picker into a non-interactive command.
V1 / V2 alignment: opencode is currently building out a V2 session core (see [FEATURE]: Cross-project session list / picker for TUI #31932's 2.0 label). I'm not sure whether this flag should land in the V1 CLI surface or be implemented against the V2 core. Open to maintainer guidance on which branch / layer this should target.
Non-interactive behavior
--resume requires an interactive picker and therefore a TTY. In non-TTY contexts (pipes, CI, nohup, tmux send-keys from a non-tty parent) it should fail fast with a clear error pointing the user at -s <session_id>, not silently fall back to a default. Open to maintainer preference on the exact error wording.
Why this is small
CLI flag wiring: add --resume to the yargs builder in packages/opencode/src/cli/cmd/tui.ts (the same place -s is declared). No changes are needed in run.ts because opencode run --resume is intentionally unsupported.
Resolution: when args.resume is set, call the existing SessionV2.list({ directory }) (or current equivalent), open the same dialog used by TUI /sessions, and feed the chosen SessionID into the existing -s resolution path.
No backend / DB schema changes required.
Picker implementation
The picker should reuse the existing TUI /sessions dialog rather than introducing a separate UI:
Single source of truth for filtering, sorting, keybindings, and rendering
# In a project directory, resume a previous conversation interactively
opencode --resume
# Once the picker is dismissed, the chosen session is loaded into the TUI# exactly as if the user had selected it from the in-app /sessions dialog.# In a script / CI, you already know the id (e.g. captured from a prior run# via `opencode export`); the existing `-s` / `--session` flag continues to# work and is the recommended path for non-interactive pipelines.
opencode run -s ses_abc123 "follow up after CI run"
Willing to implement
I am happy to send a PR for this. Before doing so I would like to confirm with the maintainers:
Option A vs Option B (or both) above
Whether the picker should be reused from the TUI /sessions dialog, or a separate lighter-weight picker
Whether --resume should be its own top-level flag, or added as an alias on --session
The exact error wording for the non-TTY case
Whether this should land on the V1 CLI or against the V2 session core
Happy to align with anyone who is already working on this area (#31932) before opening the PR.
Feature hasn't been suggested before.
Describe the enhancement you want to request
When launching
opencode(TUI) at a project, it is easy to forget the exactses_...id of a previous session. Today the only ways to resume one are:opencodefirst, then use the in-TUI/sessionspickerses_...id explicitly via-s/--sessionI would like a startup-time entry point that opens the session picker, the same way Claude Code does with
claude --resume("Opens the session picker" per the Claude Code CLI help text). This drops the user straight into the existing session picker for the current project, so they can resume a conversation without first entering an unrelated TUI session.Proposed shape
I am flexible on the exact flag layout and would like the maintainers' input during the design review. Two reasonable options, both scoped to the current project / working directory:
-r, --resumeflag (Claude Code parity)opencode --resume-> open session picker for the current project, then load the chosen session into the TUI-s/--sessionsemantics are unchanged: it still requires ases_...id and continues the given session (or errors)-s, --sessionto accept no valueopencode -s/opencode --session(no value) -> open session pickeropencode -s ses_xxx(with value) -> current behavior--resumeas an alias for the no-value formI'd prefer Option A for two reasons:
-s/--sessionsemantically simple ("give me a session id, I will continue it").--resumeis discoverable on its own inopencode --help, while "no-value-s" is more of a quirky shorthand.Inverting the flag to an explicit
--resumealso keeps the "give an id" path loud and explicit, which is preferable to silent fallback.Scope
/sessionsbehavior. Cross-project listing is being discussed in [FEATURE]: Cross-project session list / picker for TUI #31932; this proposal intentionally does not overlap with it./sessionsdialog (or the same underlyingGET /session?directory=&search=query) instead of introducing a new picker--resume --forkshould fork the resumed session, mirroring the existing--session --forkbehavior.--continueinteraction:--resumeand-c/--continueshould be mutually exclusive, or--continueshould take precedence (same as the current-coverrides-sbehavior discussed in Correct CLI --continue --session syntax for persisting sessions is malfunctioning. #11680). Open to maintainer preference.opencode run -s ses_xxx "...", and combining--resumewithopencode runwould force an interactive picker into a non-interactive command.2.0label). I'm not sure whether this flag should land in the V1 CLI surface or be implemented against the V2 core. Open to maintainer guidance on which branch / layer this should target.Non-interactive behavior
--resumerequires an interactive picker and therefore a TTY. In non-TTY contexts (pipes, CI,nohup,tmux send-keysfrom a non-tty parent) it should fail fast with a clear error pointing the user at-s <session_id>, not silently fall back to a default. Open to maintainer preference on the exact error wording.Why this is small
--resumeto the yargs builder inpackages/opencode/src/cli/cmd/tui.ts(the same place-sis declared). No changes are needed inrun.tsbecauseopencode run --resumeis intentionally unsupported.args.resumeis set, call the existingSessionV2.list({ directory })(or current equivalent), open the same dialog used by TUI/sessions, and feed the chosenSessionIDinto the existing-sresolution path.Picker implementation
The picker should reuse the existing TUI
/sessionsdialog rather than introducing a separate UI:/sessions1:1Use case
Willing to implement
I am happy to send a PR for this. Before doing so I would like to confirm with the maintainers:
/sessionsdialog, or a separate lighter-weight picker--resumeshould be its own top-level flag, or added as an alias on--sessionHappy to align with anyone who is already working on this area (#31932) before opening the PR.
Related issues
[FEATURE]: Cross-project session list / picker for TUI(in progress; this proposal intentionally scopes to the current project to avoid overlap)/sessionspicker only shows recent sessions (the data source for the proposed picker; worth aligning with)-cvs-sprecedence (precedent for how--resumeshould interact with--continue)