Skip to main content

Claude Code 会话统计工具 — 分析 AI Coding 工程指标

Project description

cc-statistics

PyPI Downloads GitHub stars License

English | 中文

AI Coding 会话统计工具 — 支持 Claude Code / Gemini CLI / Codex / Cursor,从本地数据中提取工程指标。

CC Stats Dashboard

CLI Demo

CC Stats CLI Demo

安装

# uv(推荐,速度最快)
uv tool install cc-statistics

# pipx(隔离环境,任意终端可用)
pipx install cc-statistics

# Homebrew(macOS / Linux)
brew install androidZzT/tap/cc-statistics

零依赖,纯 Python 标准库。

Clawd 状态栏动画

状态栏 Clawd 像素宠物实时感知 AI 工作状态,自动切换动画:

Clawd Animation States

核心功能

  • Clawd 状态栏动画 — 实时感知 AI 工作状态,像素风动画随 Claude 任务运行/暂停/完成自动切换
  • 多数据源 — 支持 Claude Code、Gemini CLI、Codex、Cursor,可切换或聚合统计
  • macOS 原生状态栏 — 预编译二进制,无需本地编译;Claude logo + Token + 费用,超限变红预警
  • 费用估算 — 内置主流模型定价(Opus / Sonnet / Haiku / Gemini 2.5 Pro / Flash / GPT-4o)
  • 用量预警 — 单日/每周费用上限,超限系统通知
  • 会话搜索 / 恢复 / 导出 — 按关键词搜索历史对话,一键复制恢复命令,导出 Markdown / 分享长图
  • 周报 / 月报 — 自动生成 Markdown 报告,支持飞书 / 钉钉 / Slack Webhook 推送
  • 多维统计 — 指令数、工具调用 Top 10、AI vs 用户时长、代码变更(按语言)、Token(按模型)
  • 纯本地 — 所有数据读取自本地文件,不联网,不上传
  • 双语 — 自动跟随系统语言,支持中文 / English 手动切换

使用

CLI 命令行(全平台)

cc-stats                     # 分析当前目录的所有会话
cc-stats --list              # 列出所有项目(Claude + Gemini)
cc-stats --all --since 3d    # 最近 3 天所有项目
cc-stats sailor --last 3     # 某项目最近 3 个会话
cc-stats --report week       # 生成周报(Markdown)
cc-stats --compare --since 1w # 最近一周项目对比
cc-stats --notify https://hooks.slack.com/services/xxx  # Webhook 推送

Web Dashboard(全平台)

cc-stats-web

自动打开浏览器,展示暗色主题统计面板。

macOS 状态栏面板

cc-stats-app

状态栏:

  • Claude logo + 当日 Token 用量 + 预估费用
  • 右键菜单切换显示模式(Token+费用 / Token / 费用 / 会话数)
  • 超限变红预警

统计面板(原生 SwiftUI):

  • 多数据源:Claude Code / Gemini CLI / Codex / Cursor,可切换或聚合展示
  • 主题切换:跟随系统 / 深色 / 浅色
  • 用量预警:单日/每周费用上限,超限系统通知
  • 导出统计数据(JSON / CSV,自动保存到桌面并打开)
  • 设置页:开机自启、语言切换、主题切换、版本更新检测
  • 会话搜索 + 一键恢复(复制 claude --resume
  • 进程管理:查看所有 Claude 进程内存占用
  • 工具调用拆分:Skill 和 MCP 工具展开为具体名称
  • 全局快捷键 Cmd+Shift+C

数据来源

所有数据读取自本地文件,不联网,不上传:

数据源 路径
Claude Code ~/.claude/projects/<project>/<session>.jsonl
Gemini CLI ~/.gemini/tmp/<project>/chats/<session>.json
Codex ~/.codex/sessions/*.jsonl
Cursor ~/Library/Application Support/Cursor/User/globalStorage/state.vscdb
Git 变更 项目目录的 git log --numstat

各平台数据能力对比

数据维度 Claude Code Codex (OpenAI) Gemini CLI Cursor
会话列表
消息内容
Input Tokens
Output Tokens
Cache Read Tokens
Cache Creation Tokens
模型名称
费用估算 ✅ 4维 ⚠️ 3维 ⚠️ 3维
代码行数
AI 代码采纳率
工具调用统计
项目路径
用量百分比
消耗速率告警

致谢

  • 状态栏 Clawd 动画素材来自 clawd-on-desk — 一个 Electron 桌面宠物应用,通过 hook 系统实时感知 AI coding agent 的工作状态并播放像素风动画。

请 cc 吃 Token

如果这个工具对你有帮助,欢迎请 cc 吃点 Token :)

微信赞赏码

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

cc_statistics-0.12.12-py3-none-macosx_12_0_x86_64.whl (1.0 MB view details)

Uploaded Python 3macOS 12.0+ x86-64

cc_statistics-0.12.12-py3-none-macosx_12_0_arm64.whl (1.0 MB view details)

Uploaded Python 3macOS 12.0+ ARM64

cc_statistics-0.12.12-py3-none-any.whl (150.3 kB view details)

Uploaded Python 3

File details

Details for the file cc_statistics-0.12.12-py3-none-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for cc_statistics-0.12.12-py3-none-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 d0833b198b50f10b05440ff7fd3fe0b1e6ea73706a0667acb25ce02dd7e93434
MD5 bf68a304c2a9c46043bbe8a4993cb386
BLAKE2b-256 b9c7783a1f4d204aa285c5a58860e03189689aa85251f4d485d808f6a84f8e26

See more details on using hashes here.

Provenance

The following attestation bundles were made for cc_statistics-0.12.12-py3-none-macosx_12_0_x86_64.whl:

Publisher: publish.yml on androidZzT/cc-statistics

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cc_statistics-0.12.12-py3-none-macosx_12_0_arm64.whl.

File metadata

File hashes

Hashes for cc_statistics-0.12.12-py3-none-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 86231a97b54978ae853a82354e22957d0a4c227afa1bcd940e824e8fc3ad415d
MD5 88a332d76c657626a669841d5b14f525
BLAKE2b-256 dc8a28438bbbf6652e978c431fe146a3b3c8ca954977cb110e562dc2afc5cc25

See more details on using hashes here.

Provenance

The following attestation bundles were made for cc_statistics-0.12.12-py3-none-macosx_12_0_arm64.whl:

Publisher: publish.yml on androidZzT/cc-statistics

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cc_statistics-0.12.12-py3-none-any.whl.

File metadata

File hashes

Hashes for cc_statistics-0.12.12-py3-none-any.whl
Algorithm Hash digest
SHA256 de9f44c103c6b7045db9a353db20235a12ec05c57d722532c17c42d4a642aa17
MD5 645bb8cfb5dd95a6078c271960105912
BLAKE2b-256 42c5a568d8bd256e816ece4f258ddd18a4f6044618874bb43e302f4ef0e7666e

See more details on using hashes here.

Provenance

The following attestation bundles were made for cc_statistics-0.12.12-py3-none-any.whl:

Publisher: publish.yml on androidZzT/cc-statistics

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page