One-click backup solution for AI Agent workspaces to a private GitHub repository.
> First time setup: Tell me "setup GitHub backup" and I'll guide you through the interactive wizard!
> Already configured: Just say "backup now" to trigger an immediate backup.
| Mode | Trigger | Description |
|---|---|---|
| ------ | --------- | ------------- |
| Manual | "setup backup" | Interactive Q&A to configure |
| Auto | After setup | Scheduled via OpenClaw Cron |
| Files/Directories | Description |
|---|---|
| ------------------- | ------------- |
skills/ | All installed skills |
memory/ | Daily memory files |
AGENTS.md | Agent configuration |
SOUL.md | AI identity definition |
USER.md | User information |
IDENTITY.md | AI identity info |
TOOLS.md | Local tools config |
HEARTBEAT.md | Heartbeat tasks |
| Config files | README.md, SYNC.md, etc. |
| Pattern | Description |
|---|---|
| --------- | ------------- |
.clawhub/ | ClawHub cache |
.openclaw/ | Runtime data |
node_modules/ | Dependencies |
*.log | Log files |
*.tmp | Temp files |
.DS_Store | System files |
| API Keys | Sensitive info in env vars |
When user says "setup GitHub backup", ask these questions one by one:
> Please tell me your GitHub username.
Wait for answer (e.g., "johnsmith")
> What name would you like for your backup repository?
> Suggestion: ai-workspace-backup or agent-workspace
Wait for answer
> Now let's generate a GitHub Token:
> 1. Go to https://github.com/settings/tokens
> 2. Click "Generate new token (classic)"
> 3. Note: backup-token
> 4. Check the repo permission (full control of private repositories)
> 5. Click "Generate token"
> 6. Copy and paste the Token here
Wait for token (format: ghp_xxx)
> When would you like automatic backup to run each day?
> - A) 3:00 AM (midnight owl)
> - B) 7:00 AM (morning)
> - C) 12:00 PM (noon)
> - D) 6:00 PM (evening)
>
> Or tell me your preferred time (e.g., "every day at 5 PM")
Wait for selection
> Configuration summary:
> - GitHub Username: [username]
> - Repository: [repo-name]
> - Backup Time: [time]
>
> Reply "confirm" or "yes" to start setup, or tell me what to change.
After confirmation:
# Immediate backup
"backup now"
"backup immediately"
"run backup now"
# Check status
"backup status"
"when did we last backup"
"show backup status"
# Restore
"restore from GitHub"
"recover workspace"
# Modify setup
"change backup time"
"pause auto backup"
The skill activates when user or agent says:
| Problem | Cause | Solution |
|---|---|---|
| --------- | ------- | ---------- |
| "Permission denied" | Invalid token | Regenerate token with repo scope |
| "Repository not found" | Wrong repo name | Check spelling |
| "Push failed" | No network | Check connection |
| "Cron not running" | Config error | Run openclaw cron list |
# Check remote
git remote -v
# Reset remote with new token
git remote set-url origin https://x-access-token:TOKEN@github.com/user/repo.git
# View cron jobs
openclaw cron list
# Manual backup
cd /root/.openclaw/workspace
git add skills/ memory/ AGENTS.md SOUL.md USER.md IDENTITY.md TOOLS.md HEARTBEAT.md README.md SYNC.md .gitignore
git commit -m "Backup: $(date +%Y-%m-%d)"
git push origin main
If you're another AI agent using this skill:
openclaw cron add to set schedulegit log -1 to see last backup timeExample cron setup:
openclaw cron add --name "workspace-backup" --cron "0 3 * * *" --message "Execute workspace backup" --agent main
When user needs to restore:
# 1. Clone the backup repo
git clone https://github.com/[username]/[repo].git /tmp/restore
# 2. Restore files
cp -r /tmp/restore/* ~/.openclaw/workspace/
# 3. Reconfigure environment variables
# (sensitive info not in backup)
Created by Jeremy for OpenClaw community. Published to ClawHub for anyone to use and improve.
共 1 个版本