Skip to main content
The crush stats command generates and displays detailed usage statistics including token usage, costs, activity patterns, and tool usage analytics.

Usage

Description

Generate and display comprehensive usage statistics in a beautiful HTML dashboard. The stats include:
  • Total statistics: Sessions, tokens, costs, messages
  • Daily usage: Token consumption and costs over time
  • Model usage: Which models you use most
  • Hourly patterns: When you’re most active
  • Day of week: Activity by day
  • Recent activity: Last 30 days of usage
  • Tool usage: Which tools are called most frequently
  • Heatmap: Hour-by-day activity visualization
  • Response times: Average AI response times

Global Flags

string
default:"~/.crush"
Custom Crush data directory. Specify which Crush database to analyze.
Other global flags are also available: --debug

Output

The command generates an HTML file with interactive charts and visualizations:
The file is automatically opened in your default browser. If the browser fails to open, the path is displayed for manual opening.

Examples

Statistics Breakdown

Total Stats

Overall usage metrics:
  • Total Sessions: Number of Crush sessions
  • Total Messages: Messages exchanged with AI
  • Total Tokens: Combined prompt and completion tokens
    • Prompt Tokens: Tokens sent to the AI
    • Completion Tokens: Tokens generated by the AI
  • Total Cost: Estimated cost in USD
  • Average Tokens per Session: Mean token usage per session
  • Average Messages per Session: Mean message count per session

Usage by Day

Daily breakdown showing:
  • Date
  • Prompt tokens
  • Completion tokens
  • Total tokens
  • Cost
  • Session count

Usage by Model

Model usage statistics:
  • Model name (e.g., claude-sonnet-4-20250514)
  • Provider (e.g., anthropic)
  • Message count
Helps identify your most-used models.

Usage by Hour

Activity distribution across 24 hours:
  • Hour (0-23)
  • Session count
Shows when you’re most productive with Crush.

Usage by Day of Week

Weekly activity patterns:
  • Day name (Sunday through Saturday)
  • Session count
  • Prompt tokens
  • Completion tokens
Identify your most productive days.

Recent Activity

Last 30 days of activity:
  • Date
  • Session count
  • Total tokens
  • Cost
Track recent trends in your usage.

Tool Usage

Frequency of tool calls:
  • Tool name (e.g., bash, edit, read)
  • Call count
See which tools the AI uses most in your sessions.

Hour-Day Heatmap

Visualize activity across hours and days:
  • X-axis: Hours (0-23)
  • Y-axis: Days of week
  • Color intensity: Session count
Identify your peak productivity patterns.

Average Response Time

Mean response time from the AI in milliseconds.

Generated HTML

The statistics page includes:
  • Interactive charts: Built with JavaScript charting library
  • Responsive design: Works on desktop and mobile
  • Embedded styling: Self-contained HTML file
  • Branding: Crush logo and styling
  • Metadata: Generation date, project name, username

File Structure

The HTML file is completely self-contained with embedded:
  • CSS styling
  • JavaScript code
  • SVG graphics
  • Statistics data (JSON)

Example Output

When you run the command:
The browser opens showing:

Error Messages

No Data Available

Cause: No Crush sessions have been recorded yet. Solution: Use Crush to create some sessions first:

Failed to Initialize Config

Cause: Configuration file is invalid or data directory doesn’t exist. Solution:

Failed to Connect to Database

Cause: Database file is missing or corrupted. Solution:

Browser Doesn’t Open

Cause: System browser couldn’t be launched. Solution: Open the displayed file path manually:

Data Source

Statistics are gathered from the SQLite database at:
The database contains:
  • Sessions table: Session metadata
  • Messages table: All messages with token counts
  • Tool calls: Records of tool invocations
  • Timestamps: For time-based analysis

Privacy & Analytics

The stats command:
  • Runs locally: No data is sent to external servers
  • Reads from local DB: Only accesses your local Crush database
  • Generates local HTML: Output is saved to your filesystem
  • No telemetry: Statistics generation doesn’t trigger any metrics

Use Cases

Cost Tracking

Monitor your AI API spending:

Usage Optimization

Identify patterns to optimize your workflow:
  • Which models you use most
  • Peak productivity hours
  • Most-used tools
  • Average session length

Team Reporting

Share usage insights:

Billing & Budgeting

Track costs for:
  • Personal budget management
  • Project cost allocation
  • Client billing
  • Team cost analysis

Telemetry

Running crush stats triggers an analytics event:
This can be disabled with:
  • CRUSH_DISABLE_METRICS=true environment variable
  • DO_NOT_TRACK=true environment variable
  • "disable_metrics": true in crush.json

See Also