opencode resume: --continue, --session, /sessions, and where the sessions live
- opencode
- coding-agents
- agent-ops
No, opencode has no resume subcommand. No --resume flag either. I open old sessions in Claude Code and Codex most mornings, so I looked up the opencode names. The last session comes back with opencode --continue, short -c. One session by ID comes back with opencode --session <id>, short -s. In the TUI you type /sessions. Both versions accept /resume and /continue as aliases. opencode run has the same two flags. --fork copies a session. The original stays untouched.
opencode --continue # last session here
opencode -s ses_4f2a1c # one session by ID
opencode run --continue "next step" # scripted follow-up
opencode run -s ses_4f2a1c --fork "try it another way"
opencode session list # IDs, titles, updated time
- No resume command appears on the CLI page, which lists
--continueand--sessiononopencode,opencode runandopencode attach. - Last means here, since
latestSessioninsession-target.tsof v2.2.5 stops at the first session from the current directory and opencode 1.19.5 limits the list to the current project. - Unknown ID fails in opencode 1 but starts a new session in opencode 2, except with
--fork, whereselectSessionthrowsSession not found. - Where sessions live is one SQLite file,
opencode.db, in the data directory,~/.local/share/opencode/on Linux and macOS. - How I know is reading rather than running, since opencode is not installed here and the text relies on the docs and the source at tags v1.19.5 and v2.2.5 on 31 October 2026.
How Claude Code does this, with six entry points and a lookup across projects, is in my claude --resume post. This one is the opencode side.
How do I resume the last opencode session?
Run opencode --continue, or opencode -c, in the project folder. The CLI page only says "Continue the last session". The source says what last means. In opencode 1.19.5, run.ts reads a session list that session.ts limits to the current project. The newest update comes first. run.ts picks the first entry without a parent. In opencode 2.2.5, session-target.ts walks the list in the same order. It picks the first top-level session from the current directory.
So opencode --continue in a folder with no sessions starts a new one. It never reaches into another project. The opencode 1 TUI, in app.tsx, sorts the same way and picks the first session without a parent.
How do I resume a previous opencode session by ID?
Pass the ID with --session, short -s. The docs define it as "Session ID to continue". To find an ID, run opencode session list. Each row has the ID, the title and the update time. The newest session comes first. --format json adds the directory.
An unknown ID behaves differently in each version. opencode 1.19.5 checks the ID before the TUI starts. A malformed ID gets Invalid session ID. A missing one fails the lookup. opencode run prints Session not found. The opencode 2.2.5 flag help says "Session ID to continue, or to create if it does not exist". In opencode run, session-target.ts creates that session at once. The TUI waits for your first prompt before it creates one. With --fork the same code throws Session not found. So a typo in -s gives a fresh session in opencode 2 and an error in opencode 1.
--fork makes a copy under a new ID. The original stays as it was, per the fork call in run.ts. opencode 1 wants -c or -s next to it. Without one, the process exits with --fork requires --continue or --session. In opencode 2.2.5, commands.ts puts --fork on run and mini only.
What is the opencode resume session command inside the TUI?
/sessions. The TUI page says it will "List and switch between sessions" and names /resume and /continue as aliases. The key is ctrl+x l. ctrl+x is the default leader. A fresh session starts with /new. Its alias is /clear.
opencode 2 keeps the command. The aliases sit in its code. The v2 docs do not list them. The v2 TUI page says "Press Ctrl+X, then L or run /sessions to return to an existing session". The same page says "Ctrl+O opens recent sessions and projects together."
How do I resume an interrupted opencode conversation?
Open the TUI again with --continue, or pick the session from /sessions. A session in opencode is a row in a SQLite database, per the source, not a file you save first. I think closing the terminal does not take it away.
The opencode 2 CLI page says OpenCode "discovers or starts one shared background server for your user account" and that this server "owns sessions". The TUI is a client. I read that as a session that may still be running when you reopen the TUI. I have not watched it happen.
The Codex version, with my own test, is in codex resume.
Can I resume an opencode subagent session?
Not by flag, as far as the docs and code show. Subagents run in child sessions. On the opencode 1 agents page, session_child_first (leader plus Down) enters the first child. Right and Left cycle between children. Up returns to the parent. opencode 2 has session.child.first, a subagent picker, plus session.child.next, session.child.previous and session.parent.
--continue skips children in both versions. opencode session list filters the same way, so a child ID never shows up there. Could --session <child-id> open one? The lookup is a plain get by ID with no parent check, so I think it would. The docs do not say. I have not tried it.
Where does opencode store sessions?
In SQLite. The opencode 2 troubleshooting page says "The database normally lives at ~/.local/share/opencode/opencode.db" and that OPENCODE_DB overrides it. In the 1.19.5 source, database.ts resolves the same opencode.db under the data directory for the latest, beta and prod channels.
Print the path. opencode 1: opencode db path. opencode 2: opencode debug paths db. The v2 docs warn: "Do not delete or edit service files or the database while troubleshooting."
How does opencode resume compare with claude --resume?
| Task | Claude Code | opencode |
|---|---|---|
| Newest session here | claude --continue | opencode --continue |
| Pick from a list | claude --resume picker | /sessions in the TUI |
| One session | claude --resume <id> or a name | opencode --session <id> |
| Copy instead of continue | --fork-session | --fork with -c or -s |
| Scripted follow-up | claude -p --resume <id> | opencode run --session <id> |
| Unknown ID | No conversation found error | 1.x error; 2.x creates it, error with --fork |
| On disk | One .jsonl per session under ~/.claude/projects/ | SQLite opencode.db in the data directory |
Claude Code also resumes by name; opencode only by ID. The permission flags are in opencode --dangerously-skip-permissions.
Frequently asked questions
Is there an opencode --resume flag?
No. The CLI page has --continue and --session on the opencode command, on opencode run and on opencode attach. The only resume command string is the /resume alias of /sessions in the TUI.
Does opencode --continue work from another directory?
Not as a way to reach that directory's session. In 1.19.5 the list is scoped to the current project, in 2.2.5 to the current directory. Pass --session <id> instead.
Did you test this?
No. opencode is not installed on my machine. This post reads the opencode docs and the source at tags v1.19.5 and v2.2.5 on 31 October 2026.
The verdict
Coming from Claude Code, drop the word resume. opencode -c is claude --continue, opencode -s <id> is claude --resume <id>, and /sessions is the picker. Keep the ID from opencode session list in your handoff note. On opencode 2, check the spelling of -s before you trust a fresh-looking session.
Sources, read on 31 October 2026. For opencode 1 I used the CLI, TUI and agents pages. For opencode 2 I used the CLI, commands, TUI, keybinds and troubleshooting pages. Code comes from the anomalyco/opencode repository at tag v1.19.5 (cli/cmd/run.ts, cli/cmd/tui.ts, tui/src/app.tsx, session/session.ts, core/src/database/database.ts) and at tag v2.2.5 (cli/src/session-target.ts, run/run.ts, commands.ts, handlers/default.ts, tui/src/app.tsx, database-path.ts). Claude Code commands come from its Manage sessions page.