task-token-usage

A reporting skill that reads Claude Code session records and draft task files to calculate token usage by task. Tokens are the text units used to measure an AI session.

In plain words
What is it for?
Use it to list recent or all tasks, group usage summaries, compare sessions, or view detailed per-session counts.
Why use it?
It replaces manual inspection of session logs when you need to understand usage, costs, or task efficiency.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/platonai/browser4/task-token-usage
Any agent
npx skills add platonai/Browser4 --skill task-token-usage
Clone the repo
git clone --depth 1 https://github.com/platonai/Browser4

Made for: Claude Code, Codex.

Per session 41 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 718 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00041 $0.00718
Opus 5 $0.00020 $0.00359
Sonnet 5 $0.00008 $0.00144
Haiku 4.5 $0.00004 $0.00072

Measured 2d ago against content hash 30be332fe6d8, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

task-token-usage scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/list-tasks.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

coworker/skills/task-token-usage/SKILL.md · 91 lines

How it starts

The opening of the file, as written. The whole thing — 91 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Task Token Usage

Analyzes Claude Code conversation traces to report token consumption per task.

When to Use

  • "list tasks with token usage"
  • "show me token usage for each task"
  • "how many tokens did task X use?"
  • "what tasks ran in the last N hours?"
  • "compare token usage across tasks"

How It Works

  1. Scans ~/.claude/projects/<project>/ for JSONL session traces
  2. Extracts input_tokens, output_tokens, cache_read_input_tokens from each assistant message
  3. Optionally matches sessions to draft task files in coworker/tasks/issues/draft/
  4. Prints a summary table grouped by task

Usage

Run the bundled script:

python3 coworker/skills/task-token-usage/scripts/list-tasks.py [OPTIONS]

Options

Flag Description
--recent N Only show sessions from last N hours (default: 24)
-d, --detail Per-session breakdown instead of grouped summary
-a, --all Show all sessions (no time filter)

Examples

# Summary of last 12 hours
python3 coworker/skills/task-token-usage/scripts/list-tasks.py --recent 12

# Detailed per-session view for all time
python3 coworker/skills/task-token-usage/scripts/list-tasks.py --all --detail

# Default: last 24 hours, grouped summary
python3 coworker/skills/task-token-usage/scripts/list-tasks.py

Output Columns (Summary Mode)

Column Description
Task Task name (matched from draft files or first step description)
Runs Number of evaluation sessions for this task
In Tok Total input tokens across all runs
Out Tok Total output tokens across all runs
Cache Total cache-read + cache-creation tokens
TOTAL Sum of all tokens
Avg/run Average total tokens per run

Output Columns (Detail Mode)

Column Description
Time When the session ended
Task Matched task name
In Input tokens
Out Output tokens
CacheR Cache-read tokens
TOTAL Total tokens
Model AI model used

Read the full file on GitHub · 91 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 91 lines · 41 tokens per session scan A 30be332fe6d8

Subscribe to this mod's changes

task-token-usage is a skill published in the GitHub repository platonai/Browser4 (1,114 stars, last pushed 3d ago), licensed Apache-2.0. It adds 41 tokens to every session and 718 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.