How to delete opencode session history, and what you lose
one SQLite file holds every session, so the unit of deletion is larger than you expect
opencode does not write a file per conversation. Every session, every message and every part of a message lives in one SQLite database, which makes removing all of it easy and removing one of it awkward.
Where the sessions are
~/.local/share/opencode/opencode.db
${XDG_DATA_HOME}/opencode/opencode.db
Three tables carry a conversation: session, message joined by session_id, and part joined by message_id — the text, the tool calls and their results are parts.
How to delete it
Delete a session from opencode itself. The database is live state the client owns, and editing it underneath a running client is how people lose more than the session they meant to remove.
With opencode closed, the file is the whole history:
rm ~/.local/share/opencode/opencode.db
Two things people get wrong here. Deleting rows does not shrink the file — SQLite reuses the freed pages — so run VACUUM with the client closed if the space is what you are after. And there is no archive: a removed session is gone, not moved.
What you lose
The sessions are the record of what was tried and what worked. opencode's own list is the only way back into them, and it reads the same database — so the answer to a question you solved in June exists only while that file does.
Keeping it searchable instead
deja reads this database through sqlite3 — along with the other thirty-three agents' histories on the machine — into one local index, searchable from the shell and readable by the agents themselves over MCP:
curl -fsSL https://raw.githubusercontent.com/vshulcz/deja-vu/main/install.sh | sh deja "opencode session about the retry budget"
Nothing to switch on first: the database is already there, including the months before deja was installed. Indexing and search stay local, credentials are stripped as the index is built, and deja forget drops a session from the index for good.
Where every agent keeps its history · Memory for opencode · The opencode format
Found this useful? Star deja-vu on GitHub.