One database holds every session, it grows without limit, and nothing else has a copy.
Where this tool keeps its history
~/.local/share/opencode/opencode.dbOne database holds every session, it grows without limit, and nothing else has a copy.
~/.local/share/opencode/opencode.dbOpenCode is the most transparent tool in this category: your history is an ordinary SQLite database and you can read it right now, with no product and no permission.
DB=~/.local/share/opencode/opencode.db
sqlite3 -readonly "$DB" "SELECT
(SELECT COUNT(*) FROM session) sessions,
(SELECT COUNT(*) FROM message) messages,
(SELECT COUNT(*) FROM part) parts;"On the machine used to write this, that returns 392 sessions, 13,799 messages and 63,413 parts, in a 1.4 GB file. Which is the good news and the problem in one line.
Nothing prunes it, so it grows. A large single file eventually attracts either a cleanup or a corruption — an unclean shutdown or a full disk can leave a database that will not open, and there is nothing to fall back to. And because copying a live SQLite file with cp can capture a torn write, the naive backup is not always a backup.
# the correct way to copy it while OpenCode is running
sqlite3 "$DB" ".backup '$HOME/Backups/opencode-$(date +%F).db'"
sqlite3 -readonly "$HOME/Backups/opencode-$(date +%F).db" "PRAGMA integrity_check;"The daemon reads the database read-only, joins sessions to messages to parts, and stores each turn as prompt, response and the associated file changes in its own store. From then on the record survives the original being reset, corrupted, or deleted for disk space.
It also puts OpenCode in the same timeline as every other AI tool on the machine — which matters more than it sounds, because most developers who use OpenCode are also using something else, and eight separate histories in five formats is not a history.
npx promptwake doctor
npx promptwake init .