/insights: session-meta cache not invalidated when session grows

Resolved 💬 1 comment Opened Feb 17, 2026 by hellaxe Closed Feb 17, 2026

Summary

/insights generates session-meta JSON files that cache session statistics (message counts, duration, etc.). Once generated, these files are never updated, even if the underlying session .jsonl file continues to grow significantly.

This leads to inaccurate insights reports — sessions that were active when /insights was first run get their stats frozen at that point.

Steps to reproduce

  1. Start an interactive Claude Code session, send a few messages
  2. Run /insights — the session appears in the report with correct stats
  3. Continue the same session (send many more messages, or let it auto-continue after context limit)
  4. Run /insights again
  5. Expected: session stats are updated to reflect all messages
  6. Actual: session stats remain frozen from step 2

Evidence

Compared session-meta JSON vs actual .jsonl content for one session:

  • session-meta reports: 3 user messages, 4 min duration
  • Actual .jsonl contains: 57 user messages, ~23 hours of activity
  • The session-meta file timestamp (2026-02-15 01:36) predates the last .jsonl modification (2026-02-16 00:56) by ~23 hours

Multiple session-meta files share the exact same timestamp (e.g., 2026-02-17 03:40:54), confirming they are batch-generated by /insights runs, not by the sessions themselves.

Suggested fix

Before reusing cached session-meta, compare the .jsonl file's mtime/size against what was cached. If the session file has changed, regenerate the meta.

Environment

  • Claude Code 2.1.44
  • WSL2 Ubuntu, Linux 5.10.16.3-microsoft-standard-WSL2

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗