Safe protocol for editing ~/.openclaw/openclaw.json. Wrong key names silently break the gateway — this skill prevents that.
bash
cp ~/.openclaw/openclaw.json ~/.openclaw/openclaw.json.bak-$(date +%Y%m%d-%H%M)
Never guess a config key name. Check the source:
bash
# Replace KEY with the key you're about to add (e.g. "visibility", "agentToAgent")
grep -r "cfg\." ~/.nvm/versions/node/v22.22.0/lib/node_modules/openclaw/dist/*.js \
| grep -o '"[a-zA-Z.]*KEY[a-zA-Z.]*"' | sort -u | head -10
Or check the full path:
bash
grep -r "tools\.sessions\." ~/.nvm/versions/node/v22.22.0/lib/node_modules/openclaw/dist/*.js \
| grep -o '"[a-z.]*"' | sort -u
If the key doesn't appear in source → it doesn't exist, don't add it.
Use Python to safely read/modify/write (avoids JSON syntax errors):
bash
cat ~/.openclaw/openclaw.json | python3 -c "
import json, sys
cfg = json.load(sys.stdin)
# Make your change here, e.g.:
# cfg['tools']['sessions']['visibility'] = 'all'
with open('$HOME/.openclaw/openclaw.json', 'w') as f:
json.dump(cfg, f, indent=2, ensure_ascii=False)
print('Done')
"
bash
openclaw gateway status 2>&1 | grep -i "unknown\|invalid\|error"
Doctor will flag unknown keys. If you see any → restore from backup, don't restart.
bash
openclaw gateway restart
bash
# List backups
ls -lt ~/.openclaw/openclaw.json.bak-* | head -5
# Restore most recent
cp ~/.openclaw/openclaw.json.bak-YYYYMMDD-HHMM ~/.openclaw/openclaw.json
# Restart
openclaw gateway restart
What you wantCorrect key pathValid valuesCross-agent session visibilitytools.sessions.visibility``self tree agent allAgent-to-agent messagingtools.agentToAgent.enabled``true / falseCompaction trigger thresholdagents.defaults.compaction.maxHistoryShare``0.0– 1.0Compaction modeagents.defaults.compaction.mode``default safeguardReserve tokens before compactionagents.defaults.compaction.reserveTokensintegerPrimary modelagents.defaults.model.primary``provider/model-idTool allow/denytools.allow / tools.denyarray of tool names
A single unknown key in openclaw.json makes the gateway refuse to start. There's no warning — it just fails. The backup + source verification + doctor flow takes 30 seconds and prevents complete system outages.
Real example: tools.sessions.scope (doesn't exist) vs tools.sessions.visibility (correct) — one character difference, gateway down.