OpenCode
Where OpenCode stores your session history
OpenCode keeps every session in one SQLite database, opencode.db, under ~/.local/share/opencode. How to find it, list, export, share and delete sessions.
Updated October 29, 2026 // Markdown
- Made by
- Anomaly (formerly SST)
- History lives in
- macOS / Linux
~/.local/share/opencode/opencode.db - Windows
%USERPROFILE%\.local\share\opencode\opencode.db
- macOS / Linux
- Format
- SQLite (tables session, message, part)
- Kept for
- No automatic deletion
- Resume
opencode --continue, opencode --session <id>- Cloud copy
- Local unless you share a session
OpenCode, the open-source terminal agent now maintained at anomalyco/opencode, stores all sessions in one SQLite database.
Where the database is
opencode db path # prints the active database
By default it is ~/.local/share/opencode/opencode.db on macOS and Linux, and the same path under %USERPROFILE% on Windows. OPENCODE_DB changes the file name. Before v1.2.0 (February 2026) sessions were JSON files under storage/; they are migrated automatically.
What is inside
| Table | What it holds |
|---|---|
session |
Title, model, token counts, cost |
message |
Messages in each session |
part |
Message parts as JSON: text, tool calls, results |
Resume, export and delete
opencode --continue # the latest session
opencode --session <id> # a specific one
opencode --session <id> --fork
opencode session list
opencode session delete <id>
opencode export <id> --sanitize # export with sensitive values removed
opencode import <file>
Sharing
/share uploads a session to a public link at opncd.ai/s/<id>, and /unshare removes it. The share setting is manual by default; auto shares every session and disabled turns sharing off.
Not to be confused with
The older Go project named opencode was archived and continues as Charm's Crush.
The groundedby evaluator does not read OpenCode's database yet.
Questions
Where are OpenCode sessions stored?+
In a single SQLite database, opencode.db, under ~/.local/share/opencode on every system. Run opencode db path to print the exact location; OPENCODE_DB changes it.
How do I export an OpenCode session?+
opencode export <id> writes it out, and --sanitize removes sensitive values. opencode import brings one back in.
Are OpenCode sessions uploaded?+
Only if you share them. The share setting is manual by default; a shared session is uploaded to a public link at opncd.ai. Set share to disabled to rule it out.
Sources
Waitlist
Your sessions, your call.
We are building an opt-in marketplace where developers license redacted sessions they pick, one by one. Join to hear first.
Read next
- Claude CodeWhere Claude Code stores your session historyClaude Code keeps every session as a JSONL file in ~/.claude/projects and deletes them after 30 days by default. How to find, resume, export, keep and delete them.Read +
- Codex CLIWhere OpenAI Codex CLI stores your session historyCodex CLI saves each session as a rollout JSONL file in ~/.codex/sessions by date and compresses old ones to .jsonl.zst. How to find, resume, archive and delete them.Read +
- Market$500, then $200: what one posting tells us about the price of a coding sessionIn October 2026 Mercor paid developers $500 per recorded coding session, then cut it to $200 within a week. What the price says about the market for agent session data.Read +