/insights only analyzes ~14% of sessions — sessions-index.json severely underpopulated

Resolved 💬 3 comments Opened Feb 17, 2026 by lejando Closed Feb 17, 2026

Bug Description

/insights reports 66 sessions total, 41 analyzed — but the actual number of session files on disk is far higher. The generated report significantly underrepresents actual usage, making quantitative metrics (messages, tokens, LOC, commits) unreliable.

Environment

  • Claude Code version: 2.1.44
  • OS: macOS (Darwin 25.2.0)
  • Usage period: ~2 months (Dec 2025 – Feb 2026)

Evidence

Session files vs. what /insights sees

| Metric | Actual (on disk) | Reported by /insights |
|---|---|---|
| Total JSONL session files | 502 | — |
| Unique session IDs | 502 | 66 |
| Sessions >10KB (real, not sub-agents) | 367 | — |
| Session-meta extracted | 51 | — |
| Facets (fully analyzed) | 44 | 41 |
| Coverage of real sessions | 14% | — |
| Total JSONL data on disk | 1,841 MB | — |
| Total sessions-index.json entries | 12 | — |

Root cause: sessions-index.json is severely underpopulated

Each project's sessions-index.json contains only the last ~3 sessions, not all sessions:

Project A (main project)  | JSONL files: 392 | Index entries: 3
Project B                 | JSONL files:  54 | Index entries: 3
Project C                 | JSONL files:  28 | Index entries: 3
Project D                 | JSONL files:   6 | Index entries: 3
Project E                 | JSONL files:   9 | Index entries: 0
Project F                 | JSONL files:   5 | Index entries: 0
Project G                 | JSONL files:   3 | Index entries: 0

Some projects have zero index entries despite having session files on disk.

Additional issues

  1. Worktree/subdirectory sessions are fragmented: Sessions started from git worktrees or subdirectories (e.g., project-a-feature-branch, project-a/src/subdir) create separate project directories in ~/.claude/projects/. /insights treats them independently rather than aggregating them as part of the same project.
  1. Quantitative metrics are unreliable: The report shows 605 total messages and 181 commits across "66 sessions" — but with only 14% coverage, the real numbers are much higher.
  1. Token counts in session-meta seem incorrect: Session-meta files show input_tokens: 515 and output_tokens: 133 for a session with 65 assistant messages and 46KB of JSONL data. These numbers seem orders of magnitude too low.

Expected Behavior

/insights should discover and analyze all session JSONL files on disk, not just those listed in sessions-index.json. The sessions-index.json should either be kept in sync with actual session files, or /insights should fall back to scanning the filesystem for *.jsonl files.

Related Issues

  • #25032 — sessions-index.json not updated, causing stale/missing sessions
  • #24069 — Insights report sections silently missing when usage limit hit
  • #24039 — Facets not generated, report sections empty

View original on GitHub ↗

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