[FEATURE] /branch command - spawn parallel terminal session with duplicated context

Resolved 💬 3 comments Opened Dec 20, 2025 by jon-craftatale Closed Dec 20, 2025

Summary

Add a /branch command that opens a new terminal tab/split with a duplicate Claude Code session, preserving full conversation context. This enables true parallel work on multi-pronged implementations.

Problem

Complex implementations often have multiple parallel tracks. Currently, when you hit a fork in the road or discover a tangent issue mid-task, your options are:

  • Derail current work → lose momentum on primary task
  • Note it for later → lose context on the discovered issue
  • Manual workaround → open new tab, cd to same dir, start fresh session, re-explain everything → friction kills it

Proposed Solution

/branch              # Opens new terminal tab with duplicated session
/branch --split      # Opens split pane instead of new tab

Behavior:

  1. User types /branch
  2. New Windows Terminal tab (or split pane) opens automatically
  3. New Claude Code session starts with:
  • Same working directory
  • Full conversation context/summary preserved
  • Same project settings
  1. Sessions then evolve independently

Real-World Use Case (Just Happened)

Main session: Validating a GitHub feature request
    ↳ Discovered: pre-push hook is broken ($CLAUDE_PROJECT_DIR not expanding)
    ↳ Want to fix it NOW while context is fresh
    ↳ But don't want to derail the current task
    ↳ WISH: /branch → new tab, same context, go fix hook
    ↳ REALITY: Had to choose one, lost momentum on the other

Multi-Pronged Implementation Pattern

Working on "add user settings feature"
├── /branch → Tab 1: explore models approach A
├── /branch → Tab 2: explore models approach B  
└── Main session: continues with frontend while models settle

Compare results across tabs, merge the winner mentally, continue with confidence.

Implementation Notes

Windows Terminal native support:

  • wt -w 0 nt - new tab
  • wt -w 0 sp - split pane

Possible approach:

  • Serialize current conversation state to temp file
  • Launch new terminal with claude --resume <session-id> --fork-session
  • The --fork-session flag already exists (creates new session ID from resumed state)

Why This Is Different From Existing Issues

| Issue | What it does | This request |
|-------|--------------|--------------|
| #4963 | Background agents in git worktrees | Interactive parallel sessions |
| #10370 | In-session conversation branching | New terminal window, not same UI |
| #150 | Git branches = conversation forks | OS-level terminal spawning |

This is about OS-level terminal management + session duplication, not in-app conversation branching or background agents.

Benefits

  • Eliminates "let me finish this first" bottleneck
  • Matches how developers actually think (parallel exploration)
  • Each branch maintains full context - no re-explaining
  • Fast iteration on competing approaches
  • Low friction (single command vs manual setup)

View original on GitHub ↗

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