OperationsBackup & restore

Backup & restore

All durable memory lives in PostgreSQL, in the mnemosyne schema. In the Docker stack that is the mnemosyne-pgdata volume. Mnemosyne ships no backup tool of its own: use Postgres tooling.

Dump

From the docker/ folder of the repository:

docker compose exec -T postgres pg_dump -U mnemo -d mnemo -Fc > mnemo-$(date -u +%F).dump

Run it on a schedule and copy the file off the host. For point-in-time recovery, use Postgres WAL archiving or your provider’s managed backups; nothing in Mnemosyne is specific to either.

Secrets that are not in the database

Two production secrets live in the environment, not in Postgres. Store them with the backup, in a separate place:

  • MNEMO_MASTER_KEY encrypts confidential and restricted rows.
  • MNEMO_KEY_PEPPER blinds stored API tokens.

A restored database needs the same values to read those rows and to accept the existing API keys.

Restore

docker compose stop server
docker compose exec -T postgres pg_restore -U mnemo -d mnemo --clean --if-exists < mnemo-2026-11-18.dump
docker compose run --rm migrate
docker compose start server

Running migrate after the restore applies any migration added since the dump was taken. A pg_dump archive does not contain roles: when restoring into a new Postgres cluster, restore the roles first (pg_dumpall --roles-only on the source).

⚠️

These are standard Postgres commands written against the Compose service names. Rehearse a restore on a scratch host before you depend on it.

What the dump contains

  • Every mnemo_* table: facts, decisions, entities, relations and the rest.
  • Embeddings, stored as pgvector columns next to their rows.
  • API key hashes (mnemo_api_keys).
  • The audit log (mnemo_audit_log).

What it does not contain

  • Redis. It holds the hot tier, rate-limit counters and idempotency keys. Recall falls through to Postgres when the cache is empty or down.
  • The Ollama models (mnemosyne-ollama-data volume). Pull them again.
  • The two secrets above.

Logical export

mnemo export writes one workspace as gzip JSONL to stdout:

mnemo export > workspace.jsonl.gz

It is not a one-step backup. The export needs the memory:export scope and a key bound to a user, and it is approval-gated with dual control:

  1. The first call creates a pending approval, prints its id and exits with code 2.
  2. A different user approves it with POST /approvals/{id}/resolve and the body {"status":"approved"}. Self-approval is rejected.
  3. Run it again with the id, within 24 hours:
mnemo export --approval-request-id <id> > workspace.jsonl.gz

Import the file on another instance:

mnemo import workspace.jsonl.gz --conflict-resolution skip

--conflict-resolution takes skip, overwrite or newest. --from (mem0, zep or claude) is only for third-party formats; a Mnemosyne export is imported without it.