Cross-Project Analytics
Query local analytics data from
. All data is local-only, privacy-safe (hashed project IDs, no PII).
Subcommands
Parse the user's argument to determine which report to show. If no argument provided, use AskUserQuestion to let them pick.
| Subcommand | Description | Data Source | Reference |
|---|
| Top agents by frequency, duration, model breakdown | | |
| Model delegation breakdown (opus/sonnet/haiku) | | |
| Top skills by invocation count | | |
| Slowest hooks and failure rates | | |
| Team spawn counts, idle time, task completions | | |
| Replay a session timeline with tools, tokens, timing | CC session JSONL | references/session-replay.md
|
| Token cost estimation with cache savings | | references/cost-estimation.md
|
| Daily activity, model delegation, peak hours | | references/trends-analysis.md
|
| Unified view of all categories | All files | |
Quick Start Example
bash
# Top agents with model breakdown
jq -s 'group_by(.agent) | map({agent: .[0].agent, count: length}) | sort_by(-.count)' ~/.claude/analytics/agent-usage.jsonl
# All-time token costs
jq '.modelUsage | to_entries | map({model: .key, input: .value.inputTokens, output: .value.outputTokens})' ~/.claude/stats-cache.json
Quick Subcommand Guide
, , , , , — Run the jq query from
for the matching subcommand. Present results as a markdown table.
— Follow the 4-step process in
references/session-replay.md
: locate session file, resolve reference (latest/partial/full ID), parse JSONL, present timeline.
— Apply model-specific pricing from
references/cost-estimation.md
to CC's stats-cache.json. Show per-model breakdown, totals, and cache savings.
— Follow the 4-step process in
references/trends-analysis.md
: daily activity, model delegation, peak hours, all-time stats.
— Run all subcommands and present a unified view: total sessions, top 5 agents, top 5 skills, team activity, unique projects.
Data Files
See
references/data-locations.md
for complete data source documentation.
| File | Contents |
|---|
| Agent spawn events with model, duration, success |
| Skill invocations |
| Hook execution timing and failure rates |
| Session end summaries |
| Task completions |
| Team spawns and idle events |
Rules
Each category has individual rule files in
loaded on-demand:
| Category | Rule | Impact | Key Pattern |
|---|
| Data Integrity | | CRITICAL | Hash project IDs, never log PII, local-only |
| Cost & Tokens | rules/cost-calculation.md
| HIGH | Separate pricing per token type, cache savings |
| Performance | rules/large-file-streaming.md
| HIGH | Streaming jq for >50MB, rotation-aware queries |
| Visualization | rules/visualization-recharts.md
| HIGH | Recharts charts, ResponsiveContainer, tooltips |
| Visualization | rules/visualization-dashboards.md
| HIGH | Dashboard grids, stat cards, widget registry |
Total: 5 rules across 4 categories
References
| Reference | Contents |
|---|
| Ready-to-run jq queries for all JSONL subcommands |
references/session-replay.md
| Session JSONL parsing, timeline extraction, presentation |
references/cost-estimation.md
| Pricing table, cost formula, daily cost queries |
references/trends-analysis.md
| Daily activity, model delegation, peak hours queries |
references/data-locations.md
| All data sources, file formats, CC session structure |
Important Notes
- All files are JSONL (newline-delimited JSON) format
- For large files (>50MB), use streaming without — see
rules/large-file-streaming.md
- Rotated files: — include for historical queries
- field only present during team/swarm sessions
- is a 12-char SHA256 hash — irreversible, for grouping only
Output Format
Present results as clean markdown tables. Include counts, percentages, and averages. If a file doesn't exist, note that no data has been collected yet for that category.
Related Skills
- - Codebase exploration and analysis
- - Capture user feedback
- - Store project knowledge
- - Health check diagnostics