token-analysis

Analyzes Claude Code token consumption across sessions using a persistent delta-based cache.

1|Updated Jun 27, 2026
One-click install
npx skills add https://github.com/vickysrawat/AI-Assisted-development --skill token-analysis-vickysrawat
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: token-analysis
Source: https://github.com/vickysrawat/AI-Assisted-development/tree/main/skills/token-analysis
Command: npx skills add https://github.com/vickysrawat/AI-Assisted-development --skill token-analysis-vickysrawat

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Claude Code sessions consume tokens through always-loaded files, repeated file reads, vague prompts, and long conversations, but this cost is invisible. This Skill measures where tokens go and produces prioritized, data-driven recommendations to reduce spending. ## Core Features & Use Cases - Delta-based caching: A persistent token-graph.json cache means only new sessions and changed files are re-analyzed, keeping repeat runs fast and cheap. - Static overhead audit: Measures always-loaded files (CLAUDE.md, rule files, knowledge graph index) with a GREEN/AMBER/RED status for fixed per-session cost. - Prompt classification and rewrites: Classifies prompts as efficient, vague, redundant, multi-task, or correction, then rewrites the most expensive ones with estimated savings. - Use Case: After a month of heavy Claude Code usage, run the analysis to discover that CLAUDE.md exceeds 5,000 tokens and 30% of prompts are vague, then apply the generated recommendations to cut per-session cost. ## Quick Start Ask the assistant to analyze my token usage across the last 10 sessions and show where I can reduce costs.

Frequently Asked Questions about token-analysis

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

FAQPage Schema
How do I analyze Claude Code token usage across sessions?

Run the token-analysis command, which scans recent sessions via recent_chats and conversation_search, estimates tokens as characters divided by 4, and produces an HTML report with per-session costs, expensive operations, and savings recommendations.

How does the token analysis cache avoid re-processing sessions?

A persistent token-graph.json file stores analyzed session IDs and file character counts. On subsequent runs only new sessions and files whose character count changed are re-measured; unchanged data is read directly from the cache.

How accurate are the token estimates in the report?

Estimates use a characters-divided-by-4 approximation, not exact API token counts. The consistent methodology makes comparisons between sessions and files valid even though absolute numbers are approximate, and all values are labeled as estimates.

What files count as always-loaded token overhead?

CLAUDE.md, rule files with paths scoped to **/*, and the knowledge graph graph-index.md are classified as ALWAYS loaded. The skill sums their estimated tokens and flags the total as GREEN under 2,000, AMBER up to 5,000, or RED above that.

Why does the token analysis report flag vague prompts?

Prompts under 20 words with no file or method reference force the model to load broad context or ask clarifying questions, consuming extra turns. When vague prompts exceed 30% of all prompts, the report triggers a high-priority recommendation with rewrite examples.

Can token analysis expose sensitive prompt content?

The skill truncates all prompt previews to 200 characters and never displays content that may contain secrets. Sessions whose content cannot be retrieved are recorded with title and date only, with metrics marked null rather than fabricated.