← 返回
未分类 Key 中文

OpenClaw Backup & Restore — Encrypted OpenClaw Snapshots

Backup and restore the .openclaw agent folder — encrypted snapshots pushed to a private GitHub repo. Use this skill whenever the user mentions backup, restor...
备份和恢复 .openclaw 代理文件夹——将加密快照推送到私有 GitHub 仓库。当用户提到备份、恢复时使用此技能。
krishbhimani krishbhimani 来源
未分类 clawhub v1.2.0 1 版本 99808.4 Key: 需要
★ 1
Stars
📥 501
下载
💾 1
安装
1
版本
#backup#encryption#github#latest#migration#restore

概述

Snapshot — OpenClaw Backup & Restore

Encrypted backup and restore for the ~/.openclaw agent folder.

Backups are GPG-encrypted, chunked for GitHub's 100MB file limit, and pushed to a private repo.

How it works

  • backup — tar.gz → GPG encrypt → split into ≤95MB chunks → push to GitHub
  • restore — clone repo → pick version → reassemble chunks → verify checksum → decrypt → extract
  • setup — install GPG, clone/init the GitHub transport repo

Each backup version lives in its own folder with a manifest:

backups/openclaw-{timestamp}/
├── manifest.json
├── part-000.gpg
├── part-001.gpg
└── ...

Last 10 backups are kept; older ones are auto-deleted.


Prerequisites

Before running any command, verify:

  1. GPG is installed. If not: sudo apt-get update && sudo apt-get install -y gnupg gpg-agent
  2. Credentials are configured (see below)
  3. Setup has been run at least once on this workspace: python3 scripts/setup.py

Providing credentials

The scripts need these values: BACKUP_PASSWORD, GITHUB_PAT, GITHUB_USERNAME, and optionally REPO_NAME (defaults to openclaw-transport).

Provide them via any of these methods (checked in this order):

  1. OpenClaw's env file (recommended): Add to ~/.openclaw/.env:

```

BACKUP_PASSWORD=your-strong-password

GITHUB_PAT=ghp_xxxxxxxxxxxxxxxxxxxx

GITHUB_USERNAME=YourGitHubUsername

REPO_NAME=openclaw-transport

```

Then in openclaw.json, just enable the skill:

```json

"skills": { "entries": { "snapshot": { "enabled": true } } }

```

  1. Skill-local env file: Copy env-example.txt to .env in this skill's directory and fill in values. Useful for standalone usage outside OpenClaw.
  1. Shell environment: Export the variables in your shell profile.

Commands

All scripts live in the scripts/ subdirectory of this skill.

Take a backup

python3 <skill-path>/scripts/backup.py

Non-interactive. Compresses, encrypts, chunks if needed, pushes to GitHub.

Auto-deletes versions older than the most recent 10.

Restore a backup

# Restore the latest version (non-interactive, best for AI agents)
python3 <skill-path>/scripts/restore.py --latest

# Restore a specific version by timestamp
python3 <skill-path>/scripts/restore.py --version 20260227-120000

# List available versions without restoring
python3 <skill-path>/scripts/restore.py --list

# Interactive mode (prompts user to pick — use only in human-attended sessions)
python3 <skill-path>/scripts/restore.py

Run setup (first time or new workspace)

python3 <skill-path>/scripts/setup.py

Safe to run multiple times. Installs GPG if missing, clones or syncs the transport repo.


Typical workflows

Always run setup.py before backup or restore. It's idempotent (safe to run every time) and ensures GPG is installed, the transport repo exists, and the local repo is synced with GitHub. This prevents issues like missing repos, stale local state, or remotely deleted backups not being reflected locally.

"Back up my agent"

  1. Run python3 /scripts/setup.py
  2. Run python3 /scripts/backup.py
  3. Report the timestamp and size to the user

"Restore my agent" or "Load the latest backup"

  1. Run python3 /scripts/setup.py
  2. Run python3 /scripts/restore.py --latest
  3. Tell the user it's done and suggest restarting: openclaw gateway restart

"Show me available backups"

  1. Run python3 /scripts/setup.py
  2. Run python3 /scripts/restore.py --list
  3. Present the version list to the user

"Set up backups on this new workspace"

  1. Confirm the user has a .env file with credentials (help them create one from env-example.txt if not)
  2. Run python3 /scripts/setup.py

"Restore a specific version"

  1. Run python3 /scripts/setup.py
  2. Run python3 /scripts/restore.py --list to show available versions
  3. Ask the user which timestamp they want
  4. Run python3 /scripts/restore.py --version

Important notes

  • All .env files are excluded from backups — both ~/.openclaw/.env (OpenClaw root secrets) and the skill's own .env. Credentials never end up in encrypted archives.
  • The transport repo (~/openclaw-transport/) lives outside .openclaw and is not backed up.
  • The skill scripts themselves are backed up as part of .openclaw.
  • WhatsApp sessions are excluded (workspace-specific). User must reconnect after restore.
  • After restoring, the user should restart their agent: openclaw gateway restart

版本历史

共 1 个版本

  • v1.2.0 当前
    2026-03-30 16:35 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

ai-agent

Agent Browser

rez0
用于 AI 代理的浏览器自动化 CLI。当用户需要与网站交互(包括浏览页面、填写表单、点击按钮、截图等)时使用。
★ 835 📥 311,260
ai-agent

self-improving agent

pskoett
捕获经验教训、错误及修正内容,以实现持续改进。适用于以下场景:(1)命令或操作意外失败;(2)用户纠正Claude(如“不,那不对……”“实际上……”);(3)用户请求的功能不存在;(4)外部API或工具出现故障;(5)Claude发现自身
★ 4,099 📥 827,480
ai-agent

Self-Improving + Proactive Agent

ivangdavila
自我反思+自我批评+自我学习+自组织记忆。智能体评估自身工作、发现错误并持续改进。
★ 1,396 📥 322,692