360 Secure SkillHub
360 安全技能中心

MyOpenClaw Backup Restore

这是OpenClaw的跨平台备份恢复工具,仅需Node.js即可运行,支持Windows/macOS/Linux跨系统互操作。核心功能包括备份/恢复OpenClaw核心数据(排除冗余文件),提供dry-run预览、自动预恢复快照等安全机制,还内置HTTP服务器支持浏览器管理。适用于创建快照、恢复备份、跨设备迁移、防数据丢失等场景,输入为命令行指令或浏览器操作,输出为备份包或恢复后的系统状态。

beyound87
beyound87
热度 57.97
最近更新 2026-05-18 12:18:03
分类:自动化依赖:代码执行 / 读写文件应用场景:自动化脚本 / 数据处理

安装技能

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

执行命令安装此 skill: npx secure-skills-cli add myopenclaw-backup-restore
Metadata
name
myopenclaw-backup-restore
description
Cross-platform backup and restore for OpenClaw. Works on Windows, macOS, and Linux — backups created on any OS can be restored on any other OS. Use when user wants to create a snapshot, restore from backup, migrate to a new machine, or protect against data loss. Supports dry-run preview, automatic pre-restore snapshots, gateway token preservation, credential permission hardening, and a built-in HTTP server for browser-based management. Only requires Node.js (no bash/rsync/python needed).
metadata
{"openclaw":{"requires":{"bins":["node"]},"trust":"high","permissions":[{"read":"~/.openclaw"},{"write":"~/.openclaw"},{"network":"listen"}]}}

MyOpenClaw Backup Restore — Cross-Platform

Part of the MyClaw.ai open skills ecosystem. Full documentation (中文): see README.md

Quick Start

# Backup
node scripts/backup-restore.js backup

# List backups
node scripts/backup-restore.js list

# Restore (always dry-run first!)
node scripts/backup-restore.js restore <archive> --dry-run
node scripts/backup-restore.js restore <archive>

No setup, no dependencies beyond Node.js.

What Gets Backed Up

Workspace (MEMORY.md, SOUL.md, etc.) • All workspace-* dirs (multi-agent teams) • Gateway config (tokens, API keys, channels) • Skills • Extensions • Credentials & channel pairing state • Agent config & session history • Devices • Identity • Cron jobs • Guardian scripts • ClawHub registry • Delivery queue • Memory index

Excluded: logs, node_modules, .git, media files, browser data, .lock/.deleted.* files.

See references/what-gets-saved.md for full details.

Cross-Platform

Backups use tar.gz (native on Win10+/macOS/Linux). Auto-fallback to ZIP on older Windows. Archives from any OS restore on any OS.

Commands

backup

node scripts/backup-restore.js backup [--output-dir <dir>]

Creates openclaw-backup_{agent}_{timestamp}.tar.gz in ~/openclaw-backups/. Auto-prunes (keeps last 7). On non-Windows: chmod 600 applied.

restore

node scripts/backup-restore.js restore <archive> [--dry-run] [--overwrite-gateway-token]

Safety features:

  • --dry-run: Preview without changes
  • Pre-restore snapshot: Auto-saves current state before overwriting
  • Gateway token preservation: Keeps new server's token (prevents Control UI mismatch)
  • Interactive confirmation: Must type yes
  • Credential hardening: chmod 700/600 on non-Windows
  • Auto-restart: Starts gateway after restore
  • Legacy compatibility: Handles v1 (bash) and v2 archive structures

list

node scripts/backup-restore.js list [--backup-dir <dir>]

HTTP Server

node scripts/server.js --token <secret> [--port 7373] [--backup-dir <dir>]
  • Web UI at http://localhost:<port>/?token=<token>
  • Remote: list, download, upload only
  • Localhost: backup, restore (shell execution restricted to localhost)
  • Token is mandatory — server won't start without one

Security

Archives contain bot tokens, API keys, and credentials. Store securely. Never commit to public repos. Transfer via encrypted channels.