[FEATURE] Scope /insights to specific project(s)
Problem
/insights analyzes all sessions across ~/.claude/projects/ with no way to scope it to a specific project. For users working across multiple unrelated codebases (e.g., a work monorepo + personal projects), the insights get diluted with irrelevant data, making the report less actionable.
Concrete example
I work on a large fintech monorepo with 100+ sessions and also have personal projects. When I run /insights, the report mixes sessions from all projects — recommendations that apply to my work codebase get blended with patterns from personal side projects. The result is generic advice that doesn't apply well to any single project.
Current workaround
Manually renaming/moving folders under ~/.claude/projects/ before running /insights to hide unwanted projects from the ingestion stage. This is fragile and tedious.
Proposed solution
Add project-scoping support to /insights:
/insights # current behavior (all projects)
/insights --project . # scope to current working directory
/insights --project ~/my-project # scope to specific path
/insights --exclude ~/personal # exclude specific projects
Alternative approach: when run inside a project directory, auto-scope to that project by default (with --all to get current behavior).
Implementation note
Since facets are cached per-session in ~/.claude/usage-data/facets/, scoping would only need to filter which session logs are ingested in Stage 1 and which cached facets are aggregated in Stage 6 — the rest of the pipeline stays the same.
Related issues
- #23658 — Insights ignores complex projects, focuses only on latest
- #23514 — Report only captures a fraction of projects
- #22967 — Insights should incorporate project-level config (complementary — about config-awareness, not session scoping)
- #22998 / #23285 — Session sampling issues compound the multi-project problem
Environment
- Claude Code CLI
- macOS
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗