Feature Request: Usage Analytics with JSON/CSV Export Support
Resolved 💬 4 comments Opened Jun 4, 2025 by fumiya-kume Closed Jan 7, 2026
Background
This request builds upon several existing feature requests to provide comprehensive usage analytics:
- #1109 requests usage metrics visibility for Max subscribers
- #522 requests automated project tracking and logging
- #507 requests cost reporting in non-interactive mode
- #209 requests conversation history tracking
Problem Statement
Organizations and teams need structured data export capabilities to:
- Monitor usage across multiple developers (enterprise governance)
- Track costs per project/team for budget allocation
- Integrate with external tools (BI, accounting, monitoring systems)
- Analyze productivity patterns for workflow optimization
Proposed Solution
Extend existing usage tracking with data export capabilities:
Core Commands
# Enhanced usage reporting with export
claude usage --period daily --export json --output report.json
claude usage --period monthly --export csv --output report.csv
claude sessions --project my-app --export csv
Export Formats
JSON Structure:
{
"period": { "start": "2025-05-01", "end": "2025-05-31" },
"summary": { "total_cost": 156.78, "total_sessions": 45 },
"daily_usage": [
{ "date": "2025-05-01", "cost": 12.34, "sessions": 3, "projects": ["web-app"] }
],
"sessions": [
{ "session_id": "sess_123", "project": "web-app", "cost": 8.45, "duration": "45m" }
]
}
CSV Structure:
date,project,session_id,duration,cost_usd,input_tokens,output_tokens,files_modified
2025-05-01,web-app,sess_123,45m,8.45,2500,1800,12
Key Features
- Date range filtering:
--since,--untilparameters - Project grouping:
--project,--group-by project - Multiple formats: JSON, CSV support
- Enterprise support: Multi-user analytics for administrators
Use Cases
- Enterprise Monitoring: IT admins track team usage for governance and compliance
- Cost Allocation: Finance teams allocate Claude Code costs to specific projects/departments
- Tool Integration: Export data to existing analytics platforms (Grafana, DataDog, Excel)
- Workflow Optimization: Analyze usage patterns to improve development efficiency
Implementation Approach
This leverages existing infrastructure from the issues mentioned above:
- Extend the current
/costcommand with export options - Build on the logging system proposed in #522
- Add structured export to the metrics visibility from #1109
- Support the non-interactive mode requirements from #507
Related Issues
- #1109 - Usage Metrics Visibility for Max Subscribers
- #522 - Automated Project Tracking and Logging for Claude Sessions
- #507 - Add Cost Reporting Feature to Claude Code CLI in Non-Interactive Mode
- #209 - Markdown Conversation History Tracking Feature Request
This feature would address the enterprise and team collaboration needs that aren't fully covered by the existing feature requests, while building on their foundation.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗