Mnemonic stores all data in a single SQLite database at ~/.mnemonic/memory.db. This guide covers backup strategies and disaster recovery.
mnemonic backupThis creates a timestamped JSON export in ~/.mnemonic/backups/ and automatically keeps only the last 5 backups.
Exports memories, associations, and raw memories as structured JSON:
mnemonic export --format json --output ~/my-backup.jsonPros: Human-readable, importable, format-stable across versions. Cons: Doesn't include SQLite-specific data (patterns, abstractions, episodes, system metadata).
Copies the raw database file:
mnemonic export --format sqlite --output ~/my-backup.dbPros: Complete copy of all data including patterns, abstractions, and indexes. Cons: May not be compatible across major schema changes.
The daemon automatically creates a SQLite backup before applying schema migrations at startup. These are saved as pre_migrate_<timestamp>.db in ~/.mnemonic/backups/.
mnemonic restore ~/.mnemonic/backups/pre_migrate_2026-03-10_143022.dbThis will:
- Verify the backup file exists and passes
PRAGMA integrity_check - Check that the daemon is not running (stop it first with
mnemonic stop) - Move the current database aside as
memory.db.old - Copy the backup into place as the new
memory.db
After restoring, start the daemon:
mnemonic startmnemonic import ~/my-backup.json --mode mergeModes:
merge— Add imported memories alongside existing ones (default)replace— Clear existing data and load from backup
If ~/.mnemonic/memory.db is accidentally deleted:
-
Check for automatic backups:
ls -lt ~/.mnemonic/backups/ -
Restore the most recent one:
mnemonic restore ~/.mnemonic/backups/<most-recent>.db
-
If no backups exist, start fresh:
mnemonic serve # creates a new empty databaseThen re-ingest important projects:
mnemonic ingest ~/Projects/my-project --project my-project
If mnemonic diagnose reports corruption:
-
Try restoring from a pre-migration backup (created automatically):
mnemonic restore ~/.mnemonic/backups/pre_migrate_<latest>.db
-
Try SQLite's built-in recovery:
sqlite3 ~/.mnemonic/memory.db ".recover" | sqlite3 /tmp/recovered.db mnemonic restore /tmp/recovered.db
-
Last resort — purge and start over:
mnemonic purge
If you switched LLM embedding models, existing vector embeddings are incompatible:
- The daemon detects this and warns at startup.
- Existing memories still work for keyword search (FTS) but semantic search quality degrades.
- Options:
- Switch back to the original model
- Accept degraded semantic search for old memories (new ones will use the new model)
mnemonic purgeand re-ingest if semantic quality is critical
| Use Case | Strategy |
|---|---|
| Personal use | Run mnemonic backup weekly |
| Heavy use | Run mnemonic backup daily via cron |
| Before upgrades | The daemon does this automatically (pre-migration backup) |
| Before experiments | Manual mnemonic export --format sqlite --output ~/before-experiment.db |
# Add to crontab: crontab -e
0 3 * * * /path/to/mnemonic --config /path/to/config.yaml backupAll backups are stored in ~/.mnemonic/backups/. The backup command automatically manages retention (keeps last 5). Pre-migration backups are also stored here but are not subject to the retention limit — clean them up manually if needed.