Feature request: hook event for /branch + parent session ID access
Resolved 💬 2 comments Opened Apr 2, 2026 by jean-haley Closed May 11, 2026
Feature Request
Problem
When using /branch to fork a conversation for side-quest work (e.g. debugging a CI/CD failure while in the middle of a planning session), there's no way to automatically capture the parent session ID for later resumption.
The /branch command outputs To resume the original: claude -r {session-id} but:
- No hook event fires on branch creation (no
BranchorConversationBranchedevent) - The parent session ID isn't accessible programmatically from within the branched session
- There's no built-in stack mechanism to push/pop between sessions
Desired Behavior
- A
Branchhook event (orPostBranch) that fires after/branchcompletes, with the parent session ID available as context - Parent session ID accessible from within the branched session (e.g. via environment variable, file, or session metadata)
Use Case
Building a session stack: push parent ID on branch, pop to resume. This enables workflows like:
- Branch for a hotfix → fix it → pop back to the planning session
- Branch for code review → review → pop back to implementation
Current Workaround
Manual copy-paste of the claude -r command, or building a skill that requires the user to manually push before branching.
Environment
- Claude Code CLI (containerized)
- Using hooks extensively for session management (SessionStart, PreCompact)
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗