Synapse field manuallocal · v1.19.4
synapse

Data lifecycle

Locate the database, understand startup checks and automatic backups, export a consistent snapshot, and restore safely.

referencerelease 1.19.4

Files and permissions

On macOS, the default data directory is ~/Library/Application Support/synapse. Run synapse path to print the resolved data, shared-guidance, and CLI paths for the current environment.

PathPurpose
brain.dbScoped memory, import provenance and batches, settings, vault metadata, global mappings, and scope approvals.
SOUL.mdThe editable shared guidance loaded by both connected tools and the MCP server.
brain.db-wal and brain.db-shmSQLite write-ahead-log sidecars while the database is active.
brain.lockShared lifecycle lock held by the app, CLI operations, and MCP server.
backups/Automatic pre-migration and pre-restore SQLite snapshots.

On Unix systems the data and backup directories use mode 0700; database files, sidecars, locks, and backups use 0600.

Startup

Every database open follows the same sequence:

  1. Create and secure the data directory if needed.
  2. Acquire a shared lifecycle lock.
  3. Open SQLite with foreign keys enabled, a five-second busy timeout, and WAL journal mode.
  4. Run PRAGMA foreign_key_check, and PRAGMA quick_check when this store has not already been read.
  5. Reject a database newer than the current application supports.
  6. Create a pre-migration snapshot when an existing database needs a numbered migration, then apply the migration transactionally.
  7. Move project memory filed under a repository's folder path to that repository's origin key, when the folder is still a repository with a remote. A store with nothing to move costs one indexed read.
  8. Reapply owner-only file permissions.
shell
synapse data check
synapse data check --json

Automatic backups

Before changing an existing schema, Synapse creates backups/brain.<timestamp>.v<version>.db. Before replacing an existing database during restore, it creates backups/brain.<timestamp>.restore.db.

Upgrading to schema 13 rebuilds the search index: memory is stemmed, sources become searchable, and a fragment index is added beside it. Like every migration it is one-way. An earlier Synapse refuses a store this release has opened, and says so. To go back, close Synapse and restore the .v12.db snapshot it took first.

These are complete snapshots created through SQLite VACUUM INTO, not copies of a live database file. Synapse does not currently rotate them; include the folder in your normal local backup policy and remove old snapshots deliberately.

Export a portable snapshot

shell
synapse data export "$HOME/Desktop/synapsebackup.db"
synapse data check --json

The destination must not already exist. Synapse opens the active database normally, writes a consistent compact snapshot, secures its permissions, then reopens it read-only and validates integrity before reporting success.

Restore a snapshot

  1. Quit the Synapse desktop app.
  2. Close all tool sessions connected to this store, including those using devcontainer SSH.
  3. Run the restore command from a separate terminal.
shell
synapse data restore "$HOME/Desktop/synapsebackup.db"
synapse data check

Restore opens the source read-only, validates page and relationship integrity, and requires its schema version to match the current release. It then tries to acquire the exclusive lifecycle lock. If the app or any MCP server still holds the database, restore refuses without changing anything.

When a current database exists, Synapse validates it and creates a recovery snapshot before atomically replacing it. WAL and SHM sidecars are cleared, file permissions are secured, and the containing directory is synced.

Memory wipe is not a reset

synapse memory wipe --confirm removes every memory entry and import batch but leaves SOUL.md, settings, vault labels, stored values, global mappings, and scope approvals. Use it when you want a clean memory history without rebuilding guidance or credential setup.

To remove Synapse completely, first revoke devcontainer grants and forget each secret through the app or CLI. Then quit all processes and remove the application, installed launcher, and data directory deliberately. Removing the data directory also removes the encrypted vault and its key. synapse uninstall --data reports this before it acts.