Config Guardian
Overview
Use this workflow whenever editing ~/.openclaw/openclaw.json or running openclaw config set/apply. Prevents invalid config, creates backups, validates against schema, and enables rollback.
Workflow (use every time)
Preflight
- Confirm the requested change and scope
- Check for sensitive keys (tokens, credentials)
Backup
bash {baseDir}/scripts/backup.shValidate (before change)
bash {baseDir}/scripts/validate.shIf validation fails, stop and report.
Apply change
- Prefer
openclaw config set <path> <value>for small changes - For complex edits, edit the file directly and keep diffs minimal
- Prefer
Validate (after change)
bash {baseDir}/scripts/validate.shIf it fails, restore from backup:
bash {baseDir}/scripts/restore.shDiff review
bash {baseDir}/scripts/diff.shRestart (only with explicit approval)
- If change requires restart, ASK for approval first
- Use
openclaw gateway restart
Guardrails
- Never restart or apply config without explicit user approval
- Never remove keys or reorder blocks unless requested
- Always keep a backup before edits
- If unsure about schema: run
openclaw doctor --non-interactiveand stop on errors
Multi-environment Support
For environments with multiple OpenClaw instances, pass OPENCLAW_CONFIG environment variable:
OPENCLAW_CONFIG=/path/to/alternate/openclaw.json bash {baseDir}/scripts/backup.sh