← 返回 Skills 市场
ashishjaingithub

Clawdoc

作者 Ashish Jain · GitHub ↗ · v0.12.0 · MIT-0
cross-platform ✓ 安全检测通过
193
总下载
0
收藏
1
当前安装
2
版本数
在 OpenClaw 中安装
/install clawdoc
功能描述
Diagnose OpenClaw agent failures, cost spikes, and performance issues with 14 pattern detectors. Use when: task failed unexpectedly, costs seem high, agent b...
使用说明 (SKILL.md)

clawdoc

Examine agent sessions. Diagnose failures. Prescribe fixes.

Invocation modes

/clawdoc (slash command — default: headline mode)

Produces a compact, tweetable health check:

🩻 clawdoc — 3 findings across 12 sessions (last 7 days)
💸 $47.20 spent — $31.60 was waste (67% recoverable)
🔴 Retry loop on exec burned $18.40 in one session
🟡 Opus running 34 heartbeats ($8.20 → $0.12 on Haiku)
🟡 SOUL.md is 9,200 tokens — 14% of your context window

Run: bash {baseDir}/scripts/headline.sh ~/.openclaw/agents/main/sessions

/clawdoc full or "give me a full diagnosis"

Runs all 14 pattern detectors and produces the complete diagnosis report with evidence and prescriptions.

/clawdoc brief or "clawdoc one-liner for daily brief"

Single-line summary for morning cron integration:

Yesterday: 8 sessions, $3.40, 1 warning (cron context growth on daily-report)

Run: bash {baseDir}/scripts/headline.sh --brief ~/.openclaw/agents/main/sessions

Natural language triggers

Also activates when user says: "what went wrong", "why did that fail", "debug", "diagnose", "why was that so expensive", "where are my tokens going", "cost breakdown", "health check", "check my agent", "what's wrong", "examine"

Quick examination — most recent session

Find the most recent session file and run:

bash {baseDir}/scripts/examine.sh \x3Csession.jsonl>

This outputs a JSON summary with turns, cost, token counts, tool call frequency, and error count.

Single-session diagnosis

Run all 14 pattern detectors against a specific session file:

bash {baseDir}/scripts/diagnose.sh \x3Csession.jsonl> | jq .

Diagnosis with prescriptions

Pipe diagnose output into prescribe for a formatted report with fix recommendations:

bash {baseDir}/scripts/diagnose.sh \x3Csession.jsonl> | bash {baseDir}/scripts/prescribe.sh

Cost breakdown

Show per-turn cost waterfall for a session:

bash {baseDir}/scripts/cost-waterfall.sh \x3Csession.jsonl> | jq '.[0:5]'

Cross-session pattern recurrence

Analyze pattern recurrence across multiple sessions in a directory:

bash {baseDir}/scripts/history.sh \x3Csessions-dir> | jq .

Full diagnosis

When the user wants a comprehensive diagnosis, run the scripts above and synthesize findings into this report format:

Diagnosis report format

## 🩻 Diagnosis — [date]

### Patient summary
- Sessions examined: N
- Period: [date range]
- Total spend: $X.XX
- Total tokens: XXk in / XXk out

### Findings

#### 🔴 Critical
[Infinite retry loops, context exhaustion, tool-as-text failures]
Each finding includes: what happened, evidence, estimated cost impact, and specific prescription.

#### 🟡 Warning
[Cost spikes, model routing waste, cron accumulation, compaction damage, workspace overhead]

#### 🟢 Healthy
[What's working well — efficient sessions, good model routing]

### Prescriptions (ranked by cost impact)
1. [Highest-impact fix with specific config change or command]
2. [Second highest]
3. [Third]

### Cost breakdown
[Per-day costs for the examination period]
[Top 3 most expensive sessions with root cause]

Pattern reference

# Pattern Severity Key indicator
1 Infinite retry loop 🔴 Critical Same tool called 5+ times consecutively
2 Non-retryable error retried 🔴 High Validation error → identical retry
3 Tool calls as text 🔴 High Tool names in assistant text, no toolCall blocks
4 Context window exhaustion 🟡-🔴 inputTokens > 70% of contextTokens
5 Sub-agent replay 🟡 Medium Duplicate completion messages in parent
6 Cost spike 🟡-🔴 Session cost > 2x rolling average
7 Skill selection miss 🟢 Low "command not found" after skill activation
8 Model routing waste 🟡 Medium Premium model on heartbeat/cron
9 Cron context accumulation 🟡 Medium Growing inputTokens across cron runs
10 Compaction damage 🟡 Medium Post-compaction tool call repetition
11 Workspace token overhead 🟡 Medium Baseline > 15% of context window
12 Task drift 🟡 Medium Post-compaction directory divergence or 10+ reads without edits
13 Unbounded walk 🟠 High Repeated unscoped find/grep -r flooding output
14 Tool misuse 🟡 Medium Same file read 3+ times without edit, or identical search repeated

Self-improving-agent integration

To enable writing findings to .learnings/LEARNINGS.md, set CLAWDOC_LEARNINGS=1 before running prescribe:

CLAWDOC_LEARNINGS=1 bash {baseDir}/scripts/diagnose.sh \x3Csession.jsonl> | bash {baseDir}/scripts/prescribe.sh

Tips

  • Session JSONL files are the ground truth for all diagnostics
  • Use jq -s (slurp) for aggregations across all lines in a session file
  • Filter message.content[] by type=="text" for readable content, type=="toolCall" for tool invocations
  • When prescribing config changes, always show the exact JSON path and value
安全使用建议
This appears to be a legitimate local diagnostics skill. Before running it: (1) Inspect the scripts (they are plain shell + jq) and confirm you trust them in your environment. (2) Run the demo (generate-demo.sh) to see behavior on synthetic data. (3) When diagnosing real sessions, supply explicit paths (avoid passing / or other broad roots to convert or headline scripts). (4) Only set CLAWDOC_LEARNINGS=1 if you want findings written into a local .learnings/LEARNINGS.md file. (5) Ensure dependencies (jq, bash, bc) are installed and run the test suite (make test) if you want extra assurance.
功能分析
Type: OpenClaw Skill Name: clawdoc Version: 0.12.0 clawdoc is a professional-grade diagnostic utility for OpenClaw agent sessions, designed to identify 14 specific failure patterns such as infinite retry loops, cost spikes, and task drift. The bundle consists of a suite of shell scripts (e.g., diagnose.sh, prescribe.sh, headline.sh) that process JSONL session logs using jq and awk. The codebase demonstrates high engineering standards, including a robust test suite of 57 tests, comprehensive documentation (README.md, CLAUDE.md), and defensive scripting practices like avoiding eval, quoting variables, and using mktemp for cleanup. There are no indicators of data exfiltration, malicious persistence, or unauthorized remote execution; the tool's functionality is strictly limited to local log analysis and reporting.
能力评估
Purpose & Capability
Name/description match the requested binaries (bash, jq, bc) and the provided scripts implement 14 detectors for JSONL agent sessions. Nothing requested (no cloud credentials, no unusual binaries) appears unrelated to a local diagnostics tool.
Instruction Scope
SKILL.md instructs running local scripts against explicit session JSONL files or a user-provided sessions directory. The tool only reads session files, produces JSON findings, and — only if opt-in via CLAWDOC_LEARNINGS=1 — writes a local .learnings/LEARNINGS.md file. There are no instructions to contact external endpoints, harvest unrelated config, or automatically search system paths without explicit user input. Note: helper/dev scripts (e.g., convert-claude-sessions.sh) will scan an input directory you provide and may run find/grep on paths you pass — review the path you give to avoid scanning sensitive large trees.
Install Mechanism
No install spec is provided (instruction-only install), and there are no downloads or remote installers referenced. Code is shipped as shell scripts in the package; risk is limited to running those scripts locally. No extract-from-URL or third-party package installs are present.
Credentials
The skill requires no environment variables or credentials to run. The only optional environment flag (CLAWDOC_LEARNINGS=1) enables a local write to .learnings/LEARNINGS.md and is opt-in. No secrets or unrelated environment/config paths are requested.
Persistence & Privilege
always is false and the skill is user-invocable. It does not request persistent platform privileges or modify other skills. The only persistence is an opt-in local write when CLAWDOC_LEARNINGS is set; scripts otherwise operate on files you explicitly pass.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install clawdoc
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /clawdoc 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v0.12.0
Security hardening: removed eval, inline bash from SKILL.md, moved dev tooling out of shipped dirs, gated file writes behind opt-in env var. All diagnostics route through hardened scripts requiring explicit user-provided paths.
v0.11.1
Initial public release
元数据
Slug clawdoc
版本 0.12.0
许可证 MIT-0
累计安装 1
当前安装数 1
历史版本数 2
常见问题

Clawdoc 是什么?

Diagnose OpenClaw agent failures, cost spikes, and performance issues with 14 pattern detectors. Use when: task failed unexpectedly, costs seem high, agent b... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 193 次。

如何安装 Clawdoc?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install clawdoc」即可一键安装,无需额外配置。

Clawdoc 是免费的吗?

是的,Clawdoc 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Clawdoc 支持哪些平台?

Clawdoc 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Clawdoc?

由 Ashish Jain(@ashishjaingithub)开发并维护,当前版本 v0.12.0。

💬 留言讨论