Lightweight backup/restore skill for OpenClaw.
It covers:
openclaw.jsonIt does not provide WebDAV storage. The user must supply their own WebDAV endpoint and credentials.
Use this skill when the user asks to:
Canonical implementation lives inside the skill:
scripts/openclaw-backup.impl.shscripts/openclaw-restore.impl.shThin wrapper scripts may also exist in the workspace and call these implementations. Keep the skill scripts as the source of truth.
bash
bash skills/openclaw-webdav-backup/scripts/openclaw-backup.sh
Auto-determines level based on day:
bash
# Smart strategy (recommended for cron)
BACKUP_STRATEGY=smart bash skills/openclaw-webdav-backup/scripts/openclaw-backup.sh
# Or explicitly set level
bash skills/openclaw-webdav-backup/scripts/openclaw-backup.sh --level=1
🔴 CHECKPOINT: Confirm with the user before uploading to any remote WebDAV target. This operation sends potentially sensitive data (including encrypted configs) to an external server. Only proceed after explicit user confirmation.
Prepare .env.backup with the user's own WebDAV settings, then run:
bash
bash skills/openclaw-webdav-backup/scripts/openclaw-backup.sh --encrypt-config --upload
Only do real upload after confirming the user wants to write to the remote WebDAV target.
🛑 STOP: Restore will overwrite current workspace files. Before proceeding, confirm with the user:
bash
bash skills/openclaw-webdav-backup/scripts/openclaw-restore.sh --from backups/openclaw/latest --decrypt-config
If any backup, upload, restore, or notification operation fails, follow the table below:
Trigger ConditionFirst-Line FixIf Still Failing (Fallback)WebDAV upload fails (curl error)Retry with --retry 3, verify .env.backup credentialsFall back to local-only backup, notify user with error detailsBackup integrity check fails ( tar -tzf error)Report specific archive corruption path, do NOT proceed with restoreSuggest manual inspection of the backup directory and logsEncryption fails (openssl unavailable)Check openssl version and install if missingFall back to unencrypted backup with a clear security warningRestore source missing or corruptedVerify backup path exists with ls -laList available backups for user to select an alternativeDisk space insufficient for backupRun df -h . and suggest cleanupAbort with available-space-required message and suggestionsNotification send fails (Telegram/WeCom/Feishu)Check network, verify token/key in .env.backup.notifyLog failure locally and continue; backup itself is not affectedCompression tool unavailable (pigz/pzstd)Auto-fallback to gzip/zstd (single-threaded)Log warning about degraded performance, proceed with gzip
The skill supports multiple backup strategies via BACKUP_STRATEGY environment variable:
StrategyDescriptionLevel Behaviorfull (default)Always full backupLevel 0weeklyWeekly full backupLevel 0dailyDaily with auto-incrementalLevel 0 once, then Level 1smartRecommended for productionSunday=Level 0, Mon-Sat=Level 1hourlyFine-grained incrementalLevel 0 → 1 → 2 chain
bash
# Smart strategy: Sunday full, weekdays incremental
0 0 * * 0 BACKUP_STRATEGY=smart /path/to/openclaw-backup.sh --upload
30 3 * * 1-6 BACKUP_STRATEGY=smart /path/to/openclaw-backup.sh --upload
# Weekly full only
0 3 * * 0 BACKUP_STRATEGY=weekly /path/to/openclaw-backup.sh --upload
# Daily with auto-level detection
0 3 * * * BACKUP_STRATEGY=daily /path/to/openclaw-backup.sh
Override auto-detection with --level flag:
bash
bash openclaw-backup.sh --level=0 # Force full backup
bash openclaw-backup.sh --level=1 # Force incremental (level 1)
The skill supports multiple compression tools with automatic detection of parallel variants:
OptionToolThreadsNotesgzipgzip1Standard, widely availablepigzpigzNParallel gzip, 3-5x fasterzstdzstd1High compression ratiopzstdpzstdNParallel zstd, fastest option
By default, the skill auto-detects the best available compressor:
bash
# Prefers pigz > gzip, pzstd > zstd
bash skills/openclaw-webdav-backup/scripts/openclaw-backup.sh
Force a specific compressor:
bash
bash skills/openclaw-webdav-backup/scripts/openclaw-backup.sh --compress=pigz
bash skills/openclaw-webdav-backup/scripts/openclaw-backup.sh --compress=pzstd
Control the number of compression threads (default: auto-detect CPU cores):
bash
# Use 8 threads explicitly
PARALLEL_JOBS=8 bash skills/openclaw-webdav-backup/scripts/openclaw-backup.sh
# Or via CLI
bash skills/openclaw-webdav-backup/scripts/openclaw-backup.sh --jobs=8
Install parallel compression tools for best performance:
bash
# Ubuntu/Debian
sudo apt-get install pigz zstd
# macOS
brew install pigz zstd
# CentOS/RHEL
sudo yum install pigz zstd
The skill supports multiple notification channels for backup success/failure alerts.
ChannelStatusConfigurationTelegram✅ ReadyBot token + Chat IDWeCom (企业微信)✅ ReadyWebhook keyFeishu (飞书)✅ ReadyWebhook token
bash
cp references/env.backup.notify.example .env.backup.notify
.env.backup.notify with your channel settings:bash
BACKUP_NOTIFY=1
BACKUP_NOTIFY_CHANNEL="telegram"
BACKUP_NOTIFY_TELEGRAM_CHAT_ID="123456789"
BACKUP_NOTIFY_TELEGRAM_BOT_TOKEN="123456:your-bot-token" # Optional, can auto-detect
bash
BACKUP_NOTIFY=1
BACKUP_NOTIFY_CHANNEL="wecom"
BACKUP_NOTIFY_WECOM_KEY="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
BACKUP_NOTIFY_WECOM_MENTION="13800138000,13900139000" # Optional: mobile numbers
Get webhook key from: Group Settings → Add Robot → Copy Webhook URL key
bash
BACKUP_NOTIFY=1
BACKUP_NOTIFY_CHANNEL="feishu"
BACKUP_NOTIFY_FEISHU_TOKEN="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
BACKUP_NOTIFY_FEISHU_SECRET="your-secret" # Optional: if signature enabled
Get webhook token from: Group Settings → Add Bot → Copy Webhook URL token
Notifications include:
Do NOT do the following when using or maintaining this skill:
🚫 Anti-PatternWhyCorrect ApproachCommit .env.backup or .env.backup.secret to gitLeaks WebDAV credentials and encryption keys permanentlyAdd to .gitignore; only share via secure channelHardcode real credentials in example filesExamples get copied into scripts and committedAlways use placeholder values ( your_webdav_url, your_password)Run restore without user confirmationOverwrites the current workspace irreversiblyUse --dry-run first, then confirm with userDelete old backups without askingUser may need older backups for audit/recoveryList available versions, let user choose which to deleteUpload unencrypted openclaw.json to remoteContains API keys, tokens, and secretsAlways use --encrypt-config before --uploadRun destructive operations without --dry-runNo way to preview what will happenAlways offer dry-run first; restore supports --dry-run flagInclude real tokens in .env.backup.notify examplesNotification tokens can be misused if leakedUse placeholder values in docs; store real values separately
The following operations require explicit user confirmation before proceeding:
OperationCheckpointRisk LevelWebDAV uploadConfirm remote target and data sensitivity🔴 HighRestore from backupConfirm backup path, destructive nature, current state backup🔴 HighEncrypted config backupConfirm encryption password is recoverable🟡 Medium
openclaw.json may contain secrets, tokens, and API keys--encrypt-config before remote upload.env.backup stores WebDAV connection settings and should not be committed.env.backup.secret is optional; it is only a convenience carrier for BACKUP_ENCRYPT_PASS.env.backup.notify is optional and enables backup notifications when configured.env.backup.secret and the password are either/or: either keep the file, or remember/provide the password.env.backup and .env.backup.secretLOCAL_KEEP and REMOTE_KEEPreferences/backup.mdreferences/restore.mdreferences/scheduling.mdreferences/migration-plan.mdreferences/faq.mdreferences/env.backup.example, references/env.backup.secret.example, and references/env.backup.notify.exampleThis skill has been validated against a real OpenClaw setup for:
Run scripts/openclaw-healthcheck.sh to diagnose backup environment:
bash
bash skills/openclaw-webdav-backup/scripts/openclaw-healthcheck.sh
Checks performed:
CheckDescriptionBase Environmentworkspace dir, state dir, openclaw.json, extensionsBackup Infrastructurebackup root, snapshot dir, existing backupsDependenciestar, curl, openssl availabilityConfiguration.env.backup, .env.backup.secret variablesBackup IntegrityValidates all existing tar.gz archives
Exit codes:
0 - All checks passed1 - One or more critical checks failedEvery backup automatically runs integrity checks:
tar -tzf verifies archive structureFailed integrity checks will abort the backup with error status.
To manually verify a specific backup:
bash
tar -tzf backups/openclaw/2026-04-02-030000/workspace.tar.gz >/dev/null && echo "Valid" || echo "Corrupted"
When restoring, verify the backup before extraction:
bash
# Check integrity first
bash scripts/openclaw-restore.sh --from <backup_dir> --dry-run
# Then perform actual restore
bash scripts/openclaw-restore.sh --from <backup_dir>
Before sharing this skill privately, verify:
.env.backup or .env.backup.secret is includedThis skill intentionally stays lightweight. It supports:
It does not currently provide: