[FEATURE] Auto-assign sessions to groups based on working directory
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
Problem
I work on multiple projects in parallel and use Claude Code's session groups to keep them organized in the sidebar. Today, the only automatic grouping is by fork lineage (/branch / --fork-session). Every fresh session I start in a project folder lands ungrouped, and I have to drag it into the right group manually.
With 3+ active projects, this becomes constant overhead — and easy to forget, which defeats the point of groups.
Why this matters
Session groups only deliver value if they reflect how I think about my work (per-project), and that mapping is stable and obvious — it's the folder I'm cd'd into. Manual assignment is the worst of both worlds: the data the system needs is already present, but it asks me to re-enter it every session.
Environment
Claude Code CLI on macOS (Darwin 25.3.0)
Model: Opus 4.7
Proposed Solution
Proposed solution
Let users map a working directory (cwd) to a group name in settings.json. When a session starts in (or under) that directory, it's automatically assigned to that group.
{
"sessionGroups": {
"/Users/berk/Desktop/myapp": "myapp",
"/Users/berk/code/acme-web": "acme",
"~/work/side-projects": "side"
}
}
Match should be longest-prefix wins, and ~ should expand.
Alternative (or complement)
Expose group assignment to the SessionStart hook so users can script arbitrary logic (e.g. derive group from git remote, branch name, or a .claude/group file):
{
"hooks": {
"SessionStart": [{
"hooks": [{ "type": "command", "command": "echo myapp" }],
"output": "sessionGroup"
}]
}
}
The hook's stdout becomes the group name.
Alternative Solutions
_No response_
Priority
Critical - Blocking my work
Feature Category
CLI commands and flags
Use Case Example
_No response_
Additional Context
_No response_
3 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
You can group by project in the sidebar.
https://github.com/user-attachments/assets/0ccc84bb-5c57-4206-9b92-57b7580884d7
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.