Backup, restore, and migrate OpenClaw installations between machines.
# Download the restore script
curl -sLO https://raw.githubusercontent.com/seans-openclawbot/openclaw-migrate/main/restore.sh
chmod +x restore.sh
# Restore (works on a fresh machine — installs Node + OpenClaw if needed)
bash restore.sh /path/to/openclaw-backup.tgzcurl -sLO https://raw.githubusercontent.com/seans-openclawbot/openclaw-migrate/main/openclaw-migrate.sh
chmod +x openclaw-migrate.sh
# Hot backup (gateway stays running — cron-safe)
./openclaw-migrate.sh backup
# Cold export (stops gateway first)
./openclaw-migrate.sh export# One-shot: export → scp → install → import on remote
./openclaw-migrate.sh push user@newhost --encryptEverything inside ~/.openclaw/ (or $OPENCLAW_STATE_DIR):
- Gateway config and API keys
- Session history and agent state
- Channel state (Telegram, WhatsApp, Signal, Discord)
- Cron jobs
- Workspace files (MEMORY.md, SOUL.md, skills, etc.)
- External workspace (auto-detected if configured outside state dir)
| Command | Description |
|---|---|
backup |
Hot backup — gateway stays running |
export |
Cold export — stops gateway first |
import <archive> |
Restore from a .tgz or .tgz.gpg archive |
push <user@host> |
One-shot migration over SSH |
verify |
Post-migration health check |
| Flag | Description |
|---|---|
--encrypt |
GPG-encrypt the archive (symmetric passphrase) |
--slim |
Skip session history (smaller archive) |
--no-restart |
Don't restart gateway after export |
--insecure |
Allow push over public networks without encryption |
-o FILE |
Custom output path |
Minimal one-command disaster recovery:
- Installs Node.js (via nvm) if missing
- Installs OpenClaw if missing
- Backs up any existing
~/.openclaw/state - Extracts the backup archive
- Hardens file permissions
- Runs
openclaw doctor - Starts the gateway
Full migration toolkit with network security, encryption, checksums, and audit logging.
- Network enforcement: Push over public IPs requires
--encryptor--insecure. Tailscale and private network IPs are trusted automatically. - Permission hardening: Secrets →
600, sensitive dirs →700after extraction. - Secure cleanup: Temp files and decrypted archives are shredded (
shred -u), not just deleted. - Archive integrity: SHA-256 checksum sidecar generated on export, verified on import.
- Archive age: Warns if importing a backup older than 30 days (credentials may have rotated).
- Audit trail: All operations logged to
~/.openclaw/migration-audit.log.
| Variable | Description |
|---|---|
OPENCLAW_STATE_DIR |
Override state directory (default: ~/.openclaw) |
OPENCLAW_PROFILE |
Use a named profile (state dir becomes ~/.openclaw-<profile>) |
- Linux and macOS
- No bash 4+ features required
- Non-interactive mode for cron/scripts
MIT