Workspace GitHub Backup
One-click backup solution for AI Agent workspaces to a private GitHub repository.
Quick Start
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.
Features
Two Backup Modes
| Mode | Trigger | Description |
|---|
| Manual | "setup backup" | Interactive Q&A to configure |
| Auto |
After setup | Scheduled via OpenClaw Cron |
What Gets Backed Up ✅
| Files/Directories | Description |
|---|
| INLINECODE0 | All installed skills |
| INLINECODE1 |
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. |
What's Excluded ❌
| Pattern | Description |
|---|
| INLINECODE8 | ClawHub cache |
| INLINECODE9 |
Runtime data |
|
node_modules/ | Dependencies |
|
*.log | Log files |
|
*.tmp | Temp files |
|
.DS_Store | System files |
| API Keys | Sensitive info in env vars |
Interactive Setup Wizard
When user says "setup GitHub backup", ask these questions one by one:
Question 1: GitHub Username
Please tell me your GitHub username.
Wait for answer (e.g., "johnsmith")
Question 2: Repository Name
What name would you like for your backup repository?
Suggestion: ai-workspace-backup or INLINECODE15
Wait for answer
Question 3: GitHub Token
Now let's generate a GitHub Token:
- 1. Go to https://github.com/settings/tokens
- Click "Generate new token (classic)"
- Note: INLINECODE16
- Check the
repo permission (full control of private repositories) - Click "Generate token"
- Copy and paste the Token here
Wait for token (format: ghp_xxx)
Question 4: Backup Time
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
Question 5: Confirm
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:
- 1. Initialize Git repo
- Run first backup
- Set up OpenClaw Cron
Usage Commands
Manual Triggers
CODEBLOCK0
Trigger Keywords
The skill activates when user or agent says:
- - "setup GitHub backup"
- "backup to github"
- "auto backup"
- "manual backup"
- "backup now"
- "backup status"
- "workspace backup"
- "git backup"
- "scheduled backup"
- "sync to github"
Troubleshooting
Common Issues
| 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 |
Manual Fix Commands
CODEBLOCK1
For Other AI Agents
If you're another AI agent using this skill:
- 1. First backup: Run the setup wizard to configure
- Subsequent backups: Use
openclaw cron add to set schedule - Manual trigger: Execute git add/commit/push commands
- Status check: Run
git log -1 to see last backup time
Example cron setup:
openclaw cron add --name "workspace-backup" --cron "0 3 * * *" --message "Execute workspace backup" --agent main
Security Notes
- - Token is stored in Git remote URL (not in files)
- Sensitive data (API keys, passwords) are NOT backed up
- Backup archive contains no credentials
- Use a private repository for backup
- If token is compromised, revoke it immediately in GitHub Settings
Recovery Guide
When user needs to restore:
CODEBLOCK3
Author
Created by Jeremy for OpenClaw community. Published to ClawHub for anyone to use and improve.
工作区GitHub备份
AI Agent工作区一键备份至私有GitHub仓库的解决方案。
快速开始
首次设置: 告诉我设置GitHub备份,我将引导您完成交互式向导!
已配置完成: 只需说立即备份即可触发即时备份。
功能特性
两种备份模式
设置完成后 | 通过OpenClaw Cron定时执行 |
备份内容 ✅
| 文件/目录 | 说明 |
|---|
| skills/ | 所有已安装的技能 |
| memory/ |
每日记忆文件 |
| AGENTS.md | Agent配置 |
| SOUL.md | AI身份定义 |
| USER.md | 用户信息 |
| IDENTITY.md | AI身份信息 |
| TOOLS.md | 本地工具配置 |
| HEARTBEAT.md | 心跳任务 |
| 配置文件 | README.md、SYNC.md等 |
排除内容 ❌
| 模式 | 说明 |
|---|
| .clawhub/ | ClawHub缓存 |
| .openclaw/ |
运行时数据 |
| node_modules/ | 依赖包 |
| *.log | 日志文件 |
| *.tmp | 临时文件 |
| .DS_Store | 系统文件 |
| API密钥 | 环境变量中的敏感信息 |
交互式设置向导
当用户说设置GitHub备份时,逐一询问以下问题:
问题1:GitHub用户名
请告诉我您的GitHub用户名。
等待回答(例如:张三)
问题2:仓库名称
您希望备份仓库叫什么名字?
建议:ai-workspace-backup 或 agent-workspace
等待回答
问题3:GitHub令牌
现在我们来生成GitHub令牌:
- 1. 访问 https://github.com/settings/tokens
- 点击生成新令牌(经典)
- 备注:backup-token
- 勾选repo权限(私有仓库完全控制)
- 点击生成令牌
- 将令牌复制粘贴到这里
等待令牌(格式:ghp_xxx)
问题4:备份时间
您希望每天什么时间自动备份?
- - A) 凌晨3:00(夜猫子)
- B) 早上7:00(早晨)
- C) 中午12:00(正午)
- D) 下午6:00(傍晚)
或者告诉我您偏好的时间(例如:每天下午5点)
等待选择
问题5:确认
配置摘要:
- - GitHub用户名:[用户名]
- 仓库:[仓库名称]
- 备份时间:[时间]
回复确认或是开始设置,或告诉我需要修改的内容。
确认后:
- 1. 初始化Git仓库
- 运行首次备份
- 设置OpenClaw Cron
使用命令
手动触发
bash
立即备份
立即备份
马上备份
现在运行备份
检查状态
备份状态
上次备份时间
显示备份状态
恢复
从GitHub恢复
恢复工作区
修改设置
更改备份时间
暂停自动备份
触发关键词
当用户或Agent说出以下内容时激活此技能:
- - 设置GitHub备份
- 备份到github
- 自动备份
- 手动备份
- 立即备份
- 备份状态
- 工作区备份
- git备份
- 定时备份
- 同步到github
故障排除
常见问题
| 问题 | 原因 | 解决方案 |
|---|
| 权限被拒绝 | 无效令牌 | 重新生成带有repo权限的令牌 |
| 未找到仓库 |
仓库名称错误 | 检查拼写 |
| 推送失败 | 无网络连接 | 检查网络连接 |
| Cron未运行 | 配置错误 | 运行openclaw cron list |
手动修复命令
bash
检查远程仓库
git remote -v
使用新令牌重置远程仓库
git remote set-url origin https://x-access-token:TOKEN@github.com/user/repo.git
查看定时任务
openclaw cron list
手动备份
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 备份:$(date +%Y-%m-%d)
git push origin main
供其他AI Agent使用
如果您是使用此技能的其他AI Agent:
- 1. 首次备份: 运行设置向导进行配置
- 后续备份: 使用openclaw cron add设置定时计划
- 手动触发: 执行git add/commit/push命令
- 状态检查: 运行git log -1查看上次备份时间
定时任务设置示例:
bash
openclaw cron add --name workspace-backup --cron 0 3 * --message 执行工作区备份 --agent main
安全说明
- - 令牌存储在Git远程仓库URL中(不在文件中)
- 敏感数据(API密钥、密码)不会被备份
- 备份存档不包含任何凭证信息
- 使用私有仓库进行备份
- 如果令牌泄露,请立即在GitHub设置中撤销
恢复指南
当用户需要恢复时:
bash
1. 克隆备份仓库
git clone https://github.com/[用户名]/[仓库].git /tmp/restore
2. 恢复文件
cp -r /tmp/restore/* ~/.openclaw/workspace/
3. 重新配置环境变量
(敏感信息不在备份中)
作者
由Jeremy为OpenClaw社区创建。发布到ClawHub供任何人使用和改进。