Insights report should aggregate sessions across git worktrees

Resolved 💬 2 comments Opened Feb 5, 2026 by jasonostrander Closed Mar 5, 2026

Problem

The /insights report treats each git worktree as a completely separate project, fragmenting session data and causing inaccurate categorization of work patterns.

Example

In my Android codebase, I use worktrees extensively for feature branches. My sessions are distributed like this:

  • Main repo : 185 sessions
  • worktree 1: 26 sessions
  • worktree 2: 13 sessions
  • worktree 3: 13 sessions
  • ...and 36+ more worktrees with 1-5 sessions each

Total: ~375 Kotlin/Android sessions

However, the insights report doesn't detect "Kotlin/Android Development" as a project area at all because each worktree individually doesn't have enough sessions to register as a significant pattern.

Expected Behavior

The insights report should recognize that worktrees are part of the same repository and aggregate their sessions together. This would allow proper detection of language/framework patterns.

Suggested Solutions

  1. Detect worktrees via git worktree list - When analyzing a project directory, check if it's a worktree and find the main repo to aggregate with
  2. Use repo name pattern matching - Directories like repo-name-* could be grouped as related projects
  3. Categorize by file extensions/language - Look at the actual files being edited (.kt, .swift, .py) rather than relying solely on project directory isolation
  4. Check for shared CLAUDE.md - Worktrees often share the same CLAUDE.md configuration, indicating they're the same codebase

Impact

For developers who use worktrees heavily (common in large monorepos and Android/iOS development), the current behavior significantly underreports their work in specific languages/frameworks.

View original on GitHub ↗

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