OpenParable
Skip to content
← Back to skills

Task Token Usage

Productivity
task-token-usage

Task Token Usage is an Agent Skill for productivity published in the platonai/Browser4 repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

Analyzes Claude Code session traces (JSONL) and draft task files to report token usage per task. Use when asked about token usage, session costs, or task efficiency metrics.

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/platonai/Browser4/blob/HEAD/coworker/skills/task-token-usage/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/task-token-usage, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

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

FlagDescription
--recent NOnly show sessions from last N hours (default: 24)
-d, --detailPer-session breakdown instead of grouped summary
-a, --allShow 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)

ColumnDescription
TaskTask name (matched from draft files or first step description)
RunsNumber of evaluation sessions for this task
In TokTotal input tokens across all runs
Out TokTotal output tokens across all runs
CacheTotal cache-read + cache-creation tokens
TOTALSum of all tokens
Avg/runAverage total tokens per run

Output Columns (Detail Mode)

ColumnDescription
TimeWhen the session ended
TaskMatched task name
InInput tokens
OutOutput tokens
CacheRCache-read tokens
TOTALTotal tokens
ModelAI model used

Token Pricing (Approximate)

The script does not compute cost, but you can estimate:

ModelInput (per 1M)Output (per 1M)Cached (per 1M)
claude-sonnet-4.6$3.00$15.00$0.30
claude-opus-4$15.00$75.00$1.50
claude-haiku-4.5$1.00$5.00$0.10

Cache tokens account for ~96% of total usage in typical evaluation sessions.