npx skills add https://github.com/theagentservice/skills --skill openclaw-backup使用 Claude Code 为 OpenClaw Agent 工作区文件提供自动加密备份与恢复功能。
本技能提供三项核心功能:
所有备份均使用 AES-256-CBC 加密(通过 openssl)和 自动生成的随机密码。每个备份都会获得一个唯一的密码,该密码存储在恢复文件中。
在执行备份操作前,请确保已安装以下工具:
pip install requests)如果用户未指定文件,默认备份以下 OpenClaw 工作区文件:
SOUL.md - Agent 核心身份与目标MEMORY.md - Agent 记忆与上下文IDENTITY.md - Agent 身份定义Automated encrypted backup and restore for OpenClaw Agent workspace files using Claude Code.
This skill provides three core functions:
All backups use AES-256-CBC encryption (via openssl) with auto-generated random passwords. Each backup gets a unique password that is stored in the recovery file.
Before executing backup operations, ensure the following tools are installed:
pip install requests)If the user doesn't specify files, the following OpenClaw workspace files are backed up by default:
SOUL.md - Agent core identity and goals广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
AGENTS.md - Agent 配置TOOLS.md - 工具配置当用户请求备份工作区文件时执行:
收集文件列表
SOUL.md MEMORY.md IDENTITY.md AGENTS.md TOOLS.md执行备份脚本(密码自动生成)
定位脚本路径(通常在 Skill 目录的 scripts/backup.py)
执行命令时不带 --password 参数(脚本将自动生成):
python3 scripts/backup.py upload \
--files "SOUL.md MEMORY.md IDENTITY.md"
脚本自动生成一个 32 位字符的随机密码
捕获标准输出(JSON 响应)和标准错误(进度信息,包括生成的密码)
处理响应
成功时,脚本输出 JSON:
{
"backupId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"downloadUrl": "https://soul-upload.com/backup/...",
"sizeBytes": 12345,
"sha256": "abc123...",
"password": "auto-generated-32-char-random-password"
}
解析 JSON 并提取关键信息,包括自动生成的密码
保存恢复信息
使用 Write 工具创建/更新 .openclaw-backup-recovery.txt
关键:在恢复文件中包含自动生成的密码
格式:
Backup ID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Password: auto-generated-32-char-random-password
Download URL: https://soul-upload.com/backup/...
Created: 2024-01-15 10:30:00 UTC
Size: 12.05 KB
SHA256: abc123...
Files: SOUL.md, MEMORY.md, IDENTITY.md
---
追加到文件末尾(保留历史记录)
显示成功消息
.openclaw-backup-recovery.txt| 错误场景 | 检测方式 | 用户指导 |
|---|---|---|
| 文件未找到 | 脚本返回错误:"Files not found: ..." | 列出缺失的文件,询问用户是否希望继续备份其他文件 |
| 文件过大 | 脚本返回错误:"Backup size ... exceeds limit ..." | 显示实际大小,建议移除大文件或拆分备份 |
| 网络错误 | 脚本返回错误:"Network error: ..." | 建议检查网络连接,询问是否希望重试 |
| 413 过大 | 脚本返回错误:"File too large (413 Payload Too Large)" | 表明超过 20MB 限制,建议减小备份大小 |
| 加密失败 | 脚本返回错误:"openssl encryption failed: ..." | 检查 openssl 是否正确安装 |
User: Back up my SOUL.md and MEMORY.md
Claude: I'll backup these files with auto-generated encryption.
[Executes backup script]
Backup complete!
- Backup ID: 3f8a2b1c-...
- Size: 45.2 KB
- Password: Auto-generated (32 chars)
- Recovery info saved to .openclaw-backup-recovery.txt
IMPORTANT: Keep .openclaw-backup-recovery.txt safe!
It contains the password needed to restore this backup.
当用户请求恢复备份时执行:
获取备份 ID 和密码
.openclaw-backup-recovery.txt确定输出目录
.)执行恢复脚本
使用恢复文件中的密码执行命令:
python3 scripts/backup.py download \
--backup-id "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" \
--password "password-from-recovery-file" \
--output-dir "."
捕获标准输出(JSON 响应)和标准错误(进度信息)
处理响应
成功时,脚本输出 JSON:
{
"success": true,
"extractedFiles": ["SOUL.md", "MEMORY.md", "IDENTITY.md"],
"outputDir": "/path/to/output"
}
解析提取的文件列表
验证恢复结果
显示成功消息
| 错误场景 | 检测方式 | 用户指导 |
|---|---|---|
| 备份 ID 不存在 | 脚本返回错误:"Backup not found: ..." | 检查备份 ID 是否正确,可能已被删除 |
| 恢复文件缺失 | .openclaw-backup-recovery.txt 未找到 | 无法恢复 - 没有恢复文件则密码未知 |
| 密码错误 | 脚本返回错误:"Decryption failed - wrong password ..." | 恢复文件可能已损坏或来自不同的备份 |
| 网络错误 | 脚本返回错误:"Network error: ..." | 建议检查网络连接,询问是否希望重试 |
| 提取失败 | 脚本返回错误:"tar extraction failed: ..." | 文件可能已损坏,请尝试重新下载 |
User: Restore my last backup
Claude: I found the most recent backup in .openclaw-backup-recovery.txt
- Backup ID: 3f8a2b1c-...
- Created: 2024-01-15 10:30:00 UTC
Downloading and decrypting backup...
Restoration complete! Extracted the following files:
- SOUL.md
- MEMORY.md
- IDENTITY.md
Files saved to current directory, please verify content is correct.
当用户请求删除远程备份时执行:
获取备份 ID
.openclaw-backup-recovery.txt请求确认
执行删除脚本
用户确认后,执行命令:
python3 scripts/backup.py delete \
--backup-id "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
捕获标准输出(JSON 响应)和标准错误(进度信息)
处理响应
成功时,脚本输出 JSON:
{
"success": true,
"backupId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
更新恢复信息文件
.openclaw-backup-recovery.txt显示成功消息
| 错误场景 | 检测方式 | 用户指导 |
|---|---|---|
| 备份 ID 不存在 | 脚本返回错误:"Backup not found: ..." | 备份可能已被删除或 ID 不正确 |
| 网络错误 | 脚本返回错误:"Network error: ..." | 建议检查网络连接,询问是否希望重试 |
| 用户取消 | 用户拒绝确认 | 操作已取消,备份未删除 |
User: Delete my backup
Claude: I found the following backups in .openclaw-backup-recovery.txt:
1. Backup ID: 3f8a2b1c-... (2024-01-15 10:30:00)
2. Backup ID: 7b2c9d4e-... (2024-01-14 08:20:00)
Which backup would you like to delete? (1 or 2)
User: 1
Claude: Warning: This will permanently delete backup 3f8a2b1c-...
This action cannot be undone. Confirm deletion? (yes/no)
User: yes
Claude: Backup deleted.
- Backup ID: 3f8a2b1c-...
To backup again, create a new backup with a new auto-generated password.
.openclaw-backup-recovery.txt 中(解密所必需).openclaw-backup-recovery.txt(工作区根目录).gitignoresoul-upload.com 备份 API:
| 端点 | 方法 | 功能 | 响应 |
|---|---|---|---|
/backup | POST | 上传备份 | {backupId, downloadUrl, sizeBytes, sha256} |
/backup/:backupId | GET | 下载备份 | 302 重定向到 R2 存储 URL |
/backup/:backupId | DELETE | 删除备份 | {success: true, backupId} |
常见状态码:
问题:脚本错误 "Missing required tools: tar, openssl"
解决方案:
brew install openssl (tar 内置)sudo apt-get install tar openssltar --version 和 openssl version问题:脚本错误 "Error: 'requests' library not found"
解决方案:
pip install requests
# 或
pip3 install requests
问题:无法恢复备份 - 恢复文件丢失
解决方案:
问题:上传/下载期间超时
解决方案:
问题:恢复期间覆盖现有文件
解决方案:
User: Back up my workspace files
Claude: [Execute upload workflow using default file list]
[Auto-generate password and save to recovery file]
User: Back up only SOUL.md and MEMORY.md
Claude: [Execute upload workflow, backup only specified files]
[Auto-generate password and save to recovery file]
User: Restore my last backup
Claude: [Read latest Backup ID and password from .openclaw-backup-recovery.txt]
[Execute download workflow]
User: Restore backup 3f8a2b1c-1234-5678-90ab-cdef12345678
Claude: [Read password for this Backup ID from recovery file]
[Execute download workflow]
User: Delete my old backups
Claude: [Show available backup list from recovery file]
[User selects backup to delete]
[Execute delete workflow]
[Remove entry from recovery file]
.openclaw-backup-recovery.txt 并单独备份脚本文件位于 Skill 目录的 scripts/backup.py。
执行 Bash 命令时,请确保使用正确的相对或绝对路径。通常:
python3 scripts/backup.py ...cd 到 Skill 目录版本 : 2.0.0 作者 : Claude Code 许可证 : MIT 密码策略 : 每个备份自动生成唯一密码(v2.0.0 新增)
每周安装量
1.8K
仓库
首次出现
Feb 15, 2026
安全审计
安装于
github-copilot1.7K
opencode1.7K
codex1.7K
gemini-cli1.7K
cursor1.7K
kimi-cli1.7K
MEMORY.md - Agent memory and contextIDENTITY.md - Agent identity definitionAGENTS.md - Agent configurationTOOLS.md - Tool configurationExecute when the user requests to backup workspace files:
Collect File List
SOUL.md MEMORY.md IDENTITY.md AGENTS.md TOOLS.mdExecute Backup Script (Password Auto-Generated)
Locate script path (usually scripts/backup.py in Skill directory)
Execute command WITHOUT --password argument (script will auto-generate):
python3 scripts/backup.py upload \
--files "SOUL.md MEMORY.md IDENTITY.md"
Script automatically generates a 32-character random password
Capture stdout (JSON response) and stderr (progress info including generated password)
Process Response
On success, script outputs JSON:
{
"backupId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"downloadUrl": "https://soul-upload.com/backup/...",
"sizeBytes": 12345,
"sha256": "abc123...",
"password": "auto-generated-32-char-random-password"
}
Parse JSON and extract key information including the auto-generated password
Save Recovery Information
Use Write tool to create/update .openclaw-backup-recovery.txt
CRITICAL : Include the auto-generated password in the recovery file
Format:
Backup ID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Password: auto-generated-32-char-random-password
Download URL: https://soul-upload.com/backup/...
Created: 2024-01-15 10:30:00 UTC
Size: 12.05 KB
SHA256: abc123...
Files: SOUL.md, MEMORY.md, IDENTITY.md
---
Append to end of file (preserve history)
Display Success Message
.openclaw-backup-recovery.txt| Error Scenario | Detection | User Guidance |
|---|---|---|
| Files not found | Script returns error: "Files not found: ..." | List missing files, ask if user wants to continue backing up other files |
| Files too large | Script returns error: "Backup size ... exceeds limit ..." | Show actual size, suggest removing large files or splitting backup |
| Network error | Script returns error: "Network error: ..." | Suggest checking network connection, ask if retry is wanted |
| 413 Too Large | Script returns error: "File too large (413 Payload Too Large)" | Indicate 20MB limit exceeded, suggest reducing backup size |
| Encryption failed | Script returns error: "openssl encryption failed: ..." | Check if openssl is properly installed |
User: Back up my SOUL.md and MEMORY.md
Claude: I'll backup these files with auto-generated encryption.
[Executes backup script]
Backup complete!
- Backup ID: 3f8a2b1c-...
- Size: 45.2 KB
- Password: Auto-generated (32 chars)
- Recovery info saved to .openclaw-backup-recovery.txt
IMPORTANT: Keep .openclaw-backup-recovery.txt safe!
It contains the password needed to restore this backup.
Execute when user requests to restore backup:
Get Backup ID and Password
.openclaw-backup-recovery.txtDetermine Output Directory
.)Execute Restore Script
Execute command with password from recovery file:
python3 scripts/backup.py download \
--backup-id "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" \
--password "password-from-recovery-file" \
--output-dir "."
Capture stdout (JSON response) and stderr (progress info)
Process Response
On success, script outputs JSON:
{
"success": true,
"extractedFiles": ["SOUL.md", "MEMORY.md", "IDENTITY.md"],
"outputDir": "/path/to/output"
}
Parse extracted file list
Verify Restoration Result
Display Success Message
| Error Scenario | Detection | User Guidance |
|---|---|---|
| Backup ID doesn't exist | Script returns error: "Backup not found: ..." | Check if Backup ID is correct, may have been deleted |
| Recovery file missing | .openclaw-backup-recovery.txt not found | Cannot restore - password is unknown without recovery file |
| Wrong password | Script returns error: "Decryption failed - wrong password ..." | Recovery file may be corrupted or from different backup |
| Network error | Script returns error: "Network error: ..." | Suggest checking network connection, ask if retry is wanted |
| Extraction failed | Script returns error: "tar extraction failed: ..." | File may be corrupted, try downloading again |
User: Restore my last backup
Claude: I found the most recent backup in .openclaw-backup-recovery.txt
- Backup ID: 3f8a2b1c-...
- Created: 2024-01-15 10:30:00 UTC
Downloading and decrypting backup...
Restoration complete! Extracted the following files:
- SOUL.md
- MEMORY.md
- IDENTITY.md
Files saved to current directory, please verify content is correct.
Execute when user requests to delete remote backup:
Get Backup ID
.openclaw-backup-recovery.txtRequest Confirmation
Execute Delete Script
After user confirms, execute command:
python3 scripts/backup.py delete \
--backup-id "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
Capture stdout (JSON response) and stderr (progress info)
Process Response
On success, script outputs JSON:
{
"success": true,
"backupId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
Update Recovery Info File
.openclaw-backup-recovery.txtDisplay Success Message
| Error Scenario | Detection | User Guidance |
|---|---|---|
| Backup ID doesn't exist | Script returns error: "Backup not found: ..." | Backup may have been deleted or ID is incorrect |
| Network error | Script returns error: "Network error: ..." | Suggest checking network connection, ask if retry is wanted |
| User cancels | User declines confirmation | Operation cancelled, backup not deleted |
User: Delete my backup
Claude: I found the following backups in .openclaw-backup-recovery.txt:
1. Backup ID: 3f8a2b1c-... (2024-01-15 10:30:00)
2. Backup ID: 7b2c9d4e-... (2024-01-14 08:20:00)
Which backup would you like to delete? (1 or 2)
User: 1
Claude: Warning: This will permanently delete backup 3f8a2b1c-...
This action cannot be undone. Confirm deletion? (yes/no)
User: yes
Claude: Backup deleted.
- Backup ID: 3f8a2b1c-...
To backup again, create a new backup with a new auto-generated password.
.openclaw-backup-recovery.txt (necessary for decryption).openclaw-backup-recovery.txt (workspace root directory).gitignore if sensitivesoul-upload.com Backup API:
| Endpoint | Method | Function | Response |
|---|---|---|---|
/backup | POST | Upload backup | {backupId, downloadUrl, sizeBytes, sha256} |
/backup/:backupId | GET | Download backup | 302 redirect to R2 storage URL |
/backup/:backupId | DELETE | Delete backup | {success: true, backupId} |
Common Status Codes:
Problem : Script error "Missing required tools: tar, openssl"
Solution :
brew install openssl (tar built-in)sudo apt-get install tar openssltar --version and openssl versionProblem : Script error "Error: 'requests' library not found"
Solution :
pip install requests
# or
pip3 install requests
Problem : Cannot restore backup - recovery file missing
Solution :
Problem : Timeout during upload/download
Solution :
Problem : Overwriting existing files during restore
Solution :
User: Back up my workspace files
Claude: [Execute upload workflow using default file list]
[Auto-generate password and save to recovery file]
User: Back up only SOUL.md and MEMORY.md
Claude: [Execute upload workflow, backup only specified files]
[Auto-generate password and save to recovery file]
User: Restore my last backup
Claude: [Read latest Backup ID and password from .openclaw-backup-recovery.txt]
[Execute download workflow]
User: Restore backup 3f8a2b1c-1234-5678-90ab-cdef12345678
Claude: [Read password for this Backup ID from recovery file]
[Execute download workflow]
User: Delete my old backups
Claude: [Show available backup list from recovery file]
[User selects backup to delete]
[Execute delete workflow]
[Remove entry from recovery file]
.openclaw-backup-recovery.txt safe and backed up separatelyScript file is located in Skill directory at scripts/backup.py.
When executing Bash commands, ensure correct relative or absolute path is used. Usually:
python3 scripts/backup.py ...cd to Skill directory firstVersion : 2.0.0 Author : Claude Code License : MIT Password Policy : Auto-generated unique password per backup (NEW in v2.0.0)
Weekly Installs
1.8K
Repository
First Seen
Feb 15, 2026
Security Audits
Installed on
github-copilot1.7K
opencode1.7K
codex1.7K
gemini-cli1.7K
cursor1.7K
kimi-cli1.7K
Azure Data Explorer (Kusto) 查询技能:KQL数据分析、日志遥测与时间序列处理
93,700 周安装