[FEATURE] Agent SDK: Support different sessions for different Git branches in the same project

Resolved 💬 2 comments Opened Jun 8, 2026 by mcfly001 Closed Jun 11, 2026

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

Requirement: When switching to different Git branches in the same project, I want to use different sessions for each branch.

Current behavior: All branches share the same session data in the same directory.

Expected behavior: Ability to automatically or manually isolate sessions for different branches to avoid context confusion between branches.

Use case: When developing in parallel on multiple branches of the same project, each branch should have an independent AI conversation history.

Proposed Solution

When switching Git branches, Claude Code automatically detects the branch change
and uses a separate session for each branch. Sessions are stored with a branch
identifier (e.g., ~/.claude/projects/<project>/<branch-name>/sessions/).

User experience: No configuration needed. Just switch branches and the session
automatically changes.

Alternative Solutions

_No response_

Priority

Critical - Blocking my work

Feature Category

Developer tools/SDK

Use Case Example

_No response_

Additional Context

_No response_

View original on GitHub ↗

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