Claw Sync:为 Openclaw Skills 提供安全的记忆与工作区备份

作者:互联网

2026-03-21

AI教程

什么是 Claw Sync?

Claw Sync 是一款关键的实用程序,旨在确保您的 AI 智能体长期记忆和工作区配置永不丢失。它能够实现本地环境与远程仓库之间的无缝同步,支持对人格文件、工具配置和日常日志进行版本化备份。

通过与 Openclaw Skills 集成,该工具为需要在多台设备间保持一致性或从本地数据丢失中恢复的开发人员和高级用户提供了强大的安全保障。该技能的核心设计理念是安全性,它会自动排除 API 密钥和环境变量等敏感文件,同时确保智能体的身份和所学知识保持完整且可迁移。

下载入口:https://github.com/openclaw/skills/tree/main/skills/arakichanxd/claw-sync

安装与下载

1. ClawHub CLI

从源直接安装技能的最快方式。

npx clawhub@latest install claw-sync

2. 手动安装

将技能文件夹复制到以下位置之一

全局模式 ~/.openclaw/skills/ 工作区 /skills/

优先级:工作区 > 本地 > 内置

3. 提示词安装

将此提示词复制到 OpenClaw 即可自动安装。

请帮我使用 Clawhub 安装 claw-sync。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。

Claw Sync 应用场景

  • 在不同机器或开发环境之间同步智能体记忆。
  • 在进行重大更改之前,为智能体人格和自定义技能创建版本化快照。
  • 实施灾难恢复工作流,在硬件故障后恢复工作区。
  • 在使用 Openclaw Skills 的团队内部共享标准化的智能体身份和工具配置。
Claw Sync 工作原理
  1. 用户在本地备份配置文件中配置远程 Git 仓库和访问令牌。
  2. 触发同步命令时,该技能会识别核心 Markdown 文件和自定义技能目录,同时排除敏感私钥。
  3. 版本化备份被推送到远程仓库,创建一个可恢复的时间点。
  4. 用户可以列出可用版本或拉取特定快照以恢复智能体状态。
  5. 在执行任何恢复操作前,该技能会先创建本地备份以防止意外数据覆盖。

Claw Sync 配置指南

要开始使用 Claw Sync,请在 ~/.openclaw/.backup.env 创建配置文件并填写您的仓库详情:

BACKUP_REPO=https://github.com/username/your-repo
BACKUP_TOKEN=ghp_your_token

请确保您的远程仓库已初始化,且可以使用提供的令牌访问,以便与您的 Openclaw Skills 工作区实现无缝集成。

Claw Sync 数据架构与分类体系

Claw Sync 在 Openclaw Skills 生态系统中跟踪并组织以下组件:

文件/文件夹 用途
MEMORY.md 长期记忆存储
USER.md 用户个人资料数据
SOUL.md & IDENTITY.md 智能体人格与身份定义
TOOLS.md & AGENTS.md 配置规则与工具集
memory/*.md 日常活动日志与时序数据
skills/* 所有自定义技能逻辑与清单

注:为保持安全性,严格排除 openclaw.json.env 等文件。

name: claw-sync
description: Secure sync for OpenClaw memory and workspace. Use /sync to push, /restore to pull, /sync-status to check. Supports versioned backups and disaster recovery.
commands:
  - name: sync
    description: Push memory and skills to remote repository
    usage: /sync [--dry-run]
    run: node skills/claw-sync/index.js sync
  - name: restore
    description: Restore memory and skills from remote
    usage: /restore [latest|] [--force]
    run: node skills/claw-sync/index.js restore
  - name: sync-status
    description: Show sync configuration and local backups
    usage: /sync-status
    run: node skills/claw-sync/index.js status
  - name: sync-list
    description: List all available backup versions
    usage: /sync-list
    run: node skills/claw-sync/index.js list

Claw Sync

Secure, versioned sync for OpenClaw memory and workspace.

Commands

/sync

Push your memory and skills to the remote repository.

/sync              → Push and create versioned backup
/sync --dry-run    → Preview what would be synced

/restore

Restore memory and skills from the remote repository.

/restore                        → Restore latest version
/restore latest                 → Same as above
/restore backup-20260202-1430   → Restore specific version
/restore latest --force         → Skip confirmation

/sync-status

Show sync configuration and local backup info.

/sync-status

/sync-list

List all available backup versions.

/sync-list

What Gets Synced

File Description
MEMORY.md Long-term memory
USER.md User profile
SOUL.md Agent persona
IDENTITY.md Agent identity
TOOLS.md Tool configs
AGENTS.md Workspace rules
memory/*.md Daily logs
skills/* Custom skills

NOT Synced (security)

  • openclaw.json - Contains API keys
  • .env - Contains secrets

Setup Required

Create ~/.openclaw/.backup.env:

BACKUP_REPO=https://github.com/username/your-repo
BACKUP_TOKEN=ghp_your_token

Features

  • ??? Versioned - Each sync creates a restorable version
  • ?? Disaster Recovery - Local backup before every restore
  • ?? Secure - No config files synced, token sanitization
  • ??? Cross-platform - Windows, Mac, Linux