Docs / Local backups and restore

Local backups and restore

From 0.9.2, ModelBrain saves an encrypted snapshot of your memory store once a day and keeps the last seven. You don't need an account, and nothing leaves your computer. Before 0.9.2, unless you were on the Sync plan, you only had a backup if you made one yourself.

When it runs

The first snapshot is taken about ten minutes after ModelBrain starts. After that, ModelBrain checks every half hour and takes a new one once the last is a day old. Each snapshot reuses the parts of the store that haven't changed, so the first one is about the size of your store and the ones after it are usually much smaller. A snapshot taken after ModelBrain has tidied its files is bigger, because the merged files are saved again. When there are more than seven, the oldest is removed.

To see when the last one ran, look at last_backup in diagnostics, which gives the time, the snapshot id and the bytes written.

Where the backups are
System
Backups folder
Memory store
macOS
~/Library/Application Support/ModelBrain/backups
…/ModelBrain/data
Windows
%LOCALAPPDATA%\ModelBrain\backups
…\ModelBrain\data
Linux
~/.modelbrain/backups
~/.modelbrain/data

If your memory store is somewhere else, the backups folder sits next to it. It is called backups if the store folder is called data, and otherwise has the store folder’s name with -backups on the end.

The folder holds a snapshots folder, the key file backup.key, and a README.txt that explains how to restore. backup.key is created once. On macOS and Linux only your user account can read it. On Windows it gets the same permissions as the folder it sits in. Without it the snapshots can't be read. If you copy your backups to another drive, copy backup.key with them and keep it private. A snapshot you made yourself with modelbrain_backup snapshot uses the key file you gave it then, not this one; if a restore says the key does not decrypt the snapshot, it is the other key you need.

Folders it will not use

ModelBrain won't save backups inside the memory store itself, or inside a cloud-synced folder such as iCloud Drive, Dropbox or OneDrive. The key sits next to the snapshots, so a synced folder would upload both, and ModelBrain refuses a synced folder for the store for the same reason. If the folder is refused, the daily backup stays off and the log explains why. To fix it, set MODELBRAIN_BACKUP_DIR to a local folder outside the store.

Restoring

Restore uses modelbrain_backup, which is installed with ModelBrain. On macOS it's in ModelBrain.app/Contents/MacOS, on Windows in %LOCALAPPDATA%\Programs\ModelBrain, and on Linux in ~/.local/lib/modelbrain.

  1. Quit ModelBrain from the tray.
  2. See which snapshots you have: modelbrain_backup list --dest <backups folder>/snapshots
  3. Restore into a new, empty folder: modelbrain_backup restore --dest <backups folder>/snapshots --key-file <backups folder>/backup.key --snapshot latest --into <new folder>. If it can't find ModelBrain's search model, it asks for --model-path with the path to model.gguf.
  4. Move the old data folder aside, move the restored folder into its place and name it data, then start ModelBrain.

To restore an older snapshot, put its id from list in place of latest. Keep the old data folder until you've checked the restored memories.

Settings

Set MODELBRAIN_DAILY_BACKUP=0 to turn the daily snapshot off, or set MODELBRAIN_BACKUP_DIR to keep the backups somewhere else. If you uninstall ModelBrain, your memories, your settings and the backups folder all stay where they are. On Linux, uninstall.sh --purge-data removes all three. Running modelbrain_uninstall by hand prints where the backups folder is.

Local backups and managed backup

The daily local backup is free and stays on your computer, so it won't help if you lose the computer itself. Managed backup on the Sync plan stores encrypted backups off your computer, and you restore them from the Account window. Both can run at the same time. See Your ModelBrain account.

Questions

Does ModelBrain back up my memories automatically?

Yes, from 0.9.2. Once a day ModelBrain saves an encrypted snapshot of the memory store into a backups folder next to it and keeps the last seven. You don't need an account, and nothing leaves your computer.

What is backup.key?

It's the key that encrypts the snapshots. Without it they can't be read. If you copy the backups to another drive, copy backup.key with them and keep it private.

Does uninstalling delete my backups?

No. Uninstalling leaves your memories, your settings and the backups folder in place. On Linux, uninstall.sh --purge-data removes all three. Running modelbrain_uninstall by hand prints where the backups folder is.

How do I turn the daily backup off?

Set MODELBRAIN_DAILY_BACKUP=0. To keep the backups somewhere else, set MODELBRAIN_BACKUP_DIR.

ModelBrain won't start?

What the tray shows and what to try first.

Troubleshooting →
Command-line tools

Search and export from a terminal.

CLI →