Local Agent Token Usage Stats
Paste the following prompt into your AI chat to install this skill:
Please follow the guide at https://skillhub.cn/install/skillhub.md to install @user_15292d5a/yjkj-agent-usage-stats into your AI assistant.
About this skill
Problem
When several Agents run side by side, token usage is scattered across local logs: Hermes stores sessions in SQLite, Claude Code keeps JSONL files, and CodeX mixes SQLite state with JSONL sessions. Inspecting these files manually is awkward, especially when checking one Agent’s recent spend.
How It Works
agent-usage-stats treats local Agent data files as its data source. It runs offline and uses only the Python standard library to read and summarize token statistics. It locates records by Agent type:
- Hermes: reads the sessions table in ~/.hermes/state.db
- Claude Code: reads ~/.claude/projects/**/*.jsonl
- CodeX: reads ~/.codex/state_*.sqlite and ~/.codex/sessions/**/*.jsonl
- OpenClaw: reads ~/.openclaw/agents/main/sessions/
At runtime it shows a menu so you can choose which Agent to inspect. It can also be integrated into Hermes via SKILL.md, letting a task finish by reporting token usage directly.
Limits
It is best for reviewing local usage history already present on the machine. It will not estimate missing logs, remote-only usage, or Agents without local records. If an Agent uses custom storage paths, the target files must exist and be readable.
Use Cases
- After a batch of Claude Code sessions, review token spend in project JSONL logs.
- Check the local Hermes sessions table to see if recent task token usage is abnormal.
- With CodeX SQLite state and JSONL sessions present, summarize local usage for one coding task.
- Use the local OpenClaw session directory to inspect recent token spend for the main agent.
Best For
- Engineers using Claude Code for local project work who need to check token spend in project JSONL logs.
- Developers running Hermes automation tasks who want to inspect local sessions-table token usage after each run.
- Ops engineers maintaining CodeX or OpenClaw local records who need to check whether a session spent unusually much.
- Researchers comparing token usage across multiple coding agents from local logs without uploading data.
Related Skills
Generate Markdown public opinion reports by calling an internal service with MIDU_API_KEY.
Extracts Google AI Mode answers, standard SERP, AI Overviews, and citations via Pangolin APIs, with multi-turn follow-ups and region support.
Provides break-even analysis frameworks and templates without code execution, outputting structured recommendations.
Generate web reports from existing analysis data with classic or PPT-style layouts, Chart.js charts, and keyboard/touch navigation.