Agent view
Dispatch, monitor, peek at and attach to background Claude Code sessions from one terminal screen with claude agents.
Agent view is a single terminal screen for every background session you have running. You type a task, it becomes a row, and the row tells you whether Claude is working, waiting on you, or done. You only open a full conversation when one actually needs you.
Each row is a complete Claude Code session that keeps going with no terminal attached. A separate supervisor process hosts them, so you can close agent view, close the shell, or start something else and the work carries on.
I use it for the jobs that do not need me watching: a dependency bump, a flaky-test hunt, a review of someone else's PR. Three prompts, three rows, and I get on with my own work until one turns yellow.
Note: Agent view is a research preview. Keys and layout may change.
For how it compares with subagents, teams and workflows, see Run agents in parallel. If you want Claude to start and track parallel sessions in the cloud from one conversation instead, look at Projects.
Getting started
- Open it. Run
claude agentsfrom your shell. If the directory is not yet trusted, you get the usual workspace trust dialog first; declining exits. - Dispatch. Type a task at the bottom and press
Enter. Every prompt you submit here starts a new session; it never sends a follow-up to an existing one. - Peek. Highlight a row and press
Space. The panel shows the latest output or the question it is stuck on. Type a reply and pressEnterto answer without leaving the list. - Attach. Press
Enteror→to take over the terminal with the full session. Press←on an empty prompt to go back to the list. - Bring in an existing session. In any ordinary
claudesession, run/bg(or press←on an empty prompt) to send it to the background and open agent view.
Esc leaves agent view. If you arrived by pressing ← in a session, Esc takes you back to that conversation instead.
In a normal session, the prompt footer's ← hint shows how many background agents are waiting, for example ← 2 agents, and flashes briefly when one finishes (← 2 done). The flashes respect prefersReducedMotion.
Make it the default
Turn on Open agents view by default in /config, or type:
/config defaultToAgentsView=true
From then on, plain claude opens agent view. Pass a prompt (claude "tidy the README") to get an ordinary session. Set it back to false the same way.
Reading the list
By default the list shows background sessions from every project. Narrow it with:
claude agents --cwd ~/clients/acme-portal
That includes sessions that have since moved into a worktree under that folder's .claude/worktrees/. Interactive sessions in other terminals are not listed until you background them, and subagents or teammates a session spawns do not get rows of their own.
Here is roughly what a busy list looks like:
Pinned
✽ invoice export Writing CSV writer for VAT breakdown 6m
Ready for review
∙ stripe upgrade Draft PR open, types fixed #318 1h
Needs input
✻ email templates keep the old footer or use the new brand one? 2m
Working
✽ flaky checkout test Re-running suite with retries disabled 4m
✢ nightly lint 12 runs, all clean in 9m
Completed
∙ README refresh Rewrote setup section 3h
… 4 more
State colours
| State | Icon | Meaning |
|---|---|---|
| Working | Animated | Running tools or writing a reply |
| Needs input | Yellow | Waiting on you: a question, a permission prompt, a sandbox or MCP input request, or a command that needs an attached terminal |
| Idle | Dimmed | Ready for another prompt |
| Completed | Green | Finished successfully |
| Failed | Red | Ended on an error |
| Stopped | Grey | Stopped with Ctrl+X or claude stop, killed externally, or ended while the background service was off |
The icon shape adds a second signal: ✻ or an animated ✽ means the process is alive, ∙ means it has exited (replying or attaching restarts it from where it was), and ✢ marks a /loop session sleeping between runs, with its run count and countdown.
While agent view is open, the terminal tab title shows something like 2 awaiting input · claude agents, and Claude Code sends your configured terminal notification when a session needs input, finishes or fails. /loop sessions only notify when they need you. These fire the Notification hook with type agent_needs_input or agent_completed.
Summaries
The one-line text on each row comes from a Haiku-class model. During a turn it refreshes at most every 15 seconds from the session's own output without a model call, gets rewritten every few minutes on long turns, and gets a proper summary when the turn ends. Those summary calls go through your normal provider. On a provider with no Haiku-class model configured, set ANTHROPIC_DEFAULT_HAIKU_MODEL or it falls back to the session's main model.
Pull request labels
When a session opens or works on a PR, a #1234 label (or !1234 for a GitLab merge request) appears on the right and links to it. Its colour tracks status:
| Colour | Status |
|---|---|
| Yellow | Waiting on checks or review, or checks failed |
| Green | Checks passed, no blocking review |
| Purple | Merged |
| Grey | Draft or closed |
Claude Code finds the PR from gh command output, from gh pr checkout, or by looking up the branch after a push. It retries the lookup across the next five git, gh, glab or curl commands, so a PR created just after the push still links. Several PRs show as a count such as 3 PRs. Set FORCE_HYPERLINK=0 if the link escape codes cause trouble.
My habit: when a row goes green with a PR number, that is my cue to review and merge.
Peeking and replying
Space opens the peek panel. For a waiting session it shows the exact question; for a finished one, the result; for a working one, its full status line. Linked PRs are listed, and for a waiting session a line such as waiting 3m tells you how long it has been stuck.
Replies behave differently by situation:
- Session is working:
/model,/effort,/renameand/usageapply immediately. Anything else joins the message queue and is picked up when queued input normally is. - Exactly
/stop: stops the session at once. - Prefix
!: sends a Bash command instead. - A question with numbered choices: press the number to fill it in, then
Enter. - A free-text question: type your answer, or
Tabto accept a suggested reply. - A permission prompt or other dialog: replying does not answer it. Attach with
→to deal with the dialog.
If delivery fails because the background service is unreachable, the reply is saved and sent when the session next starts (except ! commands). Hold-to-talk voice dictation works in the reply and dispatch inputs. ↑ and ↓ move the peek to neighbouring rows.
Attaching
Enter or → attaches. Claude gives you a short recap of what happened while you were away, and then it is a normal session. Attached sessions always render in fullscreen mode because there is no scrollback to append to; scroll with PgUp, PgDn or the mouse, and use Ctrl+O for transcript mode.
Commands that need a human at a dialog, such as /install-github-app or the /mcp settings list, put an unattended session into Needs input with a row like open this session to manage MCP servers. Attach and run the command again. /mcp reconnect, /mcp enable and /mcp disable work either way.
To leave:
| Key | Result |
|---|---|
← on an empty prompt, or /exit | Back to agent view |
Ctrl+Z | Back to where you came from (agent view, or the shell if you used claude attach). Useful when a dialog swallows ← |
Ctrl+C twice on an empty prompt | Detach |
/stop | Actually end the session |
Detaching never stops the session. A single Ctrl+C still cancels the running response as normal. On Windows, a ← within half a second of attaching asks you to press again.
Switching from a foreground session
In a session you started in the terminal, ← on an empty prompt backgrounds it and opens agent view with that row selected, under the banner Your conversation moved to the background. Enter reopens it, Esc undoes the switch, and Ctrl+C twice exits to the shell. The task list travels with the conversation.
If a tool is running, Claude Code waits for it before switching (press ← again to skip the wait). After about ten seconds it switches anyway, unless foreground subagents are running, a prompt or question is waiting for you, or you have typed into the input. Turn the shortcut off with leftArrowOpensAgents in /config.
Organising the list
Groups run Ready for review and Needs input first, then Working, then Completed. A session lands in Ready for review when its PR needs review or has failing checks; Completed also collects failed and stopped sessions.
Ctrl+Sswitches between grouping by state and by directory (remembered between runs).Ctrl+Tpins a session to the top and keeps its process alive while idle.Shift+↑/Shift+↓reorders.Ctrl+Rrenames.Enteron a group header collapses it.Ctrl+Xstops a session; a secondCtrl+Xwithin two seconds deletes it. On a group header it deletes the whole group after confirming.
Deleted sessions keep their transcript on disk for claude --resume. To bring one back as a row, type a bare /resume (or /continue) in the dispatch input (v2.1.212+) and pick from the repository's past sessions. The picker does not open when you pass an ID or search term, or when the view was opened with --cwd, --safe-mode, --permission-mode, --settings or similar flags.
Filters
Start the dispatch input with a filter to narrow the list as you type:
| Filter | Matches |
|---|---|
a:<name> | Sessions running that agent |
s:<state> | A state or group, for example s:working, s:ready, or s:blocked for everything waiting on you |
n:<text> | Name or first prompt contains the text (v2.1.287+) |
o:<text> | Result contains the text; bare o: lists all sessions with a result |
#1234 or a PR URL | The session on that PR |
| Any other URL | The session whose first prompt included it |
Combine with spaces: s:blocked a:reviewer shows reviewer sessions that need you.
Keys
| Key | Action |
|---|---|
↑ ↓, PgUp PgDn, Home End | Move around |
Enter / → | Attach, or submit the input |
Space | Toggle peek |
Shift+Enter, Ctrl+J | Newline in the dispatch input |
Ctrl+Enter | Dispatch and attach at once (where supported) |
Alt+1 to Alt+9 | Attach to session 1 to 9 in the focused directory |
Tab | Browse subagents on an empty input, or accept a suggestion |
Alt+↑ / Alt+↓ | Jump between group headers |
Ctrl+F | Find by name |
Ctrl+G | Edit the dispatch prompt in $VISUAL or $EDITOR |
Ctrl+C | Clear input; twice to exit |
? | Show the shortcut overlay |
Most of these can be rebound in the Agents context of keybindings.
Dispatching work
From agent view
Type a task and press Enter. A Haiku-class model names the session, and you can rename it with Ctrl+R. Paste screenshots straight in. Pasted text over 800 characters or three lines collapses to [Pasted text #N]; paste it again to expand it for editing. Prompts under four characters are rejected as Too short.
| Input | Effect |
|---|---|
| First word matches a subagent name | That subagent runs as the session's main agent |
@<agent> anywhere | Same, explicitly |
@<repo> | Run the session in that repository |
/<command> | Dispatch a skill or command as the first prompt |
! <command> | Run a shell command as a background job instead of a Claude session |
#<number> or PR URL | Jump to the session already on that PR, if any |
/exit, /quit, /logout, /login, /model and a bare /resume run in agent view itself. Skills, your own commands and prompt-expanding built-ins such as /init become the new session's first prompt; other built-ins tell you to attach first.
If an @name matches both a subagent and a repository, the subagent wins. That first-word rule can surprise you: a prompt that happens to start with an agent's name dispatches that agent.
Choosing a directory
Sessions start where you opened agent view. To target somewhere else, open claude agents there; or open it in a parent folder and use @<repo>, which lists git repositories one level down, worktrees inside the launch repository, and directories that already have sessions (names with spaces are not listed); or cd and run claude --bg. When grouped by directory, dispatching goes to the selected group's folder.
From inside a session
/background(alias/bg) moves the current conversation to the background and frees the terminal. Add a final instruction:/bg run the integration tests and fix what breaks. Exiting while subagents, workflows or monitors are running also offersMove to background and exit./forkcopies the conversation into a new background session while the original carries on (v2.1.212+). The copy keeps model, permission mode, effort, added directories and "don't ask again" grants. With a prompt, it starts immediately; without one it waits for instructions. Sessions launched with flags the copy cannot inherit, such as a replaced system prompt or--tools, cannot be forked.
When you background, in-flight background shell commands, backgrounded subagents, dynamic workflows, /loop tasks and automatic artifact comment replies move with it. Running monitors cannot move and are stopped, so you get a Background this session? dialog first. A workflow with running subagents also triggers the dialog because those subagents restart from scratch. Set CLAUDE_DISABLE_ADOPT=1 to stop in-flight work instead of moving it.
These launch flags carry over: --mcp-config, --strict-mcp-config, --settings, --setting-sources, --add-dir, --plugin-dir, --fallback-model and --allow-dangerously-skip-permissions, plus directories added with /add-dir.
From the shell
claude --bg "find out why the PDF export times out on large invoices"
claude --bg --name pdf-timeout "find out why the PDF export times out"
claude --agent migration-checker --bg "review the migrations on this branch"
claude --resume <session-uuid> --bg "carry on and finish the refactor"
--bg (long form --background) takes the prompt as a positional argument and cannot be combined with -p. Untrusted directories show the trust dialog, or fail with Workspace not trusted in scripts. An unknown --agent name makes the session exit with --agent '<name>' not found.
On v2.1.257+, --resume <id> --bg continues the session in place where possible, or starts a copy and prints a note: explaining why. --continue, a bare --resume or a name always start a copy; --fork-session starts one deliberately.
The command prints the short ID and the management commands:
backgrounded · 3a91f0c2 · pdf-timeout
claude agents list sessions
claude attach 3a91f0c2 open in this terminal
claude logs 3a91f0c2 show recent output
claude stop 3a91f0c2 stop this session
Shell jobs
claude --bg --exec 'npm run test:e2e' (or ! in the dispatch input) runs a plain command as a PTY-backed row with no model involved. Its last output line is its status. Output lives in memory only and the row disappears about five minutes after the command exits, so grab the result with claude logs <id> before then. Claude Code never re-runs a shell job on restart.
How file edits are isolated
A dispatched session starts in your working directory, then moves into its own git worktree under .claude/worktrees/ before its first edit, so parallel sessions never collide. Claude Code then enforces that isolation for the session and any subagents.
It skips the worktree when you backgrounded an existing session, when the session or the edited file is already in a linked worktree, when the directory is not a git repository and there is no WorktreeCreate hook, or when the write is outside the working directory.
Turn isolation off for a repository with:
{
"worktree": {
"bgIsolation": "none"
}
}
Outside git, sessions share the directory, so do not dispatch overlapping edits. Other version control systems can use a WorktreeCreate hook.
A session that edited inside its own worktree is told to preserve its work: commit without asking, push if there is a remote, and open a draft PR when it suits the task. It never pushes to main or master, force-pushes or merges, and your own instructions in the task, CLAUDE.md or memory override this. A session editing a checkout it did not isolate asks before committing or switching branches. Every job ends with a report saying where the work is.
What deletion removes
Deleting a session (double Ctrl+X or claude rm) removes the row but keeps the transcript. For a worktree Claude created:
- Agent view removes it, uncommitted changes included. Commit first.
claude rmkeeps the worktree and the row if there are uncommitted changes.- A worktree in use or locked by another session is never removed; the row shows
not deleted. - If the worktree has commits not found on a remote or on your checked-out default branch, deletion is refused with the branch name and count. Push or merge them, or delete again (or run
claude rm <id> --discard-unpushed <value>as printed) to throw them away. - If git or your
WorktreeRemovehook fails, the message says why. Deleting again, orclaude rm <id> --force-remove-worktree <worktree-id>, removes the directory when it is safe, leaving the branch.
A worktree you created yourself is always left alone.
Model, permission mode and effort
Model
The header shows the dispatch model, taken from your user model setting. Override it for the whole run with claude agents --model, or type /model sonnet in the dispatch input; the header gains a (session) marker and /model default clears it. Per session, use claude --bg --model, attach and run /model, or dispatch a subagent with its own model.
Settings and provider
A background session reads settings from its own directory, including project env values, and inherits the dispatching shell's PATH, provider selection (CLAUDE_CODE_USE_BEDROCK, CLAUDE_CODE_USE_VERTEX and so on), ANTHROPIC_DEFAULT_*_MODEL values and CLAUDE_CODE_EXTRA_BODY.
If you use an LLM gateway, put its variables in a settings file's env block. A shell-only ANTHROPIC_BASE_URL reaches background sessions only in narrow cases (when the supervisor was started from a shell with the same gateway and you are backgrounding, dispatching or waking a session in the current directory).
Permission mode
- Backgrounded with
/bgor←: keeps its current mode. - Dispatched from an agent view opened with
←: the target directory'spermissions.defaultModefirst (withautoandbypassPermissionshonoured only from managed,--settingsor user settings, and project settings never allowed to be more permissive than where you came from), then the mode you came from. - Dispatched from
claude agentsin a shell, orclaude --bg: starts as a freshclaudein that directory would.
Dispatch defaults
claude agents --permission-mode plan --model opus --effort high --agent reviewer
--effort accepts the same values as the top-level flag, including ultracode. --agent defaults to the agent setting, then the built-in claude agent. --dangerously-skip-permissions is shorthand for bypass mode and --allow-dangerously-skip-permissions adds it to each session's Shift+Tab cycle; both require the one-time disclaimer. --restricted starts every dispatched session in restricted mode (v2.1.248+). Active defaults appear in the footer.
Mode, model, effort, carried flags, /rename names and Ctrl+S stashed prompts all survive supervisor restarts.
Settings, plugins and MCP
claude agents accepts --settings, --setting-sources, --add-dir, --plugin-dir, --mcp-config and --strict-mcp-config, and passes them all to dispatched sessions. Repeat a flag once per value. Put --add-dir and --mcp-config after agents, or claude agents --json fails with unknown option.
Shell commands
| Command | Does |
|---|---|
claude agents | Open agent view |
claude agents --cwd <path> | Scoped to one directory |
claude agents --json [--all] [--cwd <path>] | Print sessions as JSON and exit |
claude attach <id|name> | Attach here |
claude logs <id|name> | Recent output |
claude stop <id> (or claude kill) | Stop |
claude respawn <id> / --all | Restart, for example onto a new binary |
claude rm <id> | Remove, with safe worktree clean-up |
claude daemon status | Supervisor state, version, socket directory, worker count |
claude daemon logs | Follow ~/.claude/daemon.log |
claude daemon stop --any [--keep-workers] | Stop the supervisor, optionally leaving sessions running |
Name matching for attach and logs needs v2.1.290+.
Scripting against session state
claude agents --json --all is the supported interface; do not parse ~/.claude/jobs/. Each entry has cwd, kind and startedAt, plus id and state for background sessions, pid and status (busy, waiting, idle) while alive, waitingFor when waiting, and sessionId and name when set.
state | Meaning |
|---|---|
working | A turn is running or the session is mid-way through self-driven work such as a /loop |
blocked | It needs something from you |
done | Finished the last request and ready for more |
failed / stopped | Ended on an error, or stopped |
Each session gets CLAUDE_JOB_DIR pointing at ~/.claude/jobs/<id>; its tmp/ subfolder is a private scratch area where Write and Edit do not prompt, deleted with the session.
How it is hosted
The supervisor starts the first time you background something or open agent view. Each session is its own process under it. Working, waiting-on-a-dialog and attached sessions keep running; idle or finished ones unattached for about an hour are stopped to save resources and restart on demand (pin to prevent this). Crashed sessions are restarted. After an auto-update the supervisor moves itself and idle sessions to the new version.
State lives under your config directory (or CLAUDE_CONFIG_DIR, which gives a separate supervisor):
| Path | Holds |
|---|---|
~/.claude/daemon.log | Supervisor log |
~/.claude/daemon/roster.json | Running sessions, for reconnecting |
~/.claude/jobs/<id>/state.json | Per-session state |
~/.claude/jobs/<id>/tmp/ | Per-session scratch space |
/status shows Session kind as background job · attached, background job · unattended or interactive.
To switch the whole feature off, set disableAgentView to true or export CLAUDE_CODE_DISABLE_AGENT_VIEW. Admins can enforce this through managed settings.
Troubleshooting
| Symptom | Fix |
|---|---|
claude agents prints a list of subagents and exits | Agent view is unavailable: run claude update, then check it has not been disabled |
Background this session? dialog | Something cannot move or will restart. Run /tasks, then confirm or choose Stay |
| Sessions failed or stopped after a shutdown | Within 48 hours they show as failed; reply or attach to restart. Older ones show ended while the background service was off; press Enter twice to resume |
already open when opening a row | The conversation is live in another terminal or process. Use that one or close it |
This session has no saved transcript | It was backgrounded before its first reply finished. Enter again or claude respawn <id> starts it fresh |
possibly low memory | A hint, not a diagnosis. Free memory and retry |
| Background service did not respond | claude daemon stop --any --keep-workers, then reopen. If the PID cannot be verified, stop it yourself and delete ~/.claude/daemon.lock |
Could not resolve authentication method | Run /login (or export your API key), then restart the supervisor as above from that shell |
macOS Operation not permitted on Desktop, Documents or Downloads | Grant Claude Code access under Privacy & Security > Files and Folders, or Full Disk Access |
macOS connect: no route to host to LAN devices | Approve the Local Network prompt for Claude Code (macOS 15+) |
| Slow after attaching | The idle process was stopped and is restarting. Pin sessions you return to often |
.claude/worktrees/ filling up | git worktree list, then git worktree remove <path> |
Limitations
- Background sessions use your plan's quota just like interactive ones, so parallelism burns it faster.
- Sessions run locally. They survive sleep but not shutdown.
- Deleting from agent view removes Claude-created worktrees, uncommitted work included.