analytics
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCross-Project Analytics
跨项目分析
Query local analytics data from . All data is local-only, privacy-safe (hashed project IDs, no PII).
~/.claude/analytics/从查询本地分析数据。所有数据仅存储在本地,隐私安全(项目ID已哈希处理,无个人可识别信息PII)。
~/.claude/analytics/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 | |
| Token cost estimation with cache savings | | |
| Daily activity, model delegation, peak hours | | |
| Unified view of all categories | All files | |
解析用户参数以确定要显示的报告。如果未提供参数,使用AskUserQuestion让用户选择。
| 子命令 | 描述 | 数据源 | 参考文档 |
|---|---|---|---|
| 按使用频率、时长、模型细分的热门Agent | | |
| 模型委托细分(opus/sonnet/haiku) | | |
| 按调用次数排序的热门Skill | | |
| 最慢的Hook及失败率 | | |
| 团队生成次数、空闲时间、任务完成情况 | | |
| 重放包含工具、令牌、时间线的会话 | CC session JSONL | |
| 含缓存节省的令牌成本估算 | | |
| 每日活动、模型委托、高峰时段 | | |
| 所有类别的统一视图 | 所有文件 | |
Quick Start Example
快速入门示例
bash
undefinedbash
undefinedTop 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
undefinedjq '.modelUsage | to_entries | map({model: .key, input: .value.inputTokens, output: .value.outputTokens})' ~/.claude/stats-cache.json
undefinedQuick Subcommand Guide
子命令快速指南
agentsmodelsskillshooksteamssummaryreferences/jq-queries.mdsessionreferences/session-replay.mdcostreferences/cost-estimation.mdtrendsreferences/trends-analysis.mdsummaryagentsmodelsskillshooksteamssummaryreferences/jq-queries.mdsessionreferences/session-replay.mdcostreferences/cost-estimation.mdtrendsreferences/trends-analysis.mdsummaryData Files
数据文件
See for complete data source documentation.
references/data-locations.md| 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 |
完整的数据源文档请查看。
references/data-locations.md| 文件 | 内容 |
|---|---|
| 包含模型、时长、成功状态的Agent生成事件 |
| Skill调用记录 |
| Hook执行时间及失败率 |
| 会话结束摘要 |
| 任务完成记录 |
| 团队生成及空闲事件 |
Rules
规则
Each category has individual rule files in loaded on-demand:
rules/| Category | Rule | Impact | Key Pattern |
|---|---|---|---|
| Data Integrity | | CRITICAL | Hash project IDs, never log PII, local-only |
| Cost & Tokens | | HIGH | Separate pricing per token type, cache savings |
| Performance | | HIGH | Streaming jq for >50MB, rotation-aware queries |
| Visualization | | HIGH | Recharts charts, ResponsiveContainer, tooltips |
| Visualization | | HIGH | Dashboard grids, stat cards, widget registry |
Total: 5 rules across 4 categories
每个类别在目录下有单独的规则文件,按需加载:
rules/| 类别 | 规则 | 影响级别 | 关键模式 |
|---|---|---|---|
| 数据完整性 | | 关键 | 哈希项目ID,绝不记录PII,仅本地存储 |
| 成本与令牌 | | 高 | 按令牌类型区分定价,缓存节省 |
| 性能 | | 高 | 对>50MB文件使用流式jq查询,支持轮换文件查询 |
| 可视化 | | 高 | Recharts图表、ResponsiveContainer、工具提示 |
| 可视化 | | 高 | 仪表板网格、统计卡片、小部件注册表 |
总计:4个类别下的5条规则
References
参考文档
| Reference | Contents |
|---|---|
| Ready-to-run jq queries for all JSONL subcommands |
| Session JSONL parsing, timeline extraction, presentation |
| Pricing table, cost formula, daily cost queries |
| Daily activity, model delegation, peak hours queries |
| All data sources, file formats, CC session structure |
| 参考文档 | 内容 |
|---|---|
| 适用于所有JSONL子命令的可直接运行的jq查询 |
| 会话JSONL解析、时间线提取、呈现 |
| 定价表、成本公式、每日成本查询 |
| 每日活动、模型委托、高峰时段查询 |
| 所有数据源、文件格式、CC会话结构 |
Important Notes
重要说明
- All files are JSONL (newline-delimited JSON) format
- For large files (>50MB), use streaming without
jq— see-srules/large-file-streaming.md - Rotated files: — include for historical queries
<name>.<YYYY-MM>.jsonl - field only present during team/swarm sessions
team - is a 12-char SHA256 hash — irreversible, for grouping only
pid
- 所有文件均为JSONL(换行分隔JSON)格式
- 对于大文件(>50MB),使用不带的流式
-s— 详见jqrules/large-file-streaming.md - 轮换文件:— 查询历史数据时需包含这些文件
<name>.<YYYY-MM>.jsonl - 字段仅在团队/集群会话中存在
team - 是12位SHA256哈希 — 不可逆,仅用于分组
pid
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
相关技能
- - Codebase exploration and analysis
ork:explore - - Capture user feedback
ork:feedback - - Store project knowledge
ork:remember - - Health check diagnostics
ork:doctor
- - 代码库探索与分析
ork:explore - - 收集用户反馈
ork:feedback - - 存储项目知识
ork:remember - - 健康检查诊断
ork:doctor