---
name: hermes-backup
slug: hermes-backup-skill
displayName: "Hermes全量备份"
version: 1.0.0
description: "Hermes Agent 全自动全量备份恢复系统 v1.0 — 精准文件级备份（SOUL/USER/config/state.db/技能/会话），单包输出带恢复说明，安装即自动注册 Hermes cron 定时备份"
description_zh: "精准备份 Hermes Agent 的人设、记忆、配置、会话历史、技能，一个包带走，安装即自设定时任务"
description_en: "Precise file-level backup for Hermes Agent: SOUL/USER/config/state.db/skills/sessions — single package with RESTORE.md, auto-setup Hermes cron"
author: adapted from rikkychen's openclaw-backup for Hermes Agent
license: MIT
disable: false
agent_created: true
---

# Hermes Agent 全自动全量备份 v2.0

> 精准文件级备份，一个包带走整个 Agent

## 📦 备份内容

| 模块 | 文件 | 说明 |
|------|------|------|
| 🧠 人格 | `SOUL.md` | Agent 人设/行为准则 |
| 👤 用户画像 | `USER.md` | 用户偏好记录 |
| ⚙️ 配置 | `config.yaml` | Hermes 完整配置 |
| 💬 会话历史 | `state.db` (+WAL) | 全部对话记录 |
| 🧩 技能 | `~/.hermes/` | 所有已安装技能 |
| ⏰ 定时任务 | `cron-jobs.json` | Hermes 定时任务定义 |
| 📋 其他 | sessions, manifest 等 | 路由/元数据 |

## 🚀 安装 + 自动设置定时备份

### 第 1 步：安装文件

```bash
cd ~/.hermes/profiles/default/skills/openclaw-full-incremental-backup
chmod +x install.sh scripts/*.sh scripts/*.py
./install.sh /opt/data/hermes-backup
```

安装脚本会自动：
- 复制备份脚本到 `/opt/data/hermes-backup/scripts/`
- 生成 `sources.json`（备份源清单）
- 创建 `~/.hermes/scripts/hermes-backup.sh` 包装脚本
- 执行首次全量备份

### 第 2 步：注册 Hermes 定时备份（安装后自动执行）

```yaml
cronjob:
  action: create
  name: "Hermes 全自动备份"
  schedule: "59 23 * * *"     # 每天 23:59
  script: hermes-backup.sh     # ~/.hermes/scripts/ 下的包装脚本
  no_agent: true               # 纯脚本运行，不消耗 LLM
  deliver: origin               # 结果推送回当前会话
```

> ⚠️ Agent 注意：install.sh 执行完成后，**必须立即执行上述 cronjob create** 来完成自动定时备份设置。

### 第 3 步：验证

```bash
# 查看备份状态
python3 /opt/data/hermes-backup/scripts/hermes_backup.py list

# 查看定时任务
cronjob action=list
```

## 📖 常用命令

```bash
# 手动执行备份
/opt/data/hermes-backup/scripts/backup.sh

# 查看备份列表
python3 /opt/data/hermes-backup/scripts/hermes_backup.py list

# 验证备份完整性
python3 /opt/data/hermes-backup/scripts/hermes_backup.py verify

# 恢复
/opt/data/hermes-backup/scripts/restore.sh
```

## ⚙️ 配置

备份源在 `sources.json` 中管理，可直接编辑增减文件：

```bash
vi /opt/data/hermes-backup/sources.json
```

修改后下次备份自动生效。

## 🗑️ 卸载

```bash
cd ~/.hermes/profiles/default/skills/openclaw-full-incremental-backup
chmod +x uninstall.sh
./uninstall.sh
rm -rf /opt/data/hermes-backup
```

## 系统要求

- Python 3.8+
- tar（GNU tar）
- Hermes Agent
