OpenClaw Backup Skill
Use the bundled script scripts/openclaw-backup.sh for real operations. Do not rewrite backup logic inline when the bundled script already covers the task.
When to use
Use this skill when the user wants to:
- - create a local OpenClaw backup;
- create a manual backup before risky changes;
- prune old regular backups;
- schedule recurring backup runs;
- inspect or adjust retention behavior.
Preconditions
This skill assumes:
- - Linux;
- Bash 4+;
- OpenClaw CLI installed and working;
- local filesystem access.
Primary commands
- - Show the current CLI contract directly from the script:
-
scripts/openclaw-backup.sh --help
-
scripts/openclaw-backup.sh --backup
-
scripts/openclaw-backup.sh --manual
-
scripts/openclaw-backup.sh --prune --dry-run --keep-hours 24 --keep-days 7 --keep-weeks 4
- - Automatic backup + prune:
- INLINECODE5
Recommended scheduled run
For recurring local backups, a good default pattern is:
On Linux hosts, use the system scheduler (for example cron) when the goal is a direct local script run without chat delivery.
Operational notes
The current backup format includes:
- - workspace contents, including assistant identity and continuity files (for example SOUL.md, USER.md, AGENTS.md, and other workspace-level context files);
- OpenClaw config;
- cron export and human-readable cron summary;
- software versions;
- restore instructions;
- manifest.
The current backup format intentionally excludes:
- - backup storage inside a workspace (legacy support);
- temp artifacts;
- environment variables / system env / system override.
- - Regular archives are subject to prune; manual archives are excluded from normal prune.
- Retention is based on UTC timestamps encoded in archive filenames, not on
mtime / ctime. - The script resolves the OpenClaw workspace/config automatically unless the caller passes an explicit output directory.
- If the user wants recurring backups, ask before installing or changing scheduled jobs.
- For the full behavior contract, retention model, and archive naming rules, read
references/spec.md.
OpenClaw 备份技能
使用捆绑脚本 scripts/openclaw-backup.sh 执行实际操作。当捆绑脚本已涵盖任务时,请勿内联重写备份逻辑。
使用时机
当用户希望执行以下操作时使用此技能:
- - 创建本地 OpenClaw 备份;
- 在风险变更前创建手动备份;
- 清理旧的常规备份;
- 安排定期备份运行;
- 检查或调整保留策略。
前置条件
此技能假设:
- - Linux 系统;
- Bash 4+ 版本;
- 已安装并可正常运行的 OpenClaw CLI;
- 本地文件系统访问权限。
主要命令
- scripts/openclaw-backup.sh --help
- scripts/openclaw-backup.sh --backup
- scripts/openclaw-backup.sh --manual
- scripts/openclaw-backup.sh --prune --dry-run --keep-hours 24 --keep-days 7 --keep-weeks 4
- scripts/openclaw-backup.sh --auto --keep-hours 24 --keep-days 7 --keep-weeks 4
推荐的计划运行
对于定期本地备份,推荐的默认模式为:
- - scripts/openclaw-backup.sh --auto --keep-hours 24 --keep-days 7 --keep-weeks 4
在 Linux 主机上,当目标是直接运行本地脚本而不通过聊天交付时,请使用系统调度器(例如 cron)。
操作说明
当前备份格式包含:
- - 工作区内容,包括助手身份和连续性文件(例如 SOUL.md、USER.md、AGENTS.md 以及其他工作区级上下文文件);
- OpenClaw 配置;
- cron 导出和人类可读的 cron 摘要;
- 软件版本;
- 恢复说明;
- 清单。
当前备份格式明确排除:
- - 工作区内的备份存储(遗留支持);
- 临时工件;
- 环境变量/系统环境/系统覆盖。
- - 常规归档受清理规则约束;手动归档不受常规清理影响。
- 保留策略基于归档文件名中编码的 UTC 时间戳,而非 mtime/ctime。
- 除非调用者传递显式输出目录,否则脚本会自动解析 OpenClaw 工作区/配置。
- 如果用户需要定期备份,请在安装或更改计划任务前进行询问。
- 有关完整的行为合约、保留模型和归档命名规则,请阅读 references/spec.md。