← 返回
开发者工具 中文

self-backup

Backup OpenClaw workspace files like AGENTS.md, SOUL.md, scripts/, and configs to a GitHub repo, with token sanitization and version control.
将 OpenClaw 工作区文件(如 AGENTS.md、SOUL.md、脚本/、配置等)备份到 GitHub 仓库,并进行令牌清理和版本控制。
mayueanyou
开发者工具 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 1
Stars
📥 660
下载
💾 16
安装
1
版本
#latest

概述

Self Backup

Backup critical OpenClaw workspace files to your GitHub repository for safe keeping and version control.

Setup

1. Install GitHub CLI (if not already installed)

# Ubuntu/Debian
sudo apt install gh

# macOS
brew install gh

# Other platforms: https://cli.github.com/

2. Login to GitHub

gh auth login

3. Configure your backup repository

Edit the configuration in the backup script or set environment variables:

# Set your repository URL (replace with your repo)
export BACKUP_REPO_URL="https://github.com/YOUR_USERNAME/YOUR_BACKUP_REPO.git"

# Or edit the script directly
nano scripts/backup.sh

4. Create your backup repository

# Create a private repository for your backups
gh repo create YOUR_USERNAME/openclaw-backup --private --description "OpenClaw workspace backup"

What Gets Backed Up

Core Configuration Files

  • AGENTS.md - Workflow documentation and procedures
  • SOUL.md - Personal assistant personality and behavior
  • USER.md - Personal profile and preferences
  • MEMORY.md - Long-term memory and important context
  • IDENTITY.md - Assistant identity and emoji
  • TOOLS.md - Tool configuration and local notes
  • AUTOMATION.md - Cron and scheduling documentation
  • openclaw.json - OpenClaw system settings (tokens sanitized for security)

Scripts & Automation

  • scripts/ directory - All automation scripts
  • memory/ directory - Daily memory logs (last 30 days)
  • Custom configuration files

Skills Configuration

  • skills/ directory - Local skill installations (metadata only)
  • Skill customizations

Repository Structure

Files are organized in the backup repository as:

/
├── config/           # Core configuration files
├── scripts/          # Automation scripts  
├── memory/          # Daily memory logs
├── skills/          # Skill configurations
└── backup-info.md   # Backup metadata

Usage

First-time setup:

scripts/setup.sh

Regular backups:

scripts/backup.sh

Options:

scripts/backup.sh --force      # Force push even with conflicts
scripts/backup.sh --dry-run    # Show what would be backed up

Security Features

  • Automatic token sanitization: All sensitive tokens (Discord, Telegram, API keys) are automatically redacted
  • Private repository recommended: Keep your configuration private
  • Structure preservation: All settings preserved, only sensitive data redacted
  • Safe restore: Easy to restore and re-enter tokens

Configuration

Edit these variables in scripts/backup.sh:

# Your GitHub repository URL
REPO_URL="https://github.com/YOUR_USERNAME/YOUR_BACKUP_REPO.git"

# Workspace directory (usually auto-detected)
WORKSPACE_DIR="$HOME/.openclaw/workspace"

Manual Backup

To backup specific files manually:

# Clone your backup repository
git clone https://github.com/YOUR_USERNAME/YOUR_BACKUP_REPO.git /tmp/backup
cd /tmp/backup

# Copy important files
cp ~/.openclaw/workspace/AGENTS.md config/
cp ~/.openclaw/workspace/SOUL.md config/
# ... etc

# Commit and push
git add .
git commit -m "Manual backup $(date)"
git push origin main

Restore Process

To restore from backup:

# Clone the backup
git clone https://github.com/YOUR_USERNAME/YOUR_BACKUP_REPO.git

# Copy files back to workspace
cp backup/config/* ~/.openclaw/workspace/
cp -r backup/scripts/* ~/.openclaw/workspace/scripts/
# ... etc

# Re-enter your actual tokens in openclaw.json
nano ~/.openclaw/openclaw.json

Troubleshooting

GitHub Authentication Issues

# Re-login to GitHub
gh auth logout
gh auth login

Permission Denied

# Check repository exists and you have access
gh repo view YOUR_USERNAME/YOUR_BACKUP_REPO

Git Configuration

# Set git identity if needed
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-30 22:33 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

developer-tools

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 668 📥 323,933
developer-tools

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 66 📥 179,966
developer-tools

Agent Browser

matrixy
专为AI智能体优化的无头浏览器自动化CLI,支持无障碍树快照和基于引用的元素选择。
★ 426 📥 118,090