360 Secure SkillHub
360 安全技能中心

Booker's OpenClaw Backup

该 Skill 用 bash 脚本管理 ~/.openclaw 的自包含 tar.gz 备份包:可创建备份、列出备份、查看当前与生效配置、修改默认备份目录,并选择备份包进行审计、解压和输出恢复命令。备份包内含 .openclaw/、restore.sh、manifest.txt 和 SHA256SUMS;恢复强制校验完整性,并拒绝符号链接、硬链接及危险目标路径。配置优先级为命令行参数、confi…

silronin
silronin
热度 35.90
最近更新 2026-05-11 17:43:38
分类:自动化依赖:代码执行 / 读写文件应用场景:工作流 / 自动化脚本

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add bookers-openclaw-backup
Metadata
name
openclaw-backup
description
Create, inspect, configure, and restore self-contained backup bundles for ~/.openclaw. Use when the user wants full-state backup, backup listing, changing the default backup directory, bundle selection, or guarded restore of OpenClaw state. Public default path is ~/backups/openclaw-snapshots; private local setups can override it with config or CLI.

OpenClaw Backup

Use this skill as the unified backup and restore entrypoint for ~/.openclaw.

Main commands

Create a backup bundle:

bash scripts/create_backup.sh

List existing bundles:

bash scripts/list_backups.sh

Show current configuration and effective values:

bash scripts/show_config.sh

Change the default backup directory:

bash scripts/set_backup_dir.sh /absolute/path

Select a bundle, audit it, extract it, and print the restore command:

bash scripts/select_and_restore.sh

Bundle format

Each backup is a self-contained tar.gz bundle with this structure:

occt7pkbak-YYYYMMDD-HHMMSS/
├── .openclaw/
├── restore.sh
├── manifest.txt
└── SHA256SUMS

The bundled restore.sh is the primary restore path.

Public defaults vs local overrides

Public default path:

~/backups/openclaw-snapshots

Local/private setups can override that path in two ways:

  • environment variable: OPENCLAW_SNAPSHOT_DIR
  • local config file: config.env

Configuration model

This skill keeps long-term local defaults in config.env.

Current configurable values:

  • OPENCLAW_SNAPSHOT_DIR
  • OPENCLAW_SNAPSHOT_PREFIX
  • OPENCLAW_SNAPSHOT_KEEP

Priority order is:

  • command-line flags
  • skill config file (config.env)
  • OPENCLAW_SNAPSHOT_* environment variables
  • built-in defaults

Important: in the current design, values stored in config.env override same-name environment variables. If you want a one-off override, prefer command-line flags such as --out-dir.

show_config.sh shows stored config values, environment values, and final effective values.

CLI notes

Primary CLI flag for backup location:

  • --out-dir

Compatibility alias still accepted:

  • --backup-dir

Safety model

  • integrity verification is mandatory during restore
  • symbolic links and special files are rejected
  • tar entries are audited before extraction, including hard-link rejection
  • dangerous target paths are rejected
  • the restore target basename must match the bundled source basename, normally .openclaw
  • the bundle is portable across environments; restore uses the current runtime target path rather than a build-time HOME lock
  • do not rename the extracted bundle root before running restore.sh