# ๐พ SKILL INSTALLATION: OpenClaw Backup System
**Skill ID:** openclaw-backup-system
**Version:** 2.0.0
**Complexity:** Low
**Est. Setup Time:** 5 minutes
**Author:** Mia / Blazo
---
## ๐ฏ Installation Goal
Install a complete backup system that automatically saves all essential OpenClaw configuration, scripts, and data daily. Protects against drive failure and enables easy migration to new machines with compact 50-100MB backups.
---
## โ ๏ธ CRITICAL: Prerequisites Check
<thinking>
Before proceeding, I need to verify all prerequisites are met. If any are missing, I must STOP and inform the human.
</thinking>
### ๐ System Check
**ACTION:** CHECK_SYSTEM
**Parameters:**
- OpenClaw version: >= 2026.2.0
- Shell: bash
- Tools available: tar, cron, du
- Disk space: >= 100MB free
**STATUS:** โณ CHECKING...
```bash
# Verifying prerequisites...
command -v bash >/dev/null && echo "โ
bash" || echo "โ bash missing"
command -v tar >/dev/null && echo "โ
tar" || echo "โ tar missing"
command -v crontab >/dev/null && echo "โ
cron" || echo "โ cron missing"
df -h ~ | tail -1 | awk '{print "๐พ Disk: "$4" free"}'
```
**STATUS:** [Running check...]
**IF FAIL:**
```
๐ INSTALLATION BLOCKED
Missing requirement: [specific tool]
**Human Action Required:**
Install missing tool: sudo apt-get install [package]
**Ask me to retry after completing the above.**
```
---
## ๐ค Human Setup Phase
<thinking>
The following steps require human action. I cannot proceed until the human confirms completion.
</thinking>
### Required Human Actions (Do These First)
**๐ HUMAN REQUIRED - Step 1: Confirm Backup Location**
**ASK HUMAN:** Where should backups be stored?
**Options:**
- A) Default: `~/clawd/backups/`
- B) Custom path (specify)
**Default is recommended** - automatically copies to Windows Desktop if on WSL
**โณ AWAITING HUMAN INPUT**
**IF "A" or blank:**
โ
Using default: `~/clawd/backups/`
Backup location stored.
**IF custom path:**
๐ฅ Custom path: [human input]
Path validated and stored.
---
**๐ HUMAN REQUIRED - Step 2: Windows Desktop Sync**
**ASK HUMAN:** Sync backups to Windows Desktop for File History?
**Options:**
- A) Yes (recommended for WSL - auto-backs up via Windows)
- B) No (keep only in WSL)
**Why this matters:** Windows File History automatically backs up Desktop files
**IF "A" or blank:**
โ
Windows Desktop sync enabled
Backups will be copied to: `C:Users[username]Desktop`
**IF "B":**
โ ๏ธ Windows sync disabled
Consider manual backup to external drive
---
## โ๏ธ Configuration Phase
<thinking>
Now I'll collect configuration from the human. Securely store each value.
</thinking>
### Configuration Variables
**๐ง CONFIG 1: Backup Time**
**Purpose:** When to run daily backup automatically
**ASK HUMAN:** What time for daily backup? (24-hour format)
**Options:**
- A) 23:00 (11 PM) - RECOMMENDED
- B) 02:00 (2 AM)
- C) Custom: [HH:MM]
**Example:** 23:00
**โณ INPUT:** _waiting for response_
**IF invalid time format:**
```
โ ๏ธ Invalid format. Use 24-hour format: HH:MM
Examples: 23:00, 02:00, 14:30
Try again:
```
**๐ฅ RECEIVED:** [backup_time]
**โ
VALIDATION:** Format check: PASS
**VARIABLE STORED:** `BACKUP_TIME` = `[HH:MM]`
---
**๐ง CONFIG 2: Backup Retention**
**Purpose:** How many daily backups to keep (optional cleanup)
**ASK HUMAN:** Keep how many days of backups? (default: 30)
**Or enter:** 0 to keep all backups forever
**Example:** 30
**โณ INPUT:** _waiting_
**๐ฅ RECEIVED:** [retention_days]
**โ
VALIDATION:** Range check: PASS
**VARIABLE STORED:** `RETENTION_DAYS` = `[number]`
---
## ๐ ๏ธ Automated Installation Phase
<thinking>
All prerequisites met and configuration collected. Now executing automated installation.
</thinking>
### Installation Steps
**STEP 1: Create Skill Directory Structure**
**ACTION:** CREATE_DIRECTORY
**Path:** `~/clawd/backups/`
**Subdirectories:** none (created as needed)
**COMMAND:**
```bash
mkdir -p ~/clawd/backups ~/clawd/logs
```
**STATUS:** โ
Created
---
**STEP 2: Generate Backup Script**
**ACTION:** WRITE_FILE
**Path:** `~/clawd/backup-openclaw.sh`
**Permissions:** 755 (executable)
**Content:**
```bash
#!/bin/bash
# OpenClaw Backup System v2.0
# Auto-generated backup script
BACKUP_DIR="$HOME/clawd/backups"
LOG_FILE="$HOME/clawd/logs/backup.log"
DATE=$(date +%F-%H%M)
BACKUP_NAME="openclaw-backup-${DATE}"
TMP_DIR="/tmp/${BACKUP_NAME}"
RETENTION_DAYS="[RETENTION_DAYS]"
echo "[$(date)] Starting backup..." >> "$LOG_FILE"
mkdir -p "$BACKUP_DIR" "$TMP_DIR"
# Copy essential OpenClaw config
cp ~/.openclaw/openclaw.json "$TMP_DIR/" 2>/dev/null
cp -r ~/.openclaw/credentials "$TMP_DIR/" 2>/dev/null
cp -r ~/.openclaw/identity "$TMP_DIR/" 2>/dev/null
# Agent settings
[ -d ~/.openclaw/agents/main ] && cp -r ~/.openclaw/agents/main "$TMP_DIR/"
# Scripts and memory
cp -r ~/clawd/scripts "$TMP_DIR/" 2>/dev/null
cp -r ~/clawd/memory "$TMP_DIR/" 2>/dev/null
# Documentation
for file in AGENTS.md SOUL.md USER.md TOOLS.md MEMORY.md HEARTBEAT.md MODEL-SELECTION.md CONTEXT-WINDOW-GUIDE.md BACKUP-RESTORE-GUIDE.md; do
[ -f ~/clawd/$file ] && cp ~/clawd/$file "$TMP_DIR/"
done
# Credentials
cp ~/clawd/.env "$TMP_DIR/" 2>/dev/null
cp ~/clawd/*-credentials.json "$TMP_DIR/" 2>/dev/null
# Crontab
crontab -l > "$TMP_DIR/crontab-backup.txt" 2>/dev/null
# Create archive
tar -czf "${BACKUP_DIR}/${BACKUP_NAME}.tar.gz" -C /tmp "$BACKUP_NAME"
rm -rf "$TMP_DIR"
# Calculate size
SIZE=$(du -h "${BACKUP_DIR}/${BACKUP_NAME}.tar.gz" | cut -f1)
echo "[$(date)] Backup complete: ${BACKUP_NAME}.tar.gz (${SIZE})" >> "$LOG_FILE"
# Windows Desktop sync
WIN_DESKTOP="/mnt/c/Users/$(whoami)/Desktop"
if [ -d "$WIN_DESKTOP" ]; then
cp "${BACKUP_DIR}/${BACKUP_NAME}.tar.gz" "$WIN_DESKTOP/"
echo "[$(date)] Synced to Desktop" >> "$LOG_FILE"
fi
# Cleanup old backups (if retention set)
if [ "$RETENTION_DAYS" -gt 0 ]; then
find "$BACKUP_DIR" -name "openclaw-backup-*.tar.gz" -mtime +$RETENTION_DAYS -delete 2>/dev/null
echo "[$(date)] Cleaned backups older than ${RETENTION_DAYS} days" >> "$LOG_FILE"
fi
echo "[$(date)] Backup finished" >> "$LOG_FILE"
```
**COMMAND:**
```bash
cat > ~/clawd/backup-openclaw.sh << 'EOF'
[content above]
EOF
chmod +x ~/clawd/backup-openclaw.sh
```
**STATUS:** โ
Created and made executable
---
**STEP 3: Configure Cron Job**
**ACTION:** CREATE_CRON_JOB
**Schedule:** Daily at [BACKUP_TIME]
**Command:** ~/clawd/backup-openclaw.sh
**STATUS:** โณ Installing...
**COMMAND:**
```bash
# Install cron job
(crontab -l 2>/dev/null; echo "0 [HOUR] * * * ~/clawd/backup-openclaw.sh") | crontab -
```
**STATUS:** โ
Cron job scheduled for [BACKUP_TIME]
**IF FAILED:**
```
โ CRON INSTALLATION FAILED
**Error:** [error message]
**Manual fix:**
Run: crontab -e
Add line: 0 [HOUR] * * * ~/clawd/backup-openclaw.sh
Then type "retry" to continue.
```
---
**STEP 4: Run First Backup**
**ACTION:** EXECUTE_BACKUP
**Script:** ~/clawd/backup-openclaw.sh
**STATUS:** โณ Running first backup...
**Output:**
```
๐ Creating OpenClaw backup...
๐ Copying config...
๐ Copying scripts...
๐ง Copying memory...
๐ Copying documentation...
๐ Copying credentials...
๐ฆ Creating archive...
โ
Backup complete: openclaw-backup-[DATE]-[TIME].tar.gz (XX MB)
๐พ Also saved to Windows Desktop
```
**STATUS:** [Running... / โ
Complete / โ Failed]
**IF FAILED:**
```
โ BACKUP FAILED
**Error:** [error message]
**Troubleshooting:**
1. Check disk space: df -h ~
2. Verify paths: ls ~/.openclaw/openclaw.json
3. Check permissions: ls -la ~/clawd/
**Retry?** (yes/no)
```
---
**STEP 5: Verify Installation**
**ACTION:** RUN_VERIFICATION
**Tests:**
- โ
Script exists: ~/clawd/backup-openclaw.sh
- โ
Script executable: permissions 755
- โ
First backup created: ~/clawd/backups/openclaw-backup-*.tar.gz
- โ
Windows Desktop copy: C:Users...Desktopopenclaw-backup-*.tar.gz (if applicable)
- โ
Cron job installed: crontab showing backup line
- โ
Log file created: ~/clawd/logs/backup.log
**OVERALL STATUS:** โณ Running verification...
**STATUS:** [PASS / FAIL]
---
## ๐ Installation Complete!
<thinking>
All steps completed successfully. The backup system is now installed and operational.
</thinking>
### โ
Summary
**Skill:** OpenClaw Backup System
**Location:** `~/clawd/backup-openclaw.sh`
**Status:** INSTALLED & READY
**What's Working:**
- โ
Backup script installed and executable
- โ
Daily backup scheduled for [BACKUP_TIME]
- โ
First backup completed: [SIZE]
- โ
Windows Desktop sync: [ENABLED/DISABLED]
- โ
Log file: ~/clawd/logs/backup.log
- โ
Retention: [RETENTION_DAYS] days
**Storage Locations:**
1. **WSL (primary):** `~/clawd/backups/` - [SIZE]
2. **Windows Desktop:** `C:Users...Desktop` - [SIZE]
3. **External:** Copy manually for offsite backup
---
## ๐ Final Configuration
<thinking>
Skill is installed and running. Need to confirm human understands storage strategy.
</thinking>
### Backup Strategy Confirmation
**๐ฏ FINAL CONFIG: Storage Strategy**
**ASK HUMAN:** Do you understand the triple backup strategy?
**Storage Strategy:**
- **Primary:** WSL `~/clawd/backups/` (local access)
- **Secondary:** Windows Desktop (auto-backup via File History)
- **Tertiary:** External drive (manual copy recommended weekly)
**Why this works:** Even if WSL dies, you have Desktop copy. Even if PC dies, you have external copy.
**โณ CONFIRM:** Type "confirmed" to acknowledge triple backup strategy
**๐ฅ RECEIVED:** confirmed
**โ
Acknowledged.**
---
## ๐ Skill is Active!
<thinking>
All complete. Skill operational.
</thinking>
### ๐ What Happens Next
**Automatic Actions:**
- ๐ Daily backup at [BACKUP_TIME]
- ๐พ Backups saved to WSL + Desktop
- ๐งน Old backups auto-deleted after [RETENTION_DAYS] days
- ๐ Logs at: `tail -f ~/clawd/logs/backup.log`
**Manual Actions You Can Take:**
- **Check status:** `tail ~/clawd/logs/backup.log`
- **Run backup now:** `~/clawd/backup-openclaw.sh`
- **View backups:** `ls -lah ~/clawd/backups/`
- **Pause backup:** `crontab -e` (comment out line)
- **Uninstall:** `crontab -r` (removes all jobs) then delete script
---
## ๐ Support & Restore
**Quick Restore on New Machine:**
```bash
# 1. Install OpenClaw
npm install -g openclaw
# 2. Extract backup
tar -xzvf openclaw-backup-*.tar.gz
cd openclaw-backup-*
# 3. Restore
cp openclaw.json ~/.openclaw/
cp -r credentials ~/.openclaw/
cp -r identity ~/.openclaw/
cp -r scripts ~/clawd/
cp -r memory ~/clawd/
cp *.md ~/clawd/
crontab crontab-backup.txt
# 4. Restart
openclaw gateway restart
```
**Full docs:** See `~/clawd/BACKUP-RESTORE-GUIDE.md`
---
## โ
Confirmation
**OpenClaw Backup System v2.0 has been successfully installed!**
**Installation completed at:** [TIMESTAMP]
**Next backup:** [BACKUP_TIME] tomorrow
**Type "run backup" to test manually, or "backups" to list recent backups.**
---
*This installation prompt uses the OnlyBots Perfected Format v2.0*
*Based on OpenAI Function Calling, Anthropic Agent SDK, and ReAct patterns*
Copy the prompt above and paste it into your AI agent (Claude, GPT, OpenClaw, etc.)