← 返回 Skills 市场
sinoslug

Token Stats Reporter

作者 sinoslug · GitHub ↗ · v1.3.0 · MIT-0
cross-platform ✓ 安全检测通过
155
总下载
0
收藏
0
当前安装
6
版本数
在 OpenClaw 中安装
/install token-stats-reporter
功能描述
Generate and append accurate token/cost statistics in replies with a reproducible local algorithm (snapshot+incremental log aggregation + dedupe). Use when u...
安全使用建议
This skill appears to do what it claims: it reads local conversation logs to compute token and cost stats and writes local state files. Before installing, verify (1) you are comfortable that the script will read your ~/.openclaw/agents/main/sessions logs (these contain user/assistant messages), (2) the hardcoded run path in SKILL.md matches your install location or update the invocation to the actual script path, (3) you are okay with the skill's fail-closed behavior (it can block sending messages if the script fails), and (4) you review the bundled script (it is local and contains no network calls). Consider testing in a non-production instance first and backing up session/state files.
功能分析
Type: OpenClaw Skill Name: token-stats-reporter Version: 1.3.0 The skill is a utility designed to aggregate and report token usage and costs by parsing local session logs. The Python script (`scripts/token-show.py`) implements an incremental aggregation algorithm that reads JSONL files from the agent's session directory (`~/.openclaw/agents/main/sessions/`), calculates statistics, and maintains state in a local JSON file to avoid redundant processing. The instructions in `SKILL.md` provide a clear workflow for the agent to append these statistics to its responses, including a 'fail-closed' validation gate to ensure reporting accuracy. The code uses only standard libraries, lacks network access, and contains no evidence of data exfiltration or malicious intent.
能力评估
Purpose & Capability
The skill's description (generate token/cost stats) matches its actions: it reads local session jsonl files and aggregates usage, and writes local state/counter files. Minor mismatch: SKILL.md tells the agent to run a hardcoded path (/home/admin/.openclaw/...), while the bundled script contains portable path-detection logic; this could cause the documented invocation to fail on systems where that exact path doesn't exist.
Instruction Scope
Instructions are narrow and specific: run the bundled Python script immediately before sending replies, append one exact token line, and fail-closed if the script fails. The script only reads local session logs (~/.openclaw/agents/main/sessions) and updates workspace/memory state. This is within scope for token reporting, but noteworthy because the skill will block sending messages if the script fails (operational impact) and it reads full conversation logs (sensitive data) — however it does not network-out or request extra credentials.
Install Mechanism
No install spec; skill is instruction-only with a bundled Python script. There are no network downloads or external package installs, and the script is present in the skill bundle. Low install risk.
Credentials
The skill requests no environment variables or credentials, which is appropriate. It does require read access to session log files (conversation transcripts) and write access to its own workspace/memory files — this access is necessary for its purpose but involves exposure of conversation contents, so consider privacy implications.
Persistence & Privilege
The skill does not request always:true and does not modify other skills. It writes state and counter files under its own workspace/memory directory (token-agg-state.json, token-counter.json), which is expected for aggregation state.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install token-stats-reporter
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /token-stats-reporter 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.3.0
Scheme-1 output labels: 本次总消耗/本次计费token/月累计总消耗; synced SKILL.md and reporter script
v1.2.0
**Changelog for token-stats-reporter v1.2.0** - Added "v1.2.0 Send Gate," enforcing strict validation steps before sending replies with token lines. - Now blocks sending if script fails or validation does not pass, disallowing handwritten token/cost stats. - Provides a standard fallback text when automatic stats are unavailable. - Updated documentation with the new validation workflow to ensure accuracy and consistency in token reporting.
v1.1.2
- Minor update only: documentation and metadata unchanged. - No functional changes introduced in this version.
v1.1.1
- Maintenance release with no user-facing changes. - Documentation and functionality remain the same.
v1.1.0
**Major update: New local aggregation algorithm and script path for precise, reproducible token/cost reporting.** - Bundled script (`scripts/token-show.py`) added, with all usage stats determined from local message logs. - Output format updated: now includes in/out tokens, cache reads, monthly statistics, costs, and model info. - Deduplication, stateful incremental aggregation, and robust file handling now mandated for all reporters. - Reliability and portability rules clarified for consistent deployment. - Documentation details exact workflow, data sources, and requirements.
v1.0.0
Initial release: standardized token stats output workflow
元数据
Slug token-stats-reporter
版本 1.3.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 6
常见问题

Token Stats Reporter 是什么?

Generate and append accurate token/cost statistics in replies with a reproducible local algorithm (snapshot+incremental log aggregation + dedupe). Use when u... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 155 次。

如何安装 Token Stats Reporter?

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

Token Stats Reporter 是免费的吗?

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

Token Stats Reporter 支持哪些平台?

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

谁开发了 Token Stats Reporter?

由 sinoslug(@sinoslug)开发并维护,当前版本 v1.3.0。

💬 留言讨论