OpenClaw Backup & Restore
Backup and restore OpenClaw configuration, agents, sessions, and workspace to/from a private Git repository. Use when the user wants to manually trigger a ba...
Description
name: openclaw-backup-restore description: Backup and restore OpenClaw configuration, agents, sessions, and workspace to/from a private Git repository. Use when the user wants to manually trigger a backup, migrate to a new machine, or restore from a previous state.
OpenClaw Backup & Restore
A specialized skill for managing the lifecycle of your OpenClaw data. This skill utilizes an external Git-managed backup directory to keep your production environment clean while ensuring full recoverability.
Strategy
- Isolation: Git operations happen in a dedicated directory outside the live
.openclawruntime to avoid pollution. - Minimalism: Large
node_modules, logs, and temporary files are excluded. - Redundancy: Regular backups can be scheduled via Cron.
Setup
Before using this skill, you must set your private backup repository URL in openclaw.json. This URL is used by the scripts to push and pull data.
openclaw config set skills.entries.openclaw-backup-restore.env.OPENCLAW_BACKUP_REPO "git@github.com:your-username/your-repo.git"
How to Backup
To trigger a manual backup and sync to your remote repository:
- The agent should execute the
backup.shscript located within this skill'sscripts/directory. - The script will:
- Read the repo URL from the OpenClaw config.
- Sync
${HOME}/.openclaw/to${HOME}/openclaw-backup/usingrsync(respecting.gitignore). - Generate a readable commit summary from changed paths (for example workspace/config/runtime/memory).
- Commit and push to the remote
mainbranch.
Trigger Phrases: "Backup OpenClaw now", "Sync my data to GitHub".
How to Restore
To restore your environment on a new or existing machine:
- Ensure your SSH key is added to your Git provider (e.g., GitHub).
- The agent should execute the
restore.shscript located within this skill'sscripts/directory. - The process involves:
- Reading the repo URL from the OpenClaw config.
- Cloning or pulling the latest backup from the configured repository.
- Syncing files back to
${HOME}/.openclaw/. - Reinstalling node dependencies and running
openclaw doctor --yesto fix environment paths.
- Restart the Gateway:
openclaw gateway restart.
Trigger Phrases: "Restore OpenClaw from backup", "Migrate my data".
Technical Details
- Backup Directory:
${HOME}/openclaw-backup - Source Directory:
${HOME}/.openclaw - Exclusions: Defined in the skill's
.gitignore(includesnode_modules/,logs/,completions/,tmp/,dist/). - Automatic Setup: The
.gitignorefile is included in this skill and will be copied to${HOME}/openclaw-backup/during the first backup run.
Recovery Checklist
If restoring to a completely new machine:
- Install OpenClaw CLI first.
- Set the
OPENCLAW_BACKUP_REPOconfig value. - Configure SSH access for your Git provider.
- Run the restore script provided by this skill.
- Run
openclaw onboardif you need to re-install the daemon service.
Reviews (0)
No reviews yet. Be the first to review!
Comments (0)
No comments yet. Be the first to share your thoughts!