# Claude Code Dashboard
A Rust TUI tool that reads your [Claude Code](https://claude.ai/code) `.claude` data directory and renders monthly/yearly usage reports right in your terminal.

## Features
- **Overview** — all-time stats: tokens (stacked input/output/cache), tool calls, projects, languages, sessions
- **Monthly / Yearly reports** — daily activity heatmaps, per-model token composition, tool usage, project breakdown
- **Token breakdown** — stacked bar chart with color-coded input/output/cache per model, cache hit rate
- **Tool call stats** — counts Claude Code tool calls (Bash, Read, Write, Edit, etc.) + web search/fetch
- **Time statistics** — longest session, average session duration, peak coding period (Morning/Afternoon/Evening/Night)
- **Language detection** — scans project directories (up to depth 3) for programming language distribution
- **Scrollable sections** — Tab to switch focus between panels, each independently scrollable
- **Keyboard-driven** — arrow keys, vim-style scrolling, y to copy as TSV
## Installation
```bash
git clone https://gitcode.com/eedt/claude-dashbord
cd claude-dashboard
cargo build --release
```
The binary will be at `target/release/claude-dashboard` (or `.exe` on Windows).
## Usage
```bash
# Uses %USERPROFILE%\.claude (Windows) or ~/.claude (Unix) by default
cargo run
# Override the data directory
cargo run -- --data-dir /path/to/.claude
```
### Controls
| `1` `2` `3` | Switch between Overview / Monthly / Yearly |
| `Tab` / `Shift+Tab` | Cycle focus between scrollable sections |
| `←` `→` | Previous / next month or year |
| `↑` `↓` or `j` `k` | Scroll focused section |
| `PgUp` `PgDn` | Page scroll |
| `y` | Copy current view as TSV |
| `r` | Refresh data from disk |
| `q` or `Esc` | Quit |
## How it works
Reads three data sources from your `.claude` directory:
- **`stats-cache.json`** — aggregate stats (daily activity, model tokens, hour counts, model usage)
- **`history.jsonl`** — user message history, used to map session IDs to real project paths
- **`projects/<encoded>/`** — per-project session JSONL files. Parses assistant events for token breakdown (input/output/cache), tool_use blocks (Bash, Read, Edit, etc.), web search/fetch, and per-event timestamps for session duration and hourly distribution
Language detection runs in a background thread using `walkdir` to scan project directories for file extensions.
## Requirements
- Rust 1.70+
- A `.claude` directory with Claude Code usage data (generated automatically by Claude Code)