A standalone OpenClaw skill for creating versioned, restorable backups of OpenClaw state with checksum verification, dry-run restore plans, include/exclude filters, and automatic pre-restore rollback snapshots.
Built for people who want a safer way to back up and restore OpenClaw without manually copying a pile of runtime, memory, and workspace files.
- Versioned backup archives (
.tar.gz) - Manifest + SHA-256 checksums for every archived file
- Mutable vs full backup modes
- Dry-run restore plans before writing anything
- JSON restore reports written to disk
- Include / exclude prefix filters for targeted backup or restore
- Automatic pre-restore rollback backup before modifying current state
- Compatibility checks for OpenClaw version mismatches
OpenClaw state is spread across multiple places:
- gateway/runtime config
- session metadata
- memory indexes and notes
- workspace memory files
- user-authored skills
That makes ad-hoc copying fragile and partial restores risky.
This skill provides a repeatable workflow with:
- a machine-readable manifest
- checksum verification
- restore previews
- rollback protection
SKILL.md— skill instructions for OpenClaw / ClawHubREADME.md— human-facing project overviewLICENSE— MIT licensescripts/backup_state.py— create versioned backup archivesscripts/restore_state.py— verify, diff, and restore archives
Examples:
~/.openclaw/openclaw.json~/.openclaw/sessions.json~/.openclaw/restart-sentinel.json~/.openclaw/memory/~/.openclaw/agents/workspace/MEMORY.mdworkspace/memory/workspace/SESSION-STATE.mdworkspace/HEARTBEAT.mdworkspace/TOOLS.mdworkspace/skills/
Included in full mode:
workspace/SOUL.mdworkspace/USER.mdworkspace/IDENTITY.mdworkspace/AGENTS.mdworkspace/BOOTSTRAP.md
python scripts/backup_state.py \
--workspace ~/.openclaw/workspace \
--state-dir ~/.openclaw \
--output-dir ./backups \
--mode mutable \
--label nightlypython scripts/backup_state.py \
--workspace ~/.openclaw/workspace \
--state-dir ~/.openclaw \
--output-dir ./backups \
--mode full \
--label migrationpython scripts/restore_state.py \
--archive ./backups/openclaw-backup-migration-full-20260311T000000Z.tar.gz \
--workspace ~/.openclaw/workspace \
--state-dir ~/.openclaw \
--verify-onlypython scripts/restore_state.py \
--archive ./backups/openclaw-backup-migration-full-20260311T000000Z.tar.gz \
--workspace ~/.openclaw/workspace \
--state-dir ~/.openclaw \
--dry-runpython scripts/restore_state.py \
--archive ./backups/openclaw-backup-migration-full-20260311T000000Z.tar.gz \
--workspace ~/.openclaw/workspace \
--state-dir ~/.openclawBefore a real restore, the tool will:
- verify archive structure and checksums
- check compatibility metadata
- generate a restore plan
- create an automatic pre-restore rollback archive
- copy archived files into place
- write a JSON restore report
This is intentionally conservative:
- it restores files included in the archive
- it does not delete unrelated files outside the manifest
Both backup and restore support repeated prefix filters:
--include-prefix <relative-path-prefix>--exclude-prefix <relative-path-prefix>
Examples:
# only memory-related content
--include-prefix MEMORY.md --include-prefix memory
# exclude skills from a mutable backup
--exclude-prefix skillsThis repository contains only the standalone openclaw-state-backup skill.
It is intentionally separated from a larger private OpenClaw workspace so unrelated personal files, memories, and local runtime data are not published with it.
Potential future improvements:
- optional compression/encryption profiles
- richer restore diff summaries
- pluggable retention policies
- export/import helpers for migration workflows
MIT