OpenCode session sync — continue on any device

Last updated 2026-09-17 · MIT licensed · free for personal self-hosting

OpenCode's CLI and desktop builds share a single database, which makes it the least fussy agent to sync: whatever you wrote through either entry point comes along in one go.

Where OpenCode keeps its sessions

Item Value
Database $XDG_DATA_HOME/opencode/opencode.db (SQLite)
Tables session / message / part
Shared by CLI and desktop 1.x use the same store and the same tables

If you have moved XDG_DATA_HOME, the adapter follows it.

Connecting it

  1. Open the setup help page, pick OpenCode, and download the client package (server address pre-filled).
  2. On first run, execute install-deps.bat (Windows) or ./install-deps.sh (macOS / Linux).
  3. Register with the generated command — your workspace API key is already filled in. The client starts as HERMES_SYNC_AGENT=opencode.
  4. Restart OpenCode.

First start pulls incrementally; an empty server gets a full push to complete the pairing; then it syncs every 5 minutes.

Behaviour worth knowing

  • Written in the desktop row shape — session ids carry the ses_ prefix (msg_ for messages, prt_ for parts), timestamps are milliseconds and the model column is written as {id, providerID} JSON. A synced session therefore looks exactly like a local one and opens normally.
  • Foreign sessions get normalised — a session arriving from another agent gets a ses_ id through the id mapper and round-trips with stable dedupe, so repeated syncs do not pile up duplicates.
  • Projects resolve from the directory — project_id is derived from where the session lives, so project cards line up.
  • Database writes only — your files are not rewritten, and an interrupted sync cannot leave a corrupt store behind.

Across devices, across agents

Install the OpenCode client on two machines, connect both to the same workspace, and a day looks like this: at work you have the CLI agent refactor a module, at home you open the same session in the desktop app and ask why the refactor left that one branch alone. Handing it to Hermes or Oh My Pi works too — same pool.