anthropics / anthropics/claude-code

[FEATURE] Let /branch register the new session in agent view without a separate /bg

Open
#94,892 0 comments 0 reactions 0 assignees View on GitHub
area:agent-view area:tui enhancement
Dominant language
Python
Stars
145k
Forks
23.1k
PR merge metrics
PR metrics pending

Description

### Preflight Checklist

- [x] I have searched [existing requests](https://github.com/anthropics/claude-code/issues?q=is%3Aissue%20label%3Aenhancement) and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)

### Problem Statement

`/branch` and agent view are disjoint. Agent view lists only backgrounded sessions, so a branched session is reachable through the `/resume` picker but never appears in `claude agents` until it is separately backgrounded. Branching and putting the branch in the fleet feel like one intent, but they are two commands across two subsystems, and `/branch`'s own output points only at `/resume`.

This was raised before in #69712, which was auto-closed as stale with no maintainer response. That issue bundled this with a `/merge` command. This one asks only for the visibility half.

### Proposed Solution

Make a branched session able to land in agent view as part of branching, instead of as a follow-up action. Any one of these is enough:

- an argument on the command, e.g. `/branch --bg`, where the new session appears as an agent-view row and the current terminal stays on the original
- a settings key that defaults new branches into agent view
- a second branch action in the TUI that registers the new session

The branch is already identifiable at creation time: since v2.1.214, `SessionStart` fires with `source: "fork"` for `/branch`, `/fork`, and `--fork-session`. The signal this would key on is already plumbed.

### Alternative Solutions

The workaround is `/branch `, then `/bg` or `←` on an empty prompt inside the new session. It works, but it is a separate step and is not discoverable from `/branch`.

There is no setting that defaults a session into agent view. `disableAgentView` and `CLAUDE_CODE_DISABLE_AGENT_VIEW` are disable-only, and `--bg` applies at launch, not to a session created mid-flight by `/branch`.

### Priority

Medium - Would be very helpful

### Feature Category

Interactive mode (TUI)

### Use Case Example

1. At a known-good point, branch `approach-a` so it becomes an agent-view row.
2. Branch `approach-b` the same way.
3. Arrow between the original and both branches from agent view.

Today each branch has to be backgrounded individually after it is created.

### Additional Context

Related: #69712 (same ask, stale-closed, bundled with merge-back), #73053 (branch lineage for hooks; `source: "fork"` shipped from it).

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the `/branch` command and the agent-view registration path, then trace how `SessionStart` with `source: "fork"` is handled. The issue names no files or tests; done means one supported branching interaction registers the new session in `claude agents` without requiring a separate `/bg`, with the resulting navigation behavior matching the chosen interface.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.