Skip to content

hipotures/command-center

Repository files navigation

Command Center - panel CC


Claude Code Usage Reports

Modern SQLite-based analytics for Claude Code usage with intelligent caching.

Inspiration: The idea and analysis approach were inspired by cc-wrapped. Pricing: Pricing data is fetched from https://www.litellm.ai/.

Example Report

Claude Code Usage Report

Features:

  • 📅 Activity heatmap with daily usage patterns
  • 📊 Top models by token consumption
  • 💾 Cache efficiency metrics (read/write/hit rate)
  • 📈 Total sessions, messages, and tokens
  • 🔥 Current usage streak tracking

Installation

Option 1: Global installation (recommended)

uv tool install -e .

After this, you can run command-center from anywhere without activation.

Option 2: Local virtual environment

uv sync
source .venv/bin/activate

Usage

After global installation (uv tool install -e .):

# Generate report for current year
command-center --verbose

# Generate report for specific date range
command-center --from 2024-01-01 --to 2024-12-31

# Generate report with compact date format
command-center --from 20250101 --to 20250131

# Show database statistics
command-center --db-stats

With local venv (uv sync):

# Activate venv first
source .venv/bin/activate

# Then run
command-center --verbose

Without installation:

uv run command-center --verbose

CLI Options

  • --from DATE - Start date in YYYY-MM-DD or YYYYMMDD format (default: January 1 of current year)
  • --to DATE - End date in YYYY-MM-DD or YYYYMMDD format (default: today)
  • --verbose - Show detailed progress and statistics
  • --force-rescan - Ignore file tracking, rescan all files
  • --rebuild-db - Delete and rebuild database from scratch
  • --db-stats - Show database statistics and exit
  • --update-pricing - Update pricing cache from LiteLLM and exit
  • --list-projects - List all discovered projects with metadata
  • --update-project - Update project: PROJECT_ID "name" "description"

How It Works

First Run: Imports ALL historical data from all years (~1-2 minutes) Subsequent Runs: Only processes new/modified files (<5 seconds)

Data stored in ~/.claude/db/command_center.db with hourly aggregation (local time).

Network & Data Behavior (Current)

Command Center is local-first, but not strictly offline in all modes.

Core CLI (command-center) behavior:

  • Reads local JSONL logs from ~/.claude/projects/ and ~/.config/claude/projects/
  • Stores analytics in local SQLite: ~/.claude/db/command_center.db
  • Does not send prompts/responses to external APIs

Outbound network can happen when:

  • --update-pricing is used (or a missing model price triggers refresh) to download pricing JSON from LiteLLM GitHub source
  • scripts/cc_usage_web.py is used with Telegram env vars (TELEGRAM_BOT_TOKEN, TELEGRAM_CHAT_ID)

Additional local data stores used by optional flows:

  • ~/.claude/db/pricing_cache.json (pricing cache)
  • ~/.claude/db/command-center-projects.json (project metadata)
  • ~/.claude/db/cc_usage.db (optional usage accounts logger; contains account email and usage snapshot fields)

Testing & Ops Procedures

Run these checks before release:

# Python tests (current repo layout requires PYTHONPATH)
PYTHONPATH=src pytest

# CLI smoke check
PYTHONPATH=src python -m command_center --db-stats

# Frontend quality gates
npm --prefix desktop/ui run lint
npm --prefix desktop/ui run build

# Tauri/Rust backend check
cargo check --manifest-path desktop/src-tauri/Cargo.toml

If you use command-center via installed entrypoint and want API smoke tests:

PYTHONPATH=src python -m command_center.tauri_api dashboard --from 2025-01-01 --to 2025-12-31 --refresh 0 --granularity month

Output

  • PNG Image: cc-usage-report-{date_from}_{date_to}.png
  • Terminal display (Kitty/iTerm2/WezTerm/Ghostty/Konsole/VS Code)

Requirements

  • Python >= 3.10
  • Pillow >= 10.0.0
  • rich >= 13.0.0

Technical Documentation

Complete technical documentation is available in separate chapters:

Core Concepts

Implementation Details

Advanced Features

Operations & Maintenance

Reference

📖 Browse all chapters

About

Modern SQLite-based analytics for Claude Code usage with intelligent caching

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors