微算力 · API 导航与自营网关
API 接入 EN
未登录登录
💾

OpenClaw 跨设备状态同步与灾难恢复

openclaw-checkpoint · vv1.0.5
效率 安全 A 级 作者 AnthonyFrancis 公开目录收录
下载 1.8k 安装 647 收藏 5.1k 浏览 16.9k
下载 zip

简介

OpenClaw 官方生态的跨设备状态同步工具,通过私有 Git 仓库实现身份、记忆、配置的灾难恢复与无缝迁移。

原始描述

Backup and restore OpenClaw workspace state and agents across machines using git. Enables disaster recovery by syncing SOUL.md, MEMORY.md, memory files, cron...

通过你的 Agent 添加

点「快速安装」复制一段指令,粘给你正在用的 Agent(Claude Code、Codex、OpenClaw 等),它会自己完成安装。

或者手动安装

Claude Codeunzip -o skill.zip -d ~/.claude/skills/openclaw-checkpoint/
其它 Agent解压到它自己的 skills 目录,目录名用 openclaw-checkpoint

包里是 SKILL.md 加作者附带的文件,解压后目录名就是技能名。 技能申请的权限由作者决定,装之前请确认它能读什么、能执行什么。

中文使用说明 来自收录源

核心用法

OpenClaw Checkpoint 是一套基于 git 的灾难恢复方案,专为 OpenClaw AI 工作区设计。用户通过 checkpoint-setup 完成首次交互式配置后,即可使用 checkpoint-backup 将身份文件(SOUL.md、IDENTITY.md)、记忆库(MEMORY.md、memory/*.md)、定时任务(自动导出为 JSON)及配置同步至私有 GitHub 仓库。跨设备恢复时,checkpoint-restore 提供向导式流程,支持选择历史版本或 --latest 一键恢复最新状态。

关键命令矩阵:

命令 场景
checkpoint-setup 首次配置,生成 SSH 密钥、创建 PRIVATE 仓库
checkpoint-backup 手动触发备份,自动附带 cron 任务导出
checkpoint-schedule hourly 启用自动备份(15min/30min/2hours/daily 可选)
checkpoint-restore --latest 新机器一键恢复
checkpoint-status 检查同步状态与健康度

显著优点

  • 零配置迁移:新机器仅需安装技能并执行 checkpoint-restore,即可在数分钟内恢复完整工作环境,包括对话历史、自定义工具、定时任务配置
  • 多粒度自动备份:支持从 15 分钟到每日的频率选择,macOS 采用 launchd、Linux 采用 cron,均用户级运行无系统侵入
  • 安全意识内置:明确区分备份边界——API 密钥、OAuth Token 等敏感信息被 .gitignore 排除,强制要求 PRIVATE 仓库,并在文档中多次警示公开风险
  • 交互式体验优化:restore 流程内置首次使用引导,自动检测 SSH 授权状态,处理未提交变更冲突时提供保存/丢弃/取消三选项

潜在缺点与局限性

  • 单点并发限制:文档明确禁止多机器同时运行 OpenClaw,否则可能导致提交冲突或状态不一致
  • 数据丢失窗口:默认每小时备份意味着最坏情况下丢失 1 小时工作进度,高频用户需手动调整为 15 分钟
  • 密钥恢复盲区:.env.* 文件不纳入版本控制,灾难恢复后必须手动从 1Password 等密码管理器还原 API 密钥
  • 平台绑定:仅支持 macOS 与 Linux,Windows 用户无法使用
  • GitHub 单点依赖:所有远程操作依赖 GitHub 可用性与个人账号安全,无离线或自托管选项

适合人群

  • 在多台 Mac/Linux 设备间切换工作的 OpenClaw 重度用户
  • 对 AI 对话连续性有强需求的知识工作者、开发者
  • 具备基础 git 操作能力,能理解 PRIVATE 仓库重要性的技术用户
  • 需要自动化定时任务(cron)备份与迁移的场景

常规风险

  1. 仓库可见性误配:若用户误将备份仓库设为 public,个人记忆、身份配置将完全暴露——文档虽多次警示但无强制技术拦截
  2. curl|bash 供应链风险:快速安装指令 curl ... | bash 存在中间人攻击或仓库被篡改风险,安全建议是先下载审查再执行
  3. SSH 密钥管理:推荐 SSH 认证虽免 Token 过期烦恼,但私钥泄露将直接危及整个备份仓库
  4. 定时任务静默失败:自动备份写入用户级日志,若未主动 checkpoint-status 检查,可能长期未察觉同步中断
  5. 来源可信度:T3 级别(个人开发者 AnthonyFrancis),无企业背书,需用户自行审查代码仓库提交历史

技能正文


name: openclaw-checkpoint description: Backup and restore OpenClaw workspace state across machines using git. Enables disaster recovery by syncing SOUL.md, MEMORY.md, memory files, cron jobs, and configuration to a remote repository. Use when user wants to checkpoint their OpenClaw state, restore on a new machine, migrate between computers, or protect against data loss. Provides commands checkpoint (help overview), checkpoint-setup (interactive onboarding), checkpoint-backup, checkpoint-restore (with interactive checkpoint selection or --latest for most recent), checkpoint-schedule (auto-backup), checkpoint-stop, checkpoint-status, checkpoint-init, and checkpoint-reset. Automatically backs up cron jobs to memory/cron-jobs-backup.json on each checkpoint-backup.

OpenClaw Checkpoint Skill

Backup and restore your OpenClaw identity, memory, and configuration across machines.

Platform: macOS and Linux only. Windows is not supported.

Overview

This skill provides disaster recovery for OpenClaw by syncing your workspace to a git repository. It preserves:

  • Identity: SOUL.md, IDENTITY.md, USER.md (who you and the assistant are)
  • Memory: MEMORY.md and memory/*.md files (conversation history and context)
  • Cron Jobs: Scheduled tasks exported to memory/cron-jobs-backup.json (morning briefs, daily syncs, automations)
  • Configuration: TOOLS.md, AGENTS.md, HEARTBEAT.md (tool setups and conventions)
  • Scripts: Custom tools and automation you've built

Not synced (security): API keys (.env.*), credentials, OAuth tokens

Installation

Option 1: Git Clone (Recommended)

# Clone the skill repo
git clone https://github.com/AnthonyFrancis/openclaw-checkpoint.git ~/.openclaw/skills/openclaw-checkpoint

# Copy scripts to tools directory
mkdir -p ~/.openclaw/workspace/tools
cp ~/.openclaw/skills/openclaw-checkpoint/scripts/checkpoint* ~/.openclaw/workspace/tools/
chmod +x ~/.openclaw/workspace/tools/checkpoint*

# Add to PATH (also add to ~/.zshrc or ~/.bashrc for persistence)
export PATH="${HOME}/.openclaw/workspace/tools:${PATH}"

# Run setup wizard
checkpoint-setup

Option 2: Quick Install

curl -fsSL https://raw.githubusercontent.com/AnthonyFrancis/openclaw-checkpoint/main/scripts/install-openclaw-checkpoint.sh | bash

This runs the install script -- review it first if you prefer to inspect before executing.

Commands

checkpoint

Show all available commands and usage examples.

checkpoint

What it does:

  • Displays a quick reference of all checkpoint commands with descriptions and examples

When to use:

  • When you can't remember the exact command name
  • Quick reference for available options

checkpoint-setup

Interactive onboarding flow for first-time setup.

checkpoint-setup

What it does:

  • Guides you through creating a PRIVATE GitHub repository
  • Sets up SSH authentication (recommended) or Personal Access Token
  • Automatically detects if SSH key is already authorized on GitHub
  • Generates a README.md with recovery instructions and commands
  • Commits workspace files within ~/.openclaw/workspace (secrets excluded via .gitignore)
  • Configures automatic backups
  • Tests the backup system
  • Shows final status

When to use:

  • First time setting up checkpoint system
  • After installing the skill
  • After running checkpoint-reset
  • Recommended starting point for new users

checkpoint-auth

Authenticate with GitHub (browser-based).

checkpoint-auth

What it does:

  • Option 1: GitHub CLI (opens browser automatically)
  • Option 2: Personal Access Token (expires, needs renewal)
  • Option 3: SSH Key (recommended - no token expiry)
  • Automatically adds GitHub to known_hosts
  • Tests authentication after setup

When to use:

  • Authentication expired or failed
  • Switching authentication methods
  • Setting up on a new machine

SSH is recommended because:

  • No token expiration to worry about
  • Works reliably without password prompts
  • GitHub no longer accepts password authentication for HTTPS

checkpoint-backup

Save current state to remote repository.

checkpoint-backup

What it does:

  • Backs up OpenClaw cron jobs to memory/cron-jobs-backup.json (requires openclaw CLI and running gateway)
  • Commits all changes in ~/.openclaw/workspace
  • Pushes to origin/main
  • Shows commit hash and timestamp

Cron job backup details:

  • Runs openclaw cron list --json to export all scheduled tasks
  • Strips runtime state, keeps only configuration (name, schedule, target, payload)
  • Non-blocking: if the CLI or gateway is unavailable, checkpoint-backup continues without cron backup

When to use:

  • Before switching computers
  • After significant changes (new memory, updated SOUL.md)
  • Any time you want to ensure changes are saved

checkpoint-schedule

Set up automatic backups with configurable frequency.

checkpoint-schedule 15min      # Every 15 minutes
checkpoint-schedule 30min      # Every 30 minutes
checkpoint-schedule hourly     # Every hour (default)
checkpoint-schedule 2hours     # Every 2 hours
checkpoint-schedule 4hours     # Every 4 hours
checkpoint-schedule daily      # Once per day at 9am
checkpoint-schedule disable    # Turn off auto-backup

What it does:

  • macOS: Creates launchd plist for reliable background backups
  • Linux: Adds cron job for scheduled backups
  • Logs all activity to ~/.openclaw/logs/checkpoint.log

When to use:

  • First time setup: checkpoint-schedule hourly
  • Change frequency: checkpoint-schedule 15min
  • Stop backups: checkpoint-schedule disable

checkpoint-status

Check backup health and status.

checkpoint-status

What it shows:

  • Last backup time and commit
  • Whether local is behind remote
  • Uncommitted changes
  • Auto-backup schedule status
  • Recent backup activity log

When to use:

  • Before switching machines (verify synced)
  • Troubleshooting backup issues
  • Regular health checks

checkpoint-restore

Restore state from remote repository, with checkpoint selection and first-time onboarding.

checkpoint-restore            # Select from recent checkpoints (interactive)
checkpoint-restore --latest   # Restore most recent checkpoint (skip selection)
checkpoint-restore --force    # Discard local changes before restoring

What it does:

  • First-time users: Launches interactive restore onboarding flow
    • Guides you through GitHub authentication (SSH, GitHub CLI, or PAT)
    • Lets you specify your existing backup repository
    • Verifies access and restores your checkpoint
    • Handles merge/replace options if local files exist
    • Shows available checkpoints to pick from (if the repo has more than one commit)
    • Offers to restore cron jobs from backup
  • Returning users: Shows a list of the 10 most recent checkpoints to choose from
    • Pick the latest or any older checkpoint to restore
    • Current checkpoint is marked in the list
    • Restoring an older checkpoint warns that the next backup will overwrite newer remote checkpoints
    • Use --latest flag to skip the interactive selection and restore the most recent checkpoint automatically
  • Uncommitted changes: If you have local uncommitted changes, you're prompted to:
    1. Save changes first (runs checkpoint-backup)
    2. Discard local changes and continue restoring
    3. Cancel
  • Cron jobs: Automatically offers to restore cron jobs from memory/cron-jobs-backup.json after restoring (requires OpenClaw gateway to be running)

When to use:

  • Starting OpenClaw on a new machine
  • After hardware failure/disaster
  • When resuming work on different computer
  • First-time restore from an existing backup
  • Rolling back to a previous checkpoint after unwanted changes

Onboarding flow triggers when:

  • No workspace exists
  • Workspace exists but not a git repository
  • Git repository exists but no remote configured

checkpoint-init

Initialize workspace for checkpoint system.

checkpoint-init

What it does:

  • Creates git repository in ~/.openclaw/workspace
  • Generates .gitignore (excludes secrets and ephemeral files)
  • Creates initial commit

When to use:

  • First time setting up checkpoint system
  • After restoring from backup to new machine

checkpoint-reset

Reset checkpoint system for fresh setup.

checkpoint-reset

What it does:

  • Option 1: Removes local git repository only (keeps SSH keys)
  • Option 2: Removes everything (git repo + SSH keys + GitHub from known_hosts)
  • Reminds you to delete the GitHub repo manually

When to use:

  • Starting over with a fresh setup
  • Switching to a different GitHub repository
  • Troubleshooting persistent authentication issues

checkpoint-stop

Stop automatic backups.

checkpoint-stop

What it does:

  • Disables scheduled automatic backups
  • Removes cron job (Linux) or launchd agent (macOS)

When to use:

  • Temporarily pausing backups
  • Before making major workspace changes
  • If backups are causing issues

To restart: checkpoint-schedule hourly (or any frequency)

Setup

Easy Setup (Recommended)

Just run the interactive wizard:

checkpoint-setup

This handles everything: git init, SSH keys, GitHub setup, and first backup.

First Time Setup (Manual)

# 1. Initialize checkpoint system
checkpoint-init

# 2. Create PRIVATE GitHub repository
# Go to https://github.com/new
# Name: openclaw-state
# ⚠️  Visibility: PRIVATE (important - contains your personal data!)

# 3. Add remote (use SSH, not HTTPS)
cd ~/.openclaw/workspace
git remote add origin git@github.com:YOURUSER/openclaw-state.git
checkpoint-backup

Setup on Second Machine

Option 1: Interactive Restore (Recommended)

# Install the checkpoint skill first
curl -fsSL https://raw.githubusercontent.com/AnthonyFrancis/openclaw-checkpoint/main/scripts/install-openclaw-checkpoint.sh | bash

# Run checkpoint-restore - it will guide you through the entire process
checkpoint-restore

This will:

  • Help you authenticate with GitHub (if not already)
  • Ask for your backup repository details
  • Clone/restore your checkpoint automatically

Option 2: Manual Clone

# 1. Clone repository (use SSH)
git clone git@github.com:YOURUSER/openclaw-state.git ~/.openclaw/workspace

# 2. Restore secrets from 1Password/password manager
# Create ~/.openclaw/workspace/.env.thisweek
# Create ~/.openclaw/workspace/.env.stripe
# (Copy from secure storage)

# 3. Start OpenClaw
openclaw gateway start

Automated Backups

Easy Setup (Recommended)

# Enable hourly backups
checkpoint-schedule hourly

# Or choose your frequency:
checkpoint-schedule 15min   # Every 15 minutes - high activity
checkpoint-schedule 30min   # Every 30 minutes - medium activity  
checkpoint-schedule 2hours  # Every 2 hours - low activity
checkpoint-schedule daily   # Once per day - minimal activity

Check Status

checkpoint-status

Shows:

  • Last backup time
  • Whether synced with remote
  • Auto-backup schedule
  • Recent activity log

Manual Cron Setup (Advanced)

If you prefer manual cron:

# Edit crontab
crontab -e

# Add line for hourly backups:
0 * * * * /Users/$(whoami)/.openclaw/workspace/skills/openclaw-checkpoint/scripts/checkpoint-backup >> ~/.openclaw/logs/checkpoint.log 2>&1

Disaster Recovery Workflow

Scenario: Home server dies

# On new machine:

# 1. Install OpenClaw
brew install openclaw  # or your install method

# 2. Install checkpoint skill and run interactive restore
curl -fsSL https://raw.githubusercontent.com/AnthonyFrancis/openclaw-checkpoint/main/scripts/install-openclaw-checkpoint.sh | bash
checkpoint-restore
# Follow the interactive prompts to:
# - Authenticate with GitHub
# - Enter your backup repository (e.g., YOURUSER/openclaw-state)
# - Restore your checkpoint

# 3. Restore secrets from 1Password (API keys are not backed up for security)
cat > ~/.openclaw/workspace/.env.thisweek << 'EOF'
THISWEEK_API_KEY=your_key_here
EOF

# 4. Start OpenClaw
openclaw gateway start

# 5. Cron jobs are restored automatically during checkpoint-restore
# (if the gateway is running and cron backup exists)

# 6. Enable automatic backups on this machine
checkpoint-schedule hourly

# 7. Verify
# Ask assistant: "What were we working on?"
# Should recall everything up to last checkpoint, with all scheduled tasks restored

Security Considerations

⚠️ CRITICAL: Repository MUST be PRIVATE

Your backup contains sensitive personal data:

  • SOUL.md, MEMORY.md (your identity & memories)
  • Personal notes and conversation history
  • Custom scripts and configurations

If you make the repo public, anyone can see your data!

What gets backed up:

  • ✅ Memory files (conversation history)
  • ✅ Identity files (SOUL.md, etc.)
  • ✅ Cron jobs (memory/cron-jobs-backup.json)
  • ✅ Scripts and tools
  • ✅ Configuration

What does NOT get backed up:

  • ❌ API keys (.env.*) — keep in 1Password
  • ❌ OAuth tokens — re-authenticate on new machine
  • ❌ Downloaded media — ephemeral
  • ❌ Temporary files — ephemeral

Best practices:

  • Always use a PRIVATE repository
  • Use SSH authentication (no token expiry)
  • Store API keys in password manager, not in backed-up files
  • Enable 2FA on GitHub account
  • Consider encrypting sensitive notes before adding to memory

Permissions and Scheduling

This skill uses standard system scheduling to automate backups:

  • macOS: Creates a launchd plist at ~/Library/LaunchAgents/com.openclaw.checkpoint.plist
  • Linux: Adds a user-level cron job (visible via crontab -l)

Auto-backup is opt-in only -- it is never enabled unless you explicitly run checkpoint-schedule. You can disable it at any time with checkpoint-stop or checkpoint-schedule disable.

The skill does not install any background daemons, system services, or root-level processes. All scheduling runs under your user account.

File access scope: The skill only reads and writes within ~/.openclaw/workspace. It does not access files outside this directory. Sensitive files (.env.*, credentials, OAuth tokens) are excluded from backups via .gitignore.

Troubleshooting

"Not a git repository" or "'origin' does not appear to be a git repository"

Running checkpoint-restore will now automatically start the interactive restore onboarding flow to help you connect to your backup repository. Alternatively, run checkpoint-setup to create a new backup from scratch.

"Failed to push checkpoint"

Another machine pushed changes. Run checkpoint-restore first, then checkpoint-backup.

"You have uncommitted changes"

checkpoint-restore will prompt you to choose:

  1. Save changes first (runs checkpoint-backup)
  2. Discard local changes and continue
  3. Cancel

You can also skip the prompt with checkpoint-restore --force to discard changes directly.

Behind remote after restore

This is expected if another machine checkpointed since you last synced.

GitHub prompting for username/password

GitHub no longer accepts password authentication for HTTPS. Switch to SSH:

cd ~/.openclaw/workspace
git remote set-url origin git@github.com:YOURUSER/REPO.git

"Host key verification failed"

GitHub's SSH host key isn't in your known_hosts. Fix with:

ssh-keyscan -t ed25519 github.com >> ~/.ssh/known_hosts

"Permission denied (publickey)"

Your SSH key isn't added to GitHub. Run checkpoint-auth and choose SSH option.

GitHub repo is empty after setup

The old checkpoint-init only committed .gitignore. This is fixed now. Run:

cd ~/.openclaw/workspace && git add -A && git commit -m "Full backup" && git push

Starting fresh

Run checkpoint-reset to remove local git repo and optionally SSH keys, then checkpoint-setup.

Limitations

  • Single machine at a time: Don't run OpenClaw on multiple machines simultaneously
  • Max data loss: 1 hour if using hourly backups (cron)
  • Secrets not synced: Must restore API keys manually on new machine
  • Large files: GitHub has 100MB file limit (your text files are fine)

File Reference

See references/setup.md for detailed setup instructions.

正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。

标签

devopsautomationproductivitygitbackup-recoveryopenclaw-ecosystem

同类 Skill