Claw Time Machine
Back up, restore, and migrate the important state of an OpenClaw installation.
Run the script
Use the bundled script:
CODEBLOCK0
Commands:
- -
backup [filename] — create a backup under INLINECODE1 - INLINECODE2 — show backups, newest first
- INLINECODE3 — restore a backup
- INLINECODE4 — copy a backup to another machine and restore it there
What the script preserves
The script backs up only the important OpenClaw state, not the full installation binaries:
- - INLINECODE5
- INLINECODE6
- INLINECODE7
- INLINECODE8
- INLINECODE9
- INLINECODE10
- INLINECODE11
Each archive also includes a manifest.txt file that lists the captured paths.
Core workflow
Create a backup
Before a risky change, server migration, or major upgrade:
CODEBLOCK1
If the user asks how many backups exist or wants to inspect them:
CODEBLOCK2
Report the count, filenames, sizes, and highlight the newest backup.
Restore a backup
Prefer listing backups first when the user is choosing by index:
CODEBLOCK3
Use latest when the intent is obvious:
CODEBLOCK4
Add --force only when non-interactive restore is clearly intended.
Migrate to another machine
Use the migration command when the user wants a full move to a new server:
CODEBLOCK5
The script creates a fresh backup, copies it to the target host, and restores it there without requiring the skill to already exist on the target machine.
If the user wants the copied archive removed from the target machine after a successful restore, add --clean-remote-archive.
Important safety rules
- 1. Treat restore as destructive: it overwrites the preserved state paths.
- Keep the automatic safety backup path shown by the script so rollback remains possible.
- This skill does not stop or start Gateway automatically.
- If the target environment is unusual, read
references/usage.md before doing a migration.
Additional guidance
For detailed examples, migration notes, and failure handling, read references/usage.md.
爪机时光机
备份、恢复和迁移OpenClaw安装的重要状态。
运行脚本
使用捆绑脚本:
bash
./scripts/ctm.sh <命令> [参数]
命令:
- - backup [文件名] — 在~/.ctm/下创建备份
- list — 显示备份,最新在前
- restore <索引|文件名|latest> [--force] — 恢复备份
- migrate <用户@主机> [--remote-dir <目录>] [--clean-remote-archive] [--force] — 将备份复制到另一台机器并恢复
脚本保留的内容
脚本仅备份重要的OpenClaw状态,而非完整安装二进制文件:
- - workspace/
- credentials/
- telegram/
- skills/
- cron/
- openclaw.json
- identity/
每个归档文件还包含一个manifest.txt文件,列出捕获的路径。
核心工作流程
创建备份
在风险变更、服务器迁移或重大升级前:
bash
./scripts/ctm.sh backup
如果用户询问存在多少备份或想检查它们:
bash
./scripts/ctm.sh list
报告数量、文件名、大小,并高亮显示最新备份。
恢复备份
当用户通过索引选择时,优先列出备份:
bash
./scripts/ctm.sh list
./scripts/ctm.sh restore 1
当意图明确时使用latest:
bash
./scripts/ctm.sh restore latest
仅在明确需要非交互式恢复时添加--force。
迁移到另一台机器
当用户希望完全迁移到新服务器时使用迁移命令:
bash
./scripts/ctm.sh migrate user@new-server
脚本会创建全新备份,复制到目标主机,并在目标机器上恢复,无需目标机器上已存在该技能。
如果希望在成功恢复后从目标机器删除复制的归档文件,添加--clean-remote-archive。
重要安全规则
- 1. 将恢复视为破坏性操作:它会覆盖已保留的状态路径。
- 保留脚本显示的自动安全备份路径,以便回滚。
- 此技能不会自动停止或启动Gateway。
- 如果目标环境特殊,请在迁移前阅读references/usage.md。
附加指导
有关详细示例、迁移说明和故障处理,请阅读references/usage.md。