Install
openclaw skills install clawsyncBackup and restore your OpenClaw workspace to GitHub
openclaw skills install clawsyncBackup and restore your OpenClaw workspace to GitHub.
This skill is designed with defense-in-depth. Please read carefully.
| Category | Files | Status |
|---|---|---|
| Identity Files | AGENTS.md, SOUL.md, USER.md, TOOLS.md, IDENTITY.md, HEARTBEAT.md | ✅ Safe |
| Skills | All from $OPENCLAW/skills/ | ⚠️ Manual review |
| Scripts | All from $OPENCLAW/scripts/ | ⚠️ Manual review |
The following files are NOT backed up by design:
credentials/, .env, node_modules/ClawSync scans for these secret patterns:
ghp_*)sk-*)AIza*)xoxb-*, xoxp-*)AKIA*)-----BEGIN * PRIVATE KEY-----)If any are detected → backup aborts before push.
export GITHUB_TOKEN="ghp_xxxx"
export BACKUP_REPO="username/repo-name"
export OPENCLAW_WORKSPACE="${HOME}/openclaw-workspace"
For least privilege, use a GitHub Fine-Grained PAT:
$BACKUP_REPOGITHUB_TOKENgit clone https://github.com/your-username/clawsync.git ~/clawsync
cp .env.example .env
# Edit .env with your values
bash sync.sh
# With confirmation (default)
bash restore.sh
# Force mode (no prompt)
bash restore.sh --force
Uses gh CLI if available, falls back to token auth.
sync.sh - Backup script (ShellCheck compliant)restore.sh - Restore script.env_example - Template.gitignore - Blocks secrets# Set up test workspace
mkdir -p /tmp/test-workspace
echo "test" > /tmp/test-workspace/AGENTS.md
echo "test" > /tmp/test-workspace/USER.md
mkdir -p /tmp/test-workspace/skills /tmp/test-workspace/scripts
# Run integration test
export BACKUP_REPO="test/repo"
export OPENCLAW_WORKSPACE="/tmp/test-workspace"
export GITHUB_TOKEN="dummy"
cd /tmp && rm -rf test-backup-repo && mkdir test-backup-repo
cd test-backup-repo && git init
cp ~/clawsync/sync.sh .
bash sync.sh
# Create a test file with a fake secret
echo "My API key is ghp_test1234567890abcdefghijklmnopqrstuvwxyz" > /tmp/test-workspace/AGENTS.md
# Run sync - should abort with error
bash sync.sh
# Expected output: "Error: Potential secret detected..."
This test verifies the script catches secrets BEFORE they are staged:
# Set up test workspace
export BACKUP_REPO="test/repo"
export OPENCLAW_WORKSPACE="/tmp/test-workspace"
export GITHUB_TOKEN="dummy"
# Create workspace with secret in a non-staged file
mkdir -p /tmp/test-workspace
echo "Real API key: sk-realapikey12345678901234567890" > /tmp/test-workspace/AGENTS.md
# Copy sync.sh to temp backup dir
cd /tmp && rm -rf audit-test && mkdir audit-test && cd audit-test
git init
cp ~/clawsync/sync.sh .
# Run sync - should FAIL (catches non-staged secret)
bash sync.sh
# Expected: "Error: Potential secret detected in backup directory!"
# This proves the pre-git-add scanning works
The CI runs on every push and pull request:
To publish a new version:
git add -A
git commit -m "Release v1.0.x"
git tag v1.0.x
git push origin master --tags
CI will automatically:
v*, publish to ClawHub