Install
openclaw skills install @leoluo0814/clawtraceTrace and debug a single OpenClaw conversation session. Use when you need to analyze openclaw logs, correlate them with the current session context, inspect workflow steps, summarize module activity, or produce a structured trace report.
openclaw skills install @leoluo0814/clawtraceClawTrace analyzes one OpenClaw session at a time. It combines OpenClaw logs and current session context to reconstruct steps, summarize module activity, and generate a Markdown trace report.
openclaw logs --json --local-time --no-colorNot available, Estimated, or Unknown when needed.Use JSON logs so events can be parsed reliably.
openclaw logs --json --local-time --no-color
--limit <n> to restrict line count--max-bytes <n> to avoid huge tails--interval <ms> if polling is needed--timeout <ms> if waiting for fresh output--expect-final only when the task requires waiting for the final responseUse current session context to identify the target run and recover information not explicit in logs, such as request scope, recent responses, session clues, and context-size indicators.
sessionIdsessionKeyrunIdIf multiple runs exist in the same session, prefer the latest completed run unless the user clearly points to a different one.
Extract session, prompt, agent, tool, lane, context, warning, error, and related gateway events, and capture the key fields needed for analysis such as time, level, module, sessionID, runID, tool, toolCallID, duration, summary, and outcome.
Convert events into ordered steps such as queue, prompt, agent, tool, gateway, context, warn, error, and done.
When possible, pair start and end events to compute duration. If only one side exists, mark duration as Unknown.
Use exact values when present. Otherwise mark them as Estimated or Not available.
Only give evidence-based suggestions, such as duplicate tool calls, oversized context, repeated warnings, long tool durations, queue delays, or excessive gateway noise.
If there is no clear optimization opportunity, say that no evidence-backed optimization was found.
If file sending is supported in the user's chat channel, prefer a Markdown file such as clawtrace-run-<runId>.md or clawtrace-report-<timestamp>.md; otherwise return the same structure directly in chat.
Example Markdown output:
# ClawTrace Report
## Overview
Scope: RunId=<runId> or Message=<message>
Start: <start>
End: <end>
Total Tokens Used: <tokens>
Total Duration: <total_duration> (seconds)
Total Steps: <steps_count>
Tools Used: <tools_list> (separated by comma)
Warnings: <warn_count>
Errors: <error_count>
Generated at: <time>
Suggestions:
- <evidence-based suggestion>
- <evidence-based suggestion>
## Modules
| Module | Success | Warn | Error | Total Steps | Avg Time Cost | Notes |
| --- | ---: | ---: | ---: | ---: | --- | --- |
| <module> | <success> | <warn> | <error> | <total_steps> | <avg_time_cost> | <notes> |
## Steps
| Step | Time | Type | Module | Action | Duration | Result | Notes |
| ---: | --- | --- | --- | --- | --- | --- | --- |
| 1 | <time> | <type> | <module> | <action> | <duration> | <result> | <notes> |
| 2 | <time> | <type> | <module> | <action> | <duration> | <result> | <notes> |
Sort the Steps table strictly by time in ascending order. Use Success, Failed, Warning, or Unknown for Result, and do not include raw logs or raw JSON.
If the logs contain Log tail truncated (increase --max-bytes)., explicitly state that the report is based on partial logs.
Do not fabricate missing steps. Mark uncertain durations and metrics as Unknown, Estimated, or Not available.
Ignore unrelated background noise such as cron timers, heartbeats, and unrelated channel traffic unless they materially affect the target session.
The report should quickly show which session was analyzed, how long it took, what modules and steps were involved, where time went, what warnings or failures happened, and what to optimize next. If evidence is weak, say so clearly.