Skip to content

Agent view: run many Claude Code sessions with claude agents

Agent view is the claude agents dashboard in Claude Code: one screen that lists every background session on a machine, with its state and any pull request it opened. It dispatches new sessions, answers blocked ones without attaching, and moves each session’s edits into its own git worktree. It is a research preview, added in v2.1.139.

You have three unrelated jobs before lunch: a flaky checkout test, a pull request with twelve unresolved review comments, and a dependency bump. Run them one after another and you wait on each; open three terminals and you lose track of which one is sitting on a permission prompt. Agent view gives each job its own session and shows you which one needs you. This page is for developers who run several Claude Code sessions at once, and for tech leads who set the rules those sessions run under.

Research preview v2.1.139+
  • A dispatch loop for several independent tasks, each in its own background session and its own worktree.
  • Three dispatch prompts that end in evidence (a test run, a pull request, a report) instead of “done”.
  • A way to check every session’s result from its row and its pull request, without reading transcripts.
  • A shell interface (claude --bg, claude agents --json) for scripts, status bars and notifications.
  • A symptom-to-recovery table for the failures that actually happen: lost worktrees, stalled supervisors, sessions that die on shutdown.

Agent view is for work you split into independent tasks and supervise yourself, on your own machine. When the split, the schedule or the scale belongs to someone else, another feature fits better:

You need…Use
Several unrelated tasks you dispatch and check one by oneAgent view (this page)
One task split into parallel parts inside a single conversationCustom subagents
One mechanical change spread across many files/batch, covered in multi-file workflows
Tens to hundreds of agents driven by a rerunnable scriptDynamic workflows
One objective that runs until a checkable condition holds/goal, often inside an agent view row
Work that starts on a schedule or trigger with your laptop offRoutines

Codex has its own codex agents command center, covered in parallel development with Codex. The cross-tool comparison of background and cloud agents lives in background agents.

Run your first three agents from agent view

Section titled “Run your first three agents from agent view”

Before you start, work in a git repository with a remote, and authenticate the gh CLI so pull request labels can link. Worktree isolation needs git; outside a repository, sessions edit your files directly.

  1. Open agent view. In your terminal, from the repository root:

    Terminal window
    claude agents

    In a directory you have not trusted yet, the workspace trust dialog appears first (v2.1.225+); declining exits. Esc returns to your shell, and your sessions keep running.

  2. Set dispatch defaults once. Flags passed to claude agents apply to every session you dispatch from that view, and the footer shows them:

    Terminal window
    claude agents --permission-mode auto --effort high

    Use auto only with a model that supports auto mode (on the stable channel, also check your plan); see permissions and sandboxing. Without --permission-mode, a dispatched session starts in the mode a new claude session in that directory would use.

  3. Dispatch three tasks. Type a prompt in the input at the bottom and press Enter. Every Enter starts a new session; it never sends a follow-up to an existing one. Use the prompts in the next section. Shift+Enter inserts a newline (v2.1.248+); Ctrl+Enter dispatches and attaches where the ? overlay lists it.

  4. Peek and reply. Select a row with the arrow keys and press Space. The peek panel shows the question the session is waiting on, its result, or its current status. Type a reply and press Enter, or press a number key for a multiple-choice question.

  5. Attach only when the peek is not enough. Press Enter or → to open the full conversation; Claude posts a recap of what happened while you were away. Press ← on an empty prompt or run /exit to detach. Detaching never stops the session; /stop does.

  6. Pull in a session you already have open. In any regular claude session, run /bg (alias of /background) or press ← on an empty prompt. The conversation moves to the background and appears as a row.

Write dispatch prompts that end in evidence

Section titled “Write dispatch prompts that end in evidence”

An unattended session reports “done” when it believes it is done. Make the prompt define what done looks like and what proof to leave behind, so you check the proof rather than the transcript. Each prompt below names its acceptance check, its limits and its deliverable. See acceptance criteria for writing checks that an agent cannot argue its way around.

A review session is a second, independent check: it did not write the code, so it has no stake in the result. To run a review subagent you have defined, mention it: start the prompt with @code-reviewer, and that subagent runs as the session’s main agent. The custom subagents page shows how to write one.

claude --bg returns at once and prints a short ID plus the attach, logs and stop commands for it. Use that ID with claude logs and claude attach; --name only sets the display name in agent view. Read the failure summary in the peek panel or with claude logs <id>. CLAUDE_JOB_DIR points at the session’s own ~/.claude/jobs/<id> directory, so parallel sessions never write their scratch files over each other; the backslash stops your shell from expanding it before the session sees it. The prompt must be a positional argument: Claude Code rejects --bg combined with -p.

Each row shows a name, a one-line summary and an age. The icon’s color and animation show the state; its shape shows the process:

Icon shows asStateWhat to do
AnimatedWorkingNothing
YellowNeeds inputPeek and answer: a question, a permission, a sandbox request
DimmedIdleGive it the next prompt, or delete it
GreenCompletedCheck the result and its pull request
RedFailedPeek for the error; attach or reply to restart it
GrayStoppedStopped with Ctrl+X or claude stop, or ended while the service was off

A ✻ or animated ✽ means the process is alive; ∙ means it has exited but restarts from where it left off when you reply or attach; ✢ marks a /loop session sleeping between runs.

When a session opens or pushes to a pull request, a #1234 label appears at the right of the row (!1234 for a GitLab merge request). Yellow means waiting on checks or review, or checks failed; green means checks passed and no review is blocking; purple means merged; gray means draft or closed. Groups sort the work for you: below any Pinned rows, Ready for review (sessions with an open pull request) and Needs input sit above Working and Completed.

The row summary comes from a Haiku-class model: one short request at the end of each turn and every few minutes during long turns, billed like the session itself. On a gateway or third-party provider with no Haiku-class model configured, that request uses the session’s main model; set ANTHROPIC_DEFAULT_HAIKU_MODEL to keep it cheap.

Verify the output without reading every transcript

Section titled “Verify the output without reading every transcript”

Agent view makes sessions cheap to start. What limits you is how much finished work you can check. Treat each row’s output as a change that must pass the same gates as a human’s, in this order:

  1. Machine gates. CI on the pull request (tests, type check, lint) decides the label color. A yellow label is not a result, and it is never mergeable.
  2. The evidence the prompt demanded. Read the pull request description: root cause, before/after numbers, the commands run. If the evidence is missing, reply in the peek panel asking for it; do not open the transcript to reconstruct it. The evidence bundle page defines a standard format.
  3. An independent review. Dispatch the review prompt above as its own session. It checks each acceptance criterion against output it produced itself.
  4. A human decision at merge. You, or the code owner, read the spec delta, the evidence and the review, then sample the riskiest hunks. Reviewing an agent’s pull request gives the full triage protocol, and evidence, not diffs explains why this replaces line-by-line reading.

Agent view never merges. A session that moved its changes into a worktree Claude created commits without asking, pushes its branch when there is a remote, and opens a draft pull request when the task calls for one. It never pushes main or master, never force-pushes, and never merges. If your task, CLAUDE.md or memory says you handle git yourself, Claude leaves git to you.

For tech leads: parallel sessions raise the arrival rate of pull requests, not your team’s review capacity. Cap the number of open agent pull requests per person at what the team reviews in a day, and see the review queue for work-in-progress limits and size budgets.

Agent view already notifies through your preferredNotifChannel when a session needs input, finishes or fails; add a Notification hook only to route the alerts elsewhere, such as a desktop notifier. Two notification types fire while agent view is open in a terminal: agent_needs_input and agent_completed (v2.1.198+). Route them to a desktop notifier with a Notification hook in ~/.claude/settings.json:

{
"hooks": {
"Notification": [
{
"matcher": "agent_needs_input|agent_completed",
"hooks": [
{ "type": "command", "command": "notify-send 'Claude Code' 'A background agent needs you or has finished'" }
]
}
]
}
}

notify-send is the Linux notifier; use osascript -e 'display notification ...' on macOS. See hooks automation for handler types.

claude agents --json prints sessions as a JSON array and exits; it needs no TTY. It is the supported interface. The files under ~/.claude/jobs/ are not stable, so do not parse them. This one-liner lists every background session waiting on you:

Terminal window
claude agents --json --all | jq -r '.[]
| select(.kind == "background" and .state == "blocked")
| [.id, (.name // "-"), (.waitingFor // "-")] | @tsv'

state is one of working, blocked, done, failed or stopped. blocked always means the session needs you; a session that finished its turn reads done. Add --cwd <path> to limit the list to one project.

CommandPurpose
claude --bg "<prompt>"Start a background session in the current directory; prints its short ID
claude --agent code-reviewer --bg "<prompt>"Run a named subagent as the session’s main agent
claude --bg --permission-mode plan "<prompt>"Override the permission mode for one session
claude --resume <session-id> --bg "<prompt>"Continue an existing conversation in the background (same ID from v2.1.257)
claude attach <id>Open the session in this terminal
claude logs <id>Print its recent output
claude stop <id> (or claude kill <id>)Stop it; the conversation is kept
claude respawn <id> / claude respawn --allRestart one session, or every running one, onto the current Claude Code binary
claude rm <id>Delete the session, and its worktree when that is safe
claude daemon statusShow the supervisor’s process ID, version and uptime

A background session reads settings from the directory it runs in, and inherits the PATH and cloud-provider variables of the shell you dispatched from. claude --bg --permission-mode bypassPermissions is refused until you have accepted the bypass disclaimer once interactively with claude --dangerously-skip-permissions. Use either only inside a disposable, network-restricted sandbox (a throwaway container or VM with no production credentials): a bypassed background session runs every tool call unattended, with nobody watching to stop it. From v2.1.281 (latest channel), claude --bg in a script exits with Workspace not trusted if the directory was never trusted: run claude there once interactively first.

Every background session starts in your working directory. Before it edits a file, Claude moves the session into its own git worktree under .claude/worktrees/, so sessions share reads but never share writes. Subagents the session spawns edit inside that same worktree; give a subagent its own with isolation: worktree in its frontmatter.

For a repository where worktrees are impractical, such as heavy native build output or many submodules, turn isolation off in the project’s .claude/settings.json:

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

Sessions then edit your checkout directly and ask before committing or switching branches, so never run two against the same files.

Deleting a session is where work gets lost. Pressing Ctrl+X twice in agent view removes the worktree Claude created, uncommitted changes included. claude rm <id> keeps a worktree that has uncommitted changes. Both refuse when the worktree has commits that Claude Code cannot confirm are saved elsewhere, and print the branch and the number of unpushed commits. Commits already on a remote do not block the delete, and neither do commits on your local copy of the remote’s default branch while that branch is checked out in your main checkout. After that refusal, deleting again — Ctrl+X twice on the row, or claude rm <id> --discard-unpushed <commit>@<worktree-id> with the value the refusal printed (v2.1.260+) — removes the worktree, its branch, the unpushed commits and any uncommitted changes. To keep them, push first. The transcript always survives: claude --resume reopens it, and a bare /resume in the dispatch input (v2.1.212+) brings a deleted session back as a row.

Press ? in agent view for the full list in context.

ShortcutAction
EnterDispatch the typed prompt, or attach to the selected row
SpaceOpen or close the peek panel
→ / ←Attach / detach (on an empty prompt)
TabOn an empty input, browse subagents; otherwise apply a suggestion
Ctrl+TPin or unpin a session; pinned rows sort to the top
Ctrl+RRename a session
Ctrl+SGroup by state or by directory (persists)
Ctrl+GWrite the dispatch prompt in $VISUAL or $EDITOR
Ctrl+X, twiceStop, then delete within two seconds

Type a filter into the dispatch input instead of a prompt: s:blocked shows everything waiting on you, a:<name> shows sessions running one agent, and #1234 or a pull request URL selects the session working on it. Prefix ! to run a shell command as a background job instead of a Claude session.

What breaks when you run agents in the background?

Section titled “What breaks when you run agents in the background?”
SymptomCauseRecovery
Work vanished after deleting a rowAgent view deleted a Claude-created worktree with uncommitted changesAsk sessions to commit and push in the prompt; use claude rm rather than Ctrl+X when unsure; recover the conversation with /resume
Row stays in Needs input with “open this session to…”A command such as /mcp or /install-github-app needs an attached terminalAttach and run the command again
Rows show failed after a rebootShutdown stops sessions; sleep does notAttach to or reply to each row to restart it from where it left off. After 48 hours it shows stopped (ended while the background service was off); press Enter twice on the row, or run claude attach <id>
Attach, peek or claude logs says the service did not respondThe supervisor stalledclaude daemon stop --any --keep-workers, then claude agents
Dispatch fails with Could not resolve authentication methodThe supervisor started without stored credentialsRun /login, then claude daemon stop --any --keep-workers
A --agent session exits at onceThe name matches no subagent: --agent '<name>' not foundCheck the name in .claude/agents/
Two sessions overwrote each otherIsolation is off (bgIsolation: "none") or the directory is not a git repositoryTurn isolation back on, or dispatch one session per set of files
Quota runs out mid-afternoonEach session uses your subscription quota independentlyCap concurrent sessions; see cost control
claude agents prints your subagents and exitsAgent view is unavailable or turned off (disableAgentView, CLAUDE_CODE_DISABLE_AGENT_VIEW)Run claude update, then check both settings
A green label on a change that is still wrongThe label reports CI and review status, not correctnessStrengthen the tests the prompt must pass, and keep the review session in the loop

Two limits apply as of v2.1.283: Sessions run on your machine, so they stop when it shuts down. Each session consumes quota like an interactive one, so ten parallel sessions use it roughly ten times as fast as one. Leftover directories in .claude/worktrees/ can be listed with git worktree list and removed with git worktree remove <path>.