An OpenCode skill for migrating session history between
machines (or between separate data directories) using the official
opencode export / opencode import CLI.
Compatibility: OpenCode agents that support the standard skill format
(~/.config/opencode/skills/<name>/SKILL.md). Not tested with other agent
runtimes.
Version: 1.0.0
OpenCode stores sessions in a per-machine SQLite database and keys projects by
git remote identity. When you work on the same repo from a second machine — or
reach it through a mapped drive / different path — your session history does not
follow you. There is no built-in bulk migration; the official building blocks
are opencode export, opencode import, and the TUI /move-session command.
This skill turns those blocks into a safe, repeatable workflow:
- Identify source sessions (
opencode session listor read-only SQLite query) - Export them as JSON into a transfer directory both machines can reach
- Import on the target machine (idempotent — same ID updates, no duplicates)
- Verify, and re-home sessions with
/move-sessionif their recorded directory still points at the source machine
Clone the repository and copy SKILL.md into your OpenCode skills directory:
git clone https://github.com/sterraMind/opencode-session-transfer.git
cd opencode-session-transfer
mkdir -p ~/.config/opencode/skills/opencode-session-transfer
cp SKILL.md ~/.config/opencode/skills/opencode-session-transfer/SKILL.mdAsk your agent things like:
- "Migrate my opencode sessions to another machine"
- "Export my sessions for project X and import them on machine B"
- "Why does this project show empty history on my other computer?"
- Never hand-edit
opencode.dbas a migration strategy. - Avoid two opencode instances writing the same DB file concurrently (SQLite locking over network shares is unreliable).
/sharelinks are public — do not use them to move private sessions.- Exported JSON contains full conversation content; delete transfer files after import.
MIT