Skip to content

Back up and restore

Keep a complete, verified recovery point for a 1.7.0 instance and restore it without destroying the evidence you would need if the restore fails.

Prove your own backups by restoring them in an isolated environment before you rely on them: another host, with its own object storage restored from the copy, never the production bucket. The Compose file gives Core, Graph, Neo4j and Qdrant fixed container names (hivemind, hivemind-graph-memory, hivemind-neo4j, hivemind-qdrant), so a second stack on the same host cannot run while the first one does.

Before you start

What a recovery point contains

A 1.7.0 instance keeps state in several places. A recovery point is a matching set of all of them, taken for the same moment. A database snapshot without its matching Core volume cannot recover local credentials, sealed OIDC secrets or the Core-Graph binding. Neither the Core volume nor any snapshot Core takes contains the memory itself: notes and banks live in the object storage, and a recovery point without them restores identities and grants with no memory, or with memory from another moment.

State Where it lives How it is backed up
Memory objects: SHORT notes, MID banks and rules, consolidation history, retained trash, space metadata The bucket (with the SQLite object backend, Core's object database at SQLITE_PATH) An off-host copy taken in the same stopped window as the Core volume. Bucket versioning, per-space archives and the derived long memory are not that backup.
Authority store (identity, grants, sessions, audit) authority.sqlite on the Core private volume hivemind_core_data The Core volume backup, plus a manual authority snapshot (file and manifest) taken in the same stopped window. Core's scheduled snapshots under _system/authority/snapshots/ predate the window.
Private authentication stores and their keys local/ and oidc/ on the Core volume The Core volume backup only. Snapshots never contain them.
Internal Graph transport credential and Graph's binding secrets/ and graph/ on the Core volume The Core volume backup only
Exported audit history The bucket, under the audit prefix Kept in the bucket. No lifecycle rule may remove it.
Operational database (unexported Analytics events, catalog, checkpoints) The operational volume A manual operational snapshot (file and manifest) taken in the same stopped window. The restore command consumes only a snapshot, never a raw copy of the volume. Core's scheduled snapshots under _system/operational/snapshots/ predate the window and can miss accepted events still held in the operational spool.
Analytics history, instance binding object The bucket (or Core's object database) The same off-host copy as the memory objects
Long memory documents and indexes Graph's own storage: the bucket for uploaded documents by default (Graph's own SQLite file at GRAPH_SQLITE_PATH with that backend), Neo4j and Qdrant for the graph and vectors Uploaded documents travel with the object storage copy. Copies of the Neo4j and Qdrant volumes taken in the same stopped window. Long memory is derived: keep the original sources of uploaded documents.
Secrets outside the volumes: S3 credentials, inference provider keys, the Mesh private key and the other secret settings The deployment's .env and the files it refers to Your secret management. .env is the only secret kept on the host, and a restore on another host needs it, or every secret it holds, from there.
Bucket configuration: versioning, encryption, the access principal and its policy The object storage service A record kept with the recovery point, to recreate them on a replacement bucket. The object copy does not carry them.

The Core volume is the backup unit for everything Core cannot recreate. Treat every copy of it, and of .env, as secret.

What Hivemind does for you, and what it does not

  • Core publishes an authority snapshot at startup and daily, exports audit history hourly and once more on clean shutdown, keeps local audit for 90 days by default, and captures the operational database at startup and daily.
  • Core never deletes a snapshot. Monitor storage growth and apply your own retention that keeps complete, verified sets for your recovery period.
  • Hivemind does not back up the memory objects, the Core volume, the operational volume or .env. Schedule those backups yourself, off-host, and test them.
  • Bucket versioning is not a backup: it gives no coordinated recovery point and does not survive the loss of the bucket itself.
  • Space archives from the Portal have no scheduler, retention or purge.
  • Bucket versioning and server-side encryption are not enabled by Hivemind. Enable them on the bucket (see Security and privacy).

Steps

Back up the instance

A recovery point is taken in one stopped window: Hivemind is the only writer of its dedicated bucket, so with Core, the worker and Graph stopped, nothing changes the memory or the stores, and with Graph's Neo4j and Qdrant services stopped as well, nothing changes their volumes while you copy them. Hivemind has no command that copies the object storage; use your provider's or your own tooling, and keep the copy off-host.

  1. Once, at provisioning time, turn on bucket versioning directly on the bucket. It is a safety net for accidental deletes, not a backup:

    aws s3api put-bucket-versioning \
      --bucket "$S3_BUCKET_NAME" \
      --versioning-configuration Status=Enabled
    
  2. Open the window: stop Core, the worker and Graph, then Graph's Neo4j and Qdrant services. A clean stop of Core also writes a final audit export to the object storage. Neo4j and Qdrant are separate services: left running, each keeps writing its own files (checkpoints, background optimization), and a copy of a live volume may not restore. In the deployment directory, select both Compose files and the deployment's Core image for the shell, then stop with more than Docker's default 10 seconds, which can be too short for Neo4j to shut down cleanly. The WAF, which depends on Core, stops with it:

    export COMPOSE_FILE=docker-compose.yml:docker-compose.auth17.yml
    export HIVEMIND_IMAGE=registry.example/hivemind@sha256:<digest>
    export HIVEMIND_PULL_POLICY=never
    docker compose stop --timeout 120 hivemind hivemind-worker graph-memory
    docker compose stop --timeout 120 neo4j qdrant
    

    Still in the window, verify the authority's audit chain and run the audit export once more, so that the exported history is complete even if the export at shutdown failed. Each command runs in a one-off Core container that starts no other service:

    docker compose run --rm --no-deps hivemind \
      python -m live_mem.core.maintenance_cli verify-audit \
      --store-path /data/core/authority.sqlite
    docker compose run --rm --no-deps hivemind \
      python -m live_mem.core.maintenance_cli export-audit \
      --store-path /data/core/authority.sqlite
    
  3. Copy the memory objects off-host:

    • S3 backend: copy every current object of the deployment's dedicated bucket. That includes the memory objects and _system/, which holds the authority and operational snapshots, the exported audit history and the instance binding object. Use a copy that keeps each object's key, bytes, content type and user metadata: a copy that passes through a local filesystem keeps only keys and bytes. No copy carries the bucket's version history.
    • SQLite object backend: copy Core's object database file at SQLITE_PATH, and Graph's at GRAPH_SQLITE_PATH when Graph uses SQLite, from their private directories. Never copy a live database file: the window must be open. Rehearse its restore before relying on it.
  4. In the same window, back up the whole Core private volume as one unit with your volume backup tool, or from a filesystem-consistent volume snapshot taken in that window. Encrypt the backup and restrict access to it. With Docker alone, archive the volume as root in a plain docker run, so that the archive keeps every file's owner and mode: a docker compose run of a Hivemind service drops the capabilities this needs. Compose prefixes the volume name with the project name:

    docker volume ls --filter name=hivemind_core_data
    docker run --rm --user 0:0 --network none \
      -v <project>_hivemind_core_data:/data/core:ro \
      -v <private-backup-dir>:/backup \
      "$HIVEMIND_IMAGE" tar --numeric-owner -C /data/core -cpf /backup/hivemind_core_data.tar .
    

    Each volume of the recovery point gets its own archive file in that directory; step 6 writes the Neo4j and Qdrant archives next to this one.

  5. In the same window, take the authority and operational snapshots that the restore steps consume. Prepare a private host directory, <recovery-set-dir>, owned by UID 10001 with mode 0700, and run both commands in a one-off Core container with both Compose files and that directory mounted (the same container pattern as the fresh-installation guide). Put that directory on a local filesystem of the Docker host (on Linux: ext4, XFS, Btrfs or ZFS): the operational snapshot refuses any other, such as a network share or a folder that Docker Desktop shares from the host, with store_filesystem.

    docker compose run --rm --no-deps -v <recovery-set-dir>:/data/recovery-point hivemind \
      python -m live_mem.core.maintenance_cli snapshot \
      --store-path /data/core/authority.sqlite --output-directory /data/recovery-point
    docker compose run --rm --no-deps -v <recovery-set-dir>:/data/recovery-point hivemind \
      python -m live_mem.core.operational_backup snapshot \
      --output-directory /data/recovery-point
    

    Each command writes one snapshot file and an adjacent .manifest.json, under its own name: <utc>-<schema>-<deployment-id>.sqlite for the authority store and <utc>-<instance-id>.operational.sqlite for the operational database. The restore steps read them by those names. The operational snapshot reads the stopped database and includes the accepted Analytics events that were not exported, for example when the export at shutdown failed. Copy the directory off-host with the rest of the set. Do not rely on a raw copy of the operational volume instead: the operational restore command accepts only a snapshot and its manifest.

  6. In the same window, with Neo4j and Qdrant stopped, copy Graph's own datastores (the neo4j_data and qdrant_data volumes) with your volume backup tool. With Docker alone, archive each one as in step 4, to its own file in the same directory:

    docker run --rm --user 0:0 --network none \
      -v <project>_neo4j_data:/data/neo4j:ro \
      -v <private-backup-dir>:/backup \
      "$HIVEMIND_IMAGE" tar --numeric-owner -C /data/neo4j -cpf /backup/neo4j_data.tar .
    docker run --rm --user 0:0 --network none \
      -v <project>_qdrant_data:/data/qdrant:ro \
      -v <private-backup-dir>:/backup \
      "$HIVEMIND_IMAGE" tar --numeric-owner -C /data/qdrant -cpf /backup/qdrant_data.tar .
    

    The directory then holds three archives: hivemind_core_data.tar, neo4j_data.tar and qdrant_data.tar.

  7. Close the window: start Neo4j and Qdrant, then Core, then the worker and Graph:

    docker compose start neo4j qdrant
    docker compose start hivemind hivemind-worker graph-memory waf
    
  8. Record which object storage copy, Core volume backup, authority snapshot file, operational snapshot file, Graph volume copies and .env version belong together, naming each snapshot file, with the bucket configuration (versioning, encryption, access principal and policy). That set is your recovery point. Copies taken in different windows are not one recovery point.

Between recovery points, Core's scheduled snapshots and exports continue. To add one by hand, run these in the Core container with the same storage configuration as Core. They capture the authority store and the operational database only, never the memory objects:

python -m live_mem.core.maintenance_cli snapshot \
  --store-path /data/core/authority.sqlite --output-directory /data/core/snapshots
python -m live_mem.core.maintenance_cli export-audit \
  --store-path /data/core/authority.sqlite
python -m live_mem.core.operational_backup snapshot \
  --output-directory /data/operational-backups

The operational snapshot is safe while Core runs; its output directory must exist and be private (mode 0700).

Back up one space (S3 backend)

A complete archive of one common space is a single .tar.gz that includes its notes, bank, original long memory files, graph, vectors and embedding identity. It never contains credentials, token registries or global authority. A SQLite-backed deployment is backed up as a whole instead.

  1. Sign in with an operator session that has write access to the space.
  2. Open the space, then Settings → Backups → View backups, and choose Create backup.
  3. Follow the attempt until it is complete. Writes to that space pause while accepted work drains; reads and other spaces continue.
  4. Choose Download and check the browser's download result: the availability check is not proof that the file was saved.

Personal spaces, spaces bound to Project Mesh and spaces with an explicit remote long memory binding cannot use this archive. The full contract is in Manual space backups.

Restore the instance

Preconditions: the product version that wrote the backup (an operational snapshot is accepted only with the exact schema of the binary restoring it), a recovery point whose parts match, and a decision about which recovery path you take. Never create replacement private stores during an ordinary restore: startup fails closed when they are missing or belong to another deployment.

Restore every part from one recovery point. That is the only combination whose consistency these steps define: a restored Core volume next to newer memory objects, or older memory objects next to a newer store, describes two different moments.

Restore everything before any service starts, the operational volume after the authority store. Hivemind has no command for restoring the object storage itself; restore it into the bucket the deployment is configured with.

  1. Stop Core, the worker and Graph, then Graph's Neo4j and Qdrant services, with the shell set up and the timeout of step 2 of Back up the instance.
  2. Preserve the current state before you change anything: the Core volume, the operational volume, and the current object storage, including its exported audit history. Restoring the object storage replaces audit exports newer than the recovery point; keep a copy of them off-host. They are also your evidence if the restore goes wrong.
  3. Restore the memory objects from the recovery point's copy: every object of the bucket, or the SQLite object database files, with your tooling. The restored object storage must hold exactly the copy's objects, by key and content: objects written after the recovery point and left beside the restored ones mix two moments. Removing them is destructive; do it only once step 2 has preserved them. Restore with a copy that keeps each object's content type and user metadata, as the backup did. The restored objects start a new version history, and their ETags can differ from the originals. With the SQLite backend, keep SQLITE_CREATE and GRAPH_SQLITE_CREATE at false, so that a missing database refuses startup instead of being replaced by an empty one.

    To restore on a replacement object store, create a bucket with the name in S3_BUCKET_NAME, recreate the bucket configuration recorded with the recovery point (versioning, encryption, access principal and policy), restore every object into it, and point S3_ENDPOINT_URL and the S3 credentials in .env at the new service. Core then finds the instance binding object it expects; a bucket that does not hold the restored objects refuses startup with operational_binding_missing. 4. Restore the Core private volume from the same recovery point, as one unit: authority store, local/ and oidc/ with their keys and manifests, secrets/ and graph/. Restore into an empty volume, as root, so that every file keeps its owner and mode. With hivemind_core_data.tar, the archive of step 4 of the backup:

    docker run --rm --user 0:0 --network none \
      -v <project>_hivemind_core_data:/data/core \
      -v <private-backup-dir>:/backup:ro \
      "$HIVEMIND_IMAGE" tar --numeric-owner -C /data/core -xpf /backup/hivemind_core_data.tar
    
    5. Only if the authority store in the volume backup is unusable: restore the authority snapshot recorded in the recovery set instead. Taken in the same window, it matches the restored private stores and the restored audit history. Mount the recovery set's directory in the Core container, keep the file and its adjacent .manifest.json together, and restore it to a new, empty path on the Core volume:

    docker compose run --rm --no-deps -v <recovery-set-dir>:/data/recovery-point:ro hivemind \
      python -m live_mem.core.maintenance_cli restore \
      --store-path /data/core/recovered.sqlite --snapshot /data/recovery-point/<authority-snapshot>.sqlite
    docker compose run --rm --no-deps hivemind \
      python -m live_mem.core.maintenance_cli verify-audit \
      --store-path /data/core/recovered.sqlite
    

    The command refuses a populated target. If the exported audit history is newer than the snapshot, it refuses and prints both sequence numbers; see Restore an older snapshot. Point Core at the recovered store, kept directly in /data/core, with this line in .env; Compose passes it to Core and the worker:

    AUTHORITY_STORE_PATH=/data/core/recovered.sqlite
    
  4. Restore the operational snapshot recorded in the recovery set into an existing, empty, private directory on a mounted volume (never the container's own layer). The simplest target is an empty operational volume at /data/operational, where Core expects it: on another host, the volume Compose creates on first use; on the same host, a new volume once step 2 has preserved the current one. Mount the recovery set's directory in the Core container:

    docker compose run --rm --no-deps -v <recovery-set-dir>:/data/recovery-point:ro hivemind \
      python -m live_mem.core.operational_backup restore --confirm-core-stopped \
      --target /data/operational \
      --snapshot /data/recovery-point/<operational-snapshot>.operational.sqlite
    

    The command reads the adjacent .manifest.json and checks the digest, the schema, the instance binding and the counts of unexported and exported events against it, then writes its identity file last. The live volume is never opened. An interrupted restore leaves a directory that is refused; inspect it, never adopt it. A restore into another directory needs Core pointed at it: set OPERATIONAL_DIRECTORY to it, or mount it as the volume Compose places at /data/operational.

    A scheduled snapshot from the object storage (--manifest-key _system/operational/snapshots/<utc>-<uuid>.manifest.json instead of --snapshot) is a fallback only when the recovery set's snapshot is unusable. It predates the window, so events accepted after it was taken are lost.

  5. With Neo4j and Qdrant still stopped, restore their volume copies taken in the same window, each into an empty volume. With the archives of step 6 of the backup:

    docker run --rm --user 0:0 --network none \
      -v <project>_neo4j_data:/data/neo4j \
      -v <private-backup-dir>:/backup:ro \
      "$HIVEMIND_IMAGE" tar --numeric-owner -C /data/neo4j -xpf /backup/neo4j_data.tar
    docker run --rm --user 0:0 --network none \
      -v <project>_qdrant_data:/data/qdrant \
      -v <private-backup-dir>:/backup:ro \
      "$HIVEMIND_IMAGE" tar --numeric-owner -C /data/qdrant -xpf /backup/qdrant_data.tar
    
  6. Start Neo4j and Qdrant, then Core, then the worker and Graph. At startup Core compares the operational volume with the object storage's instance binding before any other write and rebuilds derived tables when needed. With scripts/authority-compose.sh, Compose waits for healthy Neo4j and Qdrant before it starts Graph.

  7. On another host, or after recreating the stack, check the browser sign-in path. The stack's network can have a new subnet: read it as in Deploy a test server, update AUTH_BROWSER_TRUSTED_PROXIES in .env and run scripts/authority-compose.sh again, or every browser sign-in is refused. The WAF's certificates live in its caddy_data volume, which the recovery point does not hold: a new volume obtains new certificates for SITE_ADDRESS, and the local certificate authority of a local installation is a new one that each client computer must trust again.

Restore an older snapshot

This path recovers the authority store alone when it is lost and the object storage is kept as it is: identities, grants and spaces created after the snapshot are missing from the recovered store, while the memory objects are newer. Hivemind does not reconcile the two. Use it only when no complete recovery point is usable, and rehearse it.

When the exported audit history is ahead of the only snapshot you can use, restore binds the store to a new, empty audit namespace: that is the point of no return for the audit trail. The original exports stay untouched; preserve them.

python -m live_mem.core.maintenance_cli restore \
  --store-path /data/core/recovered.sqlite --snapshot /data/core/snapshots/SNAPSHOT.sqlite \
  --audit-namespace _system/audit-namespaces/<recovery-id>/ \
  --settings-output /data/core/recovery.env

After verification, configure Core with the AUTHORITY_AUDIT_PREFIX written in the private settings output and the recovered store path before starting it.

Restore one space from an archive

  1. Sign in as a deployment operator on a deployment running the same product version as the archive.
  2. Choose Create space → Start from → A complete archive and confirm the original space ID. The ID must never have been used on this deployment.
  3. Follow the import until the space is restored. Use Archive import status → Find import on the same ID after closing the dialog.

A native import pauses writes to every space of the tenant for its duration. Reads continue. Schedule it. Existing spaces and non-empty namespaces are never overwritten. SHORT event receipts that need the separate recovery path and Project Mesh state are kept in the archive but cannot be imported this way. A restore starts a new space incarnation; it never rewinds instance history.

Verify

  • verify-audit succeeds on the live or recovered store.
  • A bucket snapshot counts only with its manifest and every object it lists. Objects without a manifest are incomplete sets and are never restored.
  • Core and job logs show no snapshot or export failures. A scheduled job that runs is not a restore test.
  • The object storage copy holds the same objects as the source at the time of the window; compare their inventories with your tooling.
  • The recovery set names the authority snapshot file and the operational snapshot file taken in its window, each next to its .manifest.json.
  • A restore drill outside production, from one complete recovery point, brings up Core, an operator signs in, and a test space's notes and bank read back as before. Record the drill's result.
  • After a space import, the space is active and its notes and bank read back.

Troubleshoot

Symptom Cause Fix
Restore refuses the target. The target path is populated. Use a new, empty path. Do not delete evidence to make a target look empty.
Restore refuses with two audit sequence numbers. The exported audit tip is newer than the snapshot. Use a newer snapshot, or the audit namespace procedure above.
Core refuses to start: operational_binding_missing. The bucket's binding object is absent: wiped, replaced or wrong bucket. Check S3_BUCKET_NAME and the bucket before anything else.
Core refuses to start: operational_instance_mismatch. The operational volume belongs to another or a re-initialized instance. Restore the operational snapshot recorded in the recovery set.
Core refuses to start after restoring only part of the Core volume. A private store is missing or belongs to another deployment. Restore the whole volume from one backup.
A space backup stays paused or reports recovery required. An admitted write could not be settled. Follow the recovery steps in Manual space backups. Deleting the backup does not reopen writes.
A download or import returns 429 backup_transfer_busy. Every transfer slot of that direction is in use. Retry later, or raise BACKUP_TRANSFER_CONCURRENCY in .env and restart Core.

Last-resort operations

Each command below destroys or abandons something for good. Run one only after preserving every copy of the affected state and deciding that nothing else can recover it.

Situation Command What is lost for good
Both private stores and all their backups are lost python -m live_mem.auth_install_cli private-stores reinit --store-path /data/core/authority.sqlite --acknowledge-loss, with Core and every writer stopped and after confirming local/ and oidc/ are absent Every local sign-in factor; open browser sessions and pending challenges are revoked; OIDC connections whose secrets were sealed in the lost store are disabled. Users stay. Issue new local setup codes and re-provision those connections afterwards.
The bound operational volume is lost for good python -m live_mem.core.operational_backup rebind --confirm-core-stopped --acknowledge instance-loss The accepted Analytics events not yet exported.
The bucket was deliberately replaced python -m live_mem.core.operational_backup rebind --confirm-core-stopped --acknowledge object-store-change The old binding; every derived table is rebuilt.

Restoring over a space that carries shared Project Mesh state is refused by default through the legacy backup_restore path; its unsafe_recovery option publishes the restored state as new history and leaves the node requiring a resync of its peers. It never bypasses corruption. See the backup and restore contract.

Next