← Back to Skills Marketplace
benxiao2026

Agent State Backup

by benxiao2026 · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
169
Downloads
0
Stars
1
Active Installs
1
Versions
Install in OpenClaw
/install agent-state-backup
Description
Auto-backs up core files (IDENTITY, SOUL, MEMORY, knowledge base) daily via cron, creates compressed .tgz archive, enables one-click restore in new environme...
README (SKILL.md)

Agent State Backup & Restore

自动备份 OpenClaw 核心状态文件,防止上下文丢失。

📦 备份内容

  • IDENTITY.md - 身份定义
  • SOUL.md - 人格定义
  • MEMORY.md - 长期记忆
  • memory/*.md - 每日记忆
  • USER.md - 用户信息
  • knowledge/**/* - 知识库

🚀 快速使用

手动备份

~/.openclaw/workspace/scripts/agent-backup.sh

手动恢复

~/.openclaw/workspace/scripts/agent-restore.sh

设置自动备份 (每日凌晨 2 点)

~/.openclaw/workspace/scripts/setup-backup-cron.sh

📁 文件位置

  • 备份脚本: ~/.openclaw/workspace/scripts/agent-backup.sh
  • 恢复脚本: ~/.openclaw/workspace/scripts/agent-restore.sh
  • 备份目录: ~/.openclaw/backups/
  • 保留策略: 最近 7 个备份

🔧 配置选项

编辑 ~/.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

⚠️ 注意事项

  1. 首次备份前 - 确保所有重要文件已保存
  2. 恢复操作 - 会覆盖当前文件,建议先备份当前状态
  3. 磁盘空间 - 每个备份约 20-50KB,7 个备份约 350KB
  4. Cron 权限 - 确保 cron 有权限访问工作目录

🔄 迁移到新环境

  1. 在新环境安装 OpenClaw
  2. 复制备份文件 .tgz 到新机器
  3. 运行 agent-restore.sh
  4. 重启 OpenClaw

版本: 1.0.0
最后更新: 2026-03-03
依赖: bash, tar, gzip

Usage Guidance
This skill's documentation describes convenient backup/restore scripts and cron setup, but the package contains only instructions (no scripts or installer). Before installing or following the steps: 1) Do not copy/run commands that assume scripts exist — obtain the actual scripts from a trusted source or implement them yourself. 2) Review any backup/restore scripts you run to ensure deletion commands (xargs rm) use the correct paths and safeguards to avoid accidental deletions. 3) Treat backups as highly sensitive: encrypt them, restrict filesystem permissions, and use secure transfer methods when migrating to another machine. 4) If you expect an automated "one‑click" restore, confirm the skill actually supplies the needed scripts or an installer; otherwise this package is incomplete. 5) Prefer testing restore on a disposable environment before overwriting production data.
Capability Analysis
Type: OpenClaw Skill Name: agent-state-backup Version: 1.0.0 The skill bundle contains metadata and documentation for a legitimate utility designed to back up and restore OpenClaw agent state files (identity, memory, and knowledge base). The instructions in SKILL.md describe standard administrative tasks using common tools like tar, gzip, and cron for local data preservation. No evidence of data exfiltration, malicious code execution, or deceptive prompt injection was found in the provided files (_meta.json and SKILL.md).
Capability Assessment
Purpose & Capability
The described purpose (backup/restore of OpenClaw state files) is coherent with the files and paths referenced (~/.openclaw/*). However the skill promises runnable scripts (agent-backup.sh, agent-restore.sh, setup-backup-cron.sh) and a "one-click restore" experience while the package is instruction-only and contains no code or install spec — the claimed capabilities are not actually provided.
Instruction Scope
SKILL.md instructs the agent/user to run scripts that would read/write/overwrite sensitive local files, set up cron jobs, and delete old backups (e.g., using xargs rm). Those actions are within the stated backup scope, but the instructions assume the presence of scripts that don't exist here and include deletion commands that can be dangerous if run in the wrong directory or without verification.
Install Mechanism
There is no install spec and no code files (instruction-only). That lowers risk of arbitrary code being installed, but it also means the skill is incomplete: it documents scripts and dependencies (bash, tar, gzip) but does not provide them or an installation mechanism to create them.
Credentials
The skill requests no environment variables or credentials, which is proportionate. However the backups themselves contain highly sensitive state (IDENTITY, SOUL, MEMORY, USER.md, knowledge) — the SKILL.md does not mention encryption or secure storage/transfer, which is important for proportional handling of sensitive data.
Persistence & Privilege
The skill does not request always:true and uses normal autonomous invocation defaults. There is no evidence it modifies other skills or system-wide configs. If the agent were allowed to run the described scripts autonomously, it could access and overwrite sensitive files — but the package does not include those scripts.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install agent-state-backup
  3. After installation, invoke the skill by name or use /agent-state-backup
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
- Initial release of agent-state-backup. - Provides daily automatic backup for core agent files (IDENTITY, SOUL, MEMORY, knowledge base) via cron. - Backs up files as compressed .tgz archives and retains the latest 7 backups by default. - Includes scripts for one-click manual backup and restore. - Enables easy migration or recovery to prevent context loss after restarts or environment changes.
Metadata
Slug agent-state-backup
Version 1.0.0
License MIT-0
All-time Installs 1
Active Installs 1
Total Versions 1
Frequently Asked Questions

What is Agent State Backup?

Auto-backs up core files (IDENTITY, SOUL, MEMORY, knowledge base) daily via cron, creates compressed .tgz archive, enables one-click restore in new environme... It is an AI Agent Skill for Claude Code / OpenClaw, with 169 downloads so far.

How do I install Agent State Backup?

Run "/install agent-state-backup" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Agent State Backup free?

Yes, Agent State Backup is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Agent State Backup support?

Agent State Backup is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Agent State Backup?

It is built and maintained by benxiao2026 (@benxiao2026); the current version is v1.0.0.

💬 Comments