analyze-token-usage

Parse Claude Code JSONL session logs and aggregate token costs into markdown reports.

Updated Jan 5, 2026
One-click install
npx skills add https://github.com/d3ming/dot-agents --skill analyze-token-usage
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: analyze-token-usage
Source: https://github.com/d3ming/dot-agents/tree/main/master/skills/analyze-token-usage
Command: npx skills add https://github.com/d3ming/dot-agents --skill analyze-token-usage

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

Helps you find where Claude Code is spending the most tokens by scanning local session logs and surfacing costly projects, sessions, and spawned subagents so you can prioritize optimizations and reduce billing and context bloat.

Core Features & Use Cases

  • Startup analysis: Inspect the first assistant turn to measure startup context and estimate contributions from CLAUDE.md, AGENTS.md, skills, hooks, and memory.
  • Historical analysis: Aggregate tokens across projects and sessions, filter by date, and rank the most expensive sessions and subagents.
  • Reporting: Produce a human-readable markdown token_report and per-project prompt exports to support audits and cost breakdowns.
  • Use case: Run this Skill to identify a single long-running session or a plugin that contributes disproportionately to token costs and decide whether to disable or silence it.

Quick Start

From your project directory run the analyze_startup.py or analyze_tokens.py script in the skill's scripts directory to generate a token report in your ~/.claude/token-analysis folder.

Frequently Asked Questions about analyze-token-usage

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I analyze Claude Code session tokens to find expensive projects?

Measure Claude Code startup token costs by inspecting the first assistant turn in session JSONL files to estimate context contributions from CLAUDE.md, AGENTS.md, skills, hooks, and memory using the analyze_startup script.

Can I filter historical token usage analysis by date ranges?

Filter historical token usage analysis by setting environment variables to apply date filtering, allowing you to aggregate and rank the most expensive Claude Code sessions and subagents within specific time periods.

What is the best way to investigate subagent token usage in Claude sessions?

Investigate subagent token usage by parsing local JSONL session files to aggregate spawned subagent token costs, ranking them to identify disproportionately expensive subagents for optimization or disabling.

Does this token analysis approach require any external dependencies?

This token analysis approach requires no external dependencies, relying solely on local Claude installations where ~/.claude/projects contains JSONL session logs for parsing and generating markdown reports.

What report formats are generated when auditing Claude token billing?

Auditing Claude token billing generates a human-readable markdown token_report and per-project prompt exports in the ~/.claude/token-analysis folder, supporting historical cost breakdowns and startup context audits.