Feature: Per-project cumulative usage tracking (tokens, cost, time)
Problem
There's no way to see cumulative Claude Code usage across sessions for a given project. The /cost command shows current session usage, but nothing persists or aggregates.
Use Case
We're a small dev team using Claude Code heavily for internal tooling. We'd love to include AI usage stats in our PR descriptions, sprint reports, and dev documentation — things like:
- "This feature took 4 Claude sessions and 3.2M tokens"
- "ProjectHub has consumed 45M tokens across 127 sessions since March"
- Token burn rate per project per week
This would help us understand the ROI of AI-assisted development and make for interesting engineering metrics.
Proposed Solution
Persistent per-project usage tracking that records after each session:
- Total input/output tokens
- Estimated cost
- Session duration (wall-clock)
- Session count
- Timestamp
CLI access:
# Show usage for current project
claude usage
# Show usage for a specific project
claude usage --project /path/to/project
# Export as JSON for dashboards/reporting
claude usage --json
# Show usage for last 30 days
claude usage --since 30d
Storage: A .claude/usage.json (or similar) in the project directory, or centralized in ~/.claude/usage/.
Bonus: Expose via an API or hook so it could be pulled into PR templates, CI dashboards, or team reports automatically.
Alternatives Considered
- Manually tracking with a JSON file (works but lossy and tedious)
- Parsing
/costoutput at end of each session (not automatable) - Git commit frequency as a proxy (very indirect)
Additional Context
The data is already being computed per-session (visible via /cost). This request is really just about persisting it and making it queryable across sessions.
🤖 Generated with Claude Code
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗