Claude Code Agent View: Background Sessions from One Screen
Running several Claude Code sessions in separate terminals works until you lose track of which one is waiting for you. Agent view, opened with claude agents, is one screen for all your background sessions: what is running, what needs your input, and what is done. You dispatch work from it, peek at a session or reply without leaving the list, attach when you need the full conversation, and detach again without stopping anything.
Agent view is a research preview: the interface and shortcuts may change. This guide follows Anthropic's documentation for it: opening it and dispatching sessions, the supervisor process that keeps them running, the six states, peeking and attaching, how file edits are isolated in worktrees, the shortcuts worth learning, and the limits, which matter more than the feature list. For the worktree mechanics underneath, see Claude Code Worktrees; for sessions that run in the cloud instead of on your machine, see Claude Code Cloud Sessions.
Open agent view and dispatch sessions
Open it from a shell:
1claude agents2claude agents --cwd ~/projects/my-app # only this project's sessionsType a prompt in the input at the bottom and press Enter: a new background session starts on that task and appears as a row. You can also dispatch straight from the shell without opening the view:
1claude --bg "investigate the flaky SettingsChangeDetector test"To move a session you are already in to the background, run /background (or /bg), or press ← on an empty prompt, which backgrounds it and opens agent view with that row selected. /fork instead copies the conversation into a new background session while the original keeps running in your terminal.
claude agents accepts dispatch defaults such as --model, --effort, --permission-mode, and --agent, which apply to sessions you dispatch from that view.
Quick reference
claude agentsin a directory you have not trusted shows the workspace trust dialog first;claude --bgfrom a script in an untrusted directory exits with a Workspace not trusted error.claude --bgcannot be combined with-p; background sessions are interactive sessions without a terminal attached.- Background sessions use the same settings, CLAUDE.md, MCP servers, and permission rules as your interactive ones.
Remember this
claude agents is the dashboard, claude --bg dispatches from the shell, and ← or /bg moves your current session there.
The supervisor: why sessions keep running
Background sessions are not children of your terminal. A separate supervisor process runs them, so you can close agent view, close the shell, or start another interactive session, and dispatched work keeps going. The supervisor starts automatically the first time you need it.
To save resources, a session that has finished and stayed unattached for about an hour has its process stopped. Its conversation is kept, and it resumes when you reply or attach. If you want a session's process to stay up regardless, pin it with Ctrl+T.
Sessions are local: they run on your machine, are preserved across sleep, and stop if the machine shuts down. A session found dead long after its last activity, such as after a few days off, shows as stopped with ended while the background service was off, and asks before resuming its old conversation.
Quick reference
- Run
/statusin a session: the Session kind row saysbackground job · attached,background job · unattended, orinteractive. - Gateway variables such as
ANTHROPIC_BASE_URLexported in the dispatching shell are forwarded to sessions under specific conditions; for a gateway that must always apply, set it in a settings file. - If the background service fails to start, the error usually names the cause; on npm installs it can be an update in progress.
Remember this
A supervisor owns background sessions, so they outlive your terminal but not a machine shutdown.
Session states
The state column is the point of agent view: you scan for yellow rows. Ctrl+S groups the list by state or by directory, Ctrl+R renames a session, and Ctrl+F finds one by name.
While agent view is open, Claude Code also sends a notification through your configured terminal notification channel when a local background session starts needing input, finishes, or fails, and fires the Notification hook with the agent_needs_input or agent_completed type, so you can forward those events elsewhere.
| State | Shown as | Meaning |
|---|---|---|
| Working | Animated icon | Claude is running tools or generating a response |
| Needs input | Yellow | Waiting on an answer, a permission decision, or another prompt |
| Idle | Dimmed | Ready for your next prompt |
| Completed | Green | Finished successfully |
| Failed | Red | Ended with an error |
| Stopped | Grey | Stopped with Ctrl+X or claude stop, or ended another way |
Quick reference
- A session waiting on a sandbox network prompt, an MCP input request, or a cross-session message approval also shows as Needs input, with the reason on its row.
- Scheduled
/loopsessions notify only when they need input, not on every iteration. - Completed does not mean correct. Read what the session did before merging its work.
Remember this
Scan for yellow; let notifications or a Notification hook tell you when a session needs you.
Peek, reply, attach, detach
Three levels of interaction, from lightest to fullest:
- Peek: press
Spaceon a row to open a panel with the latest output or the pending question. You can type a reply there without attaching. - Attach: press
Enteror→to turn the row into a full interactive session. - Detach: press
←on an empty prompt, or run/exit, to return to agent view. Detaching never stops a background session.
One detail trips people up. When a session is waiting on a permission decision, typing a reply does not answer it; your message waits in the queue. To answer the permission dialog, attach with →.
Permission mode follows the session: backgrounding keeps the current mode, and a session dispatched from agent view starts in the mode the target directory configures through permissions.defaultMode, or the mode of the session you came from if none is set. bypassPermissions requires that you have accepted the bypass disclaimer.
Quick reference
- A reply that is exactly
/stopstops the session immediately; other commands sent from peek run when the current turn ends. claude attach <id>attaches from any shell;←inside it returns to agent view andCtrl+Zreturns to the shell.- If you plan to leave sessions unattended, start them in a mode that does not stop on every edit, and keep deny rules for what must never happen.
Remember this
Space to peek and reply, → to attach for permission prompts, ← to detach without stopping anything.
How background sessions keep their edits apart
Several background sessions in one repository would collide, so before editing files, Claude moves the session into an isolated git worktree under .claude/worktrees/. Parallel sessions can read the same checkout, but each writes to its own. When a session that isolated its work finishes, it commits, pushes its own branch (never main or master), and opens a draft pull request rather than asking first.
You can turn isolation off for a repository, for example one that is not under git or where you want sessions to edit the checkout directly:
1{2 "worktree": {3 "bgIsolation": "none"4 }5}With isolation off, two sessions editing the same files will conflict, so only do this when you run one background session at a time in that repository.
Quick reference
- Each worktree is a fresh checkout, so a session may spend its first minutes installing dependencies.
- Add
.claude/worktrees/to.gitignoreso background worktrees do not show as untracked files. - A backgrounded session holds a
git worktree lockon its worktree while it runs, so cleanup cannot remove it mid-task.
Remember this
Background sessions isolate themselves in worktrees and finish with a draft PR; turning that off is only safe for one session at a time.
Stop, delete, and the real limits
Stop a session with Ctrl+X in agent view or claude stop <id>. Delete it with Ctrl+X twice (within two seconds) or claude rm <id>. The transcript stays on disk and remains available through claude --resume. Deletion keeps a worktree that still has unpushed commits or uncommitted changes and tells you why, so work is not silently destroyed.
The limits to plan around:
- Usage multiplies. Background sessions consume your subscription usage exactly like interactive ones, so ten in parallel use quota roughly ten times as fast as one. Rate limits apply.
- Sessions are local. They stop when the machine shuts down. For work that must continue with the laptop off, use cloud sessions instead.
- Research preview. Shortcuts and behaviour change between releases; the docs keep a long version history for that reason.
To turn agent view off entirely, set disableAgentView: true in settings or the CLAUDE_CODE_DISABLE_AGENT_VIEW environment variable.
Quick reference
- The number of sessions worth running is limited by your review capacity as much as by quota: every session ends in a PR someone has to read.
- If a delete is refused over unpushed commits, the message names the branch and the commit count; deleting again discards them.
claude agents --jsonlists sessions in machine-readable form for scripts.
Remember this
Stopping and deleting are safe by default; the binding limits are your quota, your machine staying on, and your time to review.
Hands-on: three sessions, one screen
Use a git repository with a test command.
1. Add .claude/worktrees/ to .gitignore. Run claude agents --cwd . and dispatch: "add a unit test for the parse function".
2. From another shell, run claude --bg "update the README's install section".
3. In a normal claude session, start a small task, then press ← on an empty prompt to background it.
4. In agent view, press Ctrl+S to group by state. When a row turns yellow, press Space to peek; if it is a permission prompt, attach with → to answer it.
5. When sessions complete, check git worktree list and the draft pull requests they opened.
6. Stop one session with Ctrl+X and delete another with Ctrl+X twice; confirm with claude --resume that the transcript is still available.
Pass criterion: three sessions ran at once without touching each other's files, you answered at least one prompt from agent view, and you can explain what deleting a session kept and removed.
Quick reference
- If the README session edited the same files as another, check
worktree.bgIsolation; it should not benone. - Watch your usage page during the exercise to see how parallel sessions add up.
- Close agent view and reopen it to confirm the sessions kept running without it.
Remember this
Dispatch three ways, answer a prompt, and clean up once, and agent view stops being a mystery.
Key takeaway
Agent view is a single screen, claude agents, for Claude Code sessions that run in the background under a supervisor process. Dispatch from the view, from the shell with claude --bg, or by pressing ← in a session; scan the rows for Needs input; peek with Space, attach with → (required for permission prompts), and detach with ← without stopping anything. Before editing, background sessions isolate themselves in git worktrees and finish by pushing a branch and opening a draft pull request.
The limits are practical: usage multiplies with parallel sessions, sessions stop when the machine shuts down, and it is a research preview. For work that should run with your laptop closed, see Claude Code Cloud Sessions; for scheduling, see Claude Code Routines.
Practice (30 min): complete the six steps above, then decide how many parallel sessions you can actually review in a day.
References
- Claude Code docs: Agent view and background sessions — checked Oct 17, 2026
- Claude Code docs: Run parallel sessions with worktrees — checked Oct 17, 2026
Shoaib Hossain
Lead Author & Systems ArchitectSoftware engineer and distributed systems architect specializing in backend scalability, cloud-native infrastructure, databases, and AI engineering workflows. Author and maintainer of Core Concept Learning.
Related Articles
Explore this topic