Answer: Pass `--bg` or its long form `--background` to start a session that goes straight to the background, with the prompt as the positional argument, e.g. `claude --bg "investigate the flaky SettingsChangeDetector test"`. Status: Confirmed Entry: tool/claude-code/agents-and-automation/dispatch-agent-from-shell Revision: 4 Digest: sha256:83ad836a8061ecc6 (changes whenever the content changes) Timeline: Created: 2026-11-13T03:03:11Z Last changed: 2026-11-18T12:13:37Z (name flag: — → --name) Last verified: 2026-11-20T12:17:52Z Next check: 2026-11-21T12:17:52Z Check interval: Daily Expected change: No fixed schedule Data: Field | Value | Source | As of flag | --bg | [1] | 2026-11-20 long form flag | --background | [1] | 2026-11-20 example command | claude --bg "investigate the flaky SettingsChangeDetector test" | [1] | 2026-11-20 prompt position | positional argument | [1] | 2026-11-20 incompatible flags | -p | [1] | 2026-11-20 subagent flag | --agent | [1] | 2026-11-20 name flag | --name | [1] | 2026-11-20 Sources: [1] Anthropic. "Manage multiple agents with agent view". https://code.claude.com/docs/en/agent-view.md Role: primary. Accessed: 2026-11-20T12:17:52Z Quote: "Pass `--bg` or its long form `--background` to start a session that goes straight to the background" (Supports: flag, long form flag) Quote: "claude --bg "investigate the flaky SettingsChangeDetector test"" (Supports: example command) Quote: "The prompt is the positional argument, not a `-p` value." (Supports: prompt position) Quote: "Claude Code rejects `--bg` combined with `-p` or `--print` before any session is created" (Supports: incompatible flags) Quote: "combine `--bg` with `--agent`" (Supports: subagent flag) Quote: "Pass `--name` to set the session's display name in agent view instead of the auto-generated one" (Supports: name flag) Published: 2026-11-20T10:22:15Z Snapshot SHA-256: 5e2440d82d866cca105f93449bdec96c74e7b215fd5574017b1cd461c8ea8ac2 (captured 2026-11-20T12:17:53Z) Verification: Method: Automated extraction from [1] with deepseek-flash (JSON output, thinking disabled). Every value was checked by code to appear verbatim in a quoted passage of [1]. Cross-check: not-available at 2026-11-20T12:17:52Z. No independent second source is configured for this entry Last successful check: 2026-11-20T12:17:52Z Last attempt: 2026-11-20T12:17:52Z Notes and limitations: Extracted automatically from a single official source (section "Dispatch an agent from your shell"). Related: https://latestn.com/tool/claude-code/agents-and-automation/display-todo-progress-realtime How do I display Claude's todo progress in real time in my application using the Agent SDK? https://latestn.com/tool/claude-code/agents-and-automation/enable-agent-teams How do I enable agent teams in Claude Code? https://latestn.com/tool/claude-code/agents-and-automation/enable-file-checkpointing How do I enable file checkpointing in the Claude Code Agent SDK? https://latestn.com/tool/claude-code/agents-and-automation/custom-sessionstore-adapter How do I implement a custom SessionStore adapter for Claude Code Agent SDK session storage? https://latestn.com/tool/claude-code/agents-and-automation/disable-filesystem-settings-setting-sources How do I disable filesystem settings like CLAUDE.md and skills in a Claude Code SDK agent? https://latestn.com/tool/claude-code/agents-and-automation/disable-subagents How do I disable specific subagents in Claude Code? https://latestn.com/tool/ All entries in AI tools Change log: Time | Event | Change | Source 2026-11-18T12:13:37Z | changed | name flag: — → --name | [1] 2026-11-15T12:17:28Z | changed | name flag: --name → — | [1] 2026-11-14T12:13:35Z | changed | name flag: — → --name | [1] 2026-11-14T12:13:35Z | changed | subagent flag: — → --agent | [1] 2026-11-14T12:13:35Z | changed | long form flag: — → --background | [1] 2026-11-14T12:13:35Z | changed | long form: --background → — | [1] 2026-11-13T03:03:11Z | added | Entry created | — Changes for this entry as a feed: https://latestn.com/tool/claude-code/agents-and-automation/dispatch-agent-from-shell/latest Challenge this entry: Open challenges: None How: If a value here is wrong or out of date, send what is wrong and a link to evidence. Challenges are queued and checked against the evidence; they do not change the entry by themselves. If the entry changes as a result, the change log says so. Form: https://latestn.com/dispute/tool/claude-code/agents-and-automation/dispatch-agent-from-shell POST: https://latestn.com/dispute/tool/claude-code/agents-and-automation/dispatch-agent-from-shell with claim, evidence_url, and optionally field and contact (form-encoded or JSON) GET: https://latestn.com/dispute/tool/claude-code/agents-and-automation/dispatch-agent-from-shell?claim={what is wrong}&evidence_url={link} How to cite: LatestN. (2026). How do I dispatch a new background agent from the Claude Code shell? Revision 4, last verified 2026-11-20T12:17:52Z. https://latestn.com/tool/claude-code/agents-and-automation/dispatch-agent-from-shell (accessed 2026-11-21T10:00:39Z). @misc{LatestN_tool_claude_code_agents_and_automation_dispatch_agent_from_shell_r4, title = {How do I dispatch a new background agent from the Claude Code shell?}, author = {{LatestN}}, year = {2026}, howpublished = {\url{https://latestn.com/tool/claude-code/agents-and-automation/dispatch-agent-from-shell}}, note = {Revision 4; digest sha256:83ad836a8061ecc6; last verified 2026-11-20T12:17:52Z; accessed 2026-11-21T10:00:39Z} } Reuse: License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) Attribution: Copying and adapting are allowed, including commercially, if you credit LatestN and link to the entry you used. Each entry ends with a ready-made citation. URL: https://latestn.com/tool/claude-code/agents-and-automation/dispatch-agent-from-shell