claw-saver
Back up OpenClaw workspace to a Git repository with Git LFS support.
Features
- Full workspace backup to Git with atomic commits
- Git LFS support for large model files
- Scheduled backups via cron
- Interactive restore with commit history
- Snapshot mode for safe restore operations
- Exponential backoff on push failures
Quick Start
# Initial setup: configure your Git token
openclaw config set env.OPENCLAW_BACKUP_GIT_TOKEN <your-token>
# Run your first backup
openclaw backup run
# Enable automatic backups (every 5 hours)
openclaw backup enable-cron
Configuration
Edit ~/.openclaw/skills/claw-saver/config/schema.json:
| Option | Default | Description |
|---|---|---|
repo | https://example.com/user/repo | Git repository URL |
cron | 0 */5 * * * | Backup schedule (every 5 hours) |
push_retries | 3 | Max push retry attempts |
push_retry_interval_ms | 60000 | Initial retry delay (exponential backoff) |
CLI Commands
| Command | Description |
|---|---|
openclaw backup run | Run backup immediately |
openclaw backup status | Show last backup time and commit |
openclaw backup restore | Restore from a previous commit |
openclaw backup enable-cron | Enable scheduled backups |
openclaw backup disable-cron | Disable scheduled backups |
openclaw backup set-cron <expr> | Update cron schedule |
Exclusions
The following are excluded from backup:
agents/*/sessions/*.jsonl # Session logs
skills/*/node_modules/ # Dependencies
canvas/* # Canvas runtime
logs/* # Log files
workspace/memory/.dreams/ # Temporary files
*.tmp # Temp files
.DS_Store # macOS metadata
Restore
Restore overwrites your current workspace with a previous backup:
openclaw backup restore
You will be shown recent commits and prompted for confirmation before restoring.
After restore completes, restart the OpenClaw Gateway to apply changes.
Security
- Token is injected via URL embedding (
https://<token>@host/repo) - stderr is redirected during git operations to prevent token leakage
- Interactive restore requires a TTY; non-interactive use requires
{ confirm: true }