openclaw.json: get/set/patch/unset a value by path, print the schema, validate, or print the active file path. Run openclaw config with no subcommand to open the same guided wizard as openclaw configure.
When
OPENCLAW_NIX_MODE=1, OpenClaw treats openclaw.json as immutable. Read-only commands (config get, config file, config schema, config validate) still work; config writers refuse. Edit the Nix source for the install instead; for the first-party nix-openclaw distribution, use the nix-openclaw Quick Start and set values under programs.openclaw.config or instances.<name>.config.Root options
string
Repeatable guided-setup section filter when you run
openclaw config without a subcommand.workspace, model, web, gateway, daemon, channels, plugins, skills, health.
Examples
Paths
Dot or bracket notation. Quote bracket paths in shell examples so zsh does not glob-expand[0]:
config get
Reads a value from the redacted config snapshot (secrets never print). --json prints the same redacted value as JSON; otherwise strings/numbers/booleans print bare and objects/arrays print as formatted JSON.
When the path is missing, --json writes { "error": "Config path not found: <path>" } to stdout and exits with status 1. Without --json, the diagnostic remains on stderr.
config file
Prints the active config file path, resolved from OPENCLAW_CONFIG_PATH or the default location. The path names a regular file, not a symlink; see Write safety.
With --json, stdout contains an object with the resolved path under path.
config schema
Prints the generated JSON schema for openclaw.json to stdout.
What it includes
What it includes
- The current root config schema, plus a root
$schemastring field for editor tooling. - Field
title/descriptiondocs metadata used by the Control UI. - Nested object, wildcard (
*), and array-item ([]) nodes inherit the sametitle/descriptionmetadata when matching field docs exist. anyOf/oneOf/allOfbranches inherit the same docs metadata too.- Best-effort live plugin + channel schema metadata when runtime manifests can be loaded.
- A clean fallback schema even when the current config is invalid.
--json is accepted as the explicit
machine-output spelling and keeps stdout reserved for the schema document.
config validate
Validates the current config against the active schema without starting the gateway. It also checks provider/source compatibility for every registry-declared SecretRef, including disabled plugin or channel configuration. This strict command can report an inactive mismatch that does not block normal Gateway startup, where SecretRef resolution remains limited to effectively active surfaces.
If validation is already failing, start with
openclaw configure or openclaw doctor --fix. openclaw chat does not bypass the invalid-config guard.params bags are intentionally typed as
Record<string, unknown> because their owners define the supported keys and
values. openclaw config validate can validate the container and overall
config shape, but it cannot type-check provider-specific parameter names or
values. Passing validation does not prove that a param is supported; consult
the provider docs and verify behavior on the selected runtime and provider.
Values
Values parse as JSON5 when possible; otherwise they are treated as raw strings. Use--strict-json to require standard JSON with no string fallback (JSON5-only syntax such as comments, trailing commas, or unquoted keys is then rejected). --json is a legacy alias for --strict-json on config set.
config get <path> --json prints the redacted value as JSON instead of terminal-formatted text.
When a write changes agents.defaults.model or a per-agent agents.entries.*.model, OpenClaw resolves each changed primary or fallback through the configured provider catalogs before writing. Unknown model references are rejected without changing the active config; run openclaw models list to see available models.
Object assignment replaces the target path by default. Protected paths that commonly hold user-added entries refuse replacements that would remove existing entries unless you pass
--replace: agents.defaults.models, agents.entries, models.providers, models.providers.<id>, models.providers.<id>.models, plugins.entries, and auth.profiles.--merge when adding entries to those maps:
--replace only when the provided value should intentionally become the complete target value.
config set modes
- Value mode
- SecretRef builder mode
- Provider builder mode
- Batch mode
--batch-json/--batch-file) as the source of truth; --strict-json / --json do not change batch parsing behavior.
JSON path/value mode also works for SecretRefs and providers directly:
Provider builder flags
Provider builder targets must usesecrets.providers.<alias> as the path.
Common flags
Common flags
--provider-source <env|file|exec|store>--provider-timeout-ms <ms>(file,exec)
Env provider (--provider-source env)
Env provider (--provider-source env)
--provider-allowlist <ENV_VAR>(repeatable)
File provider (--provider-source file)
File provider (--provider-source file)
--provider-path <path>(required)--provider-mode <singleValue|json>--provider-max-bytes <bytes>
Exec provider (--provider-source exec)
Exec provider (--provider-source exec)
--provider-command <path>(required)--provider-arg <arg>(repeatable)--provider-no-output-timeout-ms <ms>--provider-max-output-bytes <bytes>--provider-json-only--provider-env <KEY=VALUE>(repeatable)--provider-pass-env <ENV_VAR>(repeatable)--provider-trusted-dir <path>(repeatable)
config patch
Paste or pipe a config-shaped JSON5 patch instead of running many path-based config set commands. Objects merge recursively; arrays and scalar values replace the target; null deletes the target path.
--stdin patches are limited to 1 MiB.
Pipe a patch over stdin for remote setup scripts:
fastMode
value is a portable typed runtime control and does not choose OpenClaw by
itself.
Use --replace-path <path> when one object or array must become exactly the provided value instead of being recursively patched:
--dry-run runs schema and SecretRef resolvability checks without writing. Exec-backed SecretRefs are skipped by default during dry-run; add --allow-exec when you intentionally want dry-run to execute provider commands.
Dry run
--dry-run validates changes without writing openclaw.json. Available on config set, config patch, and config unset.
Dry-run behavior
Dry-run behavior
- Builder mode: runs SecretRef resolvability checks for changed refs/providers.
- JSON mode (
--strict-json,--json, or batch mode): runs schema validation plus SecretRef resolvability checks. - Policy validation runs against the full post-change config, so parent-object writes (for example setting
hooksas an object) cannot bypass unsupported-surface validation. - Exec SecretRef checks are skipped by default to avoid command side effects; pass
--allow-execto opt in (this may execute provider commands).--allow-execis dry-run only and errors without--dry-run.
--dry-run --json fields
--dry-run --json fields
ok: whether dry-run passedoperations: number of assignments evaluatedchecks: whether schema/resolvability checks ranchecks.resolvabilityComplete: whether resolvability checks ran to completion (false when exec refs are skipped)refsChecked: number of refs actually resolved during dry-runskippedExecRefs: number of exec refs skipped because--allow-execwas not seterrors: structured failures whenok=false; each carries akindofmissing-path,schema,resolvability,model, orconflict(conflictmeans the config file changed while the command was writing, so nothing was changed — re-run to pick up the new file)
JSON output shape
- Success example
- Failure example
If dry-run fails
If dry-run fails
config schema validation failed: your post-change config shape is invalid; fix the path/value or provider/ref object shape.Config policy validation failed: unsupported SecretRef usage: move that credential back to plaintext/string input; keep SecretRefs on supported surfaces only.SecretRef assignment(s) could not be resolved: the referenced provider/ref cannot currently resolve (missing env/store name, invalid file pointer, exec provider failure, or provider/source mismatch).model reference validation failed: a changed text-model primary or fallback is unknown; runopenclaw models listand choose an available model.Dry run note: skipped <n> exec SecretRef resolvability check(s): rerun with--allow-execif you need exec resolvability validation.- For batch mode, fix failing entries and rerun
--dry-runbefore writing.
Applying changes
After every successfulconfig set / config patch / config unset, the CLI prints one of three hints so you know whether the gateway needs a restart:
Effective changes to
plugins.entries (or any subpath) require a restart, since the CLI cannot prove every plugin’s reload metadata is loaded. Successful config set or config unset operations that produce no effective config diff print No change and leave the JSON5 file byte-for-byte untouched. A config unset target that is absent from the authored config exits with status 1 and also leaves the file untouched. Setting an absent key to a value equal to its runtime default is still an authored change and persists the explicit value.
Write safety
openclaw config set and other OpenClaw-owned config writers validate the full post-change config before committing it to disk. If the new payload fails schema validation or looks like a destructive clobber, the active config is left alone and the rejected payload is saved beside it as openclaw.json.rejected.*.
OpenClaw-owned writes that change config reserialize JSON5 as standard JSON. When the source contains comments, the writer warns immediately before removing them; use a direct editor when preserving comments matters.
Prefer CLI writes for small edits:
openclaw.json. Run openclaw doctor --fix to repair prefixed/clobbered config or restore the last-known-good copy. See Gateway troubleshooting.
Whole-file recovery is reserved for doctor repair. Plugin schema changes or minHostVersion skew stay loud instead of rolling back unrelated user settings such as models, providers, auth profiles, channels, gateway exposure, tools, memory, browser, or cron config.
Repair loop
Afteropenclaw config validate passes, use the local TUI to have an embedded agent compare the active config against the docs while you validate each change from the same terminal:
! runs a literal local shell command (after a one-time per-session confirmation prompt):
1
Compare with docs
Ask the agent to compare your current config with the relevant docs page and suggest the smallest fix.
2
Apply targeted edits
Apply targeted edits with
openclaw config set or openclaw configure.3
Re-validate
Rerun
openclaw config validate after each change.4
Doctor for runtime issues
If validation passes but the runtime is still unhealthy, run
openclaw doctor or openclaw doctor --fix for migration and repair help.