← Back to Skills Marketplace
zhouhaoyong

Agent Usage Stats

by zhouhaoyong · GitHub ↗ · v2.1.3 · MIT-0
cross-platform ✓ Security Clean
100
Downloads
0
Stars
0
Active Installs
23
Versions
Install in OpenClaw
/install agent-usage-stats
Description
选择要监控的 AI 助手 → 查看 token 消耗。支持 Hermes / Claude Code / CodeX / OpenClaw,每次都让你选
README (SKILL.md)

token-stats — 选个 Agent 看它的消耗

核心原则

  1. 每次运行都弹菜单 — 你想看哪个 Agent 就选哪个,不预设
  2. 数据来自本地 — 不联网,纯读你的 Agent 本地数据文件
  3. 零依赖 — 纯 Python 标准库,装完即用

前置条件

  • Python 3.8+
  • 至少一种 Agent 有使用记录:Hermes / Claude Code / CodeX / OpenClaw
  • 安装方式:clawhub install agent-usage-stats,然后 python3 ~/skills/agent-usage-stats/token-stats.py setup

用法速查

# 交互式菜单(默认)
token-stats

# 跳过菜单直接看
token-stats -b hermes
token-stats -b claude-code
token-stats -b codex

# 实时监控
token-stats --watch
token-stats -b hermes --watch

# 查看本机装了哪些 Agent
token-stats --list-backends

# 查看版本
token-stats --version

Hermes 集成

Hermes 的 SKILL.md 里可以这样用:

run: token-stats -b hermes

这样每次任务结束会自动输出 Hermes 的 token 消耗,不弹菜单。

数据源说明

Agent 数据读哪里
Hermes ~/.hermes/state.db → sessions 表
Claude Code ~/.claude/projects/**/*.jsonl
CodeX ~/.codex/state_*.sqlite → threads 表
OpenClaw ~/ai-testing-lab/openclaw/data/.../sessions.json
Usage Guidance
Before installing, understand that this tool reads local AI-assistant logs and state files to calculate usage, and its setup creates a persistent `token-stats` command. The documented behavior is coherent and local-only, but verify the installed version because the bundled files show some version drift.
Capability Tags
cryptocan-make-purchases
Capability Assessment
Purpose & Capability
The purpose is coherent: it reports token usage for Hermes, Claude Code, CodeX, and OpenClaw. It necessarily reads local agent state/log files, which may contain sensitive session metadata even though the advertised output is usage statistics.
Instruction Scope
Usage is mostly user-directed through a menu or explicit backend flags. The optional Hermes integration can run automatically after tasks, but the documented action is limited to printing token usage.
Install Mechanism
There is no install spec, but the README instructs the user to run a Python setup command that creates a global wrapper. This is disclosed and purpose-aligned, though Python/setup requirements are not fully reflected in registry requirements.
Credentials
The skill’s file access is scoped to known local AI-assistant data locations and exports only on user request. Reading all Claude Code project logs or all agents is still something users should understand before use.
Persistence & Privilege
Setup creates a persistent local command under the user account, without elevated privilege in the provided artifacts. No hidden background service or self-propagation is shown.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install agent-usage-stats
  3. After installation, invoke the skill by name or use /agent-usage-stats
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v2.1.3
Version 2.1.3 - Updated version number in documentation. - No feature or functionality changes.
v2.1.2
修复: Claude Code 按消息时间戳精确过滤(非 mtime)、Hermes 包含跨天会话
v2.1.1
多 Agent 导出、每模型今日明细、无变化 tick 只显示一行
v2.1.0
- Updated version to 2.1.0. - Documentation files (README.md, README.zh.md, SKILL.md) updated. - No feature or breaking changes indicated.
v2.0.9
fix: Hermes 当前会话改读 sessions.json 精确匹配
v2.0.8
fix: --setup/-b conflict; compare dynamic alignment; watch shows tick activity + time-range summary on stop
v2.0.7
fix: --setup conflict, compare alignment, watch separators; new: command reference in README and --help
v2.0.6
单行格式 + 时间段 + 对比 + 导出 + Ctrl+C修复
v2.0.5
setup 检测旧 alias 冲突;卸载说明增加 alias 清理步骤
v2.0.4
修复 token-stats.py 内版本号不同步;README 新增完整环境依赖说明
v2.0.3
README 新增完整环境依赖说明(Python/Node.js/ClawHub)和 FAQ
v2.0.2
setup 改为 shell 包装器,不依赖脚本 +x 权限;README 统一加 python3 前缀
v2.0.1
修复 OpenClaw 数据结构适配(dict 非 list)
v2.0.0
**Major update: Now features interactive agent selection and simplified monitoring.** - Every run now prompts you with a menu to select which AI agent's usage to view—no more fixed backend. - Simplified usage: zero dependencies, runs with standard Python, now supports Python 3.8+. - Easily monitor Hermes, Claude Code, CodeX, or OpenClaw token usage, switching between them at will. - Added real-time monitoring with the `--watch` option. - Usage and install instructions revised in README for clarity.
v1.4.0
v1.4.0: universal install to ~/.local/, multi-agent friendly
v1.3.2
v1.3.2: bump SKILL.md version so token-stats.py (with --version) is actually included
v1.3.1
fix --version, improve watch output readability, default interval 5s
v1.3.0
v1.3.0: add --version arg, verify/update/uninstall docs in README
v1.2.1
docs: add update instructions for ClawHub and direct download
v1.2.0
feat: add --watch live monitor + VS Code tasks + beginner-friendly README
Metadata
Slug agent-usage-stats
Version 2.1.3
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 23
Frequently Asked Questions

What is Agent Usage Stats?

选择要监控的 AI 助手 → 查看 token 消耗。支持 Hermes / Claude Code / CodeX / OpenClaw,每次都让你选. It is an AI Agent Skill for Claude Code / OpenClaw, with 100 downloads so far.

How do I install Agent Usage Stats?

Run "/install agent-usage-stats" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Agent Usage Stats free?

Yes, Agent Usage Stats is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Agent Usage Stats support?

Agent Usage Stats is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Agent Usage Stats?

It is built and maintained by zhouhaoyong (@zhouhaoyong); the current version is v2.1.3.

💬 Comments