/insights reports incorrect metrics and uses poor session sampling

Resolved 💬 4 comments Opened Feb 4, 2026 by miguel-iex Closed Mar 7, 2026

Summary

The /insights command produces inaccurate aggregate metrics and samples sessions from too narrow a time window, leading to misleading conclusions.

Issue 1: Incorrect Aggregate Metrics

The report shows numbers that don't match the underlying ~/.claude/stats-cache.json data:

| Metric | stats-cache.json (actual) | Insights Report |
|--------|---------------------------|-----------------|
| Sessions | 2,559 | 25,110 |
| Messages | 403,118 | 149,293 |

The session count appears ~10x inflated, while the message count is ~3x undercounted.

Reproduction:

# Run insights
/insights

# Compare with actual stats
jq '.totalSessions, .totalMessages' ~/.claude/stats-cache.json
# Output: 2559, 403118

Issue 2: Poor Session Sampling

The qualitative analysis samples only 4 sessions, and all 4 were from the same hour on the same day:

21e96584... → 2026-02-04 15:42
368ac560... → 2026-02-04 15:35  
aafc98e6... → 2026-02-04 15:57
ba0ba244... → 2026-02-04 15:33

This 24-minute window is not representative of 32 days of usage. The narrow sample led to incorrect conclusions about "friction" (sessions ending early) when the actual workflow deliberately uses short sessions for context freshness.

Expected Behavior

  1. Aggregate metrics should match the underlying stats-cache.json data
  2. Session sampling should span the full date range, not just recent sessions
  3. Sample size should be larger or stratified across time periods

Environment

  • Claude Code version: (current as of 2026-02-04)
  • OS: macOS Darwin 25.2.0

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗