[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/paff": "paff",
"/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 paff" }],
"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_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗