Soul Undead
Manage these fixed core files from the OpenClaw workspace:
- - INLINECODE0
- INLINECODE1
- INLINECODE2
- INLINECODE3
- INLINECODE4
- INLINECODE5
- INLINECODE6
Fixed repository name:
Repository visibility is always private.
What this skill does
This skill is for preserving and restoring the core markdown files that define an OpenClaw workspace identity and behavior. It is designed for these situations:
- - First-time setup of a private backup repo for the core files
- Restoring the core files onto a new machine after reinstalling OpenClaw
- Manually syncing saved local changes back to the GitHub backup repo
This skill intentionally does not scan the whole workspace and does not back up every markdown file. It only manages this fixed core file set.
Rules
- - Always check
gh auth status first. - If GitHub authentication is missing, stop and tell the user to run
gh auth login. - Do not scan the whole workspace.
- Do not ask the user to choose files unless they explicitly ask for a different scope.
- Treat the fixed GitHub repo as the authority during first-time initialization on a new machine.
- Before any remote restore overwrites local files, create a timestamped local backup snapshot under
skills/soul-undead/local-backups/. - Do not keep a persistent local export mirror; sync should act directly on the GitHub private repo.
Important behavior: first restore can overwrite local default files
On a new machine, OpenClaw may already have generated local default markdown files. This skill does not treat those default files as authoritative.
If all of the following are true:
- - GitHub authentication succeeds
- The fixed repo
soul-undead exists - The local state file does not yet say INLINECODE12
then this skill will treat that run as a first-time restore scenario and pull the remote file set down to the local workspace.
That means the remote files can overwrite local default files created by a fresh OpenClaw installation.
To reduce risk, the restore order is always:
- 1. save the current local file set into a timestamped snapshot
- pull the remote file set from GitHub
- overwrite the current local files with the remote version
The snapshot is stored under:
That snapshot is the local fallback if the restore direction was wrong or the remote version is not the one the user wants.
State file
Use a local state file to mark successful initialization:
Write:
CODEBLOCK0
Only after one of these succeeds:
- 1. Restore succeeds from the default GitHub repo
- First-time repo creation and initial upload succeeds
Do not write initialized: true on failure.
Required dependencies
This skill assumes these tools are available:
- - INLINECODE16
- INLINECODE17 (GitHub CLI)
- INLINECODE18
Minimum expectations:
- -
gh auth status must succeed before any restore or sync - The active GitHub account must have permission to read/create/push the private repo
If gh is installed but not authenticated, stop and tell the user to run:
CODEBLOCK1
If a dependency is missing, tell the user exactly which command/tool must be installed before continuing.
Required user-facing reminders before execution
Before executing restore, first-time init, or sync, explicitly remind the user of the relevant points below.
Always remind
- - This skill only manages these files:
AGENTS.md, HEARTBEAT.md, IDENTITY.md, SOUL.md, TOOLS.md, USER.md, INLINECODE27 - The GitHub repository is private and fixed to INLINECODE28
- INLINECODE29 is required if GitHub CLI authentication is missing
If first-time restore may happen
Explicitly warn that:
- - if the remote repo already exists, the skill may restore remote files onto the local workspace during first initialization
- this can overwrite local default markdown files created by a fresh OpenClaw install
- before overwrite, the skill will create a timestamped local backup snapshot under INLINECODE30
If sync/upload is the user's intent
Explicitly confirm the task as sync/upload intent and avoid accidentally running restore-first behavior.
Workflow
1. Check GitHub authentication
Run:
CODEBLOCK2
If authentication fails, stop and guide the user to run:
CODEBLOCK3
2. Initialization / restore decision
Use the bundled script:
CODEBLOCK4
Behavior:
- - Uses the fixed repo name INLINECODE31
- Uses the fixed core file set only
- If the state file is missing or not initialized:
- If the GitHub repo exists, first snapshot the current local files, then restore from GitHub, then overwrite the local file set
- If the GitHub repo does not exist, create it as private and upload the local file set directly to GitHub
- On success, write
initialized: true
- - If already initialized, sync local saved changes directly to GitHub
3. Sync after saved changes
After initialization is complete, use the same script again whenever the tracked files may have changed.
Behavior:
- - Reads the fixed file set directly from the workspace
- Writes each tracked file directly to the GitHub private repo
- Also maintains
README.md and restore.sh in the GitHub repo - Does not keep a persistent local export mirror
Preview / dry-run design (not implemented yet)
If preview support is added later, it should report intent without making changes.
The preview should show these four things:
- 1. Planned path
-
restore from remote
-
first-time init + upload
-
sync upload
- INLINECODE38
- 2. Affected files
- Which of the fixed core files would be overwritten locally
- Or which of the fixed core files would be written to GitHub
- 3. Safety actions
- Whether a local timestamped snapshot would be created before remote restore
- The expected backup path under INLINECODE39
- 4. Precondition status
- Whether
gh auth status passes
- Whether the default repo exists
- Whether the state file is initialized
Preview mode should never:
- - overwrite local files
- create or update the GitHub repo
- write remote file contents
- write INLINECODE41
Failure handling
Use these failure rules:
GitHub auth failure
- - Do not continue
- Tell the user to run INLINECODE42
Missing dependency
- - Do not continue
- Tell the user which dependency is missing:
git, gh, or INLINECODE45
Repo does not exist during first use
- - Treat it as first-time initialization
- Create the private repo
- Upload the local fixed file set directly to GitHub
- Only then write INLINECODE46
Remote restore fails
- - Do not write INLINECODE47
- Keep the local backup snapshot that was created before overwrite
- Tell the user restore failed and where the local snapshot is stored
Remote restore succeeds but the restored version is wrong
- - Treat the local pre-restore snapshot as the rollback source of truth
- Restore the desired files back from
local-backups/<timestamp>/ into the workspace - After confirming the workspace is correct again, sync that corrected local version back to GitHub
Sync/push fails
- - Do not change initialization state
- Tell the user the sync failed
- Leave the local files untouched so sync can be retried later
Defaults
- - Workspace path: INLINECODE49
- State file: INLINECODE50
- Local restore-safety backup path: INLINECODE51
- Repository visibility: private
- Repository name: INLINECODE52
- Tracked files: fixed core file set only
Notes
- - On a new machine, remote restore wins over freshly generated local default md files during first initialization.
- The remote repo stores helper files such as
README.md and restore.sh alongside the tracked markdown files. - This skill is intentionally minimal: no whole-workspace scan, no persistent local export repo mirror.
灵魂亡灵
管理OpenClaw工作区中的这些固定核心文件:
- - AGENTS.md
- HEARTBEAT.md
- IDENTITY.md
- SOUL.md
- TOOLS.md
- USER.md
- MEMORY.md
固定仓库名称:
仓库可见性始终为私有。
该技能的作用
该技能用于保存和恢复定义OpenClaw工作区身份和行为的核心Markdown文件。它适用于以下情况:
- - 首次为核心文件设置私有备份仓库
- 重新安装OpenClaw后,在新机器上恢复核心文件
- 手动将保存的本地更改同步回GitHub备份仓库
该技能有意不扫描整个工作区,也不备份每个Markdown文件。它仅管理这个固定的核心文件集。
规则
- - 始终先检查gh auth status。
- 如果缺少GitHub身份验证,则停止并告知用户运行gh auth login。
- 不要扫描整个工作区。
- 除非用户明确要求不同的范围,否则不要要求用户选择文件。
- 在新机器上首次初始化时,将固定的GitHub仓库视为权威。
- 在远程恢复覆盖本地文件之前,在skills/soul-undead/local-backups/下创建带时间戳的本地备份快照。
- 不要保留持久的本地导出镜像;同步应直接作用于GitHub私有仓库。
重要行为:首次恢复可能覆盖本地默认文件
在新机器上,OpenClaw可能已经生成了本地默认Markdown文件。该技能不将这些默认文件视为权威。
如果满足以下所有条件:
- - GitHub身份验证成功
- 固定仓库soul-undead存在
- 本地状态文件尚未显示initialized: true
则该技能将此次运行视为首次恢复场景,并将远程文件集拉取到本地工作区。
这意味着远程文件可能会覆盖由全新OpenClaw安装创建的本地默认文件。
为降低风险,恢复顺序始终为:
- 1. 将当前本地文件集保存到带时间戳的快照中
- 从GitHub拉取远程文件集
- 用远程版本覆盖当前本地文件
快照存储在:
- - ~/.openclaw/workspace/skills/soul-undead/local-backups//
如果恢复方向错误或远程版本不是用户想要的版本,该快照是本地回退方案。
状态文件
使用本地状态文件标记成功初始化:
- - ~/.openclaw/workspace/skills/soul-undead/.workspace-backup-state.json
写入:
json
{initialized: true, repo: soul-undead}
仅在以下操作之一成功后执行:
- 1. 从默认GitHub仓库成功恢复
- 首次创建仓库并成功上传初始内容
失败时不要写入initialized: true。
所需依赖
该技能假定以下工具可用:
- - git
- gh(GitHub CLI)
- python3
最低要求:
- - 在任何恢复或同步之前,gh auth status必须成功
- 活跃的GitHub账户必须具有读取/创建/推送私有仓库的权限
如果已安装gh但未进行身份验证,则停止并告知用户运行:
bash
gh auth login
如果缺少依赖,则明确告知用户需要安装哪个命令/工具才能继续。
执行前需要提醒用户的事项
在执行恢复、首次初始化或同步之前,明确提醒用户以下相关要点。
始终提醒
- - 该技能仅管理这些文件:AGENTS.md、HEARTBEAT.md、IDENTITY.md、SOUL.md、TOOLS.md、USER.md、MEMORY.md
- GitHub仓库是私有的,固定为soul-undead
- 如果缺少GitHub CLI身份验证,则需要gh auth login
如果可能进行首次恢复
明确警告:
- - 如果远程仓库已存在,该技能可能在首次初始化期间将远程文件恢复到本地工作区
- 这可能会覆盖由全新OpenClaw安装创建的本地默认Markdown文件
- 在覆盖之前,该技能将在skills/soul-undead/local-backups/下创建带时间戳的本地备份快照
如果用户意图是同步/上传
明确确认任务为同步/上传意图,并避免意外运行先恢复的行为。
工作流程
1. 检查GitHub身份验证
运行:
bash
gh auth status
如果身份验证失败,则停止并引导用户运行:
bash
gh auth login
2. 初始化/恢复决策
使用捆绑脚本:
bash
bash /scripts/initorsync.sh
行为:
- - 使用固定仓库名称soul-undead
- 仅使用固定核心文件集
- 如果状态文件缺失或未初始化:
- 如果GitHub仓库存在,先快照当前本地文件,然后从GitHub恢复,再覆盖本地文件集
- 如果GitHub仓库不存在,则创建为私有仓库并直接将本地文件集上传到GitHub
- 成功后,写入initialized: true
- - 如果已初始化,直接将本地保存的更改同步到GitHub
3. 保存更改后同步
初始化完成后,每当跟踪的文件可能发生更改时,再次使用相同的脚本。
行为:
- - 直接从工作区读取固定文件集
- 直接将每个跟踪文件写入GitHub私有仓库
- 同时在GitHub仓库中维护README.md和restore.sh
- 不保留持久的本地导出镜像
预览/试运行设计(尚未实现)
如果以后添加预览支持,它应报告意图而不进行更改。
预览应显示以下四项内容:
- 1. 计划路径
- 从远程恢复
- 首次初始化 + 上传
- 同步上传
- 无操作
- 2. 受影响的文件
- 哪些固定核心文件将被本地覆盖
- 或者哪些固定核心文件将被写入GitHub
- 3. 安全操作
- 是否会在远程恢复之前创建本地带时间戳的快照
- 预期的备份路径在skills/soul-undead/local-backups/
/下
- 4. 前置条件状态
- gh auth status是否通过
- 默认仓库是否存在
- 状态文件是否已初始化
预览模式绝不应:
- - 覆盖本地文件
- 创建或更新GitHub仓库
- 写入远程文件内容
- 写入initialized: true
失败处理
使用以下失败规则:
GitHub身份验证失败
- - 不要继续
- 告知用户运行gh auth login
缺少依赖
- - 不要继续
- 告知用户缺少哪个依赖:git、gh或python3
首次使用时仓库不存在
- - 将其视为首次初始化
- 创建私有仓库
- 直接将本地固定文件集上传到GitHub
- 然后才写入initialized: true
远程恢复失败
- - 不要写入initialized: true
- 保留覆盖前创建的本地备份快照
- 告知用户恢复失败以及本地快照的存储位置
远程恢复成功但恢复的版本错误
- - 将恢复前的本地快照视为回滚的真相来源
- 从local-backups//将所需文件恢复回工作区
- 确认工作区再次正确后,将该修正后的本地版本同步回GitHub
同步/推送失败
- - 不要更改初始化状态
- 告知用户同步失败
- 保持本地文件不变,以便稍后重试同步
默认值
- - 工作区路径:~/.openclaw/workspace
- 状态文件:~/.openclaw/workspace/skills/soul-undead/.workspace-backup-state.json
- 本地恢复安全备份路径:~/.openclaw/workspace/skills/soul-undead/local-backups//
- 仓库可见性:私有
- 仓库名称:soul-undead
- 跟踪文件:仅固定核心文件集
备注
- - 在新机器上,首次初始化期间远程恢复优先于新生成的本地默认md文件。
- 远程仓库存储辅助文件,如README.md和restore.sh,与跟踪的Markdown文件一起。
- 该技能有意保持最小化:不扫描整个工作区,不保留持久的本地导出仓库镜像。