Install
openclaw skills install soul-transferBackup and restore an OpenClaw agent's full workspace (memory, config, credentials, skills, cron jobs) to/from a Git repository. Use when: migrating to a new instance, disaster recovery, setting up a fresh machine, the user says 'backup', 'restore', 'migrate', 'transfer', '夺舍', '还魂', or 'soul transfer'. Also use for periodic backup setup and backup verification.
openclaw skills install soul-transferAgent workspace migration between OpenClaw instances via Git.
$WORKSPACE = the agent's workspace directory (resolve via repo path in system prompt, or ~/.openclaw/workspace as fallback)openclaw-config-backup.json = exported OpenClaw config snapshot (channel tokens, API keys, runtime settings). Name it whatever you like — just keep it in the workspace and committed to the backup repo.cd $WORKSPACE
git remote get-url origin || git remote add origin https://<token>@github.com/<owner>/<repo>.git
Save a copy of the live config for future restoration. This file contains channel tokens, API keys, and guild settings that are NOT in the workspace markdown files.
Use gateway config.get tool → extract the parsed object → write to a JSON file in the workspace (e.g. openclaw-config-backup.json).
This step is critical — without this file, channel connections cannot be restored on a new instance.
git add -A
git commit -m "backup: $(date +%Y-%m-%d_%H%M)"
git push origin master
git log --oneline -1
git diff --stat HEAD~1
Set up a recurring cron job for automatic backups. See references/cron-templates.md for ready-to-use definitions.
Execute these steps in order. Do not skip step 5 — it is the most commonly forgotten step.
git clone https://<token>@github.com/<owner>/<repo>.git /tmp/soul-backup
Before restoring, review what's in the repo:
find /tmp/soul-backup -type f | wc -l
cat /tmp/soul-backup/IDENTITY.md
Identify sensitive files that should NOT be copied to markdown: standalone credential files (API tokens, key files, etc.)
Copy core files from the backup into $WORKSPACE:
IDENTITY.md, USER.md, SOUL.mdMEMORY.md, AGENTS.md, HEARTBEAT.md, NOW.md, SESSION-STATE.mdheartbeat-state.jsonmemory/*.md (all of them)skills/ directory.md or .json strategy/framework files# Scan for credential patterns
grep -rl 'ghp_\|AKIA[0-9A-Z]\|sk-[a-zA-Z0-9]' $WORKSPACE/ \
--include='*.md' 2>/dev/null
Replace found credentials with [REDACTED] in markdown and log files.
Do NOT scrub the config backup JSON — it contains credentials needed for step 5.
This is the step that connects channels, API keys, and runtime settings. Without it, all channels remain disconnected.
Read the config backup JSON from the workspace. Extract:
Apply via gateway config.patch:
{
"channels": {
"discord": {
"enabled": true,
"token": "<from config backup>",
"groupPolicy": "allowlist",
"guilds": { "..." },
"dm": { "..." },
"actions": { "..." }
}
},
"tools": {
"web": { "search": { "apiKey": "<from config backup>" } },
"exec": { "security": "full" }
}
}
After patching, OpenClaw restarts automatically. Verify with openclaw status — channels should show connected.
Use config.schema.lookup to check field names if the OpenClaw version differs from the backup.
Cron jobs are runtime state, NOT stored in git. Rebuild from documented list or references/cron-templates.md.
Use cron add for each job. Only restore jobs that are still needed.
# Verify channel connectivity
openclaw status
# Delete temp clone
rm -rf /tmp/soul-backup
# Delete BOOTSTRAP.md if present (no longer a fresh instance)
rm -f $WORKSPACE/BOOTSTRAP.md
# Commit restored state
cd $WORKSPACE
git add -A && git commit -m "夺舍完成: $(date +%Y-%m-%d_%H%M)"
Record the transfer in today's daily log with timestamp, file count, and any issues encountered.
config.patch is mandatory.config.schema.lookup to verify field names before patching. OpenClaw versions may rename fields.Run periodically to verify backup integrity:
cd $WORKSPACE
# Check remote is configured
git remote -v
# Check last push time
git log --oneline -1
# Check for uncommitted changes
git status --short
# Verify config backup exists and has channel tokens
grep -c '"token"' openclaw-config-backup.json 2>/dev/null || echo "⚠️ No config backup found"