Backups and Disaster Recovery
Backups and Disaster Recovery
Section titled “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.
The two backup layers
Section titled “The two backup layers”| Layer | What | Where | Cadence | Size |
|---|---|---|---|---|
| Slim (recovery) | Irreplaceable state only | NAS share, rolling 7 days | Daily 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.
What’s in the slim backup
Section titled “What’s in the slim backup”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 ledgerlcm.db compacted long-conversation context (SQLite snapshot)memory/ vector embeddings (semantic memory index)credentials/ OAuth tokens, encrypted at resttasks/ task ledgeropenclaw.json main configcron/ cron definitions + run historysecrets.json SecretRef values, encrypted at restexec-approvals.jsonDeliberately excluded:
| Excluded | Reason |
|---|---|
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/.
A rolling week of archives
Section titled “A rolling week of archives”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:
# Pseudo-code from openclaw-backup-slimgzip -c "$RAW_TAR" > "$STAGE/openclaw-slim.tar.gz" # compress locallyif (( SIZE < 10_MB )); exit 1 # sanity checkgzip -t "$STAGE/openclaw-slim.tar.gz" # integrity, locallytar -tzf ... | check required members, reject dupes # contents, locallyDIGEST=$(shasum -a 256 "$STAGE/openclaw-slim.tar.gz") # digest BEFORE transfercp "$STAGE/openclaw-slim.tar.gz" "$TMP" # one copy to the share[[ $(shasum -a 256 "$TMP") == "$DIGEST" ]] || exit 1 # verify what landedmv "$TMP" "$DEST" # atomic renameln -sfn "$ARCHIVE_NAME" "$LATEST_LINK" # repoint latestprune_rotated "$KEEP" # only now, after successTwo 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:
~/.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.
The known gap
Section titled “The known gap”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.
Restoring onto a fresh Mac
Section titled “Restoring onto a fresh Mac”# 1. Install OpenClawnpm 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.sha256mkdir -p ~/.openclawtar -xzf openclaw-slim-latest.tar.gz -C ~/.openclaw --exclude='qmd' --exclude='qmd/*'mkdir -p ~/.cachetar -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 anthropicopenclaw 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 requestsopenclaw devices approve <id>
# 8. Start gatewayopenclaw gateway startTotal 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”| Thing | Recovery |
|---|---|
| Obsidian vault | Obsidian 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 archive | iCloud Mail serves it; local mail store regenerates |
| Messages.app database | Time Machine on external SSD, or iCloud Messages sync |
imsg install + dylib injection | brew install steipete/tap/imsg then imsg launch — not snapshot-restorable |
| Tailscale device registration | Re-auth via admin console; old device can be revoked |
Operational notes
Section titled “Operational notes”Check the last backup:
ls -la "$HOME/Library/Mobile Documents/com~apple~CloudDocs/lobster-backups/"# openclaw-slim-latest.tar.gz (inspect the mtime)Force a manual slim backup:
~/.local/bin/openclaw-backup-slimVerify the archive is restorable without doing a full restore:
tar -tzf "$HOME/Library/Mobile Documents/com~apple~CloudDocs/lobster-backups/openclaw-slim-latest.tar.gz" | head -20Cron job state:
openclaw cron list | grep -i "slim backup"openclaw cron runs --id e471e2b2-e879-4bc9-8562-0808a6520659The cron fires daily at 03:00 America/Los_Angeles, reports NO_REPLY on success, and iMessages Omar only when the script exits non-zero.
Test schedule
Section titled “Test schedule”Untested backups are Schrödinger’s backups — both working and broken until you open the box.
Every quarter:
- 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 - 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.sha256mkdir -p /tmp/backup-testtar -xzf openclaw-slim-latest.tar.gz -C /tmp/backup-testls /tmp/backup-test # expect: agents/ lcm.db memory/ .../usr/bin/trash /tmp/backup-test - Run
PRAGMA integrity_checkagainst the restoredstate/openclaw.sqliteand each restoredagents/*/agent/openclaw-agent.sqlite. - If anything is missing or the mtime is stale, investigate the cron run log.
Related
Section titled “Related”scripts/local-bin/openclaw-backup-slim— the backup script itselfscripts/local-bin/openclaw-backup— full local backup scriptconfig/cron-jobs.json—[Infra] Daily Slim Backupjob definition- Secrets Management — what’s inside
secrets.json