Install
openclaw skills install agent-state-backupAuto-backs up core files (IDENTITY, SOUL, MEMORY, knowledge base) daily via cron, creates compressed .tgz archive, enables one-click restore in new environment. Solves context loss after restart/migration.
openclaw skills install agent-state-backup自动备份 OpenClaw 核心状态文件,防止上下文丢失。
IDENTITY.md - 身份定义SOUL.md - 人格定义MEMORY.md - 长期记忆memory/*.md - 每日记忆USER.md - 用户信息knowledge/**/* - 知识库~/.openclaw/workspace/scripts/agent-backup.sh
~/.openclaw/workspace/scripts/agent-restore.sh
~/.openclaw/workspace/scripts/setup-backup-cron.sh
~/.openclaw/workspace/scripts/agent-backup.sh~/.openclaw/workspace/scripts/agent-restore.sh~/.openclaw/backups/编辑 ~/.openclaw/workspace/scripts/agent-backup.sh:
# 修改保留天数 (默认 7 天)
ls -t agent_backup_*.tgz | tail -n +8 | xargs -r rm
# 改为保留 30 天:tail -n +31
# 修改备份目录
BACKUP_DIR="$HOME/.openclaw/backups"
查看备份历史:
cat ~/.openclaw/backups/backup.log
.tgz 到新机器agent-restore.sh版本: 1.0.0
最后更新: 2026-03-03
依赖: bash, tar, gzip