OpenClaw Self Backup & Restore

Data & APIs

Backup and restore OpenClaw agent configuration, skills, memory, and workspace files. Use when asked to "backup", "backup yourself", "create a restore point", "archive my agent", "export configuration", "save current state", or "setup auto-backup". Also handles restore: "restore from backup", "recover agent", "reinstall from backup".

Install

openclaw skills install yuebao-self-backup

Self Backup & Restore

Backup and restore your OpenClaw agent's complete state, including: configuration, skills, memory, and workspace files.

What Gets Backed Up

CategoryPathPriority
OpenClaw config~/.openclaw/openclaw.json⭐⭐⭐ Required
API credentials~/.openclaw/.env⭐⭐⭐ Required
Skills~/.openclaw/workspace/skills/⭐⭐⭐ Required
Memory files~/.openclaw/workspace/memory/⭐⭐⭐ Required
Identity filesMEMORY.md SOUL.md IDENTITY.md USER.md⭐⭐⭐ Required
Config filesAGENTS.md TOOLS.md HEARTBEAT.md⭐⭐ Important
Cron jobs~/.openclaw/cron/jobs.json⭐⭐ Important
Credentials~/.openclaw/credentials/⭐⭐ Important

What's NOT Backed Up

  • ~/.openclaw/logs/ — logs, not needed
  • ~/.openclaw/media/ — media cache, too large
  • ~/.openclaw/workspace/.venv-*/ — Python envs, can be rebuilt
  • ~/.openclaw/completions/ — history cache

Run Backup

python3 ~/.openclaw/workspace/skills/self-backup/scripts/backup.py

Output: ~/backups/openclaw-backup-YYYY-MM-DD_HHMM.tar.gz

Run Restore

python3 ~/.openclaw/workspace/skills/self-backup/scripts/restore.py ~/backups/openclaw-backup-YYYY-MM-DD_HHMM.tar.gz

List Backups

python3 ~/.openclaw/workspace/skills/self-backup/scripts/backup.py --list

Setup Weekly Auto-Backup (via OpenClaw cron)

openclaw cron add \
  --name "weekly-self-backup" \
  --cron "0 2 * * 0" \
  --tz "Asia/Shanghai" \
  --message "Run backup: python3 ~/.openclaw/workspace/skills/self-backup/scripts/backup.py and report result" \
  --session isolated \
  --announce \
  --channel telegram

After Restore: Rebuild Steps

  1. Reinstall OpenClaw (fresh machine only)

    npm install -g openclaw
    
  2. Restore backup

    python3 restore.py openclaw-backup-YYYY-MM-DD.tar.gz
    
  3. Rebuild Python environment (not included in backup)

    cd ~/.openclaw/workspace
    python3 -m venv .venv-stock
    source .venv-stock/bin/activate
    pip install yfinance pandas numpy pandas-ta ta ddgs tavily-python requests beautifulsoup4
    
  4. Re-login ClawHub

    clawhub auth login --token <YOUR_TOKEN> --no-browser
    
  5. Verify

    openclaw status && openclaw doctor