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

致谢

  • 状态栏 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.8-py3-none-macosx_12_0_x86_64.whl (1.0 MB view details)

Uploaded Python 3macOS 12.0+ x86-64

cc_statistics-0.12.8-py3-none-macosx_12_0_arm64.whl (998.9 kB view details)

Uploaded Python 3macOS 12.0+ ARM64

cc_statistics-0.12.8-py3-none-any.whl (146.0 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for cc_statistics-0.12.8-py3-none-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 b3270b8324f1c2d2149328382c016761d13defdc5e43148f8e3a212e101c4f8e
MD5 aa442c2d19485207b8480ad851b5d491
BLAKE2b-256 623b88a6586cbcf39d479daf9aaa9d1c293229aafdfe8d333f9ce404954380ac

See more details on using hashes here.

Provenance

The following attestation bundles were made for cc_statistics-0.12.8-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.8-py3-none-macosx_12_0_arm64.whl.

File metadata

File hashes

Hashes for cc_statistics-0.12.8-py3-none-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 76db07a8093205ca3d857be92c34b370b7160331c900b3dbad160204c1947d05
MD5 ab9ce50199898cac349d53a866308539
BLAKE2b-256 34e56057dbdf07f5cee7f1d2775ca952087f817929e49fc72ccb5f4d3a7ee58e

See more details on using hashes here.

Provenance

The following attestation bundles were made for cc_statistics-0.12.8-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.8-py3-none-any.whl.

File metadata

  • Download URL: cc_statistics-0.12.8-py3-none-any.whl
  • Upload date:
  • Size: 146.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cc_statistics-0.12.8-py3-none-any.whl
Algorithm Hash digest
SHA256 bfcba0234f3f6a6f30f4c05e0d039f895d996807392f18c9fa0b17fd44d88c20
MD5 9d52616f473a5127c0cbb865e7438322
BLAKE2b-256 22842d25a976ffc4204dd950b7246db4d9b67540a0e3e04efc7a33f5fa5ee817

See more details on using hashes here.

Provenance

The following attestation bundles were made for cc_statistics-0.12.8-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