Self-Improving Agent
一个面向 Automation 场景的 Agent 技能。原始说明:Captures learnings, errors, and corrections to enable continuous improvement. Use when: (1) A command or operation fails unexpectedly, (2) User corrects Clau...
一个面向 Automation 场景的 Agent 技能。原始说明:Time Clawshine — a simple but powerful time machine for OpenClaw. Hourly encrypted incremental snapshots of your agent's brain via restic. Use when the user...
name: quick-backup-restore
description: "Time Clawshine — a simple but powerful time machine for OpenClaw. Hourly encrypted incremental snapshots of your agent's brain via restic. Use when the user asks to backup, restore, roll back, check status, or update."
metadata: { "openclaw": { "emoji": "⏱", "requires": { "bins": ["bash", "openssl", "curl", "jq"], "auto_install": ["restic", "yq"] }, "install": [{ "id": "setup", "kind": "shell", "label": "Run Time Clawshine setup", "command": "sudo bash {baseDir}/bin/setup.sh" }], "homepage": "https://github.com/marzliak/quick-backup-restore" } }
Your agent just nuked its own memory. Now what?
You spent weeks training your OpenClaw agent — building memory, refining context, tuning personality. Then one bad session wipes it. Gone. And your last "real" backup? Yesterday. Maybe last week.
Time Clawshine gives you a time machine. Every hour, it silently takes an encrypted, incremental snapshot of your agent's brain — memory, sessions, config, everything. Only changed bytes are stored, so it runs in seconds and barely uses disk. When things break (and they will), you roll back to exactly the moment before it happened. Not yesterday. Not "the last backup." The exact hour.
One command to install. Zero maintenance. Just works.
sudo bash {baseDir}/bin/setup.sh
| Problem | Without Time Clawshine | With Time Clawshine |
|---------|----------------------|---------------------|
| Agent overwrites MEMORY.md | Hope you saved a copy | restore.sh "2h ago" |
| Bad session corrupts context | Rebuild from scratch | Roll back one snapshot |
| "What changed?" | No idea | restic diff between any two snapshots |
| Disk fills up | Backup keeps growing | Dedup — only deltas stored |
| Something fails | You find out next week | Telegram ping in 60 seconds |
restic check every 24 backups/start, /, /fail) so you also know when the backup stops running, not just when it failsbin/status.sh for a full health check at a glancebin/prune.sh to manually reclaim disk spacebin/test.sh validates backup→restore→verify roundtripSETUP_GUIDE.md and walks the user through every optionbackup.sh --dry-run to validate without writingbin/uninstall.sh for clean removal (preserves data by default)Repository: configured in {baseDir}/config.yaml
Log: configured in config.yaml under logging.file (rotated weekly via logrotate)
Password file: configured in config.yaml under repository.password_file (chmod 600 — back this up separately)
First, read {baseDir}/SETUP_GUIDE.md and walk the user through each step interactively. The guide covers Telegram, frequency, retention, extra paths, disk safety, and repo location. Configure config.yaml based on their answers before running setup.
If the user wants a quick install without customization:
sudo bash {baseDir}/bin/status.sh
sudo bash {baseDir}/bin/setup.sh
For repo-only setup (no apt-get, no cron, no /usr/local/bin changes):
sudo bash {baseDir}/bin/setup.sh --no-system-install
For CI/automated setup (skip confirmation prompts):
sudo bash {baseDir}/bin/setup.sh --assume-yes
sudo bash {baseDir}/bin/status.sh
sudo bash {baseDir}/bin/backup.sh
Then confirm with:
sudo bash {baseDir}/bin/status.sh
Run the status dashboard:
sudo bash {baseDir}/bin/status.sh
Or show the last 20 log lines:
sudo tail -20 "$(yq e '.logging.file' {baseDir}/config.yaml)"
List all snapshots (most recent first):
sudo bash {baseDir}/bin/restore.sh --help
# Or directly:
REPO=$(yq e '.repository.path' {baseDir}/config.yaml)
PASS=$(yq e '.repository.password_file' {baseDir}/config.yaml)
restic -r "$REPO" --password-file "$PASS" snapshots
Show what changed between the two most recent snapshots:
REPO=$(yq e '.repository.path' {baseDir}/config.yaml)
PASS=$(yq e '.repository.password_file' {baseDir}/config.yaml)
SNAPS=$(restic -r "$REPO" --password-file "$PASS" snapshots --json | jq -r '.[-2:][].id')
restic -r "$REPO" --password-file "$PASS" diff $SNAPS
Interactive restore (recommended — always dry-runs first):
sudo bash {baseDir}/bin/restore.sh
Restore by time (e.g. "roll back 2 hours"):
sudo bash {baseDir}/bin/restore.sh "2h ago" --target /tmp/tc-restore
sudo bash {baseDir}/bin/restore.sh yesterday --target /tmp/tc-restore
Restore a specific file from the latest snapshot:
sudo bash {baseDir}/bin/restore.sh latest --file /root/.openclaw/workspace/MEMORY.md --target /tmp/tc-restore
# Preview the result, then move manually:
# cp /tmp/tc-restore/root/.openclaw/workspace/MEMORY.md /root/.openclaw/workspace/MEMORY.md
Restore a specific snapshot by ID:
sudo bash {baseDir}/bin/restore.sh <snapshot_id>
Always confirm with the user before executing a full restore to /.
REPO=$(yq e '.repository.path' {baseDir}/config.yaml)
PASS=$(yq e '.repository.password_file' {baseDir}/config.yaml)
restic -r "$REPO" --password-file "$PASS" check
Edit {baseDir}/config.yaml with the requested changes (schedule, retention, paths, Telegram credentials), then re-run setup to apply:
sudo bash {baseDir}/bin/setup.sh
Run the local path analyzer (100% offline — no API calls, no data leaves the machine):
sudo bash {baseDir}/bin/customize.sh
This scans the system for:
~/.ssh, ~/.config, custom scripts)node_modules, *.log, cache/)Shows suggestions and asks for confirmation before changing config.yaml.
sudo bash {baseDir}/bin/prune.sh
Options:
--keep-last 24 — keep only last 24 snapshots--older-than 7d — remove snapshots older than 7 days--dry-run — preview what would be removed--yes — skip confirmation promptDry-run (validates without writing):
sudo bash {baseDir}/bin/backup.sh --dry-run
Self-test (full backup→restore→verify roundtrip in temp directory):
bash {baseDir}/bin/test.sh
bot_token and chat_id, failures are logged only.config.yaml (chmod 600). Losing it means losing access to all snapshots.secrets.env or .pass files to git. They are excluded via .gitignore.sudo bash {baseDir}/bin/uninstall.sh
This removes all system artifacts (systemd timer/service, cron, logrotate, binary, lock/marker files) but preserves the backup repository and password file.
To also delete all backup data (irreversible):
sudo bash {baseDir}/bin/uninstall.sh --purge
The source files in the skill directory are never touched — can re-install with sudo bin/setup.sh.
Run the status dashboard which includes update info:
sudo bash {baseDir}/bin/status.sh
Or check manually:
clawhub update quick-backup-restore
Note: backup.sh automatically checks for updates once per day (if updates.check: true in config). It logs a warning when a new version is available but never updates automatically.