Feature Request: Session Branching / Conversation Forking

Status Fixed / completed
Maintainer reply None cached
Activity 11 comments · opened Nov 28, 2025 · closed Aug 17, 2026

Problem

Claude Code has --fork-session functionality via CLI flags, but there's no way to access this from within a running session. Users must exit and restart with the right flags, which breaks flow and requires remembering session IDs.

Current State

The underlying functionality exists:

claude --continue --fork-session
claude --resume <session-id> --fork-session

But this requires:

  • Exiting the current session
  • Knowing the CLI flags exist (poor discoverability)
  • Manually tracking session IDs for later branching

Proposed Enhancement

Add in-session UI for forking:

  1. /fork command - Fork the current session at this point, opening a new session in a new terminal/tab
  2. /fork <name> - Create a named branch for easier reference
  3. /branches - List branches/forks of the current session lineage
  4. Keyboard shortcut - Quick fork without typing a command

Use Cases

  1. Exploring alternatives - Try two different implementation approaches from the same starting point
  2. Preserving a known-good state - Before attempting a risky refactor, create a branch to safely experiment
  3. A/B testing prompts - Test different instructions from the same conversation state to compare outcomes

Additional Context

The core functionality is already implemented - this is purely about exposing it through the in-session UI for better discoverability and workflow integration.

---
Updated: The original request was for session branching, which already exists via --fork-session. This issue now focuses on UI/UX improvements to make this feature more accessible.

View original on GitHub ↗

10 Comments

github-actions[bot] · 9 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/10370
  2. https://github.com/anthropics/claude-code/issues/4443
  3. https://github.com/anthropics/claude-code/issues/1417

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

github-actions[bot] · 8 months ago

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

NickNick · 7 months ago

I found this issue searching for this functionality. I just found the /fork command, which is for me just enough to make it workable: it forks the session, puts the current client in one of the forks (who's the original? who knows?) and lets you claude -r to drop into the other one.

wxtry · 6 months ago

+1 for this! I regularly hit this pain point during long sessions.

My typical workflow involves exploring multiple approaches from the same conversation state (e.g., brainstorming project plans, then wanting to branch into different implementation directions). Having to exit, remember the right CLI flags, and restart breaks the flow significantly.

A /fork slash command (or even a keyboard shortcut like Ctrl+F) would make this much more accessible. The underlying --fork-session mechanism already works well — it just needs an in-session entry point.

Would also love the /fork <name> variant for easier session management later.

tbrebant · 6 months ago

I also support this feature request. At least I discovered here that there is a way with --fork-session, but /fork would make more sense.

axelson · 6 months ago

There is a /fork command

<img width="1244" height="144" alt="Image" src="https://github.com/user-attachments/assets/cc41f064-96df-4fd1-97bd-192399dc7083" />

The only thing you need to do manually is run that resume command in another terminal session. Which is something that I'd want anyway so I can control where that session is launched (e.g. in a new tmux pane or window)

lldxflwb · 5 months ago

I'd like to connect some dots across related issues.

Current state: /fork exists and works — but the UX breaks flow. You fork, get a claude -r <session-id> string, then have to manually open a new terminal and paste it. For a feature meant to preserve momentum, this is ironic.

The missing piece is automatic terminal spawning. I elaborated on this in #24123, but the key insight is: the infrastructure already exists. Agent Teams (teammateMode: "tmux") already spawns independent Claude Code instances in new tmux panes/windows. /fork could reuse this same mechanism — the only delta is inheriting the current conversation history instead of starting fresh.

This would also address the broader UX gaps discussed here and in the now-closed #10370, #4443, and #1417:

| What | Status |
|------|--------|
| Core fork mechanism (--fork-session) | ✅ Shipped |
| In-session /fork command | ✅ Shipped |
| Auto-open fork in new terminal tab/pane | ❌ Missing (#24123) |

Just making /fork open in a new pane would already make session branching a practical, daily-use workflow instead of a CLI trick most users don't discover.

ithiria894 · 5 months ago

+1, this is exactly what I need daily.

Real use case from today: I'm in a long session where Claude helped me build and ship 5 MCP servers, design a brand logo, set up CI/CD, list on registries, etc. Now I'm at a decision point — Claude asks "do you want to build the marketing pipeline now?" I want to say yes AND also branch off to improve my shipping playbook, both starting from this exact point with full context.

Right now my options are:

  1. /compact and continue (loses the branch)
  2. Start a new session (loses all context — has to re-read everything)
  3. Hope memory files carry enough context (they don't carry conversation nuance)

What I want (like ChatGPT's branch feature):

  • Right-click any message → "Branch from here"
  • Opens a new session tab with identical conversation history up to that point
  • Both sessions continue independently
  • Like git branch but for conversations

This is especially critical for long planning sessions where you reach a fork in the road and want to explore both paths without losing context. The current workaround of relying on memory files doesn't preserve the conversation flow, decision rationale, or the "we just discussed X so let's build on that" continuity.

NilotpalK · 4 months ago

@jonkhler @NickNick @wxtry @tbrebant @axelson

I had the same frustrations with /fork — the terminal hopping and session ID tracking kills the flow. I built an MCP server called Variantree that handles branching, switching, and tree visualization inside a single session through natural language.

Named checkpoints and branches (no session IDs to track)
Switch branches in-place — code and conversation context swap together automatically
Tree visualization showing all branches and checkpoints
Claude gets only the relevant conversation history for the active branch, no context pollution.

Would love any feedback if you try it out — still actively developing and happy to prioritize features that would help your workflows.

boazrymland · 3 months ago

I just came back to Claude Code CLI after using 'desktop' client for some time. This feature is exactly what's missing for me when comparing with the desktop app. There, when you 'fork', it duplicates the current session into a new one and lands you in it automatically.
This is _very useful_ for side quests. For example, If I want to ask Claude Code a clarifying question about it's latest response without cluttering the main session thread (which is usually quite busy with long responses by Claude Code - which is fine).

With this feature - the functionality is complete and I can really easily 'thread out' on a need basis in Claude Code CLI. Without it - lot's of the 'parallelizing' functionality of fork/branch is nullified :(

In a nutshell: "Agents view" is completely missing fork/branch functionality and this issue is about brining this missing functionality into "Agents view".

Showing cached comments. Read the full discussion on GitHub ↗