analytics

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Cross-Project Analytics

跨项目分析

Query local analytics data from
~/.claude/analytics/
. All data is local-only, privacy-safe (hashed project IDs, no PII).
~/.claude/analytics/
查询本地分析数据。所有数据仅存储在本地,隐私安全(项目ID已哈希处理,无个人可识别信息PII)。

Subcommands

子命令

Parse the user's argument to determine which report to show. If no argument provided, use AskUserQuestion to let them pick.
SubcommandDescriptionData SourceReference
agents
Top agents by frequency, duration, model breakdown
agent-usage.jsonl
references/jq-queries.md
models
Model delegation breakdown (opus/sonnet/haiku)
agent-usage.jsonl
references/jq-queries.md
skills
Top skills by invocation count
skill-usage.jsonl
references/jq-queries.md
hooks
Slowest hooks and failure rates
hook-timing.jsonl
references/jq-queries.md
teams
Team spawn counts, idle time, task completions
team-activity.jsonl
references/jq-queries.md
session
Replay a session timeline with tools, tokens, timingCC session JSONL
references/session-replay.md
cost
Token cost estimation with cache savings
stats-cache.json
references/cost-estimation.md
trends
Daily activity, model delegation, peak hours
stats-cache.json
references/trends-analysis.md
summary
Unified view of all categoriesAll files
references/jq-queries.md
解析用户参数以确定要显示的报告。如果未提供参数,使用AskUserQuestion让用户选择。
子命令描述数据源参考文档
agents
按使用频率、时长、模型细分的热门Agent
agent-usage.jsonl
references/jq-queries.md
models
模型委托细分(opus/sonnet/haiku)
agent-usage.jsonl
references/jq-queries.md
skills
按调用次数排序的热门Skill
skill-usage.jsonl
references/jq-queries.md
hooks
最慢的Hook及失败率
hook-timing.jsonl
references/jq-queries.md
teams
团队生成次数、空闲时间、任务完成情况
team-activity.jsonl
references/jq-queries.md
session
重放包含工具、令牌、时间线的会话CC session JSONL
references/session-replay.md
cost
含缓存节省的令牌成本估算
stats-cache.json
references/cost-estimation.md
trends
每日活动、模型委托、高峰时段
stats-cache.json
references/trends-analysis.md
summary
所有类别的统一视图所有文件
references/jq-queries.md

Quick Start Example

快速入门示例

bash
undefined
bash
undefined

Top agents with model breakdown

带模型细分的热门Agent

jq -s 'group_by(.agent) | map({agent: .[0].agent, count: length}) | sort_by(-.count)' ~/.claude/analytics/agent-usage.jsonl
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
undefined
jq '.modelUsage | to_entries | map({model: .key, input: .value.inputTokens, output: .value.outputTokens})' ~/.claude/stats-cache.json
undefined

Quick Subcommand Guide

子命令快速指南

agents
,
models
,
skills
,
hooks
,
teams
,
summary
— Run the jq query from
references/jq-queries.md
for the matching subcommand. Present results as a markdown table.
session
— Follow the 4-step process in
references/session-replay.md
: locate session file, resolve reference (latest/partial/full ID), parse JSONL, present timeline.
cost
— Apply model-specific pricing from
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
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.
agents
,
models
,
skills
,
hooks
,
teams
,
summary
— 运行
references/jq-queries.md
中匹配子命令的jq查询,结果以Markdown表格呈现。
session
— 遵循
references/session-replay.md
中的4步流程:定位会话文件、解析引用(最新/部分/完整ID)、解析JSONL、呈现时间线。
cost
— 将
references/cost-estimation.md
中的模型特定定价应用于CC的stats-cache.json,显示按模型细分的成本、总成本及缓存节省。
trends
— 遵循
references/trends-analysis.md
中的4步流程:每日活动、模型委托、高峰时段、全时段统计。
summary
— 运行所有子命令并呈现统一视图:总会话数、Top 5 Agent、Top 5 Skill、团队活动、唯一项目数。

Data Files

数据文件

See
references/data-locations.md
for complete data source documentation.
FileContents
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
完整的数据源文档请查看
references/data-locations.md
文件内容
agent-usage.jsonl
包含模型、时长、成功状态的Agent生成事件
skill-usage.jsonl
Skill调用记录
hook-timing.jsonl
Hook执行时间及失败率
session-summary.jsonl
会话结束摘要
task-usage.jsonl
任务完成记录
team-activity.jsonl
团队生成及空闲事件

Rules

规则

Each category has individual rule files in
rules/
loaded on-demand:
CategoryRuleImpactKey Pattern
Data Integrity
rules/data-privacy.md
CRITICALHash project IDs, never log PII, local-only
Cost & Tokens
rules/cost-calculation.md
HIGHSeparate pricing per token type, cache savings
Performance
rules/large-file-streaming.md
HIGHStreaming jq for >50MB, rotation-aware queries
Visualization
rules/visualization-recharts.md
HIGHRecharts charts, ResponsiveContainer, tooltips
Visualization
rules/visualization-dashboards.md
HIGHDashboard grids, stat cards, widget registry
Total: 5 rules across 4 categories
每个类别在
rules/
目录下有单独的规则文件,按需加载:
类别规则影响级别关键模式
数据完整性
rules/data-privacy.md
关键哈希项目ID,绝不记录PII,仅本地存储
成本与令牌
rules/cost-calculation.md
按令牌类型区分定价,缓存节省
性能
rules/large-file-streaming.md
对>50MB文件使用流式jq查询,支持轮换文件查询
可视化
rules/visualization-recharts.md
Recharts图表、ResponsiveContainer、工具提示
可视化
rules/visualization-dashboards.md
仪表板网格、统计卡片、小部件注册表
总计:4个类别下的5条规则

References

参考文档

ReferenceContents
references/jq-queries.md
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
参考文档内容
references/jq-queries.md
适用于所有JSONL子命令的可直接运行的jq查询
references/session-replay.md
会话JSONL解析、时间线提取、呈现
references/cost-estimation.md
定价表、成本公式、每日成本查询
references/trends-analysis.md
每日活动、模型委托、高峰时段查询
references/data-locations.md
所有数据源、文件格式、CC会话结构

Important Notes

重要说明

  • All files are JSONL (newline-delimited JSON) format
  • For large files (>50MB), use streaming
    jq
    without
    -s
    — see
    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
  • 所有文件均为JSONL(换行分隔JSON)格式
  • 对于大文件(>50MB),使用不带
    -s
    的流式
    jq
    — 详见
    rules/large-file-streaming.md
  • 轮换文件:
    <name>.<YYYY-MM>.jsonl
    — 查询历史数据时需包含这些文件
  • team
    字段仅在团队/集群会话中存在
  • pid
    是12位SHA256哈希 — 不可逆,仅用于分组

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.
结果以清晰的Markdown表格呈现,包含计数、百分比和平均值。如果文件不存在,需注明该类别尚未收集数据。

Related Skills

相关技能

  • ork:explore
    - Codebase exploration and analysis
  • ork:feedback
    - Capture user feedback
  • ork:remember
    - Store project knowledge
  • ork:doctor
    - Health check diagnostics
  • ork:explore
    - 代码库探索与分析
  • ork:feedback
    - 收集用户反馈
  • ork:remember
    - 存储项目知识
  • ork:doctor
    - 健康检查诊断