← Back to library

让 OpenClaw 自改配置不翻车:openclaw.json 受控变更流程(社区实战)

问题/场景:让代理直接改 openclaw.json 时,常出现配置损坏或行为漂移。前置条件:你在生产/常用环境中启用了多模型或 MCP 配置。实施步骤:先备份配置,再只做小步 patch、每步重启并验证,失败即回滚。关键命令:`openclaw config.get`、`openclaw gateway restart`、`openclaw gateway status`。验证:每次变更后 gateway 可启动且模型路由正常。风险:一次改太多会难以定位故障。

REDDITDiscovered 2026-02-15Author u/Trick_County_9790
Prerequisites
  • You can access and back up the current OpenClaw config before any automated edits.
  • A known-good model/provider setup is already running as rollback baseline.
Steps
  1. Export/read current config and keep a timestamped backup snapshot before editing.
  2. Apply one change at a time (for example: add one model alias OR one MCP block), not bundled edits.
  3. Restart gateway immediately after each change and run a minimal smoke test prompt on target model.
  4. If any mismatch appears (wrong model selected / startup error), revert to backup and retry with smaller diff.
Commands
openclaw config get models.providers
openclaw gateway restart
openclaw gateway status
Verify

After each micro-change, gateway remains healthy and test prompts consistently use the intended model/provider.

Caveats
  • Community evidence is anecdotal; exact failure modes vary by custom configs and model stacks(需验证).
  • Avoid fully autonomous self-edit loops on production config without human checkpoints.
Source attribution

This tip is aggregated from community/public sources and preserved with attribution.

Open original source ↗
Visit original post