Skip to main content

Visualize Claude Code usage patterns from your .claude folder

Project description

Claude Code Stats

A visualization dashboard for your Claude Code usage patterns. Generates a static HTML dashboard from your local .claude folder data.

Dashboard Demo

Quick Start

pip install cc-stats
claude-stats

The dashboard opens automatically in your browser.

Features

Core Analytics

  • Activity Timeline: Track daily messages and sessions over time
  • Date Range Filter: Filter all charts by custom date range
  • Model Usage: See token distribution across Sonnet, Opus, and Haiku
  • Peak Hours: Discover when you're most productive with Claude
  • Project Breakdown: Identify which projects get the most attention

Cost & Efficiency

  • Cost Estimation: Approximate API costs based on token usage
  • Cache Savings: See how much caching saves you
  • Cache Efficiency: Track cache hit rates

Performance

  • Response Time: View turn duration percentiles (p50, p95, p99)
  • API Reliability: Track error rates and types
  • Tool Success Rate: Monitor which tools fail most often

Productivity

  • Task Completion: Track todo completion rates
  • Plan Activity: See how often you use Claude's plan mode

Deep Dive

  • Tool Usage: Analyze which tools (Read, Edit, Bash, etc.) you use most
  • MCP Tools: View usage of Model Context Protocol tools and servers
  • Subagent Analysis: Track usage of Explore, code-reviewer, Plan agents
  • Extended Thinking: Monitor thinking token usage
  • File Edit Velocity: Track file editing patterns
  • Conversation Depth: Analyze conversation threading patterns

Installation

Option 1: PyPI (Recommended)

pip install cc-stats

To update:

pip install --upgrade cc-stats

Option 2: From Source

git clone https://github.com/saurabharora90/claude-code-stats.git
cd claude-code-stats
pip install .

Usage

# Generate dashboard from default ~/.claude folder (auto-opens browser)
claude-stats

# Specify a different .claude folder
claude-stats /path/to/.claude

# Save dashboard to a specific directory
claude-stats --output ./my-dashboard

# Generate only JSON stats (no HTML)
claude-stats --json-only --output ./stats

# Don't auto-open browser
claude-stats --no-open

Options

Option Description
CLAUDE_FOLDER Path to .claude directory (default: ~/.claude)
--output, -o Output directory for dashboard (default: temp directory)
--open/--no-open Auto-open browser after generation (default: --open)
--json-only Only export stats.json, skip HTML dashboard

Requirements

  • Python 3.9+
  • click (installed automatically with pip)

Privacy

All data processing happens locally. No data is sent anywhere. The generated dashboard is a static HTML file that works completely offline.

Documentation

Data Sources

The tool reads from these files in your .claude folder:

File Data Extracted
stats-cache.json Daily activity, model tokens, session totals, peak hours
projects/*/sessions-index.json Per-project session counts and summaries
projects/*/*.jsonl Tool calls, turn durations, API errors, thinking blocks
todos/*.json Task completion statistics
plans/*.md Plan activity
file-history/ File edit patterns
settings.json Enabled plugins
history.jsonl Slash command usage

Contributing

Contributions are welcome! Please feel free to submit issues and pull requests.

License

MIT License. See LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cc_stats-0.1.2.tar.gz (25.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cc_stats-0.1.2-py3-none-any.whl (28.1 kB view details)

Uploaded Python 3

File details

Details for the file cc_stats-0.1.2.tar.gz.

File metadata

  • Download URL: cc_stats-0.1.2.tar.gz
  • Upload date:
  • Size: 25.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for cc_stats-0.1.2.tar.gz
Algorithm Hash digest
SHA256 e6e5dcfb4f3cf4cae2ab55d0c13409c30db23ca286c425a237b18ad4011f1ccb
MD5 75384653adfc88180038b7674a262bbf
BLAKE2b-256 b0c78b83f4af0c2a479952328918469b7155142e7a3bdf613818e81c4c825ad7

See more details on using hashes here.

File details

Details for the file cc_stats-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: cc_stats-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 28.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for cc_stats-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 996d3631ed3ed8ec144932cab25906b65a7a8bda7b278f3fc96ca009529cf5ed
MD5 c4fb48a692ecc85a7d8664dd0181578d
BLAKE2b-256 3d4284d94ba7c88dcbecd09fc060d91c04a7f5965c8a222f6c3a4d4851177771

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page