Install
openclaw skills install openclaw-workspace-backup-restoreThis skill should be used when the user asks for OpenClaw backup, restore, rollback, validation, GitHub backup, off-machine backup, workspace recovery, or pr...
openclaw skills install openclaw-workspace-backup-restoreBackup, restore, validate, and GitHub-sync OpenClaw workspace state (SOUL.md, USER.md, AGENTS.md, IDENTITY.md, TOOLS.md, HEARTBEAT.md, BOOTSTRAP.md, agent markdown files, and optional real openclaw.json) with versioning, rollback, and off-machine recovery.
Protect critical workspace configuration files from accidental deletion, corruption, or misconfiguration. Enable quick recovery and version history tracking.
Core SOUL files from workspace root:
SOUL.md — agent personality and missionUSER.md — user profile and preferencesAGENTS.md — agent instructions and workflowsIDENTITY.md — agent identity configurationTOOLS.md — local tool configurationHEARTBEAT.md — periodic task configurationBOOTSTRAP.md — initialization instructions# Create timestamped backup (sanitized openclaw.json)
node scripts/backup.mjs
# Create named backup
node scripts/backup.mjs --name "pre-migration"
# Backup with description
node scripts/backup.mjs --desc "Before major refactor"
# Include real ~/.openclaw/openclaw.json in the backup set
node scripts/backup.mjs --raw-openclaw-config
# Create backup, git add backups/, git commit, and git push to origin/current-branch
node scripts/backup-and-push.mjs --remote origin
# Push to a dedicated backup remote
node scripts/backup-and-push.mjs --remote clawlite-backup
# Push sanitized-config-only backup instead of the real config
node scripts/backup-and-push.mjs --remote origin --sanitized-config-only
backup-and-push.mjs already performs the full git sync flow for you:
git add backupsgit commit -m "backup: ..."git push <remote> <branch>For unattended runs, use the included GitHub Actions workflow at .github/workflows/daily-backup.yml or call the same script from cron / launchd.
# List all backups
node scripts/list.mjs
# Show detailed info
node scripts/list.mjs --verbose
# Restore latest backup
node scripts/restore.mjs
# Restore specific backup by timestamp
node scripts/restore.mjs --timestamp 2026-03-05T00-51-30
# Restore specific backup by name
node scripts/restore.mjs --name "pre-migration"
# Dry run (preview without applying)
node scripts/restore.mjs --dry-run
# Validate all backups
node scripts/validate.mjs
# Validate specific backup
node scripts/validate.mjs --timestamp 2026-03-05T00-51-30
backups/
├── 2026-03-05T00-51-30/
│ ├── manifest.json # Backup metadata
│ ├── SOUL.md
│ ├── USER.md
│ ├── AGENTS.md
│ ├── IDENTITY.md
│ ├── TOOLS.md
│ ├── HEARTBEAT.md
│ └── BOOTSTRAP.md
├── 2026-03-05T01-15-42/
│ └── ...
└── named/
├── pre-migration/
│ └── ...
└── stable-v1/
└── ...
Each backup includes a manifest.json:
{
"timestamp": "2026-03-05T00:51:30.123Z",
"name": "pre-migration",
"description": "Before major refactor",
"workspace": "/Users/m1/.openclaw/workspace-YOUR-AGENT",
"files": {
"SOUL.md": {
"size": 1234,
"hash": "sha256:abc123...",
"exists": true
},
"USER.md": {
"size": 567,
"hash": "sha256:def456...",
"exists": true
}
},
"created_by": "hunter",
"openclaw_version": "1.0.0"
}
node scripts/list.mjsnode scripts/restore.mjs --timestamp <ts> --dry-runnode scripts/restore.mjs --timestamp <ts>If workspace is corrupted and scripts won't run:
# Manual restore from backup directory
cd /Users/m1/.openclaw/workspace-hunter
cp -r soul-backup-skill/backups/LATEST_TIMESTAMP/* .
Every restore creates an automatic pre-restore backup:
# Restore creates: backups/pre-restore-2026-03-05T01-20-00/
# To rollback:
node scripts/restore.mjs --timestamp pre-restore-2026-03-05T01-20-00
Add to OpenClaw heartbeat or system cron:
# Daily backup at 2 AM
0 2 * * * cd /Users/m1/.openclaw/workspace-YOUR-AGENT/openclaw-backup-restore && node scripts/backup.mjs --name "daily-$(date +\%Y-\%m-\%d)"
# Weekly backup on Sunday
0 3 * * 0 cd /Users/m1/.openclaw/workspace-YOUR-AGENT/openclaw-backup-restore && node scripts/backup.mjs --name "weekly-$(date +\%Y-W\%V)"
# Before deploying changes
cd /Users/m1/.openclaw/workspace-hunter/soul-backup-skill
node scripts/backup.mjs --name "pre-deploy-$(git rev-parse --short HEAD)"
The validate script checks:
# Immediate recovery
node scripts/restore.mjs --file SOUL.md
# Or full restore
node scripts/restore.mjs
# Preview what will be restored
node scripts/restore.mjs --dry-run
# Restore previous version
node scripts/restore.mjs --timestamp <previous-backup>
# Validate all backups
node scripts/validate.mjs
# Find last good backup
node scripts/list.mjs --verbose
# Restore from last good backup
node scripts/restore.mjs --timestamp <last-good>
# Recreate workspace directory
mkdir -p /Users/m1/.openclaw/workspace-YOUR-AGENT
# Clone backup skill
cd /Users/m1/.openclaw/workspace-YOUR-AGENT
git clone <backup-repo-url> openclaw-backup-restore
# Restore latest backup
cd openclaw-backup-restore
node scripts/restore.mjs
validate.mjs weekly to catch corruption early--desc flag to explain why backup was created"Backup directory not found"
mkdir -p backups in skill directory"Permission denied"
ls -la ..chmod +x scripts/*.mjs"Hash mismatch during validation"
"Restore failed: file conflicts"
--force flag to overwrite existing files