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.1.tar.gz (24.4 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.1-py3-none-any.whl (27.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cc_stats-0.1.1.tar.gz
  • Upload date:
  • Size: 24.4 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.1.tar.gz
Algorithm Hash digest
SHA256 42add422bb8544a83b00296c51ec3695f11542ae7cf14f37cd512cffb60460a2
MD5 e01a8f8409ac9167f781c65d60774aa9
BLAKE2b-256 2fc326dae742c099267dd5bdff7e587c6e94e64f1b8dbb629e4fcdeb77f51115

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cc_stats-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 27.3 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d2d47e450deb6925451aae5b2d3df3e474ad3e2aea26ec3d12b3a6f9e2295042
MD5 97141642cbbaddd2ab85ad1906773ae7
BLAKE2b-256 9f738c7ab4105f2f4b9959d3251cc891ef1130b6fde184750a3579bcb303bae8

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