OC Backup

v1.1.0

备份 OpenClaw 关键配置文件、核心数据和自定义技能,支持全量及分类备份,自动管理备份文件保留和清理。

0· 108·0 current·0 all-time
byFrankMei@neverland83

Install

OpenClaw Prompt Flow

Install with OpenClaw

Best for remote or guided setup. Copy the exact prompt, then paste it into OpenClaw for neverland83/oc-backup.

Previewing Install & Setup.
Prompt PreviewInstall & Setup
Install the skill "OC Backup" (neverland83/oc-backup) from ClawHub.
Skill page: https://clawhub.ai/neverland83/oc-backup
Keep the work scoped to this skill only.
After install, inspect the skill metadata and help me finish setup.
Use only the metadata you can verify from ClawHub; do not invent missing requirements.
Ask before making any broader environment changes.

Command Line

CLI Commands

Use the direct CLI path if you want to install manually and keep every step visible.

OpenClaw CLI

Bare skill slug

openclaw skills install oc-backup

ClawHub CLI

Package manager switcher

npx clawhub@latest install oc-backup
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
high confidence
Purpose & Capability
The name/description (OpenClaw backup) aligns with the code and SKILL.md: the script collects files from ~/.openclaw (openclaw.json, .env, workspace, skills, cron, devices, memory) and produces tar.gz backup packages and manifests. No unrelated services, cloud APIs, or extraneous credentials are requested.
Instruction Scope
Instructions are focused on creating backups, using node scripts and optional cron scheduling. They explicitly reference backing up .env (marked sensitive) and other core files. The skill does read and package sensitive local files (.env with API keys) — this is expected for a backup tool but is important to note because backups will contain secrets. The SKILL.md does not instruct any network transmissions or access to unrelated system paths.
Install Mechanism
No automated remote install downloads are included in the registry metadata — it's an instruction+script package. Dependencies are standard npm modules (commander, fs-extra, tar, dayjs) declared in package.json; SKILL.md suggests running npm install locally. No obscure external URLs or archive-extract installs are used.
Credentials
The skill requests no environment variables or credentials and does not require additional secrets to run. However, it will back up the user's .env file (which contains API keys), so the resulting backups contain sensitive credentials. The config examples mention notification channels and an optional encryptionKey, but no credentials or webhooks are required by default — enabling notifications would likely require additional configuration (not declared as required here).
Persistence & Privilege
always is false and the skill does not request permanent system-level privileges. It does file-system operations confined to the ~/.openclaw area and the configured output directory. The script can delete old backups from the backup output directory (clean operation), which is expected behavior for a backup tool.
Assessment
This skill is coherent for backing up OpenClaw files and does not request external credentials. Before installing: 1) Review and run the script in dry-run mode to see what it will include; 2) remember backups will contain .env and other secrets — store backup files securely (encrypt them or use secure storage); 3) if you enable notifications or encryption in config, ensure any webhook tokens or keys are provided securely (the skill does not declare required env vars for those); 4) test restore in a safe environment before relying on automated restores; 5) note a functional inconsistency: the cleanup routine appears to look for backup directories named openclaw-backup-*, while backups are described as tar.gz files — confirm cleanup behavior on your system to avoid leaving old tar.gz files or accidentally deleting unexpected directories. If you want extra assurance, have someone you trust review scripts/backup.js and run with --dry-run and limited output-dir first.

Like a lobster shell, security has layers — review code before you run it.

latestvk976q0rdxnawqg1h1njjt90yzx83pk29
108downloads
0stars
1versions
Updated 1mo ago
v1.1.0
MIT-0

OpenClaw 关键文件备份技能

元信息

  • 名称: openclaw-backup
  • 版本: 1.1.0
  • 描述: OpenClaw 关键文件备份技能,支持全量备份和分类备份,保护您的核心配置和自定义技能
  • 作者: FrankMei (neverland_83@163.com)
  • 运行时: node18
  • 主入口: scripts/backup.js

功能说明

在 LLM 大模型的加持下,OpenClaw 功能很强大,但同时也很"傻"——它经常"自杀"(把 openclaw.json 等关键配置文件改坏,导致系统异常),也经常"自残"(把上一秒还能正常工作的 skill 搞得乱七八糟)。如果你也经常遇到这样的困扰,那就应该经常备份那些关键文件!这个 skill 就是帮你做这件事的。

备份 OpenClaw 运行所需的关键配置文件和用户数据,包括:

  • 系统配置: openclaw.json, .env, exec-approvals.json
  • 核心文件: AGENTS.md, SOUL.md, USER.md, IDENTITY.md, TOOLS.md, HEARTBEAT.md, MEMORY.md
  • 技能目录: skills/ 下所有自定义技能
  • 其他数据: cron/ 定时任务, devices/ 设备配置, memory/ 记忆数据

触发关键词

  • 备份
  • backup
  • openclaw backup

使用方式

基本用法

# 通过 OpenClaw Agent 调用
node scripts/backup.js [options]

# 或让 agent 执行备份操作

命令行参数

参数简写说明
--full-f执行全量备份(默认)
--system-s只备份系统配置
--workspace-w只备份核心文件
--skills-k只备份技能目录
--memory-m只备份记忆数据
--cron-c只备份定时任务配置
--devices-d只备份设备配置
--output <path>-o指定输出目录
--dry-run预览模式,显示将备份的文件但不实际执行
--retain <days>保留最近 N 天的备份,自动删除更早的备份
--clean清理模式:只删除旧备份,不执行新备份
--json-j以 JSON 格式输出结果

使用示例

命令行调用

# 全量备份
node scripts/backup.js

# 只备份技能目录
node scripts/backup.js --skills

# 组合备份
node scripts/backup.js --system --workspace

# 自定义输出位置
node scripts/backup.js --output /path/to/backup

# 预览模式
node scripts/backup.js --dry-run

# JSON 输出(供程序解析)
node scripts/backup.js --json

# 备份并只保留最近14天的备份
node scripts/backup.js --full --retain 14

# 只清理旧备份(不执行新备份)
node scripts/backup.js --clean --retain 14

# 预览将删除的旧备份
node scripts/backup.js --clean --retain 14 --dry-run

自然语言调用

你也可以直接对 OpenClaw 说以下话,让它帮你执行备份:

帮我备份一下 OpenClaw
备份 OpenClaw 所有配置
只备份我的技能目录
预览一下要备份哪些文件

OpenClaw 会识别你的意图并调用本技能完成备份操作。

Cron 定时任务

你可以在 OpenClaw 中设置定时任务,实现每天自动备份 + 自动清理:

# 每天凌晨2点备份,保留最近14天
0 2 * * * node ~/.openclaw/workspace/skills/openclaw-backup/scripts/backup.js --full --retain 14

通过 OpenClaw 的 cron 功能添加此任务后,系统会自动在每天凌晨执行备份,并只保留最近14天的备份文件。

输出文件

备份完成后会生成以下文件:

文件类型文件名格式说明
备份包openclaw-backup-{type}-{YYYYMMDD}-{HHMMSS}.tar.gz压缩备份文件
清单文件openclaw-backup-{type}-{YYYYMMDD}-{HHMMSS}.json备份清单(JSON格式)
恢复指南RECOVERY_GUIDE.md手动恢复操作指南

默认输出目录: ~/backups/openclaw/

重要说明

安全性

  • 不自动恢复: 本技能只提供备份功能,恢复需要根据生成的 RECOVERY_GUIDE.md 手动操作
  • 敏感文件保护: .env 文件会在清单中标记为敏感
  • 权限保持: 备份文件权限设为仅当前用户可读

文件处理

  • 不存在的文件会被跳过,在清单中标记为 "skipped"
  • 备份过程中不会修改原始文件
  • 临时文件会在备份完成后自动清理

依赖

  • Node.js >= 18.0.0
  • fs-extra (文件操作)
  • tar (压缩)
  • commander (命令行解析)
  • dayjs (日期处理)

安装

cd ~/.openclaw/workspace/skills/openclaw-backup
npm install  # 安装必要的依赖包(根据你的环境自动安装缺失的依赖)

注意事项

  1. 备份前确保有足够的磁盘空间
  2. 建议定期备份(可通过 cron 设置)
  3. 重要修改后建议立即备份
  4. 备份文件包含敏感信息,请妥善保管
  5. 恢复时请仔细阅读恢复指导书

相关文档

Comments

Loading comments...