Skip to content

Backups and Disaster Recovery

Most of Lobster’s state lives in ~/.openclaw/ on a single Mac. That directory holds everything that isn’t human-authored configuration — session transcripts, compacted context summaries, vector memory embeddings, OAuth tokens, cron run history. Losing the Mac means losing all of it.

This guide covers the two-layer backup strategy Lobster uses today, the decision rationale behind it, and how to restore onto a fresh machine.

LayerWhatWhereCadenceSize
Slim (recovery)Irreplaceable state onlyNAS share, rolling 7 daysDaily at 3 AM PT via launchd~3 GB each, ~21 GB total
Full (convenience)Entire ~/.openclaw/Local ~/lobster-backups/Manual via openclaw-backup~1.7 GB

They serve different purposes. The full backup makes a same-machine restore fast — if you corrupt a file and want to roll back an hour later, tar -xzf from the local tarball beats re-downloading Chromium and reinstalling plugins. The slim backup is the real disaster-recovery layer — it ships off-machine so a drive failure, fire, or lost Mac doesn’t take your memory with it.

Only the things that can’t be rebuilt by re-running setup.sh or reinstalling plugins:

agents/ sessions, auth profiles, workspaces (all agents)
state/ canonical shared state database and task ledger
lcm.db compacted long-conversation context (SQLite snapshot)
memory/ vector embeddings (semantic memory index)
credentials/ OAuth tokens, encrypted at rest
tasks/ task ledger
openclaw.json main config
cron/ cron definitions + run history
secrets.json SecretRef values, encrypted at rest
exec-approvals.json

Deliberately excluded:

ExcludedReason
browser/ (1.7 GB)Headless Chromium — openclaw browser start re-downloads
extensions/ (1.5 GB)Plugin installs — reinstallable via openclaw plugins install
logs/ (300+ MB)Forensic only; regenerates on every gateway run
media/ (230 MB)Message attachments — text context survives without them

The current archive is about 3 GB. Most of that growth is persisted agent runtime state, including multi-gigabyte Codex databases inside agents/.

Backups go to a NAS share over SMB, set via $OPENCLAW_BACKUP_DIR. Each night writes openclaw-slim-YYYY-MM-DD.tar.gz and repoints the openclaw-slim-latest.tar.gz symlink at it. Archives beyond the newest seven are pruned (--keep N, or $OPENCLAW_BACKUP_KEEP).

This used to be a single openclaw-slim-latest.tar.gz overwritten daily, because the destination was iCloud Drive on a 5 GB plan and 3 GB archives left no room for history. On an 11 TB share, seven copies cost about 21 GB and buy back the rollback case described under The known gap.

The script snapshots SQLite through its online backup API, then builds and validates the archive on local scratch before anything crosses the network:

Terminal window
# Pseudo-code from openclaw-backup-slim
gzip -c "$RAW_TAR" > "$STAGE/openclaw-slim.tar.gz" # compress locally
if (( SIZE < 10_MB )); exit 1 # sanity check
gzip -t "$STAGE/openclaw-slim.tar.gz" # integrity, locally
tar -tzf ... | check required members, reject dupes # contents, locally
DIGEST=$(shasum -a 256 "$STAGE/openclaw-slim.tar.gz") # digest BEFORE transfer
cp "$STAGE/openclaw-slim.tar.gz" "$TMP" # one copy to the share
[[ $(shasum -a 256 "$TMP") == "$DIGEST" ]] || exit 1 # verify what landed
mv "$TMP" "$DEST" # atomic rename
ln -sfn "$ARCHIVE_NAME" "$LATEST_LINK" # repoint latest
prune_rotated "$KEEP" # only now, after success

Two properties fall out of that ordering. If the run dies at any point before the rename (SMB hiccup, disk full, kernel panic), the temp file never replaces a good archive. And because the digest is computed before the transfer and checked against what arrived, a truncated or corrupted copy is caught while the previous archive is still on disk, rather than being signed off on.

Pruning happens last, so a failed run can never leave the directory holding less than it found.

Before a forward-only migration, create a separate labeled capsule. Labeled backups never overwrite an existing file:

Terminal window
~/.local/bin/openclaw-backup-slim --label pre-migration-$(date +%Y%m%d-%H%M%S)

Each archive contains .backup-manifest/sqlite-snapshots.tsv, with the schema version and SHA-256 checksum of every SQLite snapshot. A matching SHA-256 file for the complete tarball is written beside the archive.

This used to read: if the state corrupts mid-day, the next 3 AM backup faithfully overwrites the known-good copy with the corrupted state. Rotation closes most of it. Corruption is now recoverable as long as you notice within seven days, by extracting a dated archive instead of latest.

What remains:

  • Silent corruption older than the window. Nothing here validates that the contents are sane, only that the archive is intact and holds the required members. Corruption that predates the oldest retained archive is unrecoverable.
  • A single destination. Seven copies on one NAS share is not seven copies in seven places. A share-level failure takes all of them.
  • Time Machine on an external SSD remains worthwhile for finer-grained rollback between nightly runs.
Terminal window
# 1. Install OpenClaw
npm install -g openclaw
# 2. Clone the Lobster repo (configuration-as-code lives here)
git clone https://github.com/omarshahine/Lobster ~/GitHub/lobster
# 3. Run full setup (deps, skill deployment, MCP servers, Messages keepalive)
bash ~/GitHub/lobster/setup/setup.sh
# 4. Restore state from the slim backup. The qmd/ member belongs under
# ~/.cache; extract the remaining members under ~/.openclaw.
# Mount the NAS share, then use openclaw-slim-latest.tar.gz for the newest
# snapshot, or a dated openclaw-slim-YYYY-MM-DD.tar.gz to roll back.
# Verify first: shasum -a 256 -c openclaw-slim-latest.tar.gz.sha256
mkdir -p ~/.openclaw
tar -xzf openclaw-slim-latest.tar.gz -C ~/.openclaw --exclude='qmd' --exclude='qmd/*'
mkdir -p ~/.cache
tar -xzf openclaw-slim-latest.tar.gz -C ~/.cache qmd
# 5. Re-authenticate model providers (OAuth tokens don't survive machine moves)
openclaw models auth login --provider anthropic
openclaw models auth login --provider openai-codex
# ... any others you use
# 6. Re-pair channels
# iMessage: install imsg, run imsg launch, verify channels.imessage.cliPath
# WhatsApp: wacli login (scan QR), re-pair via Baileys
# 7. Re-approve paired devices (iPhone, dashboard, etc)
openclaw devices list # shows pending requests
openclaw devices approve <id>
# 8. Start gateway
openclaw gateway start

Total time: under an hour once OAuth flows complete.

What’s not in the backup and where it lives

Section titled “What’s not in the backup and where it lives”
ThingRecovery
Obsidian vaultObsidian Sync (Obsidian’s own paid service) — separate backup pipeline
OpenClaw source checkouts (~/GitHub/*)Git clone from GitHub
Repo secrets (~/.openclaw/secrets.json before OAuth)Restored by the slim backup
Apple Mail archiveiCloud Mail serves it; local mail store regenerates
Messages.app databaseTime Machine on external SSD, or iCloud Messages sync
imsg install + dylib injectionbrew install steipete/tap/imsg then imsg launch — not snapshot-restorable
Tailscale device registrationRe-auth via admin console; old device can be revoked

Check the last backup:

Terminal window
ls -la "$HOME/Library/Mobile Documents/com~apple~CloudDocs/lobster-backups/"
# openclaw-slim-latest.tar.gz (inspect the mtime)

Force a manual slim backup:

Terminal window
~/.local/bin/openclaw-backup-slim

Verify the archive is restorable without doing a full restore:

Terminal window
tar -tzf "$HOME/Library/Mobile Documents/com~apple~CloudDocs/lobster-backups/openclaw-slim-latest.tar.gz" | head -20

Cron job state:

Terminal window
openclaw cron list | grep -i "slim backup"
openclaw cron runs --id e471e2b2-e879-4bc9-8562-0808a6520659

The cron fires daily at 03:00 America/Los_Angeles, reports NO_REPLY on success, and iMessages Omar only when the script exits non-zero.

Untested backups are Schrödinger’s backups — both working and broken until you open the box.

Every quarter:

  1. Check the backup mtime is within the last 24 hours, and that the expected number of dated archives is present:
    Terminal window
    ls -la "$OPENCLAW_BACKUP_DIR" # expect ~7 dated archives + the latest symlink
  2. Verify the digest, then extract to a scratch directory and confirm layout:
    Terminal window
    cd "$OPENCLAW_BACKUP_DIR"
    shasum -a 256 -c openclaw-slim-latest.tar.gz.sha256
    mkdir -p /tmp/backup-test
    tar -xzf openclaw-slim-latest.tar.gz -C /tmp/backup-test
    ls /tmp/backup-test # expect: agents/ lcm.db memory/ ...
    /usr/bin/trash /tmp/backup-test
  3. Run PRAGMA integrity_check against the restored state/openclaw.sqlite and each restored agents/*/agent/openclaw-agent.sqlite.
  4. If anything is missing or the mtime is stale, investigate the cron run log.
  • scripts/local-bin/openclaw-backup-slim — the backup script itself
  • scripts/local-bin/openclaw-backup — full local backup script
  • config/cron-jobs.json — [Infra] Daily Slim Backup job definition
  • Secrets Management — what’s inside secrets.json