Technical reference for the OpenClaw framework. Real-time synchronization with the official documentation engine.
Use this file to discover all available pages before exploring further.
Secrets management
OpenClaw supports additive SecretRefs so supported credentials do not need to be stored as plaintext in configuration.
note
Plaintext still works. SecretRefs are opt-in per credential.
Goals and runtime model
Secrets are resolved into an in-memory runtime snapshot.
Resolution is eager during activation, not lazy on request paths.
Startup fails fast when an effectively active SecretRef cannot be resolved.
Reload uses atomic swap: full success, or keep the last-known-good snapshot.
SecretRef policy violations (for example OAuth-mode auth profiles combined with SecretRef input) fail activation before runtime swap.
Runtime requests read from the active in-memory snapshot only.
After the first successful config activation/load, runtime code paths keep reading that active in-memory snapshot until a successful reload swaps it.
Outbound delivery paths also read from that active snapshot (for example Discord reply/thread delivery and Telegram action sends); they do not re-resolve SecretRefs on each send.
This keeps secret-provider outages off hot request paths.
Active-surface filtering
SecretRefs are validated only on effectively active surfaces.
Validation:
* `provider` must match `^[a-z][a-z0-9_-]{0,63}$`
* `id` must be an absolute JSON pointer (`/...`)
* RFC6901 escaping in segments: `~` => `~0`, `/` => `~1`
Validation:
* `provider` must match `^[a-z][a-z0-9_-]{0,63}$`
* `id` must match `^[A-Za-z0-9][A-Za-z0-9._:/-]{0,255}$`
* `id` must not contain `.` or `..` as slash-delimited path segments (for example `a/../b` is rejected)
Plaintext string values still work. Env-template refs like
text
${MCP_SERVER_API_KEY}
and SecretRef objects are resolved during gateway activation before the MCP server process is spawned. As with other SecretRef surfaces, unresolved refs only block activation when the
text
acpx
plugin is effectively active.
Sandbox SSH auth material
The core
text
ssh
sandbox backend also supports SecretRefs for SSH auth material:
Runtime-minted or rotating credentials and OAuth refresh material are intentionally excluded from read-only SecretRef resolution.
Required behavior and precedence
Field without a ref: unchanged.
Field with a ref: required on active surfaces during activation.
If both plaintext and ref are present, ref takes precedence on supported precedence paths.
The redaction sentinel
text
__OPENCLAW_REDACTED__
is reserved for internal config redaction/restore and is rejected as literal submitted config data.
Warning and audit signals:
text
SECRETS_REF_OVERRIDES_PLAINTEXT
(runtime warning)
text
REF_SHADOWED
(audit finding when
text
auth-profiles.json
credentials take precedence over
text
openclaw.json
refs)
Google Chat compatibility behavior:
text
serviceAccountRef
takes precedence over plaintext
text
serviceAccount
.
Plaintext value is ignored when sibling ref is set.
Activation triggers
Secret activation runs on:
Startup (preflight plus final activation)
Config reload hot-apply path
Config reload restart-check path
Manual reload via
text
secrets.reload
Gateway config write RPC preflight (
text
config.set
/
text
config.apply
/
text
config.patch
) for active-surface SecretRef resolvability within the submitted config payload before persisting edits
Activation contract:
Success swaps the snapshot atomically.
Startup failure aborts gateway startup.
Runtime reload failure keeps the last-known-good snapshot.
Write-RPC preflight failure rejects the submitted config and keeps both disk config and active runtime snapshot unchanged.
Providing an explicit per-call channel token to an outbound helper/tool call does not trigger SecretRef activation; activation points remain startup, reload, and explicit
text
secrets.reload
.
Degraded and recovered signals
When reload-time activation fails after a healthy state, OpenClaw enters degraded secrets state.
One-shot system event and log codes:
text
SECRETS_RELOADER_DEGRADED
text
SECRETS_RELOADER_RECOVERED
Behavior:
Degraded: runtime keeps last-known-good snapshot.
Recovered: emitted once after the next successful activation.
Repeated failures while already degraded log warnings but do not spam events.
Startup fail-fast does not emit degraded events because runtime never became active.
Command-path resolution
Command paths can opt into supported SecretRef resolution via gateway snapshot RPC.
There are two broad behaviors:
For example `openclaw memory` remote-memory paths and `openclaw qr --remote` when it needs remote shared-secret refs. They read from the active snapshot and fail fast when a required SecretRef is unavailable.
For example `openclaw status`, `openclaw status --all`, `openclaw channels status`, `openclaw channels resolve`, `openclaw security audit`, and read-only doctor/config repair flows. They also prefer the active snapshot, but degrade instead of aborting when a targeted SecretRef is unavailable in that command path.
text
Read-only behavior:
* When the gateway is running, these commands read from the active snapshot first.
* If gateway resolution is incomplete or the gateway is unavailable, they attempt targeted local fallback for the specific command surface.
* If a targeted SecretRef is still unavailable, the command continues with degraded read-only output and explicit diagnostics such as "configured but unavailable in this command path".
* This degraded behavior is command-local only. It does not weaken runtime startup, reload, or send/auth paths.
Other notes:
Snapshot refresh after backend secret rotation is handled by
text
openclaw secrets reload
.
Gateway RPC method used by these command paths:
text
secrets.resolve
.
Audit and configure workflow
Default operator flow:
Audit current state
```bash}
openclaw secrets audit --check
```
Configure SecretRefs
```bash}
openclaw secrets configure
```
Re-audit
```bash}
openclaw secrets audit --check
```
One-way safety policy
warning
OpenClaw intentionally does not write rollback backups containing historical plaintext secret values.
Safety model:
preflight must succeed before write mode
runtime activation is validated before commit
apply updates files using atomic file replacement and best-effort restore on failure
Legacy auth compatibility notes
For static credentials, runtime no longer depends on plaintext legacy auth storage.
Runtime credential source is the resolved in-memory snapshot.