Automatically backup OpenClaw configuration to a private GitHub repository. Features API key sanitization, activity detection, and smart backup frequency (ho...
---
name: openclaw-backup
description: Automatically backup OpenClaw configuration to a private GitHub repository. Features API key sanitization, activity detection, and smart backup frequency (hourly when active, daily when inactive). One-click recovery support.
---
# OpenClaw Backup
## Overview
Automatically backup your complete OpenClaw configuration to a private GitHub repository. Features:
- ๐ **API Key Sanitization** - Automatically replaces sensitive keys before committing
- ๐ **Smart Backup Frequency** - Hourly when active, daily when inactive
- ๐ฆ **Complete Backup** - Agents, extensions, workspace, memory, and more
- ๐ง **One-Click Recovery** - Comprehensive recovery guide included
## When to Use
- After initial OpenClaw setup, establish a backup mechanism
- Periodic backup status checks
- System migration or disaster recovery
## Quick Start
### 1. Prerequisites
- Git installed
- GitHub SSH Key configured (recommended) or Personal Access Token
- GitHub private repository created (e.g., `openclaw-backup`)
### 2. Install Skill
Copy this skill to your OpenClaw workspace:
```bash
# Ensure skills directory exists
mkdir -p ~/.openclaw/workspace/skills
# Copy skill (assuming downloaded to current directory)
cp -r openclaw-backup ~/.openclaw/workspace/skills/
```
### 3. Run Installation Script
```bash
# One-click configuration
bash ~/.openclaw/workspace/skills/openclaw-backup/scripts/install.sh
```
Follow the prompts to enter:
- GitHub repository URL (e.g., `git@github.com:yourname/openclaw-backup.git`)
- Git username and email
### 4. Configure Auto Backup
After installation, a cron job will be created in OpenClaw to check for backup needs every hour.
## Usage
### Manual Backup
```bash
~/.openclaw/backup.sh backup
```
### Auto Backup (Based on Activity)
```bash
~/.openclaw/backup.sh auto
```
### Check Activity Status
```bash
~/.openclaw/check-activity.sh
# Output: active or inactive
```
### Restore from Backup
```bash
~/.openclaw/backup.sh restore
```
Follow the prompts:
1. Clone the backup repository
2. Edit `openclaw.json` to fill in real API keys
3. Restart Gateway
## Backup Contents
| Included | Description |
|----------|-------------|
| โ
openclaw.json | Main configuration (API keys sanitized) |
| โ
agents/ | All agent session history |
| โ
extensions/ | All plugins |
| โ
workspace-*/ | Agent workspaces |
| โ
memory/ | Agent memory databases |
| โ
credentials/ | Credential configurations |
| โ
feishu/ | Feishu configurations |
| โ
wecom/ | WeChat Work configurations |
| Excluded | Reason |
|----------|--------|
| โ logs/ | Log files, can be regenerated |
## Smart Backup Strategy
| Status | Condition | Backup Frequency |
|--------|-----------|------------------|
| ๐ข Active | Activity within last hour | Every 1 hour |
| ๐ด Inactive | No new activity | Every 24 hours |
## Security Notes
โ ๏ธ **Important Security Warnings**:
1. **Must use a private repository** - Backups contain sensitive configurations
2. **API Keys are sanitized** - But other configs may still contain sensitive info
3. **Manual API key entry required on restore** - Keys are replaced in backup files
## File Structure
```
~/.openclaw/
โโโ backup.sh # Main backup script
โโโ check-activity.sh # Activity status checker
โโโ .gitignore # Git ignore configuration
โโโ workspace/
โโโ memory/
โโโ heartbeat-state.json # Records backup state
```
## Troubleshooting
### Push Failed
```bash
# Check SSH connection
ssh -T git@github.com
# Force push (use with caution)
cd ~/.openclaw && git push origin main --force
```
### Configuration Lost After Restore
Ensure:
1. Edit `openclaw.json` to fill in real API keys
2. Restart Gateway: `openclaw gateway restart`
## Customization
### Custom Backup Frequency
Edit `heartbeat-state.json`:
```json
{
"backup": {
"activeInterval": 3600000,
"inactiveInterval": 86400000
}
}
```
### Add More Exclusions
Edit `~/.openclaw/.gitignore`:
```gitignore
# Custom exclusions
secrets/
*.pem
```
## Author
OpenClaw Community
## Version
- v1.0.0 - Initial release with auto backup and smart frequencydon't have the plugin yet? install it then click "run inline in claude" again.