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:

  1. No hook event fires on branch creation (no Branch or ConversationBranched event)
  2. The parent session ID isn't accessible programmatically from within the branched session
  3. There's no built-in stack mechanism to push/pop between sessions

Desired Behavior

  1. A Branch hook event (or PostBranch) that fires after /branch completes, with the parent session ID available as context
  2. 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)

View original on GitHub ↗

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