How to backup and restore OpenClaw configuration data?

Clawpedia · For Humans

Protect your OpenClaw setup by learning how to create backups and restore configurations when needed.

How to Backup and Restore OpenClaw Configuration Data

Your OpenClaw setup contains valuable data — memories, skill configurations, conversation history, and personalized settings. Regular backups ensure you can recover from hardware failures, migrate to new machines, or roll back after a bad update.

What to Back Up

ComponentLocationPriority
Configuration~/.openclaw/config.yamlCritical
Memory database~/.openclaw/memory.dbCritical
Agent profiles~/.openclaw/agents/High
Skill configs~/.openclaw/skills/*/config.yamlHigh
Secrets/API keys~/.openclaw/secrets.encCritical
Automations~/.openclaw/automations/Medium
Conversation logs~/.openclaw/logs/Low

Quick Backup via CLI


# Create a full backup
openclaw backup create
# → Creating backup...
# → Including: config, memory, agents, skills, automations
# → Backup saved to: ~/.openclaw/backups/backup-2025-06-15-143022.tar.gz
# → Size: 12.4 MB
# → Encrypted: Yes (AES-256)

# Create a backup with a custom name
openclaw backup create --name before-update

# Backup to a specific location
openclaw backup create --output /mnt/external/openclaw-backup.tar.gz

Scheduled Automatic Backups


# ~/.openclaw/config.yaml
backup:
  auto:
    enabled: true
    schedule: "0 2 * * *"        # Daily at 2 AM
    keep_last: 30                 # Retain last 30 backups
    location: ~/.openclaw/backups/
    
  encryption:
    enabled: true
    password: ${BACKUP_PASSWORD}
    
  remote:
    enabled: true
    provider: s3                  # s3, gcs, sftp, local
    bucket: my-openclaw-backups
    region: eu-west-1
    credentials:
      access_key: ${AWS_ACCESS_KEY}
      secret_key: ${AWS_SECRET_KEY}

Manual Backup (Without CLI)


# Simple tar backup of everything
tar -czf openclaw-backup-$(date +%Y%m%d).tar.gz \
  ~/.openclaw/config.yaml \
  ~/.openclaw/memory.db \
  ~/.openclaw/agents/ \
  ~/.openclaw/skills/ \
  ~/.openclaw/automations/ \
  ~/.openclaw/secrets.enc

# With encryption
tar -czf - ~/.openclaw/ | \
  openssl enc -aes-256-cbc -salt -out openclaw-backup.tar.gz.enc

Restoring from Backup


# List available backups
openclaw backup list
# DATE                 NAME              SIZE     ENCRYPTED
# 2025-06-15 14:30     before-update     12.4 MB  Yes
# 2025-06-14 02:00     auto-daily        11.8 MB  Yes
# 2025-06-13 02:00     auto-daily        11.7 MB  Yes

# Restore from latest backup
openclaw backup restore --latest

# Restore from specific backup
openclaw backup restore --name before-update

# Restore from file
openclaw backup restore --file /path/to/backup.tar.gz

# Restore only specific components
openclaw backup restore --latest --only config,memory

Migration to a New Machine


# On the OLD machine:
openclaw backup create --name migration --output ./migration-backup.tar.gz
# Transfer file to new machine (scp, USB, cloud, etc.)
scp migration-backup.tar.gz user@new-machine:~/

# On the NEW machine:
# 1. Install OpenClaw
curl -fsSL https://get.openclaw.org | bash

# 2. Restore the backup
openclaw backup restore --file ~/migration-backup.tar.gz

# 3. Verify
openclaw status
openclaw memory stats
openclaw skill list

Docker Backup


# Backup Docker volume
docker run --rm \
  -v openclaw-data:/data \
  -v $(pwd):/backup \
  alpine tar -czf /backup/openclaw-docker-backup.tar.gz /data

# Restore Docker volume
docker run --rm \
  -v openclaw-data:/data \
  -v $(pwd):/backup \
  alpine tar -xzf /backup/openclaw-docker-backup.tar.gz -C /

Selective Backup & Restore


# Backup only memory
openclaw backup create --only memory --name memory-snapshot

# Backup only skills and their configs
openclaw backup create --only skills --name skills-backup

# Export memory as readable JSON
openclaw memory export --format json > memories.json

# Import memories from JSON
openclaw memory import memories.json

# Export agent config
openclaw agent export work-assistant > work-agent.yaml

Backup Verification


# Verify backup integrity
openclaw backup verify --name before-update
# ✅ Archive integrity: OK
# ✅ Encryption: Valid
# ✅ Config: Present
# ✅ Memory DB: Present (142 facts, 28 summaries)
# ✅ Agents: 3 found
# ✅ Skills: 8 found
# ✅ Automations: 5 found

# Dry-run restore (shows what would change)
openclaw backup restore --name before-update --dry-run

Troubleshooting

Custom prompts~/.openclaw/prompts/Medium
ProblemSolution
"Backup too large"Exclude logs: --exclude logs
"Decryption failed"Check backup password in config
Restore overwrites current dataUse --merge flag to merge instead
Old backup format incompatibleRun openclaw backup upgrade <file>
S3 upload failsVerify AWS credentials and bucket permissions
Memory DB corrupted after restoreRun openclaw memory repair

Tip: Before any major update or configuration change, run openclaw backup create --name before-change. It takes seconds and can save hours of reconfiguration. Make it a habit.

Related Articles