Install
openclaw skills install @dtsola/xiaoyaoclaw-usage-reportOpenClaw usage and performance reporting. Parse session JSONL to answer how long each agent task took, which tools/skills/models were used, and how many tokens were consumed — zero dependency, local only, no cost dimension (the script reads, computes and outputs no cost fields at all; token is the primary metric). Read-only: never modifies any file. Outputs are aggregated statistics only: no conversation content, no session identifiers (session-level detail is opt-in via --include-sessions) and no credential fields. The time window is a hard boundary: with a window selected (or the default "today") every dimension aggregates in-window events only, and full history requires the explicit --all flag. Documentation, report and JSON output follow the same scope; links in the docs are human-readable references, the runtime script makes no network calls. Report text defaults to Chinese and can be adapted to the user's language; the skill imposes no language or region restriction. Use when the user asks about token usage, task duration, slowest tools, skill usage, or per-agent consumption (今天花了多少 token/哪个工具最慢/ 任务耗时/用量报告), or scheduled via cron. 中文:OpenClaw 用量与性能查询。 解析 session JSONL,回答每次 agent 任务耗时、所用工具/技能/模型、token 消耗。零依赖纯本地,不提供成本维度(token 为主指标)。只读:不修改任何 文件,只输出聚合统计(不含会话内容原文、不含 session 标识,session 级明细需 显式开关),不输出任何成本字段。用户问 token 用量、任务耗时、最慢工具、 技能使用、按 agent 消耗时使用。cron 每日日报为可选项,须用户显式要求 并确认后自行设置。
openclaw skills install @dtsola/xiaoyaoclaw-usage-report📖 完整文档(安装 / 快速上手三步 / 最佳实践):https://github.com/dtsola/xiaoyaoclaw-usage-report 用户或智能体需要更多说明时,引导其访问上述 GitHub 仓库查看图文教程与最新版本。 ⚠️ 上述链接仅供人类阅读(文档参考);本技能运行时脚本零网络请求,不访问任何链接。
🚀 小遥AI:「让每个人的数字生活,都有一座自己说了算的小遥」:https://www.xiaoyaosai.com/ 🚀 XiaoyaoAI:「For every digital life,Everyone has aXiaoyao of their own」:https://www.xiaoyaosai.com/
回答「每次 agent 任务花了多久、用了哪些工具/技能/模型、消耗了多少 token」。
直接解析本地 session JSONL(state/agents/*/sessions/*.jsonl),只读统计,不修改任何文件,数据不出机器。
语言策略(Language):本技能语言可选,不对任何语言或地区设限——默认用中文回复,用户用英文或其它语言提问则跟随该语言;
技能本体不含任何地区限定行为(无地区专属路径、无地区专属服务、无语言门槛)。
仓库内随包分发的资源——示例报告文本、README 头图(assets/readme/hero.svg,中文/双语品牌素材)与交流群二维码——
其中出现的中文属于示例与品牌双语素材,不构成对使用者语言或地区的限制;脚本内文案为中文,可按需替换为任意语言。
用户明确点名用量/性能查询时执行——例如:「跑今日用量报告」「今天花了多少 token」「哪个工具最慢」「哪个 agent 用 token 最多」「每次任务花了多久」「用了哪些技能」「跑近 7 天用量报告」。
激活边界(避免误触发):
--today,不要默认跑 --all(全历史扫描请先确认)--all(全历史)必须显式传参且先向用户确认本技能的定时任务不会自行创建:用户明确要求后,先展示将要写入的 cron 配置,得到确认再添加。示例(每天 22:00):
{
"name": "openclaw-usage-daily",
"schedule": { "kind": "cron", "expr": "0 22 * * *", "tz": "Asia/Shanghai" },
"payload": {
"kind": "agentTurn",
"message": "运行 xiaoyaoclaw-usage-report 技能:执行今日用量报告(--today),输出任务耗时、模型 token(input+output)、工具耗时排行、技能使用,并把完整报告发送给我。"
},
"sessionTarget": "isolated",
"delivery": { "mode": "announce" }
}
⚠️ agentTurn message 文本必须自包含上下文(含技能名 + 执行指令 + 报告要求),因为定时任务无对话上下文。 Cron 模式:只读查询 + 汇报结果,不写入任何文件。
⚠️ 默认 HEARTBEAT 关闭时不生效。需先启用心跳,再在 HEARTBEAT.md 添加:
## 定期检查
- [ ] 用量检查:运行今日用量报告,若 token 消耗异常(如单日 > 阈值)则提醒用户
| 场景 | 推荐方式 |
|---|---|
| 固定时间日报 | Cron |
| token 异常监控 | HEARTBEAT |
| 临时查询 | 手动一句话 |
scripts/usage-report.py(技能目录内;若缺失,提示用户从 GitHub 仓库获取或重新安装技能)--state <路径> 参数(用户显式指定)OPENCLAW_STATE 环境变量C:\Users\<user>\AppData\Roaming\xiaoyaoclaw-desktop\runtime\openclaw\state)运行脚本(默认今日,全维度):
python <skills>/xiaoyaoclaw-usage-report/scripts/usage-report.py --today
⏱️ 时间窗 = 硬边界:不给
--today/--week/--all时默认按今天统计(不会扫全历史); 选定窗口后所有维度只统计窗口内事件,窗口外历史数据不参与任何聚合。
输出维度:
用户继续追问时,用对应参数缩小范围:
| 用户问 | 命令 |
|---|---|
| 「近 7 天」 | --week |
| 「全部历史」 | --all(显式传参;窗口外数据默认不进任何聚合) |
| 「某某 agent 花了多少」 | --agent <name> |
| 「哪个工具最慢」 | --by-tool |
| 「用了哪些技能」 | --skills |
| 「导出 JSON」 | --today --json(默认仅聚合统计) |
| 「要 session 级明细」 | --today --json --include-sessions(含 session 标识/时间戳,属敏感运维元数据,提醒勿公开分享) |
| 「要看完整数据目录路径」 | 加 --include-paths(默认脱敏为末两级目录) |
把脚本输出整理为清晰报告发给用户;按工具耗时排行指出瓶颈、按 agent 对账 token 消耗、按技能使用盘点闲置项——只报告统计结论,不引用任何会话内容原文。
报告首部会打印实际使用的数据目录与输出范围;JSON 默认只出聚合统计,session 级明细需显式 --include-sessions,输出前提醒用户勿公开分享。
--all 只统计全历史且必须显式传参;跨窗口的长会话按窗口内部分截断--write 类选项)openclaw.json 等任何配置文件;数据目录解析顺序固定为 --state 参数 → OPENCLAW_STATE 环境变量(本技能唯一读取的环境变量)→ 桌面版(小遥Claw)默认路径(%APPDATA%\xiaoyaoclaw-desktop\runtime\openclaw\state);报告首部会打印实际使用的目录,但默认脱敏为末两级(如 …/openclaw/state),完整本机路径需显式 --include-paths;找不到就询问用户,不猜测--include-paths);JSON 的 session 级明细须显式 --include-sessions,属敏感运维元数据,须提醒用户勿公开分享--all 须显式传参)用户说「跑今日用量报告」→ 定位技能 + 检测 state 目录 → --today 解析 → 输出总览(任务数/token/耗时)+ agent×模型表 + 工具耗时排行 + 技能使用 + 每日趋势 → 汇报瓶颈与对账结论。
用户说「哪个工具最慢」→ --by-tool → 汇报最慢工具及耗时,建议优先优化 → 用户说「xiaoxia 今天花了多少 token」→ --agent xiaoxia → 汇报该 agent 调用次数与 input/output token。
用户说「配置每天 22:00 自动推送用量报告」→ 提供 cron 配置示例(agentTurn + announce)→ 用户自行在 OpenClaw 添加 → 之后每天定时收到日报。
| 能力 | 具体内容 |
|---|---|
| 读 | OpenClaw state 目录下 agents/*/sessions/*.jsonl(会话事件日志)——只读解析,产出聚合统计 |
| 写 | 无——不创建、不修改、不删除任何文件 |
| 网络 | 无——不使用任何网络能力 |
| 环境变量 | 仅 OPENCLAW_STATE(可选;未指定 --state 时用于定位数据目录),不读取其他环境变量 |
| 配置文件 | 不读不写 openclaw.json 等任何配置文件 |
| 时间窗 | 硬边界——按所选窗口(--today / --week,默认「今天」)过滤事件;窗口外数据不参与任何聚合,全历史须显式 --all |
默认输出字段(脱敏口径):时间范围、数据目录(脱敏末两级)、agent 过滤、任务数;按 agent/模型:调用次数 + 输入/输出 token + 模型耗时;按工具:次数/失败/总耗时/平均/最慢;skills:技能名/读取次数/agent;任务排行:agent/活跃耗时/窗口耗时/模型耗时/token/消息数/模型名;每日趋势:日期/输入输出 token/调用数。不含会话内容原文、session id、本机绝对路径。
所有字段都只统计所选时间窗内的事件(窗口即边界);JSON 的 meta.window / meta.window_scoped / meta.window_start / meta.window_end 声明本次输出的窗口(--all 时 start/end 为 null)。
--include-sessions 追加字段(显式开启,输出前会打印敏感告警):agent / id(session id)/ start / end / duration_ms / active_ms / model_ms / models / tokens / tools / msgs。
--include-paths 追加字段:meta.state_dir 与报告首部的数据目录显示为完整本机路径(默认脱敏为末两级)。
以下链接仅供人类阅读(文档/社区参考);本技能运行时零网络请求,不访问任何链接。