Skip to main content

Web-based usage monitoring tool for Claude Code

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

Claude Monitor

The missing dashboard for Claude Code โ€” track costs, optimize usage, stay in control.

Python 3.9+ License: MIT Maintained

Claude Monitor Dashboard

Overview

Claude Monitor provides comprehensive analytics for your Claude Code usage by reading local data files and presenting insights through a clean web interface. No API keys required, no data sent externallyโ€”everything runs locally on your machine.

Key Benefits:

  • ๐Ÿ“Š Visual Analytics: Modern web dashboard with detailed metrics
  • ๐Ÿ’ฐ Cost Tracking: Monitor spending and cache savings in real-time
  • ๐Ÿš€ Performance Insights: Identify optimization opportunities
  • ๐Ÿ“ Project Breakdown: See which projects consume the most resources
  • ๐Ÿ”ง Tool Analytics: Track sub-agent and MCP integration usage

Features

Dashboard Pages

  • Overview Dashboard: At-a-glance summary of all key metrics
  • Token Usage: Detailed breakdown of input, output, cache reads/writes with cost calculations
  • Projects: Per-project analytics showing sessions, commands, and token usage
  • Files: Most frequently edited files and operation statistics
  • Integrations: MCP server usage and activity tracking
  • Features: Tool usage, sub-agents, skills, and configuration analytics

Capabilities

  • Real-time Monitoring: Live data from your Claude Code usage
  • Cost Analysis: Track spending with Claude Sonnet 4.5 pricing
  • Cache Efficiency: Monitor prompt cache performance and savings
  • Time Filtering: View metrics by today, week, month, or all-time
  • Data Export: Export metrics to CSV or JSON format
  • Zero Configuration: Works automatically with Claude Code data

Quick Start

Installation

Choose the installation method that works best for you:

Option 1: PyPI (Recommended for Python users)

pip install claude-monitor

Option 2: Pre-built Binary (No Python required)

Download the latest executable for your platform from Releases:

macOS:

# Download claude-monitor-macos from releases
chmod +x claude-monitor-macos
./claude-monitor-macos

Linux:

# Download claude-monitor from releases
chmod +x claude-monitor
./claude-monitor

Windows:

# Download claude-monitor.exe from releases
claude-monitor.exe

Option 3: From Source (For development)

# Clone the repository
git clone https://github.com/allannapier/claude_monitor.git
cd claude_monitor

# Install the package
pip install .

# Or install in development mode
pip install -e .

Running

# Start the web server (default port 5000)
claude-monitor

# Open your browser to http://localhost:5000

That's it! The dashboard will load your Claude Code usage data automatically.

Usage

Basic Commands

# Start server on default port 5000
claude-monitor

# Start on custom port
claude-monitor --port 8080

# Bind to all network interfaces (allow external access)
claude-monitor --host 0.0.0.0

# Enable debug mode with auto-reload
claude-monitor --debug

# Use custom Claude data directory
claude-monitor --claude-dir /path/to/claude/data

Web Interface

Once the server is running, navigate to:

Data Export

Export your metrics for further analysis:

Screenshots

Dashboard Overview

The main dashboard provides an at-a-glance view of all your Claude Code metrics.

Dashboard

Token Usage & Costs

Detailed breakdown of token consumption with cost calculations and cache efficiency.

Token Usage

Features & Tools

Track tool usage, sub-agents, MCP integrations, and installed skills.

Features

Metrics Explained

Usage Metrics

  • Total Sessions: Number of unique Claude Code sessions
  • Total Commands: Number of commands/queries sent to Claude
  • Active Projects: Number of different projects worked on
  • Time Range: Filtered time period for displayed metrics

Token Metrics

  • Input Tokens: Regular input tokens (non-cached)
  • Output Tokens: Tokens in Claude's responses
  • Cache Write: Tokens written to prompt cache
  • Cache Read: Tokens read from prompt cache (90% cheaper!)
  • Cache Efficiency: Percentage of cache reads vs. cache writes

Cost Calculations

Based on Claude Sonnet 4.5 pricing:

  • Input: $3.00 per million tokens
  • Output: $15.00 per million tokens
  • Cache Write: $3.75 per million tokens
  • Cache Read: $0.30 per million tokens (90% discount!)

Cache Savings

Shows how much money you've saved through prompt caching. The calculation compares what cache reads would have cost as regular input tokens versus the actual discounted cache read cost. High cache efficiency (>90%) means significant savings!

Data Sources

Claude Monitor reads data from your local Claude Code installation at ~/.claude/:

  • history.jsonl: Command history and timestamps
  • projects/: Session data with detailed token usage
  • debug/: MCP server activity logs
  • file-history/: File modification tracking
  • skills/: Installed skills and configurations
  • settings.json: Claude Code settings

Privacy: All data stays on your machine. No external API calls, no data uploaded.

Requirements

  • Python: 3.9 or higher
  • Claude Code: Must be installed and used at least once
  • Dependencies:
    • click>=8.1.0
    • rich>=13.0.0
    • python-dateutil>=2.8.0
    • Flask>=3.0.0
    • Jinja2>=3.1.0

Project Structure

claude_monitor/
โ”œโ”€โ”€ src/claude_monitor/
โ”‚   โ”œโ”€โ”€ cli.py              # Entry point - launches web server
โ”‚   โ”œโ”€โ”€ parsers/            # Data parsers for Claude files
โ”‚   โ”‚   โ”œโ”€โ”€ history.py      # Command history parser
โ”‚   โ”‚   โ”œโ”€โ”€ sessions.py     # Session and token data parser
โ”‚   โ”‚   โ”œโ”€โ”€ debug.py        # MCP server logs parser
โ”‚   โ”‚   โ”œโ”€โ”€ files.py        # File editing history parser
โ”‚   โ”‚   โ”œโ”€โ”€ tools.py        # Tool usage parser
โ”‚   โ”‚   โ””โ”€โ”€ skills.py       # Skills and config parser
โ”‚   โ”œโ”€โ”€ analyzers/          # Data analysis and aggregation
โ”‚   โ”‚   โ”œโ”€โ”€ usage.py        # Usage statistics analyzer
โ”‚   โ”‚   โ”œโ”€โ”€ tokens.py       # Token usage and cost analyzer
โ”‚   โ”‚   โ”œโ”€โ”€ integrations.py # MCP integration analyzer
โ”‚   โ”‚   โ””โ”€โ”€ features.py     # Features analyzer
โ”‚   โ”œโ”€โ”€ web/                # Flask web application
โ”‚   โ”‚   โ”œโ”€โ”€ app.py          # Flask app factory
โ”‚   โ”‚   โ”œโ”€โ”€ routes/         # Route handlers
โ”‚   โ”‚   โ”œโ”€โ”€ services/       # Business logic layer
โ”‚   โ”‚   โ”œโ”€โ”€ templates/      # Jinja2 HTML templates
โ”‚   โ”‚   โ””โ”€โ”€ static/         # CSS, JS, images
โ”‚   โ””โ”€โ”€ utils/              # Shared utilities
โ”‚       โ”œโ”€โ”€ paths.py        # Path management
โ”‚       โ””โ”€โ”€ time_filter.py  # Time-based filtering
โ”œโ”€โ”€ LICENSE                 # MIT License
โ”œโ”€โ”€ README.md              # This file
โ”œโ”€โ”€ CONTRIBUTING.md        # Contribution guidelines
โ”œโ”€โ”€ CHANGELOG.md           # Version history
โ”œโ”€โ”€ setup.py               # Package setup
โ”œโ”€โ”€ pyproject.toml         # Modern Python packaging
โ””โ”€โ”€ requirements.txt       # Dependencies

Development

Want to contribute? Check out CONTRIBUTING.md for guidelines.

Run in Development Mode

# Install in editable mode
pip install -e .

# Run with debug mode (auto-reload on code changes)
claude-monitor --debug

Run Tests

# Manual testing - verify all routes work
claude-monitor
# Then navigate to each page in your browser

Tips & Best Practices

  1. Monitor Cache Efficiency: A high cache efficiency (>90%) means you're saving money through prompt caching. This happens when working on the same project/context repeatedly.

  2. Track Costs: Use the Tokens page to monitor your spending. The dashboard shows both gross cost and net cost after cache savings.

  3. Analyze Projects: The Projects page helps identify which projects consume the most tokens and cost the most, useful for budgeting.

  4. Time Filtering: Use the time period selector to track recent activity and costs, or view all-time statistics.

  5. Export Data: Use CSV/JSON export for custom analysis, charting in Excel, or integration with other tools.

  6. Performance: The tool uses streaming parsing to handle large session files efficiently, even with extensive Claude Code usage.

Troubleshooting

"FileNotFoundError: ~/.claude/ not found"

  • Ensure Claude Code is installed
  • Run Claude Code at least once to generate data files

"ImportError: No module named 'flask'"

  • Install dependencies: pip install -r requirements.txt
  • Or reinstall the package: pip install .

Web server won't start

  • Check if port 5000 is already in use
  • Try a different port: claude-monitor --port 8080
  • Check Python version: python3 --version (requires 3.9+)

Data not showing

  • Verify Claude Code has been used recently
  • Check ~/.claude/ directory exists and contains data files
  • Try restarting the web server

Version History

See CHANGELOG.md for detailed version history.

  • v1.0.0 (2025-12-20): Web-only release with production polish
  • v0.1.0 (2025-12-19): Initial release with CLI dashboard

License

MIT License - see LICENSE file for details.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. See LICENSE for full terms.

Author

Allan Napier

Contributing

Contributions welcome! See CONTRIBUTING.md for guidelines.

Support


Note: This tool is not affiliated with or endorsed by Anthropic. It's an independent monitoring tool for Claude Code users.

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

monitor_claude-1.0.4.tar.gz (88.9 kB view details)

Uploaded Source

Built Distribution

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

monitor_claude-1.0.4-py3-none-any.whl (116.0 kB view details)

Uploaded Python 3

File details

Details for the file monitor_claude-1.0.4.tar.gz.

File metadata

  • Download URL: monitor_claude-1.0.4.tar.gz
  • Upload date:
  • Size: 88.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for monitor_claude-1.0.4.tar.gz
Algorithm Hash digest
SHA256 c6790c200f96bdfc07fdcaf51907f1efaf91f619579e647aa0143215303a7abc
MD5 d1738b957abda91015097393214c5627
BLAKE2b-256 986968bfa6a4a2f428c0928014ab5a60e510acf464563b1cbbe710dca4aeb7f7

See more details on using hashes here.

File details

Details for the file monitor_claude-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: monitor_claude-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 116.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for monitor_claude-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 20a29b6054ab75c562aac621f845ed58420273cca06cc409debf6855b4ab4219
MD5 92a2544da29ed1032eba983f2633911c
BLAKE2b-256 8d877a350dba2cb65db87ebebd27084478c621679cd25e8b903295524bbf76ea

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