← All tools

PromptWake for OpenCode

OpenCode keeps everything in one SQLite database — readable, queryable, and a single point of failure that grows past a gigabyte. PromptWake reads it continuously so the record does not depend on that one file.

How OpenCode loses history

One database holds every session, it grows without limit, and nothing else has a copy.

~/.local/share/opencode/opencode.db
Storage
SQLite — session, message and part tables
Measured on a working machine
1.4 GB · 392 sessions · 13,799 messages
Readable yourself
Yes — plain sqlite3, no export needed
Session diffs
In a separate storage/ directory
What PromptWake captures
  • Sessions, messages and parts, joined into one conversation per turn
  • The file changes recorded alongside each session
  • A copy outside the database, so a reset or corruption is survivable
  • The same timeline as your other AI tools, in one place

OpenCode 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.

One file, no second copy

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;"

What PromptWake does with OpenCode specifically

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 .

When it matters

Deeper on where OpenCode keeps its history, and how to back it up without PromptWake: read the guide.