Overview
All TypeScript interfaces are defined insrc/lib/types.ts. The data model represents Claude Code usage analytics, parsed from various JSON and JSONL files in the ~/.claude/ directory.
Core Types
DashboardData
Root data structure passed from server/upload to the dashboard.src/lib/types.ts
Pre-aggregated statistics from
stats-cache.json. May be null if cache doesn’t exist.Array of per-session metadata objects, sorted by
start_time descendingPrompt history from
history.jsonlProject memory files with content (up to 5000 chars per file)
Account identifiers extracted during export. Only present in uploaded files.
ISO timestamp when export was created. Only present in uploaded files.
StatsCache
Pre-aggregated statistics computed by Claude Code itself. This data cannot be derived from session metadata alone.src/lib/types.ts
Total number of sessions recorded
Total messages across all sessions (user + assistant)
ISO date string of the first recorded session (e.g.,
"2025-01-15")Daily breakdown of activity metrics
Daily token usage by model
Per-model token breakdown and costs. Keys are model names like
"claude-3-7-sonnet-20250219"Sessions per hour of day. Keys are “0” through “23”
Metadata about the longest session by duration
Cache format version
When stats cache was last computed
SessionMeta
Per-session metadata from~/.claude/usage-data/session-meta/*.json.
src/lib/types.ts
Unique identifier for the session
Absolute path to the project directory (e.g.,
/Users/john/projects/my-app)ISO timestamp when session started
Session duration in minutes
Number of messages sent by the user
Number of messages sent by Claude
Tool usage counts by tool name (e.g.,
{"Read": 42, "Edit": 15})Language usage by line count (e.g.,
{"TypeScript": 200, "CSS": 50})Number of git commits made during session
Number of git pushes during session
Total input tokens consumed
Total output tokens generated
The first prompt text from the session
Times user interrupted Claude’s response
Number of tool execution errors
Error counts by category
Whether session used task agents
Whether session used MCP (Model Context Protocol)
Whether session used web search
Whether session used web fetch
Total lines of code added
Total lines of code removed
Number of files modified
Array of hours (0-23) when messages were sent
Unix timestamps (milliseconds) of user messages
DailyActivity
Daily activity metrics for the heatmap visualization.DailyModelTokens
Daily token consumption by model.ModelUsage
Token and cost breakdown for a single model.Total input tokens consumed
Total output tokens generated
Tokens read from cache (reduced cost)
Tokens used to create cache entries
Number of web search requests made
Total cost in USD for this model
Model’s context window size
Model’s maximum output token limit
HistoryEntry
Single prompt from~/.claude/history.jsonl.
The prompt text as displayed in the UI
Any content pasted along with the prompt
Unix timestamp in milliseconds
Project path where prompt was used
ProjectMemory
Memory files from~/.claude/projects/<id>/memory/.
Encoded project directory name (slashes replaced with dashes)
Array of memory files
AccountInfo
Account identifiers extracted from Statsig cache during export.Unique account identifier
Organization identifier (for team accounts)
Claude Code application version
SessionMessage
Individual message from a session transcript, loaded via API route.Message sender
Message content, truncated to 5000 characters
ISO timestamp when message was sent
Tools used in this message (assistant messages only)
Data Relationships
Aggregation Flow: Raw session data (
SessionMeta[]) is aggregated into StatsCache by Claude Code. The analytics app consumes both to provide comprehensive insights.Export JSON Format
Thescripts/export.mjs script produces a single JSON file:
Source Files on Disk
stats-cache.json
Pre-aggregated statisticsLocation:
~/.claude/stats-cache.jsonFormat: JSONsession-meta/*.json
Per-session metadata filesLocation:
~/.claude/usage-data/session-meta/Format: One JSON file per sessionhistory.jsonl
Prompt historyLocation:
~/.claude/history.jsonlFormat: Newline-delimited JSONmemory/*.md
Project memory filesLocation:
~/.claude/projects/<id>/memory/Format: Markdown<session>.jsonl
Full session transcriptsLocation:
~/.claude/projects/<id>/Format: Newline-delimited JSONstatsig cache
Account informationLocation:
~/.claude/statsig/Format: JSON (read during export only)Backward Compatibility
The upload zone (upload-zone.tsx) handles old export formats:
Auto-normalizes old memory format where
files contained plain strings instead of {name, content} objectsGracefully handles missing
account and exportedAt fieldsValidates JSON structure before processing
Memory Format Normalization