Requirements
- Target platform
- OpenClaw
- Install method
- Manual import
- Extraction
- Extract archive
- Prerequisites
- OpenClaw
- Primary doc
- SKILL.md
Automatic configuration rollback mechanism for OpenClaw Gateway. Provides three-layer protection: pre-modification backup, post-modification validation, and...
Automatic configuration rollback mechanism for OpenClaw Gateway. Provides three-layer protection: pre-modification backup, post-modification validation, and...
Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.
I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete.
I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run.
Three-layer configuration protection for OpenClaw Gateway โ never break your config again.
Automatically protects your OpenClaw configuration files with: Pre-modification backup โ SHA256 content-addressed snapshots before any change Post-modification validation โ JSON syntax check + Gateway health probe Automatic rollback โ instant restore if validation fails
Before modifying openclaw.json, exec-approvals.json, or skills.json When running automated config changes (cron jobs, scripts) As a background safety net during development When you want peace of mind that a bad config won't take down your agent
python3 gateway-auto-rollback.py This initializes the backup directory, validates current config, and logs status.
python3 gateway-auto-rollback.py --watch & Monitors critical config files every 3 minutes. Auto-exits after 3 consecutive healthy checks (config is stable).
Before Modification During After Modification โ โ โ Backup + Hash โโโโ Execute Change โโโโ JSON Validate + Health Check โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ Auto-rollback on failure
FileDescriptionopenclaw.jsonMain Gateway configurationexec-approvals.jsonCommand execution approvalsskills.jsonSkills registry
Backups are stored in ~/.openclaw/backup/ with content-addressed names: openclaw.json.20260301_053612.a1b2c3d4.bak โ timestamp โ SHA256 prefix (dedup)
from gateway_auto_rollback import ( pre_modification_check, # Call before modifying config post_modification_verify, # Call after modifying config create_backup, # Manual backup creation validate_json, # JSON syntax validation check_gateway_health, # Gateway health probe rollback_to_backup, # Manual rollback watch_config_files, # Start watch daemon )
from pathlib import Path config = Path.home() / ".openclaw" / "openclaw.json" # Returns backup path on success, False on failure backup = pre_modification_check(config) # ... make your changes ... # Validates and auto-rolls back if needed success = post_modification_verify(config, backup)
The watcher: Polls every 3 minutes (gives Gateway time to restart) Detects changes via SHA256 hash comparison Auto-creates backup when change detected Validates JSON + health check after each change Auto-exits after 3 consecutive healthy checks (config stabilized) Logs all events to ~/.openclaw/logs/config-modification.log
Set up periodic health checks: # Cron job example: check every hour 0 * * * * python3 /path/to/gateway-auto-rollback.py Or use OpenClaw's built-in cron: { "name": "Gateway-Auto-Rollback", "schedule": { "kind": "cron", "expr": "0 */6 * * *", "tz": "Asia/Shanghai" }, "payload": { "kind": "agentTurn", "message": "Run gateway health check. If unhealthy, rollback to latest backup." }, "sessionTarget": "isolated" }
If you need to manually restore a config: # List available backups (newest first) ls -lt ~/.openclaw/backup/ | head -10 # Restore a specific backup cp ~/.openclaw/backup/openclaw.json.20260301_053612.a1b2c3d4.bak \ ~/.openclaw/openclaw.json # Restart Gateway openclaw gateway restart # Verify curl -s http://127.0.0.1:18789/api/health
Run the included test suite to verify the mechanism works: bash test-rollback-mechanism.sh Tests cover: Backup directory existence JSON validation SHA256 hash computation Backup creation and restore Watch daemon status Log file integrity Script permissions
All events are logged to ~/.openclaw/logs/config-modification.log: [2026-03-01 05:37:00] INFO: โ ๅคไปฝๅๅปบ: openclaw.json.20260301_053612.a1b2c3d4.bak [2026-03-01 05:37:01] INFO: โ ไฟฎๆน้ช่ฏ้่ฟ [2026-03-01 05:40:00] WARN: โ ๏ธ ๆฃๆตๅฐไฟฎๆน: openclaw.json [2026-03-01 05:40:01] ERROR: JSON ้ช่ฏๅคฑ่ดฅ โ ่งฆๅๅๆป
Python 3.8+ OpenClaw Gateway running (for health checks) No additional pip packages needed (stdlib only)
gateway-auto-rollback/ โโโ SKILL.md # This file โโโ _meta.json # ClawHub metadata โโโ gateway-auto-rollback.py # Main script (backup/validate/rollback/watch) โโโ test-rollback-mechanism.sh # Test suite
Agent frameworks, memory systems, reasoning layers, and model-native orchestration.
Largest current source with strong distribution and engagement signals.