360 Secure SkillHub
360 安全技能中心

hermes-backup-restore

核心功能:备份Hermes Agent的配置、技能、会话等数据,生成含SQLite一致快照的tar.gz包;支持自定义路径、单备份恢复、预览、合并等操作,自带完整性校验与权限加固。典型场景:本地备份、跨机迁移Agent、数据恢复。通过bash脚本执行命令,输出备份包或完成数据恢复。

anyjohn
anyjohn
热度 9.42
最近更新 2026-08-27 19:02:38
分类:自动化依赖:代码执行 / 读写文件应用场景:自动化脚本 / 数据处理

安装技能

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

执行命令安装此 skill: npx secure-skills-cli add hermes-backup-restore
Metadata
name
hermes-backup-restore
description
Back up and restore Hermes Agent data — config, secrets, skills, sessions, memories, cron, profiles. Creates portable tar.gz archives with SQLite consistent snapshots, JSON manifest, and integrity verification. Use when: "back up hermes", "restore hermes", "migrate hermes to new machine", "hermes backup", "hermes restore", "hermes 数据备份", "hermes 数据恢复".

Hermes Agent Backup & Restore

Portable backup and restore scripts for Hermes Agent data.

Scripts: scripts/hermes-backup.sh and scripts/hermes-restore.sh (relative to skill root). GitHub: https://github.com/anyJohn/hermes-backup-restore

What Gets Backed Up

  • Config (config.yaml, .env, auth.json)
  • Skills, Memories, Sessions (state.db), Cron
  • Kanban, Hooks, SOUL.md
  • Platform configs, Skins, Plugins, Widgets, Pets
  • Profiles (multi-profile support)
  • SQLite databases (via sqlite3 .backup for consistent snapshots)

Excludes: source code, caches, locks, sockets, logs, runtime ephemera.

Backup

# Default backup to ~/hermes-backup-<hostname>-<timestamp>.tar.gz
./scripts/hermes-backup.sh

# Custom output path
./scripts/hermes-backup.sh -o /path/to/backup.tar.gz

# Include hermes-agent source code
./scripts/hermes-backup.sh --full

# Back up only a specific profile
./scripts/hermes-backup.sh --profile work

# Preview what would be backed up
./scripts/hermes-backup.sh --dry-run

Restore

# Restore everything
./scripts/hermes-restore.sh backup.tar.gz

# Preview
./scripts/hermes-restore.sh backup.tar.gz --dry-run

# Merge (don't overwrite existing)
./scripts/hermes-restore.sh backup.tar.gz --merge

# Auto-stop running gateway
./scripts/hermes-restore.sh backup.tar.gz --force

# Restore into a profile
./scripts/hermes-restore.sh backup.tar.gz --profile work

# Custom target dir
./scripts/hermes-restore.sh backup.tar.gz -t /target/path

Cross-Machine Migration

# Machine A: backup
./scripts/hermes-backup.sh -o /tmp/my-backup.tar.gz

# Transfer
scp /tmp/my-backup.tar.gz user@machineB:/tmp/

# Machine B: restore
./scripts/hermes-restore.sh /tmp/my-backup.tar.gz --force

After restoring on a new machine, re-authenticate if API keys or OAuth tokens are machine-specific:

hermes setup   # or   hermes model

Features

  • Consistent SQLite snapshots: Uses sqlite3 .backup to avoid WAL corruption
  • Gateway safety check: Restore detects and can auto-stop a running Hermes gateway
  • Manifest: Every backup includes a JSON manifest with metadata (hostname, user, Hermes version, file list)
  • Profile-aware: Back up and restore individual profiles
  • Integrity verification: Restored databases are checked with PRAGMA integrity_check
  • Permission hardening: Config and secrets set to chmod 600 after restore
  • Dry run: Both scripts support --dry-run for safe preview

Requirements

  • bash 4.0+
  • rsync
  • tar
  • sqlite3 (recommended — falls back to raw copy if unavailable)
  • python3 (for manifest parsing during restore, optional)

License

MIT