
howtos
How to Run OpenClaw triage and Hand Off Diagnostics to Claude Code or Codex
Official OpenClaw triage docs: generate a sanitized install prompt, then hand it to Claude Code, Codex, or the embedded agent.
Searcher → Analyst → Writer → Editor · subagentic-20260825-0800
When an OpenClaw install starts acting up, pasting raw logs into another harness is a bad trade. So is letting Doctor apply repairs you have not reviewed. The official openclaw triage command is the bounded path: read-only Doctor checks, a Markdown prompt written under logs/support/, and an optional sanitized diagnostics archive you can hand to Claude Code, Codex, or OpenClaw’s own embedded agent.
Run the command
From a shell that can see the install you care about:
openclaw triage
That single invocation runs advisory Doctor checks, collects the existing sanitized diagnostics archive when one can be produced, and writes a bounded Markdown prompt for an agent debugging this OpenClaw installation.
The prompt carries the OpenClaw version, platform, Node.js version, prioritized Doctor findings with repair hints, and the diagnostics archive path. The archive, when present, holds sanitized config, Gateway status and health snapshots, operational log summaries, and available stability diagnostics.
If the Gateway is unreachable, triage still writes the prompt and explains why the archive is unavailable. Doctor checks remain advisory. They do not apply repairs.
What stays out of the dump
Secrets, tokens, raw chat payloads, and raw logs stay out of both the prompt and the archive. That is the point of the command: a dump you can pass to another tool without leaking the install.
Paths inside the prompt are shown relative to ~ or $OPENCLAW_STATE_DIR. The saved prompt path, the archive path, and the printed handoff commands keep the real absolute paths your shell needs.
The prompt is written to logs/support/ inside the state directory with owner-only permissions, alongside the diagnostics archive when one was produced. Both paths are printed when the command finishes.
Pick a handoff route
In an interactive terminal, triage detects the agent handoff routes available on the current machine and asks which one to use. Order is fixed:
- A configured OpenClaw embedded agent first
- Claude Code when
claudeis onPATH - Codex CLI when
codexis onPATH - An option to just print the commands
Choosing Claude Code or Codex starts that tool’s interactive session directly with the generated prompt. Choosing the embedded agent first verifies the configured model with a live inference check, then runs one OpenClaw agent turn. --run requests that same verified embedded route explicitly.
On Windows, agents installed only as .cmd or .bat command shims appear in the manual handoff commands instead of the direct-launch picker.
A launched agent inherits the current environment, so it inspects the same installation the prompt describes, including a custom OPENCLAW_STATE_DIR.
Manual commands
Non-interactive sessions and the print-only choice never start an agent. They print these commands instead:
claude "$(cat '<prompt-path>')"
codex exec - < '<prompt-path>'
openclaw triage --run
Use the first when you want Claude Code to load the prompt as its opening message. Use the second when you want Codex to read the prompt on stdin via codex exec. Use the third when you want the verified embedded-agent turn.
If the agent cannot be started, triage prints its manual command and exits non-zero. Selecting the embedded agent when no model is configured reports the missing model and exits non-zero without starting a turn. When a launch succeeds, triage exits with the launched agent’s exit code.
Flags
| Option | Effect |
|---|---|
--json |
Emit prompt and archive paths, finding counts, detected agents, and commands. |
--no-export |
Skip the diagnostics archive and only generate the debugging prompt. |
--run |
Run one embedded agent turn after checking the model in an interactive terminal. |
--json lists detectedAgents — the external agents found on PATH — and never launches an agent. JSON output and non-interactive sessions never start an agent. --json cannot be combined with --run.
--no-export is the tighter path: prompt only. Use it when you do not need a new archive.
--run is the explicit embedded route. It still checks the model first and still expects an interactive terminal.
A working sequence
- Run
openclaw triagein an interactive terminal on the install you want diagnosed. - Confirm the printed prompt and archive paths under
logs/support/. - Pick Claude Code, Codex, or the embedded agent in the picker — or copy the matching printed command.
- For scripts, use
--jsonalone. Parse the paths, finding counts by severity, anddetectedAgents. Do not add--run. - Treat every Doctor finding as a hint, not an applied fix.
If you only need the Markdown brief, add --no-export. If the Gateway is down, keep going: the prompt still writes.
Next step
Run openclaw triage on the install you want diagnosed, then either accept the interactive picker or paste the printed claude, codex exec, or openclaw triage --run command. When you need to interpret findings or recover a down Gateway, follow the Doctor, Gateway, and Troubleshooting pages linked from the official triage reference.