闲社服务运行正常AI智能体自动化平台
s

自我备份

技能标识:self-backup

Backup important OpenClaw workspace files to a GitHub repository. Use when: (1) user wants to backup workspace configuration, (2) sync OpenClaw settings to GitHub, (3) preserve automation scripts and personal configuration, (4) create remote backup of AGENTS.md, SOUL.md, MEMORY.md, and other workspace files. Configurable for any GitHub repository.

作者:admin | 来源记录:ClawHub
登记来源
ClawHub
版本
V 1.0.0
检测标记
后台标记通过
免费
免费获取
1
收藏
来源与检测标记为平台登记信息,并不代表已展示可复核的检测报告。使用前请核对版本、依赖和所需权限,建议先在隔离环境中运行。
概述
安装方式
版本历史

自我备份

自我备份

将关键的OpenClaw工作区文件备份到您的GitHub仓库,以确保安全保存和版本控制。

设置

1. 安装GitHub CLI(如果尚未安装)

bash

Ubuntu/Debian

sudo apt install gh

macOS

brew install gh

其他平台:https://cli.github.com/

2. 登录GitHub

bash gh auth login

3. 配置您的备份仓库

在备份脚本中编辑配置或设置环境变量:

bash

设置您的仓库URL(替换为您的仓库)


export BACKUPREPOURL=https://github.com/YOURUSERNAME/YOURBACKUP_REPO.git

或直接编辑脚本

nano scripts/backup.sh

4. 创建您的备份仓库

bash

为您的备份创建一个私有仓库

gh repo create YOUR_USERNAME/openclaw-backup --private --description OpenClaw工作区备份

备份内容

核心配置文件

  • - AGENTS.md - 工作流文档和流程
  • SOUL.md - 个人助手个性与行为
  • USER.md - 个人资料与偏好
  • MEMORY.md - 长期记忆与重要上下文
  • IDENTITY.md - 助手身份与表情符号
  • TOOLS.md - 工具配置与本地笔记
  • AUTOMATION.md - 定时任务与调度文档
  • openclaw.json - OpenClaw系统设置(令牌已脱敏以确保安全)

脚本与自动化

  • - scripts/ 目录 - 所有自动化脚本
  • memory/ 目录 - 每日记忆日志(最近30天)
  • 自定义配置文件

技能配置

  • - skills/ 目录 - 本地技能安装(仅元数据)
  • 技能自定义设置

仓库结构

文件在备份仓库中的组织方式如下:

/
├── config/ # 核心配置文件
├── scripts/ # 自动化脚本
├── memory/ # 每日记忆日志
├── skills/ # 技能配置
└── backup-info.md # 备份元数据

使用方法

首次设置:

bash scripts/setup.sh

定期备份:

bash scripts/backup.sh

选项:

bash scripts/backup.sh --force # 即使有冲突也强制推送 scripts/backup.sh --dry-run # 显示将要备份的内容

安全特性

  • - 自动令牌脱敏:所有敏感令牌(Discord、Telegram、API密钥)会自动被遮蔽
  • 推荐使用私有仓库:保持您的配置私密
  • 结构保留:所有设置均保留,仅敏感数据被遮蔽
  • 安全恢复:易于恢复并重新输入令牌

配置

编辑 scripts/backup.sh 中的以下变量:

bash

您的GitHub仓库URL


REPOURL=https://github.com/YOURUSERNAME/YOURBACKUPREPO.git

工作区目录(通常自动检测)

WORKSPACE_DIR=$HOME/.openclaw/workspace

手动备份

手动备份特定文件:
bash

克隆您的备份仓库


git clone https://github.com/YOURUSERNAME/YOURBACKUP_REPO.git /tmp/backup
cd /tmp/backup

复制重要文件

cp ~/.openclaw/workspace/AGENTS.md config/ cp ~/.openclaw/workspace/SOUL.md config/

... 等等

提交并推送

git add . git commit -m 手动备份 $(date) git push origin main

恢复流程

从备份中恢复:
bash

克隆备份


git clone https://github.com/YOURUSERNAME/YOURBACKUP_REPO.git

将文件复制回工作区

cp backup/config/* ~/.openclaw/workspace/ cp -r backup/scripts/* ~/.openclaw/workspace/scripts/

... 等等

在openclaw.json中重新输入您的实际令牌

nano ~/.openclaw/openclaw.json

故障排除

GitHub认证问题

bash

重新登录GitHub

gh auth logout gh auth login

权限被拒绝

bash

检查仓库是否存在以及您是否有访问权限

gh repo view YOURUSERNAME/YOURBACKUP_REPO

Git配置

bash

如有需要,设置git身份信息

git config --global user.name 您的姓名 git config --global user.email 您的邮箱@example.com

标签

skill ai

通过对话安装

以下为平台配置的接入选项,并非逐项实测通过。能否安装取决于客户端支持、技能来源和运行环境:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 self-backup-1776180702 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 self-backup-1776180702 技能

通过命令行安装

skillhub install self-backup-1776180702

下载

⬇ 下载 self-backup v1.0.0(免费)

文件大小: 7.59 KB | 发布时间: 2026-4-15 11:29

v1.0.0 最新 2026-4-15 11:29
- Initial release of the self-backup skill for OpenClaw.
- Backs up key workspace files (configurations, scripts, skill metadata) to a configurable private GitHub repository.
- Includes automatic sanitization of sensitive tokens for security.
- Provides easy setup, restore, and manual/automated backup options.
- Supports customizable repository structure and backup content via configuration.
- Documentation covers setup, usage, restore process, and troubleshooting tips.
返回顶部