Backup and restore OpenClaw configuration and important data. Use when the user wants to create a backup before making changes, restore from a previous backup, list available backups, or protect their OpenClaw setup. Backs up openclaw.json, agents configuration, workspace files, memory, and custom skills.
Complete backup and restore solution for OpenClaw configuration and data.
python3 scripts/backup.py
Creates a timestamped backup in ~/.openclaw/backups/
cd ~/.openclaw/backups
git add *.tar.gz
git commit -m "备份:$(date +%Y-%m-%d)"
git push
python3 scripts/list_backups.py
python3 scripts/restore.py <backup-file>
Configuration:
openclaw.json - Main configuration fileWorkspace:
AGENTS.md, SOUL.md, USER.md, IDENTITY.mdMEMORY.md, TOOLS.md, HEARTBEAT.mdmemory/ directory - All memory filesSkills:
Metadata:
python3 scripts/backup.py --name "before-update"
Output: openclaw-backup-before-update-20260301-153000.tar.gz
python3 scripts/backup.py --output-dir ~/my-backups
python3 scripts/list_backups.py
Shows:
python3 scripts/restore.py ~/.openclaw/backups/openclaw-backup-20260301-153000.tar.gz
Safety features:
openclaw.json.before-restore)Create a private GitHub repository for backups:
cd ~/.openclaw/backups
git init
gh repo create openclaw-backups --private --description "OpenClaw 配置备份(私密)" --source=. --remote=origin --push
# 1. Create backup
python3 scripts/backup.py --name "before-update"
# 2. Push to GitHub
cd ~/.openclaw/backups
git add *.tar.gz
git commit -m "备份:$(date +%Y-%m-%d) - before-update"
git push
# 1. Pull latest backups
cd ~/.openclaw/backups
git pull
# 2. Restore
python3 scripts/restore.py ~/.openclaw/backups/<backup-file>.tar.gz
# Create a backup
python3 scripts/backup.py --name "before-agent-changes"
# Push to GitHub (recommended)
cd ~/.openclaw/backups && git add *.tar.gz && git commit -m "Before agent changes" && git push
# Make your changes
# ...
# If something goes wrong, restore
python3 scripts/restore.py ~/.openclaw/backups/openclaw-backup-before-agent-changes-*.tar.gz
# Daily backup
python3 scripts/backup.py --name "daily-$(date +%A)"
# Weekly backup
python3 scripts/backup.py --name "weekly-$(date +%U)"
# On old machine
python3 scripts/backup.py --name "migration"
# Copy backup file to new machine
scp ~/.openclaw/backups/openclaw-backup-migration-*.tar.gz newmachine:~/
# On new machine
python3 scripts/restore.py ~/openclaw-backup-migration-*.tar.gz
openclaw gateway restart
openclaw-backup-20260301-153000.tar.gz
└── openclaw-backup-20260301-153000/
├── backup-metadata.json
├── openclaw.json
├── agents/
│ ├── main/
│ │ └── agent/
│ └── project-manager/
│ └── agent/
├── workspace/
│ ├── AGENTS.md
│ ├── SOUL.md
│ ├── USER.md
│ ├── MEMORY.md
│ └── memory/
└── skills/
├── openclaw-config/
├── skill-publisher/
└── openclaw-backup/
Sessions:
.jsonl files)sessions.json)Credentials:
System Skills:
Logs:
# Add to crontab
0 2 * * * cd ~/.openclaw/workspace/skills/openclaw-backup && python3 scripts/backup.py --name "auto-daily" >> ~/.openclaw/backup.log 2>&1
# Keep only last 7 backups
cd ~/.openclaw/backups
ls -t openclaw-backup-*.tar.gz | tail -n +8 | xargs rm -f
Backup fails:
df -h ~/.openclawls -la ~/.openclawopenclaw gateway statusRestore fails:
openclaw gateway stopBackup too large:
gzip -9 old-backup.tarBackup location: ~/.openclaw/backups/
Backup format: .tar.gz (compressed tar archive)
Naming: openclaw-backup-[name-]YYYYMMDD-HHMMSS.tar.gz
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer