--background
A Claude Code CLI flag, read out of the shipped bundle. No mined inventory carries it: everything below comes from what this site has written about it.
Also written --bg. Every list on this page counts all of these spellings together.
Start the session as a background agent and return immediately. Prints the session ID and management commands. Combine with --exec to run a shell command as a background job instead of a Claude session, or with --agent to run a specific subagent. Checks workspace trust for the directory before it starts. Can't be combined with -p/--print; see the error reference
Anthropic's own wording. Read off CLI reference, captured 2026-11-09.
In the changelogs
24Releases whose published page names --background.
-
v2.1.321
Settings for user delegated sessions are passed on, and some commands refuse to run in them
Two user delegated session variables are passed to spawned processes, and
--bgandplugin evalrefuse to run when the direct API one is setfound in this entry's text
-
v2.1.314
Signing in can now be refused by your organisation's settings
After signing in, Claude Code now checks your organisation's settings first and discards the login if they refuse it
found in this entry's text
-
v2.1.314
New hidden
--agents-view-if-allowedcommand-line flagClaude Code has a new hidden command-line flag,
--agents-view-if-allowed, listed next to--bgand--backgroundfound in this entry's text
-
v2.1.312
Background session commands wait for a sign-in refresh before exiting
The logs, attach, respawn, rm and stop commands, and
--bg, now wait for any sign-in refresh to finish before exitingfound in this entry's text
-
v2.1.299
claude --bgrefuses to start when the flag is mixed into the promptIf Claude Code cannot tell
--bgapart from the prompt text, it now starts nothing and tells you to put the flag firstfound in this entry's text
-
v2.1.286
Background sessions that fail to start now say what blocked them
When a background session is blocked from starting, Claude Code now records whether a disclaimer or the folder trust check stopped it
found in this entry's text, named in this entry
-
v2.1.285
New --desktop flag, and background commands now accept options in front of them
--desktopopens the Claude Desktop app and now errors when combined with background or worktree optionsfound in this entry's text
-
v2.1.285
Changed list of startup flags Claude Code singles out
Claude Code now keeps a set of startup flags, including
--print,--backgroundand--version, that it treats as a groupfound in this entry's text
-
v2.1.281
--agents can now take a file path instead of inline JSON, but only in print mode
--agents now accepts a path to a file of subagent definitions, but only with --print (-p); interactive sessions still need inline JSON
found in this entry's text
-
v2.1.281
Background sessions started from a trusted home directory now carry that trust, with a warning when it is lost
Background sessions started from a trusted home directory keep that trust, and warn you when they lose it
found in this entry's text
-
v2.1.281
--bg rejects --agents given as a file
Using --bg with --agents pointing at a file now fails; pass the agents as inline JSON instead
found in this entry's text
-
v2.1.257
--background/--bg can now resume a session in placeCombining --bg with --resume now continues that session in the background under the same ID.
found in this entry's text
-
v2.1.257
cli_bg_dispatch telemetry gains cwd_gone reason
Background dispatch telemetry records a missing working directory as its own reason.
found in this entry's text
-
v2.1.251
--bghelp now names the commands that take the printed id--bg help now names attach, logs, stop and rm as the commands taking the printed id.
named in this entry, found in this entry's text
-
v2.1.224
Clearer error when
--bgand--environmentare combinedCombining --bg and --environment now explains they are different backends and shows the right command.
named in this entry, found in this entry's text
-
v2.1.224
Start a cloud session on a self-hosted environment with
--environmentStart a cloud session on your own environment with claude --environment, plus hidden --ref and --on-branch companions.
found in this entry's text
-
v2.1.198
--bgand--allow-toolsFlags forclaude agentsfound in this entry's text
-
v2.1.187
--bg/--background— Launch as background agentfound in this entry's text
-
v2.1.174
--poolBackend Error Messagefound in this entry's text
-
v2.1.172
--bg / --pool Conflict Error Message Improved
found in this entry's text
-
v2.1.166
--cloudreplaces--remotefor cloud sessionsfound in this entry's text
- v2.1.166
-
v2.1.122
Background Job Safety Guards
found in this entry's text
-
v2.1.121
Disable Background Agents Fleet Setting
found in this entry's text
First cited
1The earliest release whose published evidence quoted --background was v2.1.187, 23 Jun 2026. That is the oldest release this project wrote about it, so it is a floor on the name's age and not the release that introduced it. It is not a presence reading: which builds carried the name is the table below.
Presence across releases
0The miner has never read a build containing this name. It is here because a changelog entry of ours names it, which is evidence that it existed and not evidence of which releases carried it. The inventory starts at v2.1.138 and everything older than that was never mined.
Read out of the published npm bundle release by release, and out of Anthropic's own documentation as this site captured it. Nothing on this page is a description anybody here wrote about what the CLI flag does. All CLI flags.