← 返回 Skills 市场
jixsonwang

claw-saver

作者 Jixson · GitHub ↗ · v1.6.2 · MIT-0
cross-platform ⚠ suspicious
157
总下载
0
收藏
0
当前安装
4
版本数
在 OpenClaw 中安装
/install claw-saver
功能描述
Back up the full OpenClaw environment (~/.openclaw) to a Git repository. Supports scheduled backups, interactive restore, and Git LFS for large model files.
使用说明 (SKILL.md)

claw-saver

Back up the entire OpenClaw environment (~/.openclaw) to a Git repository. Supports scheduled backups, interactive restore, and exponential backoff on network failures.

Features

  • Full backup: Everything in ~/.openclaw is backed up, including agents, skills, configurations, knowledge bases, and agent memory
  • Smart exclusions: Only ignores clearly harmless runtime artifacts (logs, cache, node_modules, canvas)
  • Scheduled backups: Configurable cron schedule (default: every 5 hours)
  • Atomic commits: Two-commit strategy ensures backup files and restore guide are always consistent
  • Git LFS support: Large model files are auto-tracked via Git LFS
  • Exponential backoff: Failed pushes retry with 60s -> 120s -> 240s delays
  • Stale lock protection: Orphan backup processes are detected and cleaned up
  • Dynamic .gitignore: Scans the actual directory structure, no hardcoded assumptions

Quick Start

# 1. Configure your Git token
openclaw config set env.OPENCLAW_BACKUP_GIT_TOKEN \x3Cyour-token>

# 2. Set your repository URL
# Edit ~/.openclaw/skills/claw-saver/config.json and set "repo"
# Example: "repo": "https://cnb.cool/yourname/your-repo"

# 3. Run your first backup
openclaw backup run

# 4. Enable automatic backups (every 5 hours)
openclaw backup enable-cron

CLI Commands

openclaw backup run            # Run backup immediately
openclaw backup status         # Show last backup time and commit hash
openclaw backup restore        # Restore from a previous commit (interactive)
openclaw backup enable-cron    # Enable scheduled backups
openclaw backup disable-cron   # Disable scheduled backups
openclaw backup set-cron \x3Cexpr> # Set custom schedule (e.g. "0 */2 * * *")

Configuration

Edit ~/.openclaw/skills/claw-saver/config.json:

{
  "repo": "https://cnb.cool/yourname/your-repo",
  "cron": "0 */5 * * *",
  "lfs_threshold_mb": 10,
  "lfs_extensions": [".bin", ".gguf", ".safetensors", ".pt", ".pth", ".onnx", ".msgpack", ".model"],
  "push_retries": 3,
  "push_retry_interval_ms": 60000
}
Option Default Description
repo (required) Git repository URL
cron 0 */5 * * * Backup schedule (cron expression, in system timezone)
lfs_threshold_mb 10 Files larger than this are tracked via Git LFS
lfs_extensions (see above) File extensions to LFS-track
push_retries 3 Max push retry attempts on failure
push_retry_interval_ms 60000 Initial retry delay (doubles each attempt)

What Is Backed Up

Everything except harmless runtime artifacts:

# === BACKED UP ===
agents/              # Agent configurations, auth profiles, session data
credentials/         # Channel credentials and keys
identity/           # Device identity keys
kb/                 # Knowledge base (user docs + vector database)
lts/                # Long-term scripts (cleanup, OOM protection)
openclaw.json       # Core configuration (含 tokens)
skills/             # All installed skills and their configs
workspace-* /       # Agent workspaces, memory, learnings
**/.learnings/      # Agent self-improvement logs
**/.openclaw/       # Per-workspace OpenClaw state
And all other directories in ~/.openclaw/

What Is Excluded (Runtime Artifacts Only)

These are transient or rebuildable and intentionally not backed up:

.git/               # Git repository itself (local only)
logs/               # Runtime logs
canvas/             # Canvas runtime state
media/             # Uploaded media files
npm/               # NPM packages (rebuild with npm install)
cron/runs/         # Cron execution history
**/node_modules/   # Dependencies (rebuild with npm install / pip install)
**/__pycache__/     # Python bytecode cache
**/.cache/          # Generic cache
**/dreaming/        # Short-term memory state
*.tmp, *.bak        # OS noise
.backup.lock        # Runtime lock file

User data principle: If in doubt, it is backed up. Credentials, identity keys, knowledge bases, agent memory, and learned data are all preserved.

Security

  • Token isolation: The token is stored only in ~/.openclaw/.git/config (local, never pushed to the backup repo) and in the cron environment variable (local system only)
  • No token in commits: RESTORE.md and commit messages contain only the repo URL, never the token
  • stderr suppressed: git push stderr is redirected to prevent token leakage in error messages
  • git directory excluded: .git/ is in .gitignore, so .git/config (containing the token in the remote URL) is never backed up

Restore

openclaw backup restore

This clones the repository to a temp directory, checks out the specified commit, and copies files back to ~/.openclaw. A running backup is preserved (skills/claw-saver stays live during restore).

After restore completes:

openclaw gateway restart

Restore Guide

A RESTORE.md file is generated with each backup, embedded in the backup commit. It contains the exact commit hash, clone instructions, and a list of what was excluded so you know what needs manual restoration.

Architecture

skills/claw-saver/
  lib/
    backup.js      # Core orchestration (lock, stage, commit, push)
    git.js         # Git operations (init, add, commit, push, clone)
    lfs.js         # Git LFS setup and tracking
    restore.js     # Interactive restore logic
  scripts/
    cli.js         # CLI entry point (run, status, restore, cron)
  config.json      # User configuration (repo, cron, LFS settings)

Lock Mechanism

Concurrent backup runs are prevented via an atomic mkdir-based lock:

  • Lock dir: ~/.openclaw/.backup.lock/ (pid file inside)
  • If a stale lock is detected (holder PID is dead), it is forcibly taken over
  • Lock is always released via finally{} after backup completes or fails
安全使用建议
Install only if you are comfortable placing the full OpenClaw environment, including secrets and agent memory, into a tightly controlled Git repository. Use a private encrypted repo if possible, review what will be committed, avoid broad tokens, and be cautious enabling scheduled backups until the token-handling and shell-command issues are fixed.
功能分析
Type: OpenClaw Skill Name: claw-saver Version: 1.6.2 The skill is a backup utility that intentionally collects and exfiltrates highly sensitive data, including 'credentials/', 'identity/' keys, and 'openclaw.json' (containing tokens), to a user-defined Git repository. While this aligns with its stated purpose of a 'full backup,' the implementation contains several high-risk security practices: it injects the Git access token into the remote URL (stored in plaintext in .git/config in lib/git.js) and embeds the token directly into the system crontab (scripts/cli.js), making it visible to other local processes. Additionally, the restore function in lib/restore.js performs a destructive wipe of the ~/.openclaw directory. While no hardcoded malicious exfiltration endpoint was found, the handling of secrets and the broad data access scope present a significant security risk.
能力标签
requires-oauth-tokenrequires-sensitive-credentials
能力评估
Purpose & Capability
The backup behavior is coherent with the stated purpose, but the scope is extremely broad: credentials, identity keys, auth profiles, knowledge bases, agent memory, and token-bearing configuration are intentionally included in remote Git backups.
Instruction Scope
The documentation discloses broad backups, but its security section claims token isolation/no token-in-commit behavior that conflicts with backing up openclaw.json containing tokens.
Install Mechanism
There is no install script, but runtime operation depends on local git, git-lfs, crontab, and shell execution.
Credentials
Full access to ~/.openclaw is proportionate for a full backup tool, but pushing credentials, identity material, private documents, and agent memory to Git without clear encryption or secret filtering is high impact.
Persistence & Privilege
The skill supports persistent cron-based backups and embeds the backup token into the cron command line, so sensitive uploads can continue after initial setup.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install claw-saver
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /claw-saver 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.6.2
v1.6.2: re-publish with ClawScan note explaining execSync usage v1.6.1: docs rewrite + bug fixes
v1.6.1
v1.6.1: docs rewrite + bug fixes
v1.6.0
v1.6.0: renamed from openclaw-backup to claw-saver; v1.5.0: initial release with backup/restore/cron, Git LFS, snapshot restore, TTY safety, exponential backoff
v1.5.0
Initial release: backup/restore/cron, Git LFS, snapshot restore, TTY safety, exponential backoff
元数据
Slug claw-saver
版本 1.6.2
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 4
常见问题

claw-saver 是什么?

Back up the full OpenClaw environment (~/.openclaw) to a Git repository. Supports scheduled backups, interactive restore, and Git LFS for large model files. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 157 次。

如何安装 claw-saver?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install claw-saver」即可一键安装,无需额外配置。

claw-saver 是免费的吗?

是的,claw-saver 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

claw-saver 支持哪些平台?

claw-saver 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 claw-saver?

由 Jixson(@jixsonwang)开发并维护,当前版本 v1.6.2。

💬 留言讨论