← 返回
开发者工具 中文

OpenClaw State Backup

Create, inspect, and restore versioned OpenClaw state backups with rollback safety. Use when backing up or migrating OpenClaw memory, workspace state, gatewa...
创建、检查和恢复带版本控制的OpenClaw状态备份,支持安全回滚。用于备份或迁移OpenClaw内存、工作区状态和网关配置。
danielwangyy
开发者工具 clawhub v1.0.2 1 版本 100000 Key: 无需
★ 0
Stars
📥 680
下载
💾 4
安装
1
版本
#latest

概述

OpenClaw State Backup

Create and restore versioned, restorable snapshots of mutable OpenClaw state.

What changes over time

Treat these as mutable state and include them in backups when they exist:

  • ~/.openclaw/openclaw.json — runtime config
  • ~/.openclaw/sessions.json — session metadata
  • ~/.openclaw/restart-sentinel.json — recent restart delivery state
  • ~/.openclaw/memory/ — vector index / memory DBs
  • ~/.openclaw/agents/ — per-agent runtime/session state
  • workspace/MEMORY.md
  • workspace/memory/
  • workspace/SESSION-STATE.md
  • workspace/HEARTBEAT.md
  • workspace/TOOLS.md
  • workspace/skills/ — user-authored skills and local skill state

Treat these as mostly static/user-maintained bootstrap files and back them up when you want a full environment restore, but do not rely on them as fast-changing runtime state:

  • workspace/SOUL.md
  • workspace/USER.md
  • workspace/IDENTITY.md
  • workspace/AGENTS.md
  • workspace/BOOTSTRAP.md (if still present)

Backup strategy

Use the bundled scripts for deterministic behavior.

Create backup

Run scripts/backup_state.py with:

  • --workspace
  • --state-dir (usually ~/.openclaw)
  • --output-dir for generated snapshots
  • optional --label
  • optional --mode mutable|full (default: mutable)
  • optional repeated --include-prefix
  • optional repeated --exclude-prefix

mutable captures changing state only.

full adds mostly-static workspace identity/bootstrap files too.

The script writes:

  • a timestamped .tar.gz
  • a manifest.json
  • checksums for every stored file
  • compatibility metadata (formatVersion, OpenClaw version, host/platform)
  • applied include/exclude filter metadata

Restore backup

Run scripts/restore_state.py with:

  • --archive
  • --workspace
  • --state-dir
  • optional --verify-only
  • optional --dry-run
  • optional --allow-version-mismatch
  • optional --report-dir
  • optional repeated --include-prefix
  • optional repeated --exclude-prefix

Restore behavior:

  1. verify archive structure + checksums
  2. compare compatibility metadata
  3. optionally narrow restore scope with include/exclude prefixes
  4. build a restore plan (create / update / unchanged / missingFromArchive)
  5. always write a JSON restore/dry-run report to disk
  6. if --dry-run, stop after writing the diff-style report
  7. otherwise create a pre-restore rollback backup automatically
  8. restore files into place
  9. write a final restore report showing what changed and where rollback lives

Safety rules

  • Always prefer --verify-only first when archive provenance is uncertain.
  • Never overwrite from an archive that fails checksum verification.
  • Never delete unrelated files outside the managed backup manifest.
  • If compatibility check fails, stop unless the user explicitly wants --allow-version-mismatch.
  • Before reporting restore success, mention the generated rollback archive path.

File model

The scripts split backup contents into:

  • mutable/ — runtime-changing state
  • static/ — mostly-stable workspace identity/configuration files
  • meta/manifest.json — archive manifest

Read the manifest if you need to inspect contents without restoring.

When to use which mode

  • Use mutable for routine safety snapshots and frequent backups.
  • Use full before machine migration, risky reconfiguration, or major cleanup.

Recovery guidance

If a restore causes problems, immediately restore the auto-generated pre-restore rollback archive created by restore_state.py.

版本历史

共 1 个版本

  • v1.0.2 当前
    2026-03-31 11:00 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

developer-tools

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 668 📥 323,936
developer-tools

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 66 📥 179,967
developer-tools

Gog

steipete
Google Workspace 命令行工具,支持 Gmail、日历、云端硬盘、通讯录、表格和文档。
★ 921 📥 185,760