OpenCode session sync — continue on any device
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
- Open the setup help page, pick OpenCode, and download the client package (server address pre-filled).
- On first run, execute
install-deps.bat(Windows) or./install-deps.sh(macOS / Linux). - Register with the generated command — your workspace API key is already filled in. The client starts as
HERMES_SYNC_AGENT=opencode. - 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 themodelcolumn 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_idis 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.
Related
- Supported agents
- Setup help (sign in required)
- Technical reference: SUPPORTED_AGENTS.md