Debugging helpers for streaming output, especially when a provider mixes reasoning into normal text.Documentation Index
Fetch the complete documentation index at: https://docs.openclaw.ai/llms.txt
Use this file to discover all available pages before exploring further.
Runtime debug overrides
Use/debug in chat to set runtime-only config overrides (memory, not disk).
/debug is disabled by default; enable with commands.debug: true.
This is handy when you need to toggle obscure settings without editing openclaw.json.
Examples:
/debug reset clears all overrides and returns to the on-disk config.
Session trace output
Use/trace when you want to see plugin-owned trace/debug lines in one session
without turning on full verbose mode.
Examples:
/trace for plugin diagnostics such as Active Memory debug summaries.
Keep using /verbose for normal verbose status/tool output, and keep using
/debug for runtime-only config overrides.
Plugin lifecycle trace
UseOPENCLAW_PLUGIN_LIFECYCLE_TRACE=1 when plugin lifecycle commands feel slow
and you need a built-in phase breakdown for plugin metadata, discovery, registry,
runtime mirror, config mutation, and refresh work. The trace is opt-in and writes
to stderr, so JSON command output remains parseable.
Example:
node dist/entry.js ... after pnpm build; pnpm openclaw ...
also measures source-runner overhead.
Temporary CLI debug timing
OpenClaw keepssrc/cli/debug-timing.ts as a small helper for local
investigation. It is intentionally not wired into CLI startup, command routing,
or any command by default. Use it only while debugging a slow command, then
remove the import and spans before landing the behavior change.
Use this when a command is slow and you need a quick phase breakdown before
deciding whether to use a CPU profiler or fix a specific subsystem.
Add temporary spans
Add the helper near the code you are investigating. For example, while debuggingopenclaw models list, a temporary patch in
src/commands/models/list.list-command.ts might look like this:
- Prefix temporary phase names with
debug:. - Add only a few spans around suspected slow sections.
- Prefer broad phases such as
registry,auth_store, orrowsover helper names. - Use
time()for synchronous work andtimeAsync()for promises. - Keep stdout clean. The helper writes to stderr, so command JSON output stays parseable.
- Remove temporary imports and spans before opening the final fix PR.
- Include the timing output or a short summary in the issue or PR that explains the optimization.
Run with readable output
Readable mode is best for live debugging:models list investigation:
| Phase | Time | What it means |
|---|---|---|
debug:models:list:auth_store | 20.3s | The auth-profile store load is the largest cost and should be investigated first. |
debug:models:list:ensure_models_json | 5.0s | Syncing models.json is expensive enough to inspect for caching or skip conditions. |
debug:models:list:load_model_registry | 5.9s | Registry construction and provider availability work are also meaningful costs. |
debug:models:list:read_registry_models | 2.4s | Reading all registry models is not free and may matter for --all. |
| row append phases | 3.2s total | Building five displayed rows still takes several seconds, so the filtering path deserves a closer look. |
debug:models:list:print_model_table | 0ms | Rendering is not the bottleneck. |
Run with JSON output
Use JSON mode when you want to save or compare timing data:Clean up before landing
Before opening the final PR:--cpu-prof) or an external
profiler instead of adding more timing wrappers.
Gateway watch mode
For fast iteration, run the gateway under the file watcher:src/, extension source files,
extension package.json and openclaw.plugin.json metadata, tsconfig.json,
package.json, and tsdown.config.ts. Extension metadata changes restart the
gateway without forcing a tsdown rebuild; source and config changes still
rebuild dist first.
Add any gateway CLI flags after gateway:watch and they will be passed through on
each restart. Re-running the same watch command for the same repo/flag set now
replaces the older watcher instead of leaving duplicate watcher parents behind.
Dev profile + dev gateway (—dev)
Use the dev profile to isolate state and spin up a safe, disposable setup for debugging. There are two--dev flags:
- Global
--dev(profile): isolates state under~/.openclaw-devand defaults the gateway port to19001(derived ports shift with it). gateway --dev: tells the Gateway to auto-create a default config + workspace when missing (and skip BOOTSTRAP.md).
pnpm openclaw ....
What this does:
-
Profile isolation (global
--dev)OPENCLAW_PROFILE=devOPENCLAW_STATE_DIR=~/.openclaw-devOPENCLAW_CONFIG_PATH=~/.openclaw-dev/openclaw.jsonOPENCLAW_GATEWAY_PORT=19001(browser/canvas shift accordingly)
-
Dev bootstrap (
gateway --dev)- Writes a minimal config if missing (
gateway.mode=local, bind loopback). - Sets
agent.workspaceto the dev workspace. - Sets
agent.skipBootstrap=true(no BOOTSTRAP.md). - Seeds the workspace files if missing:
AGENTS.md,SOUL.md,TOOLS.md,IDENTITY.md,USER.md,HEARTBEAT.md. - Default identity: C3‑PO (protocol droid).
- Skips channel providers in dev mode (
OPENCLAW_SKIP_CHANNELS=1).
- Writes a minimal config if missing (
--dev is a global profile flag and gets eaten by some runners. If you need to spell it out, use the env var form:--reset wipes config, credentials, sessions, and the dev workspace (using
trash, not rm), then recreates the default dev setup.
Raw stream logging (OpenClaw)
OpenClaw can log the raw assistant stream before any filtering/formatting. This is the best way to see whether reasoning is arriving as plain text deltas (or as separate thinking blocks). Enable it via CLI:~/.openclaw/logs/raw-stream.jsonl
Raw chunk logging (pi-mono)
To capture raw OpenAI-compat chunks before they are parsed into blocks, pi-mono exposes a separate logger:~/.pi-mono/logs/raw-openai-completions.jsonl
Note: this is only emitted by processes using pi-mono’s
openai-completions provider.
Safety notes
- Raw stream logs can include full prompts, tool output, and user data.
- Keep logs local and delete them after debugging.
- If you share logs, scrub secrets and PII first.