Cross-Project Analytics
Query local analytics data from ~/.claude/analytics/. 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 |
agents |
Top agents by frequency, duration, model breakdown |
agent-usage.jsonl |
${CLAUDE_SKILL_DIR}/references/jq-queries.md |
models |
Model delegation breakdown (opus/sonnet/haiku) |
agent-usage.jsonl |
${CLAUDE_SKILL_DIR}/references/jq-queries.md |
skills |
Top skills by invocation count |
skill-usage.jsonl |
${CLAUDE_SKILL_DIR}/references/jq-queries.md |
hooks |
Slowest hooks and failure rates |
hook-timing.jsonl |
${CLAUDE_SKILL_DIR}/references/jq-queries.md |
teams |
Team spawn counts, idle time, task completions |
team-activity.jsonl |
${CLAUDE_SKILL_DIR}/references/jq-queries.md |
session |
Replay a session timeline with tools, tokens, timing |
CC session JSONL |
${CLAUDE_SKILL_DIR}/references/session-replay.md |
cost |
Token cost estimation with cache savings |
stats-cache.json |
${CLAUDE_SKILL_DIR}/references/cost-estimation.md |
trends |
Daily activity, model delegation, peak hours |
stats-cache.json |
${CLAUDE_SKILL_DIR}/references/trends-analysis.md |
summary |
Unified view of all categories |
All files |
${CLAUDE_SKILL_DIR}/references/jq-queries.md |
otel |
CC 2.1.117 OTEL enrichments: top slash commands (user vs model), per-effort cost, effort-vs-success correlation |
~/.claude/otel/*.jsonl |
${CLAUDE_SKILL_DIR}/references/otel-fields.md |
Quick Start Example
# 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
agents, models, skills, hooks, teams, summary — Run the jq query from Read("${CLAUDE_SKILL_DIR}/references/jq-queries.md") for the matching subcommand. Present results as a markdown table.
session — Follow the 4-step process in Read("${CLAUDE_SKILL_DIR}/references/session-replay.md"): locate session file, resolve reference (latest/partial/full ID), parse JSONL, present timeline.
cost — Apply model-specific pricing from Read("${CLAUDE_SKILL_DIR}/references/cost-estimation.md") to CC's stats-cache.json. Show per-model breakdown, totals, and cache savings.
trends — Follow the 4-step process in Read("${CLAUDE_SKILL_DIR}/references/trends-analysis.md"): daily activity, model delegation, peak hours, all-time stats.
summary — Run all subcommands and present a unified view: total sessions, top 5 agents, top 5 skills, team activity, unique projects. If ~/.claude/otel/*.jsonl exists with non-empty content, append the three OTEL panels from otel-fields.md; otherwise omit them (do not render empty panels).
otel — Render the three CC 2.1.117 OTEL panels (top slash commands user-vs-model, per-effort cost breakdown, effort-vs-success correlation). See Read("${CLAUDE_SKILL_DIR}/references/otel-fields.md") for queries, graceful-fallback rules, and panel semantics. Falls back cleanly to "no OTEL data available (upgrade to CC ≥ 2.1.117)" when the files are absent or empty.
Data Files
Load Read("${CLAUDE_SKILL_DIR}/references/data-locations.md") for complete data source documentation.
| File |
Contents |
agent-usage.jsonl |
Agent spawn events with model, duration, success |
skill-usage.jsonl |
Skill invocations |
hook-timing.jsonl |
Hook execution timing and failure rates |
session-summary.jsonl |
Session end summaries |
task-usage.jsonl |
Task completions |
team-activity.jsonl |
Team spawns and idle events |
Rules
Each category has individual rule files in rules/ loaded on-demand:
| Category |
Rule |
Impact |
Key Pattern |
| Data Integrity |
${CLAUDE_SKILL_DIR}/rules/data-privacy.md |
CRITICAL |
Hash project IDs, never log PII, local-only |
| Cost & Tokens |
${CLAUDE_SKILL_DIR}/rules/cost-calculation.md |
HIGH |
Separate pricing per token type, cache savings |
| Performance |
${CLAUDE_SKILL_DIR}/rules/large-file-streaming.md |
HIGH |
Streaming jq for >50MB, rotation-aware queries |
| Visualization |
${CLAUDE_SKILL_DIR}/rules/visualization-recharts.md |
HIGH |
Recharts charts, ResponsiveContainer, tooltips |
| Visualization |
${CLAUDE_SKILL_DIR}/rules/visualization-dashboards.md |
HIGH |
Dashboard grids, stat cards, widget registry |
Total: 5 rules across 4 categories
References
| Reference |
Contents |
${CLAUDE_SKILL_DIR}/references/jq-queries.md |
Ready-to-run jq queries for all JSONL subcommands |
${CLAUDE_SKILL_DIR}/references/session-replay.md |
Session JSONL parsing, timeline extraction, presentation |
${CLAUDE_SKILL_DIR}/references/cost-estimation.md |
Pricing table, cost formula, daily cost queries |
${CLAUDE_SKILL_DIR}/references/trends-analysis.md |
Daily activity, model delegation, peak hours queries |
${CLAUDE_SKILL_DIR}/references/data-locations.md |
All data sources, file formats, CC session structure |
${CLAUDE_SKILL_DIR}/references/otel-fields.md |
CC 2.1.117 OTEL fields (command_name, command_source, effort), queries, and dashboard panels |
Important Notes
- All files are JSONL (newline-delimited JSON) format
- For large files (>50MB), use streaming
jq without -s — load Read("${CLAUDE_SKILL_DIR}/rules/large-file-streaming.md")
- Rotated files:
<name>.<YYYY-MM>.jsonl — include for historical queries
team field only present during team/swarm sessions
pid 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
ork:explore - Codebase exploration and analysis
ork:feedback - Capture user feedback
ork:remember - Store project knowledge
ork:doctor - Health check diagnostics
1---
2name: analytics
3license: MIT
4compatibility: "Claude Code 2.1.76+."
5author: OrchestKit
6description: "Queries local analytics across OrchestKit projects for agent usage, skill frequency, hook timing, team activity, session replay, cost estimation, and model delegation trends. Privacy-safe with hashed project IDs. Supports time-range filtering and comparative analysis. Use when reviewing performance, estimating costs, or understanding usage patterns."
7argument-hint: "[agents|models|skills|hooks|teams|session|cost|trends|summary]"
8context: inherit
9version: 2.1.0
10tags: [analytics, metrics, usage, teams, agents, skills, hooks, data-visualization, dashboard, recharts, charts, widgets, session, cost, tokens, model-delegation]
11user-invocable: false
12allowed-tools: [Bash, Read, Grep, Glob, AskUserQuestion]
13complexity: low
14persuasion-type: collaborative
15effort: low
16model: haiku
17metadata:
18 source: https://skillmd.com/skills/aibot88/analytics
19 category: document-asset-creation
20---
21
22# Cross-Project Analytics
23
24Query local analytics data from `~/.claude/analytics/`. All data is local-only, privacy-safe (hashed project IDs, no PII).
25
26## Subcommands
27
28Parse the user's argument to determine which report to show. If no argument provided, use AskUserQuestion to let them pick.
29
30| Subcommand | Description | Data Source | Reference |
31|------------|-------------|-------------|-----------|
32| `agents` | Top agents by frequency, duration, model breakdown | `agent-usage.jsonl` | `${CLAUDE_SKILL_DIR}/references/jq-queries.md` |
33| `models` | Model delegation breakdown (opus/sonnet/haiku) | `agent-usage.jsonl` | `${CLAUDE_SKILL_DIR}/references/jq-queries.md` |
34| `skills` | Top skills by invocation count | `skill-usage.jsonl` | `${CLAUDE_SKILL_DIR}/references/jq-queries.md` |
35| `hooks` | Slowest hooks and failure rates | `hook-timing.jsonl` | `${CLAUDE_SKILL_DIR}/references/jq-queries.md` |
36| `teams` | Team spawn counts, idle time, task completions | `team-activity.jsonl` | `${CLAUDE_SKILL_DIR}/references/jq-queries.md` |
37| `session` | Replay a session timeline with tools, tokens, timing | CC session JSONL | `${CLAUDE_SKILL_DIR}/references/session-replay.md` |
38| `cost` | Token cost estimation with cache savings | `stats-cache.json` | `${CLAUDE_SKILL_DIR}/references/cost-estimation.md` |
39| `trends` | Daily activity, model delegation, peak hours | `stats-cache.json` | `${CLAUDE_SKILL_DIR}/references/trends-analysis.md` |
40| `summary` | Unified view of all categories | All files | `${CLAUDE_SKILL_DIR}/references/jq-queries.md` |
41| `otel` | CC 2.1.117 OTEL enrichments: top slash commands (user vs model), per-effort cost, effort-vs-success correlation | `~/.claude/otel/*.jsonl` | `${CLAUDE_SKILL_DIR}/references/otel-fields.md` |
42
43### Quick Start Example
44
45```bash
46# Top agents with model breakdown
47jq -s 'group_by(.agent) | map({agent: .[0].agent, count: length}) | sort_by(-.count)' ~/.claude/analytics/agent-usage.jsonl
48
49# All-time token costs
50jq '.modelUsage | to_entries | map({model: .key, input: .value.inputTokens, output: .value.outputTokens})' ~/.claude/stats-cache.json
51```
52
53### Quick Subcommand Guide
54
55**`agents`, `models`, `skills`, `hooks`, `teams`, `summary`** — Run the jq query from `Read("${CLAUDE_SKILL_DIR}/references/jq-queries.md")` for the matching subcommand. Present results as a markdown table.
56
57**`session`** — Follow the 4-step process in `Read("${CLAUDE_SKILL_DIR}/references/session-replay.md")`: locate session file, resolve reference (latest/partial/full ID), parse JSONL, present timeline.
58
59**`cost`** — Apply model-specific pricing from `Read("${CLAUDE_SKILL_DIR}/references/cost-estimation.md")` to CC's stats-cache.json. Show per-model breakdown, totals, and cache savings.
60
61**`trends`** — Follow the 4-step process in `Read("${CLAUDE_SKILL_DIR}/references/trends-analysis.md")`: daily activity, model delegation, peak hours, all-time stats.
62
63**`summary`** — Run all subcommands and present a unified view: total sessions, top 5 agents, top 5 skills, team activity, unique projects. If `~/.claude/otel/*.jsonl` exists with non-empty content, append the three OTEL panels from `otel-fields.md`; otherwise omit them (do not render empty panels).
64
65**`otel`** — Render the three CC 2.1.117 OTEL panels (top slash commands user-vs-model, per-effort cost breakdown, effort-vs-success correlation). See `Read("${CLAUDE_SKILL_DIR}/references/otel-fields.md")` for queries, graceful-fallback rules, and panel semantics. Falls back cleanly to "no OTEL data available (upgrade to CC ≥ 2.1.117)" when the files are absent or empty.
66
67## Data Files
68
69Load `Read("${CLAUDE_SKILL_DIR}/references/data-locations.md")` for complete data source documentation.
70
71| File | Contents |
72|------|----------|
73| `agent-usage.jsonl` | Agent spawn events with model, duration, success |
74| `skill-usage.jsonl` | Skill invocations |
75| `hook-timing.jsonl` | Hook execution timing and failure rates |
76| `session-summary.jsonl` | Session end summaries |
77| `task-usage.jsonl` | Task completions |
78| `team-activity.jsonl` | Team spawns and idle events |
79
80## Rules
81
82Each category has individual rule files in `rules/` loaded on-demand:
83
84| Category | Rule | Impact | Key Pattern |
85|----------|------|--------|-------------|
86| Data Integrity | `${CLAUDE_SKILL_DIR}/rules/data-privacy.md` | CRITICAL | Hash project IDs, never log PII, local-only |
87| Cost & Tokens | `${CLAUDE_SKILL_DIR}/rules/cost-calculation.md` | HIGH | Separate pricing per token type, cache savings |
88| Performance | `${CLAUDE_SKILL_DIR}/rules/large-file-streaming.md` | HIGH | Streaming jq for >50MB, rotation-aware queries |
89| Visualization | `${CLAUDE_SKILL_DIR}/rules/visualization-recharts.md` | HIGH | Recharts charts, ResponsiveContainer, tooltips |
90| Visualization | `${CLAUDE_SKILL_DIR}/rules/visualization-dashboards.md` | HIGH | Dashboard grids, stat cards, widget registry |
91
92**Total: 5 rules across 4 categories**
93
94## References
95
96| Reference | Contents |
97|-----------|----------|
98| `${CLAUDE_SKILL_DIR}/references/jq-queries.md` | Ready-to-run jq queries for all JSONL subcommands |
99| `${CLAUDE_SKILL_DIR}/references/session-replay.md` | Session JSONL parsing, timeline extraction, presentation |
100| `${CLAUDE_SKILL_DIR}/references/cost-estimation.md` | Pricing table, cost formula, daily cost queries |
101| `${CLAUDE_SKILL_DIR}/references/trends-analysis.md` | Daily activity, model delegation, peak hours queries |
102| `${CLAUDE_SKILL_DIR}/references/data-locations.md` | All data sources, file formats, CC session structure |
103| `${CLAUDE_SKILL_DIR}/references/otel-fields.md` | CC 2.1.117 OTEL fields (command_name, command_source, effort), queries, and dashboard panels |
104
105## Important Notes
106
107- All files are JSONL (newline-delimited JSON) format
108- For large files (>50MB), use streaming `jq` without `-s` — load `Read("${CLAUDE_SKILL_DIR}/rules/large-file-streaming.md")`
109- Rotated files: `<name>.<YYYY-MM>.jsonl` — include for historical queries
110- `team` field only present during team/swarm sessions
111- `pid` is a 12-char SHA256 hash — irreversible, for grouping only
112
113## Output Format
114
115Present 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.
116
117## Related Skills
118
119- `ork:explore` - Codebase exploration and analysis
120- `ork:feedback` - Capture user feedback
121- `ork:remember` - Store project knowledge
122- `ork:doctor` - Health check diagnostics