Skip to content

Course · Claude Code · Subagents

Run several Claude Code sessions at once with agent view

Subagents split work inside one conversation. Sometimes the independent tasks are whole conversations: a bug fix, a pull request review, and a flaky-test investigation, each deserving a full session of its own. Agent view is the documented place to manage those. This is a concept and reference lesson sourced from the Claude Code documentation and the local claude --help (version 2.1.310), checked 2026-10-25; it is not a captured run. The docs label agent view a research preview: the interface and keyboard shortcuts may change (agent view docs).

  • A background session is a full Claude Code conversation that keeps running with no terminal attached. It is not a subagent: you can open it, reply, and leave.
  • Agent view is the screen you open with claude agents. It lists every background session grouped by state, with the ones that need you at the top.
  • The supervisor is a background service that actually hosts the sessions, so closing agent view or your shell does not stop them. Claude Code starts it the first time you background a session or open agent view.

From your shell, hand a prompt to a new background session and get your terminal back:

Terminal window
claude --bg "investigate the flaky SettingsChangeDetector test"
claude --bg --name "flaky-test-fix" "investigate the flaky SettingsChangeDetector test"
claude --agent code-reviewer --bg "address review comments on PR 1234"

--bg takes the prompt as a positional argument. It cannot be combined with -p, because print mode never starts the interactive session that agent view attaches to. Claude prints a short ID and the commands that take it: claude attach <id>, claude logs <id>, claude stop <id>. claude respawn restarts a session so it runs the current Claude Code version, and claude rm <id> deletes a session and its worktree when that is safe. All of these appear in claude --help.

From inside a conversation you already have, two slash commands move work out:

  • /background sends the current conversation to the background and frees the terminal.
  • /fork copies the conversation so far into a new background session while the original keeps running. Add a prompt (/fork open a draft pull request with the work so far) and the copy starts on it immediately. The copy carries over the model, permission mode, and effort level.

In agent view itself, type a task into the input at the bottom and press Enter to dispatch a session.

Each row shows a session name, a one-line summary, and an age. The icon color is the state:

State Meaning
Working Claude is running tools or generating
Needs input Waiting on something only you can give: an answer, a permission decision, a sandbox prompt
Idle Nothing to do, ready for your next prompt
Completed Task finished
Failed Task ended in an error
Stopped You stopped it, or it ended while the service was off

Row summaries are generated by a small model, so treat them as a pointer to the transcript, not a substitute. Press Space on a row to peek: you see the exact question a blocked session is asking, or the result of a finished one, and you can type a reply and press Enter. Press → to attach and enter the full conversation, and ← or /exit to detach. A reply cannot answer a permission prompt; that waits in the queue until you attach and answer it. Subagents and teammates that a session spawns do not appear as separate rows.

For scripts, claude agents --json prints session state, which the docs prefer to reading files under ~/.claude/jobs/.

A session dispatched from agent view or claude --bg starts in your working directory. Before editing, Claude moves it into its own git worktree under .claude/worktrees/, so parallel sessions read the same checkout but write to separate ones. The move is skipped for a session you backgrounded with ← or /background (it keeps editing where it was), a session already in a linked worktree, and a directory that is not a git repository (unless a WorktreeCreate hook is configured). If git worktrees are impractical for a repository, set worktree.bgIsolation to "none" in .claude/settings.json, and understand that parallel sessions can then edit the same files.

Before finishing, a session that made changes in a worktree it entered commits without asking and pushes the branch when a remote exists. It opens a draft pull request when the task calls for one. The docs list what it never does: push to main or master, force-push, or merge. If your task or CLAUDE.md says you handle commits yourself, it leaves git to you. That is a place where an instruction in rules decides behavior; if you want no automatic commits, say so there.

Choose by what needs to be independent:

  • One noisy investigation whose result you want back in your thread: a subagent.
  • Many slices of one question that you will read together: parallel subagents or a dynamic workflow.
  • Several unrelated tasks, each of which may need a decision from you at its own pace: background sessions in agent view.

The cost model follows. Each background session is a full session with its own context and its own usage. Agent view saves your attention, not tokens. The docs also point to a comparison of subagents, agent teams, and worktrees under Run agents in parallel, and to agent teams for coordination between sessions.

For long unattended work, the same sessions work with /goal, which keeps a session going until a stated condition holds. Use Remote Control to answer a blocked session from your phone.