Overview
Claude Analytics supports filtering all your data by project. This allows you to analyze your coding patterns, tool usage, and prompts for specific codebases.How Project Filtering Works
Project filtering is implemented insrc/components/dashboard.tsx and filters three main data types:
- Sessions — All session metadata including duration, messages, and tool counts
- History — Prompt history entries
- Tools — Tool usage statistics derived from filtered sessions
Stats overview, activity heatmap, hour chart, and model breakdown remain unfiltered because they use pre-aggregated data from
stats-cache.json that cannot be split by project.Using the Project Filter
The project filter appears in the top-right corner of the dashboard as a dropdown menu.Filter Location
Fromsrc/components/dashboard.tsx:102-117:
Available Options
- All Projects — Shows data across all your coding sessions
- Individual Projects — One option per unique
project_pathfrom your sessions
Project Extraction Logic
Projects are extracted from session metadata insrc/components/dashboard.tsx:45-56:
How Project Names are Displayed
- Takes the full
project_path(e.g.,/Users/ishan/projects/my-app) - Removes trailing slashes
- Splits by
/separator - Extracts the last segment (
my-app) - Falls back to full path if no segments exist
- Sorts alphabetically by display name
Project names are extracted from the directory path, so
/Users/ishan/projects/my-app and /home/john/my-app will both show as “my-app”.What Gets Filtered
Sessions Table
Filtered sessions are computed insrc/components/dashboard.tsx:58-64:
<SessionTable sessions={filteredSessions} /> (line 165).
What’s included:
- Session duration and timestamps
- Message counts (user + assistant)
- Token usage (input + output)
- Tool call counts
- Git commits and pushes
- Code changes (lines added/removed, files modified)
- First prompt text
Prompt History
Prompt history filtering insrc/components/dashboard.tsx:66-72:
<PromptHistory history={filteredHistory} /> (line 178).
What’s included:
- Prompt display text
- Timestamps
- Pasted contents
- Associated project
Tool Usage
Tool usage is computed from filtered sessions in<ToolUsageChart sessions={filteredSessions} /> (line 174).
The component aggregates tool counts from the tool_counts field of each session:
- Read
- Edit
- Write
- Bash
- Glob
- Grep
- Task
- WebFetch
- And any other tools used during sessions
What’s NOT Filtered
These components use pre-aggregated data fromstats-cache.json that cannot be broken down by project:
Stats Overview Cards
- Total sessions
- Total messages
- Total tool calls
- Lines added/removed
- Files modified
- Average session duration
- Total cost (USD)
Activity Heatmap
stats.dailyActivity which aggregates activity across all projects.
Hour Chart
stats.hourCounts which tracks session distribution by hour across all projects.
Model Breakdown
stats.modelUsage which aggregates token usage and costs across all projects.
Daily Tokens Chart
stats.dailyModelTokens which tracks daily token consumption across all projects.
Filter State Management
Project filter state is managed insrc/components/dashboard.tsx:43:
- Default value:
"all" - Persists during the session (not saved to localStorage)
- Resets to “all” when you refresh the page or switch profiles
Performance Considerations
Memoization
All filtering uses React’suseMemo hook to prevent unnecessary recalculations:
- The
data.sessionsarray changes (new data loaded) - The
selectedProjectvalue changes (user selects different project)
Filtering Complexity
- Sessions: O(n) where n = number of sessions
- History: O(n) where n = number of history entries
- Projects extraction: O(n) where n = number of sessions
Tab Navigation with Filtering
The dashboard has 5 tabs (src/components/dashboard.tsx:147-154):Filtering by Tab
| Tab | Uses Filtered Data | Shows All Projects |
|---|---|---|
| Activity | No | Yes (heatmap, hours, projects) |
| Sessions | Yes | No (filtered sessions table) |
| Models | No | Yes (model breakdown, daily tokens) |
| Tools | Yes | No (filtered tool usage chart) |
| Prompts | Yes | No (filtered prompt history) |
Matching Logic
Project matching uses strict equality onproject_path:
- Exact string match (case-sensitive)
- No fuzzy matching or partial matches
- Empty or null
project_pathvalues won’t match any project filter
Project Path Handling
From SessionMeta
From HistoryEntry
Note the field name difference:
project_path in SessionMeta vs project in HistoryEntry. Both contain the same project path value.Example Use Cases
Analyzing a Specific Project
- Select your project from the dropdown
- Go to Sessions tab to see all sessions for that project
- Go to Tools tab to see which tools you used most
- Go to Prompts tab to review your prompts for that codebase
Comparing Projects
- Select “All Projects” and note tool usage patterns
- Select “Project A” and check tool counts
- Select “Project B” and compare
Finding Project-Specific Prompts
- Select your project from the dropdown
- Go to Prompts tab
- Use the search bar to find specific prompts within that project
Next Steps
Understanding Data
Learn about all data types and metrics
Privacy & Security
Understand how your data is protected