/install backup-openclaw-config
Backup OpenClaw Configuration
Overview
This skill provides automated backup and restore functionality for all OpenClaw configuration files. It creates timestamped archives containing your complete OpenClaw setup, including main configuration, workspace, skills, and user data.
What gets backed up:
~/.openclaw/- Main configuration~/.config/openclaw/- System-level configuration~/.local/share/openclaw/- Local data~/.openclaw/workspace/- Workspace, skills, and memory
Quick Start
Backup Your Configuration
Run the backup script:
~/.openclaw/workspace/skills/backup-openclaw-config/scripts/backup_openclaw.sh [output-directory]
Example:
# Backup to default location ($HOME/backups/openclaw)
~/.openclaw/workspace/skills/backup-openclaw-config/scripts/backup_openclaw.sh
# Backup to custom location
~/.openclaw/workspace/skills/backup-openclaw-config/scripts/backup_openclaw.sh ~/my-backups
Output:
- Creates
openclaw_backup_YYYYMMDD_HHMMSS.tar.gzarchive - Creates
openclaw_backup_YYYYMMDD_HHMMSS.infometadata file - Shows backup summary with file list and archive size
- Automatically deletes backups older than 15 days to manage disk space
Restore from Backup
Run the restore script:
~/.openclaw/workspace/skills/backup-openclaw-config/scripts/restore_openclaw.sh \x3Cbackup-archive.tar.gz>
Example:
~/.openclaw/workspace/skills/backup-openclaw-config/scripts/restore_openclaw.sh \
~/backups/openclaw/openclaw_backup_20260306_095000.tar.gz
Process:
- Shows backup information from .info file
- Lists all files that will be restored
- Requires confirmation before proceeding
- Backs up existing files with .bak extension
- Restores configuration to original locations
After restore:
# Restart OpenClaw Gateway to apply changes
systemctl --user restart openclaw-gateway
Workflow
Backup Workflow
-
Check prerequisites
- Verify backup directory exists or can be created
- Check if OpenClaw directories exist
-
Create backup structure
- Generate timestamp for unique backup name
- Create temporary directory for staging
-
Copy configuration files
- Backup
~/.openclaw/(main config) - Backup
~/.config/openclaw/(system config) - Backup
~/.local/share/openclaw/(local data) - Skip directories that don't exist (with warning)
- Backup
-
Create archive
- Compress all files into
.tar.gzarchive - Create
.infofile with metadata (timestamp, hostname, user, size)
- Compress all files into
-
Report results
- Show archive location and size
- Display restore command
- Warn if any directories were missing
Restore Workflow
-
Validate backup
- Check if archive file exists
- Display backup information from .info file
- List contents of archive
-
Safety confirmation
- Show warning about overwriting current config
- List all files that will be restored
- Require explicit "yes" confirmation
-
Backup existing files
- Rename existing directories to
.bak - Preserve current configuration before overwriting
- Rename existing directories to
-
Extract and restore
- Extract archive to temporary directory
- Move files to original locations
- Restore
~/.openclaw/,~/.config/openclaw/,~/.local/share/openclaw/
-
Complete and notify
- Show restore completion message
- Display restart command for Gateway
- Note that .bak files were created
Use Cases
Before Upgrade
# Backup before updating OpenClaw
~/.openclaw/workspace/skills/backup-openclaw-config/scripts/backup_openclaw.sh
# Then upgrade
openclaw update
Transfer to New Machine
# On old machine: create backup
~/.openclaw/workspace/skills/backup-openclaw-config/scripts/backup_openclaw.sh
# Transfer backup archive to new machine (scp, rsync, etc.)
scp ~/backups/openclaw/openclaw_backup_*.tar.gz user@new-machine:~/
# On new machine: restore
~/.openclaw/workspace/skills/backup-openclaw-config/scripts/restore_openclaw.sh \
~/backups/openclaw/openclaw_backup_*.tar.gz
Disaster Recovery
# Restore from backup after system failure
~/.openclaw/workspace/skills/backup-openclaw-config/scripts/restore_openclaw.sh \
/path/to/backup/openclaw_backup_20260306.tar.gz
# Restart services
systemctl --user restart openclaw-gateway
Configuration Locations
For detailed information about what gets backed up, see config-locations.md.
Summary:
- Main config:
~/.openclaw/- Gateway config, extensions, tokens - Workspace:
~/.openclaw/workspace/- Skills, memory, user data - System config:
~/.config/openclaw/- systemd services, preferences - Local data:
~/.local/share/openclaw/- Cache, runtime data
Best Practices
Regular Backups
Create backups regularly, especially after:
- Installing new skills
- Modifying configuration
- Adding extensions
- Important workspace changes
Secure Storage
- Backup archives contain sensitive data (tokens, credentials)
- Store backups in secure location
- Consider encrypting with gpg for sensitive environments
- Don't share backup archives publicly
Testing Backups
After creating a backup, verify it:
# Test extraction to temporary location
tar -tzf backup.tar.gz | head
# Verify critical files are present
tar -tzf backup.tar.gz | grep -E "(config.json|AGENTS.md|MEMORY.md)"
Troubleshooting
Permission Denied
If you see permission errors:
# Ensure scripts are executable
chmod +x ~/.openclaw/workspace/skills/backup-openclaw-config/scripts/*.sh
# Ensure backup directory is writable
mkdir -p ~/backups/openclaw
chmod 755 ~/backups/openclaw
Gateway Won't Start After Restore
If Gateway fails to start after restore:
# Check Gateway logs
journalctl --user -u openclaw-gateway -n 50
# Restore from .bak if needed
mv ~/.openclaw ~/.openclaw.bad
mv ~/.openclaw.bak ~/.openclaw
systemctl --user restart openclaw-gateway
Missing Directories
The backup script gracefully handles missing directories:
- Skips directories that don't exist
- Shows warning for each missing directory
- Still creates valid backup with available data
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install backup-openclaw-config - 安装完成后,直接呼叫该 Skill 的名称或使用
/backup-openclaw-config触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
Backup OpenClaw Config 是什么?
Backup and restore OpenClaw configuration files. Use when backing up OpenClaw settings before upgrades, transferring configuration to another machine, restor... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 109 次。
如何安装 Backup OpenClaw Config?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install backup-openclaw-config」即可一键安装,无需额外配置。
Backup OpenClaw Config 是免费的吗?
是的,Backup OpenClaw Config 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Backup OpenClaw Config 支持哪些平台?
Backup OpenClaw Config 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Backup OpenClaw Config?
由 AlexJu(@alexjunanjing-2)开发并维护,当前版本 v1.0.0。