agentleFS
YorkWong1995YorkWong1995/OPC-Harness/.claude/skills/token-report/SKILL.md

token-report

Skill4 starsChanged 6 months agoMITView on GitHub

Read OPC run artifacts and summarize token, API call, duration, and cost-related usage without invoking models or tools.

3 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions3 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 3

    1. codewithmukesh/dotnet-claude-kit★ 808same name
    2. Arylmera/Geneseed★ 1same name
    3. sarveshtalele/devcrew★ 1same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository7 other files it gives its agents.

The file

Files
SKILL.md

token-report

只读分析 OPC run artifacts,基于 run_metrics.json、run_trace.json 和 run_events.jsonl 汇总 token、API 调用、耗时和成本相关字段;不得重新调用模型、工具或触发新的 workflow。

用法

/token-report <latest run 或 artifacts 路径>

目标

  • 汇总单次 run 的 input/output tokens、api_calls 和 duration
  • 展示分阶段消耗和最高消耗阶段
  • 标记异常项、缺失字段或旧 metrics 兼容情况
  • 给出不改变代码的成本/上下文优化建议

适用场景

  • 需要解释一次 workflow run 的 token 和调用消耗
  • 需要对比阶段消耗,定位高成本阶段
  • 需要检查 run artifacts 是否包含足够的 metrics 字段
  • 需要为后续 cost trend 或优化任务提供只读证据

不适用场景

  • 重新执行 workflow 或模型调用
  • 修改 artifacts、代码或配置
  • 代替真实账单或供应商计费记录
  • 对缺失 metrics 做无依据估算

输出字段模板

字段应优先直接对应 run_metrics.json 的现有或计划字段;字段缺失时标注为“缺失”:

字段来源输出要求
run_idrun_trace.json 或 artifacts 路径标识本次 run
input_tokensrun_metrics.json.totals.input_tokens输出总输入 token
output_tokensrun_metrics.json.totals.output_tokens输出总输出 token
api_callsrun_metrics.json.totals.api_calls输出 API 调用总数
duration_secondsrun_metrics.json.totals.duration_seconds输出总耗时
stage_usagerun_metrics.json.stages按 stage 列出 tokens、api_calls、duration、model、estimated_cost
highest_usage_stagestage_usage 派生标出 token 或 cost 最高阶段
estimated_costrun_metrics.json.totals.estimated_cost仅在 artifacts 已存在时输出
currencyrun_metrics.json.totals.currency缺失时标注不适用
pricing_sourcerun_metrics.json.totals.pricing_source说明价格来源或缺失
anomaliesmetrics/trace/events 对比标记缺字段、异常耗时、异常调用数
optimization_suggestions分阶段消耗派生给出证据驱动的优化建议

执行规则

  1. 只读取用户指定或 latest run 的 artifacts。
  2. 不调用模型、不执行 workflow、不修改 run 文件。
  3. 缺失字段必须标记为“缺失”或“不适用”,不得猜测。
  4. 成本字段只能按 artifacts 中已有或配置中声明的估算字段说明。
  5. 优化建议必须对应可观察消耗,不提出无证据的大范围重构。

示例

  • /token-report latest run
  • /token-report artifacts/runs/20260526-120000/run_metrics.json

报告骨架

[分析对象] latest / 指定 artifacts 路径
[读取 artifacts]
- run_metrics.json:存在 / 缺失
- run_trace.json:存在 / 缺失
- run_events.jsonl:存在 / 缺失
[总量]
- input_tokens:...
- output_tokens:...
- api_calls:...
- duration_seconds:...
- estimated_cost:...
- currency:...
- pricing_source:...
[分阶段消耗]
- stage:model / input_tokens / output_tokens / api_calls / duration_seconds / estimated_cost
[最高消耗阶段]
- token 最高:...
- cost 最高:...
[异常项]
- ...
[优化建议]
- ...
[结论] ...

验收标准

  • 示例覆盖 latest run 和指定 artifacts 路径两种用法
  • 报告骨架包含读取 artifacts 状态、总量、分阶段消耗、最高消耗阶段、异常项和优化建议
  • 缺失 metrics 字段必须标注为缺失或不适用
  • 不触发模型、工具、workflow 或 artifacts 写入

输出骨架

[分析对象] ...
[读取 artifacts] run_metrics.json / run_trace.json / run_events.jsonl
[总量] input_tokens / output_tokens / api_calls / duration / estimated_cost / currency / pricing_source
[分阶段消耗]
- stage: model / input_tokens / output_tokens / api_calls / duration / estimated_cost
[最高消耗阶段] stage / 指标 / 数值
[异常项] ...
[优化建议] ...
[结论] ...

验收

  • 明确只读 artifacts,不重新调用模型或工具
  • 覆盖 run_metrics.json、run_trace.json、run_events.jsonl 三类输入
  • 输出包含总量、分阶段消耗、异常项和优化建议
  • 对缺失字段或旧 metrics 有兼容说明

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.