Claude Code agent view: run background sessions

Agent view is the screen claude agents opens: one list of every Claude Code background session, with the ones that need you at the top. Start one with claude --bg or /bg; it keeps running after you close the terminal or the laptop sleeps, and a reboot stops it until you open it or reply.

Contents

Claude Code's agent view is the screen claude agents opens: one list of every background session, with the ones that need you at the top. Start a session with claude --bg "task", or send the one you're in there with /bg. It keeps running after you close the terminal and through sleep. Shutting down or restarting the computer stops it until you open it or reply.

Agent view is a research preview, and it has changed a lot since it arrived in Claude Code 2.1.139 on 11 May 2026. One press of ← has backgrounded a session since 2.1.196 (29 June), and the 48-hour rule for sessions that a shutdown stopped came in 2.1.248 (27 August), so a guide written before those dates describes older behaviour. What follows is from Anthropic's agent view page and changelog, read on 24 October 2026, when the newest release was 2.1.310.

Open agent view with claude agents#

  1. Run claude update to get the current version.
  2. In a project folder, run claude agents. If you haven't trusted the folder yet, the same trust dialog as claude comes first. If it prints a count followed by your subagents and exits instead, agent view isn't available in your version, or a setting has turned it off.
  3. Type a task in the input at the bottom and press Enter. Every Enter starts a new session, not a follow-up to the last one. A prompt under four characters is refused as too short.
  4. Press Esc to get back to your shell. The sessions keep working.

The list covers every background session you've started, in all your projects. claude agents --cwd ~/projects/my-app narrows it to one. Interactive sessions open in other terminals don't show up until you background them, and the subagents a session spawns aren't rows of their own. If you'd like plain claude to open agent view, run /config defaultToAgentsView=true in a session.

Four ways to start a background session#

Where you are What to type What happens
In agent view A task, then Enter A new session starts, named from your prompt by a Haiku-class model. Ctrl+R renames it
In your shell claude --bg --name "flaky-test-fix" "investigate the flaky SettingsChangeDetector test" Prints the short ID and the attach, logs and stop commands for it
In a session you want to hand off /bg (short for /background), or ← on an empty prompt The conversation moves to the background and frees your terminal. ← also opens agent view with that row selected
In a session you want to keep /fork A copy of the conversation starts as a new background session, and you carry on in the original

Put --bg first and the prompt after it as a plain argument. Claude Code rejects --bg with -p or --print, because print mode never starts the interactive session that agent view attaches to. To push an existing conversation into the background, pass its full session ID: claude --resume <id> --bg "pick up where you left off".

When you background a session, background shell commands, background subagents, workflows and /loop tasks move with it. A running monitor can't, so Claude Code shows a Background this session? dialog before it stops one. (Background shell commands and Ctrl+B have their own guide.)

claude --bg --exec 'pytest -x' runs a shell command as a row of its own, with no model involved. claude logs <id> prints its output. That output lives in memory only, and the row clears itself about five minutes after the command exits, so read it before then.

Agent view keyboard shortcuts#

Key What it does
↑ / ↓ Move between rows
Space Peek: the latest output, or the question the session is waiting on. Type a reply and press Enter to send it without attaching
Enter or → Attach: the session takes over the terminal as a full Claude Code session
← on an empty prompt Detach from a session and go back to the list. It keeps running
Ctrl+T Pin a session to the top and keep its process running while it's idle
Ctrl+R Rename the selected session
Ctrl+S Group by directory instead of by state
Ctrl+X, twice within two seconds Stop the session, then delete it
Esc Close the peek panel, clear the input, or leave agent view
? Show every shortcut in context

Each row has a state. Working is animated, Needs input is yellow, Idle is dimmed, Completed is green, Failed is red and Stopped is grey. A session with an open pull request that needs review, or has failing checks, moves to a Ready for review group with a #1234 link on its row. While agent view is open, Claude Code also notifies you through your terminal when a session needs input, finishes or fails.

Do background sessions survive closing the terminal?#

Yes. A separate supervisor process runs them, so closing agent view, closing the terminal or starting another session changes nothing. Shutting down or restarting the computer is a different story.

What happens What the session does
You close the terminal or agent view Keeps running under the supervisor
The laptop sleeps Kept. Its process resumes on wake. One that was mid-reply can come back unresponsive, and opening it restarts the process, which carries on from where it stopped
It's done or waiting for you, with nothing attached, for about an hour The supervisor stops its process to free resources. The conversation stays on disk and comes back when you attach or reply. Pinning with Ctrl+T keeps it running
Claude Code auto-updates The supervisor restarts on the new version. Sessions that are working, waiting on you or attached aren't interrupted
The supervisor process is ended On macOS and Linux, sessions stop unless a new supervisor starts within about a minute. Run claude agents to start one
You shut down or restart the computer Running sessions stop, and come back only when you attach or reply

After a reboot, open claude agents and look at what's left. A session that was waiting on you is still under Needs input. A session that last made progress within 48 hours shows as Failed: attach or reply and it restarts from its saved conversation. To get the interrupted work going again, reply with something like "carry on where you stopped". Past 48 hours, for example after a few days with the machine off, the row shows Stopped with ended while the background service was off. Press Enter twice on it, or reply, to resume it.

Where background sessions edit files#

A session you dispatch from agent view or with claude --bg starts in your working directory. Before it edits anything, Claude moves it into its own git worktree under .claude/worktrees/, so parallel sessions read the same checkout and each writes to its own copy. Subagents it spawns edit in that worktree too. claude --worktree puts its worktrees in the same folder by default (the --worktree guide covers that flag).

There are exceptions. A session you sent to the background with ← or /bg keeps editing where it already was. So does one started inside an existing linked worktree, and one outside a git repository with no WorktreeCreate hook. To turn the worktrees off for a repository where they don't work well, add this to its .claude/settings.json:

json
{
  "worktree": {
    "bgIsolation": "none"
  }
}

When a session finishes work in its own worktree, Claude commits without asking, pushes the branch if the repository has a remote, and opens a draft pull request when the task calls for one. It never pushes to main or master, never force-pushes and never merges. If your task or CLAUDE.md says you handle git yourself, that wins.

Be careful when you delete. Ctrl+X twice in agent view removes the worktree Claude made, uncommitted changes included. claude rm <id> keeps a worktree that has uncommitted changes. Both refuse the first time when the worktree has commits Claude Code can't confirm are saved elsewhere, and say how many. The transcript stays either way, so claude --resume still finds it.

Manage background sessions from the shell#

Command What it does
claude agents --json Prints the sessions as JSON and exits; add --all for finished ones
claude attach <id> Opens a session in this terminal
claude logs <id> Prints a session's recent output
claude stop <id> Stops a session
claude respawn <id> Restarts a session, for example onto a new Claude Code version
claude rm <id> Removes a session from the list, and its worktree when that's safe
claude daemon status Shows whether the supervisor is running, its version and how many sessions it holds

On 2.1.290 or later, attach and logs also take part of a session's name instead of the ID.

Limits to know before you dispatch ten#

Background sessions use your subscription the same way interactive ones do, so ten agents in parallel use your quota roughly ten times as fast as one. That figure is from the limitations section of Anthropic's page. The one-line summary on each row is written by a short Haiku-class request at the end of every turn, and every few minutes during a long one, billed through your normal provider like the session itself.

Sessions are local: they run on your machine, are kept through sleep and stop when it shuts down. On macOS the background host also asks for access to Desktop, Documents and Downloads separately from your terminal, so a session that reports Operation not permitted there needs a grant in System Settings › Privacy & Security › Files and Folders.

If you'd rather see every agent at once in your own terminal layout, Claude Code sessions in tmux sets that up with a worktree per session, and running Claude Code agents in parallel covers merging the branches back.

How Shuriken does it#

Shuriken is a harness: a desktop app that runs Claude Code, Codex, Gemini CLI and other coding agents as chats. It does much of what agent view does, for Claude Code and the other agents alike, and you follow the chats in a window or a browser instead of a terminal.

The background service installs once, from Settings › Devices. Close the app and the chats, the queue and every running turn carry on. The service starts when you sign in to your computer and restarts by itself if it stops. Like agent view, it needs the computer on: a machine that's asleep or shut down runs nothing.

When you start a chat you pick where it works. Project folder, the default, edits your folder directly. Own branch gives the chat a separate copy on its own branch. Finish runs the checks you list in shuriken.json, then merges the branch back or opens a pull request. Shuriken doesn't cap how many chats run side by side.

Each chat's Activity panel lists what it started, live: subagents, workflow phases, background commands such as dev servers and test runs, and monitors. The "N running" pill on the chat opens it (what the panel shows). Claude Code reports the most detail there. When a chat needs you, a notification shows up on your computer, and the same chats open in the web app at app.shuriken.sh, so you can answer one from your phone.

If you want your agents to keep going with the window closed, download Shuriken.

Sources

  1. Claude Code docs: Manage multiple agents with agent view (accessed 24 October 2026)
  2. Claude Code docs: Changelog (accessed 24 October 2026)
  3. Claude Code docs: Settings reference (worktree.bgIsolation, disableAgentView) (accessed 24 October 2026)
  4. Claude Code docs: Run parallel sessions with worktrees (accessed 24 October 2026)

Frequently asked questions

What does /bg do in Claude Code?

/bg is short for /background. It moves the conversation you're in to a background session and frees your terminal; a reply Claude is in the middle of carries on there. Add a prompt, as in /bg run the tests and fix failures, to give one more instruction first.

Can I combine claude --bg with -p?

No. Claude Code rejects --bg together with -p or --print before it creates a session, because print mode never starts the interactive session that agent view attaches to. Put the prompt after --bg as a plain argument instead.

Do background sessions use my Claude plan?

Yes. Anthropic's docs say background sessions use your subscription usage the same way interactive ones do, so ten agents in parallel use it about ten times as fast as one.

Does agent view work on Windows?

Yes. Anthropic's agent view page and its version history describe Windows behaviour alongside macOS and Linux, such as a second press of the left arrow to detach right after attaching.

How do I turn agent view off?

Set disableAgentView to true in a settings file, or set the CLAUDE_CODE_DISABLE_AGENT_VIEW environment variable. That turns off claude agents, --bg, /background and the supervisor; administrators can enforce it through managed settings.

Free tools