← 返回
未分类 中文

ClawTrace

Trace and debug a single OpenClaw conversation session. Use when you need to analyze openclaw logs, correlate them with the current session context, inspect...
追踪并调试单个 OpenClaw 会话。用于分析 OpenClaw 日志、关联当前会话上下文、检查...
leoluo0814 leoluo0814 来源
未分类 clawhub v1.0.1 1 版本 100000 Key: 无需
★ 0
Stars
📥 403
下载
💾 0
安装
1
版本
#latest

概述

ClawTrace

ClawTrace 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.

When to Use

  • Inspect one OpenClaw session end to end
  • Explain slow, failed, retried, or noisy runs
  • Generate a structured session trace report
  • Produce evidence-based optimization suggestions

Core Rules

  1. Always analyze one session at a time.
  2. Always use both data sources before writing the report:
    • openclaw logs --json --local-time --no-color
    • current session context
  3. Never invent missing values. Use Not available, Estimated, or Unknown when needed.
  4. Prefer exact identifiers and timestamps over inferred values.
  5. Write the report in the user's language unless the user asks for another language.
  6. If the user's chat channel supports file sending, prefer delivering the report as a Markdown file; otherwise reply directly in chat using the same report structure.
  7. Do not output raw logs, raw JSON, or verbatim log lines in the final report.

Inputs

Logs

Use JSON logs so events can be parsed reliably.

openclaw logs --json --local-time --no-color
  • --limit to restrict line count
  • --max-bytes to avoid huge tails
  • --interval if polling is needed
  • --timeout if waiting for fresh output
  • --expect-final only when the task requires waiting for the final response

Context

Use 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.

Analysis Workflow

1: Identify the Target Session

  • sessionId
  • sessionKey
  • runId
  • channel
  • nearby timestamps
  • current-session clues

If multiple runs exist in the same session, prefer the latest completed run unless the user clearly points to a different one.

2: Extract Key Events

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.

3: Reconstruct Steps

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.

4: Compute Metrics

  • Session ID
  • Session Key
  • Run ID
  • Start and End Time
  • Total Duration
  • Step Count
  • Tool Count
  • Warning Count
  • Error Count
  • Module Count
  • Context Indicators
  • Token Indicators

Use exact values when present. Otherwise mark them as Estimated or Not available.

5: Produce Optimization Suggestions

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.

Output Format

If file sending is supported in the user's chat channel, prefer a Markdown file such as clawtrace-run-.md or clawtrace-report-.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.

Partial Data

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.

Noise Filtering

Ignore unrelated background noise such as cron timers, heartbeats, and unrelated channel traffic unless they materially affect the target session.

Quality Standard

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.

版本历史

共 1 个版本

  • v1.0.1 当前
    2026-05-07 07:35 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

it-ops-security

OpenClaw Backup

alex3alex
备份与恢复 OpenClaw 数据。适用于创建备份、设置自动备份计划、从备份恢复或管理备份轮转。处理 ~/.openclaw 目录归档并包含适当的排除规则。
★ 90 📥 31,045
it-ops-security

Free Ride - Unlimited free AI

shaivpidadi
管理OpenClaw的OpenRouter免费AI模型,自动按质量排名模型,配置速率限制备用方案,并更新opencla...
★ 471 📥 78,414
it-ops-security

1password

steipete
设置和使用 1Password CLI (op)。适用于:安装 CLI、启用桌面应用集成、登录(单/多账户)、通过 op 读取/注入/运行密钥。
★ 53 📥 31,703