/insights: session-meta cache not invalidated when session grows
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
- Start an interactive Claude Code session, send a few messages
- Run
/insights— the session appears in the report with correct stats - Continue the same session (send many more messages, or let it auto-continue after context limit)
- Run
/insightsagain - Expected: session stats are updated to reflect all messages
- Actual: session stats remain frozen from step 2
Evidence
Compared session-meta JSON vs actual .jsonl content for one session:
session-metareports: 3 user messages, 4 min duration- Actual
.jsonlcontains: 57 user messages, ~23 hours of activity - The
session-metafile timestamp (2026-02-15 01:36) predates the last.jsonlmodification (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
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗