Backup & Migration
TL;DR: Stop the stack, copy $DATA_DIR. Or run pg_dump against DATABASE_URL. That's it.
# Option A: file copy
mememory uninstall # stops containers, preserves data
cp -a "$DATA_DIR" "$DATA_DIR.backup-$(date +%F)"
mememory setup # back up
# Option B: logical dump
pg_dump "$DATABASE_URL" > mememory-$(date +%F).sqlAll mememory data lives in a single directory on your machine. This page covers backup, restore, export/import, and migration between machines.
Data Location
By default, all persistent data is stored under an OS-standard path resolved by the mememory CLI:
| Platform | Default |
|---|---|
| Linux | ~/.local/share/mememory (or $XDG_DATA_HOME/mememory) |
| macOS | ~/Library/Application Support/mememory |
| Windows | %LOCALAPPDATA%\mememory |
$DATA_DIR/
├── postgres/ # PostgreSQL data files (memories, vectors, indexes)
└── ollama/ # Ollama model files (nomic-embed-text, etc.)This location is controlled by the DATA_DIR environment variable. If unset, the CLI auto-resolves it.
Backup
Full backup (recommended)
Stop the stack and copy the data directory:
# Stop services to ensure data consistency (containers only, data preserved)
mememory uninstall
# Copy the data directory
cp -a "$DATA_DIR" "$DATA_DIR.backup-$(date +%Y%m%d)"
# Restart
mememory setupWARNING
Always stop PostgreSQL before copying its data directory. Copying while PostgreSQL is running may produce a corrupted backup.
Logical dump (works against any Postgres)
pg_dump "$DATABASE_URL" > mememory-$(date +%F).sqlRestore later with psql "$DATABASE_URL" < mememory-2026-04-08.sql.
JSON export (portable across embedding providers)
Export memories as JSON via the Admin API. This exports content and metadata but not vector embeddings — vectors are re-computed on import.
curl http://localhost:4200/api/memories/export \
-X POST \
-o memories-backup.jsonThe exported JSON is an array of memory objects:
[
{
"id": "a1b2c3d4-...",
"content": "Never commit .env files",
"scope": "global",
"type": "rule",
"tags": ["security"],
"weight": 1.0,
"created_at": "2025-01-15T10:30:00Z",
"updated_at": "2025-01-15T10:30:00Z"
}
]Restore
From full backup
mememory uninstall
cp -a "$DATA_DIR.backup-20250115" "$DATA_DIR"
mememory setupFrom JSON export
curl http://localhost:4200/api/memories/import \
-X POST \
-H "Content-Type: application/json" \
-d @memories-backup.jsonThe import process:
- Each memory is re-embedded through the current embedding provider
- New UUIDs are generated (old IDs are not preserved)
supersedesreferences are not preserved (old IDs no longer exist)- The response reports how many memories were imported
{"imported": 42}TIP
JSON export/import is the recommended method when migrating between different embedding providers. The re-embedding ensures vectors are compatible with the new provider.
Migration Between Machines
Method 1: Full data copy
If both machines use the same embedding provider and model:
# On source machine
mememory uninstall
tar czf mememory-data.tar.gz -C "$(dirname "$DATA_DIR")" "$(basename "$DATA_DIR")"
# Transfer to target machine
scp mememory-data.tar.gz user@target:~/
# On target machine
tar xzf mememory-data.tar.gz -C "$(dirname "$DATA_DIR")"
mememory setupMethod 2: JSON export/import
Works across different embedding providers:
# On source machine
curl http://localhost:4200/api/memories/export -X POST -o memories.json
# Transfer
scp memories.json user@target:~/
# On target machine (stack must be running)
curl http://localhost:4200/api/memories/import \
-X POST \
-H "Content-Type: application/json" \
-d @memories.jsonResetting
To delete all data and start fresh, use mememory uninstall --purge. This requires interactive confirmation (you must type the full data directory path):
mememory uninstall --purgeThe CLI never destroys Docker volumes — all data lives in a bind-mounted directory you control, and removal happens through os.RemoveAll against the path you confirmed.
Selective Deletion
Delete memories matching specific filters via the Admin API:
# Delete all memories for a specific project
curl "http://localhost:4200/api/memories?project=old-project" -X DELETE
# Delete all memories of a specific type
curl "http://localhost:4200/api/memories?type=context" -X DELETE
# Delete all memories in a scope
curl "http://localhost:4200/api/memories?scope=project&project=match" -X DELETEOr delete individual memories by ID:
curl http://localhost:4200/api/memories/MEMORY-UUID-HERE -X DELETE