Safe, documented, schema-validated gateway configuration operations.
openclaw.json: read, analyze, modifyconfig.get, config.schema.lookup, config.patch, config.applyDetermine mode before starting any config work.
Trigger: user asks to check, review, compare, optimize, or analyze config, without providing a specific target value.
Flow:
config.schema.lookup for relevant keysOutput format:
markdown
## Config Analysis
**Finding**: what was found
**Current state**: relevant config values (from config.get)
**Schema evidence**: what schema.lookup confirmed
**Doc evidence**: source URL or QMD reference
**Recommendation**: suggested change (if any), or "no action needed"
Transitioning to Mode B: if user responds with explicit approval to execute a recommended change (e.g. "do it", "apply", "yes, modify it"), switch to Mode B. Start from Step 3 (Form Change Proposal) — Steps 1 and 2 evidence from Mode A can be reused.
Trigger: user explicitly requests a change AND provides sufficient detail (target key + intended value or clear intent). Examples:
Insufficient for Mode B (fall back to Mode A + ask):
Flow: all 6 steps below, in strict order. No step may be skipped.
SituationActionMode A analysis done, user says "do it"→ Mode B, start from Step 3 (reuse Steps 1-2)Mode B Step 3 proposal rejected→ Back to Mode A, re-analyzeUser intent unclear→ Mode A, ask for clarificationEmergency config fix needed→ Still Mode B, but note "emergency" in log
text
config.schema.lookup(path="target.config.key")
Verify:
enum values present → only use values from the enumadditionalProperties: false → no extra sub-fields allowedadditionalProperties: {}) → still verify field names from docsSchema has key + config doesn't: this means the key can be created. Proceed to Step 2. Schema lookup fails or key doesn't exist: STOP. Do not proceed. Report to user.
This step is mandatory for both Mode A and Mode B.
Priority order (use first that works):
PriorityMethodWhen to use1qmd__queryQMD has OpenClaw docs indexed → fastest, saves tokens2web_fetch("https://docs.openclaw.ai/<path>")QMD unavailable or no results3exec("openclaw <command> --help")Docs site unreachable; last resort only
What to verify:
If no documentation source covers the target config:
Present to user:
markdown
## Config Change Proposal
**Target**: full config key path
**Action**: add / modify / remove
**Current value**: (from config.get, or "does not exist")
**Proposed value**: exact new value
**Schema evidence**: type, enum, constraints from schema.lookup
**Doc evidence**: URL or "QMD:collection/doc-id" confirming correctness
**Impact**: what changes for the user
**Risk**: version constraints, provider limitations, side effects
Wait for explicit user approval. Quote the exact change.
All Mode B operations require confirmation. There are no exceptions — if the user already said "do it", that triggered Mode B, but Step 3 proposal must still be presented and acknowledged.
When in doubt: ask. Over-confirming is better than wrong changes.
5a. Backup first (always, before any modification):
text
exec("cp ~/.openclaw/openclaw.json ~/.openclaw/backups/openclaw-$(date +%Y%m%d%H%M%S).json")
If backup fails: STOP. Do not proceed without backup.
5b. Apply change (in preference order):
config.patch — partial updates, preferredconfig.apply — only for replacing entire config sectionsexec + Python JSON edit — only when config.patch cannot achieve the change (e.g. removing keys)One logical change per operation — see definition below.
text
1. config.get(path="target.key") → confirm value applied correctly
2. exec("openclaw config validate") → confirm config is valid
3. If gateway restart triggered → confirm restart succeeded
4. Record change to logs/config-changes.log
Change log format (append to ~/.openclaw/workspace/logs/config-changes.log):
text
## YYYY-MM-DDTHH:MM:SS+08:00
- action: add|modify|remove
- target: config.key.path
- old_value: <previous value or "N/A">
- new_value: <new value>
- reason: <brief justification>
- schema_verified: true
- doc_source: <URL or "QMD:collection/doc-id">
- user_approved: true
- backup: <backup file path>
A logical change = changes to keys within the same config subtree that serve a single user intent.
ExampleCountReasonAdd one model entry1Single intent, one subtreeAdd model + set it as fallback1Same intent (add fallback model), same subtreeAdd model + add plugin + change channel3Different subtrees, different intentsModify 3 unrelated fields in tools.*3Different intents, must be separate patches
Rule of thumb: if you need to mention two different top-level config sections in one proposal, split it.
If in doubt, split. Smaller patches are safer and easier to roll back.
TopicURLConfig referencehttps://docs.openclaw.ai/gateway/configuration-referenceConfig exampleshttps://docs.openclaw.ai/gateway/configuration-examplesModelshttps://docs.openclaw.ai/models/Pluginshttps://docs.openclaw.ai/plugins/Channelshttps://docs.openclaw.ai/channels/Toolshttps://docs.openclaw.ai/tools/MCPhttps://docs.openclaw.ai/tools/mcpCLI referencehttps://docs.openclaw.ai/cli/Securityhttps://docs.openclaw.ai/gateway/securitySandboxhttps://docs.openclaw.ai/gateway/sandboxingSkillshttps://docs.openclaw.ai/tools/skillsMulti-agenthttps://docs.openclaw.ai/concepts/multi-agentCLI backendshttps://docs.openclaw.ai/gateway/cli-backendsThinking levelshttps://docs.openclaw.ai/tools/thinkingapply_patchhttps://docs.openclaw.ai/tools/apply-patchWeb searchhttps://docs.openclaw.ai/tools/web-searchTTShttps://docs.openclaw.ai/tools/ttsImage genhttps://docs.openclaw.ai/tools/image-generationMusic genhttps://docs.openclaw.ai/tools/music-generationProvidershttps://docs.openclaw.ai/providers/<provider-name>
For nested structures, lookup sub-paths incrementally:
text
config.schema.lookup(path="agents.defaults.cliBackends")
config.schema.lookup(path="agents.defaults.cliBackends.*")
config.schema.lookup(path="agents.defaults.cliBackends.*.sessionMode")
Each level returns type, enum, children, and hints.
ProblemActionGateway won't startopenclaw config validate --json → find specific errorsUnknown key errorRestore from backup → openclaw config unset <path>Type mismatchSchema lookup for expected type → fix value → re-verifyPlugin fails to loadCheck plugin docs for required config fieldsconfig.patch rejectedCheck schema for additionalProperties: false → verify all sub-fieldsPatch succeeds but wrong valueRestore from backup → redo with correct value
This skill covers openclaw.json configuration only.