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 git+https://github.com/saurabharora90/claude-code-stats.git
claude-stats

The dashboard opens automatically in your browser.

To update to the latest version:

pip install --upgrade git+https://github.com/saurabharora90/claude-code-stats.git

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: pip install from GitHub (Recommended)

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

To update:

pip install --upgrade git+https://github.com/saurabharora90/claude-code-stats.git

Option 2: Clone and Run Locally

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

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.0.tar.gz (24.5 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.0-py3-none-any.whl (27.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cc_stats-0.1.0.tar.gz
  • Upload date:
  • Size: 24.5 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.0.tar.gz
Algorithm Hash digest
SHA256 35fd6d0c9b81298f7dd7d4e72cde4e23ddea4e6bc715d8d8350a35114cb9f769
MD5 fc8e93151dc2b4c2a58ffe6aa41c8843
BLAKE2b-256 a77f09c5804ff62327cc9f8651fe5eefce2ff3dfc64ad91873bc6c5f5e6feaf9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cc_stats-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 27.4 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5cd2fb0dd98413c199340a908b9de52d4f160164fb87a2f9e2d0f86a6dd3ba35
MD5 7f30e697f5ba1a98387e42699c9abcbb
BLAKE2b-256 0d19ebf95ce58dca71a3e5a691180c15b9b235dc6cce8d33431bf63dcccb0b4b

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