Skip to main content

Agents and Teams

These variables control subagents, agent teams, background tasks, and workflows. They set limits, switch features on, and change how child agents behave. Several are experimental and may change without notice.

This page lists 77 variables. Switch rows take 1 or 0.

Example​

export CLAUDE_CODE_DISABLE_BACKGROUND_TASKS=1
claude

Claude Code does not start background tasks.

Variables​

The table is sorted by name. See Environment Variables for what each column and badge means.

VariableStatusWhat it doesValues and defaultNotes
CLAUDE_AGENT_SDK_DISABLE_BUILTIN_AGENTSDocumentedRemoves all built-in subagent types. The agent list is then empty.On or off. Takes effect only in non-interactive modeNon-interactive and SDK use. Not set from project env before trust
CLAUDE_AGENTS_AUTO_RELAUNCHED_ATUndocumentedRecords when the agents view last auto-relaunched itself on the latest build. The view skips another auto relaunch for 6 hours.A number. Claude Code sets it for the relaunched child. The view reads it with Number()claude agents view. Not set from project env before trust
CLAUDE_ASYNC_AGENT_STALL_TIMEOUT_MSDocumentedSets the stall timeout for background subagents.A number of milliseconds. Whole number from 1 to 2147483647. Without it the default is 600000 with the stream watchdog off, else the stream idle timeout plus 300000, capped at 2147483647Subagents. Not set from project env before trust
CLAUDE_AUTO_BACKGROUND_TASKSDocumentedMoves a subagent to the background after about two minutes.On or off. The code uses a 120000 ms delay when set. It also turns on the worker check-in scheduleSubagents and non-interactive mode. Project env can set it before trust
CLAUDE_BG_BACKENDUndocumentedMarks a session that runs under the background daemon. A daemon session handles SIGHUP and color output in its own way.Text. The value daemon turns on the daemon paths. Set by Claude Code when it starts a background sessionBackground sessions. Not set from project env before trust
CLAUDE_BG_CARRIED_PROMPTS_SHA256UndocumentedHolds the hash of the carried prompts file for a respawned background session.Text. Claude Code reads it once, then unsets it. The hash is checked against the carried prompts fileBackground sessions. Not set from project env before trust
CLAUDE_BG_ISOLATIONUndocumentedSets worktree isolation for a background session.Text. Else the job or the worktree.bgIsolation setting decides. Changes the prompt textBackground sessions. Not set from project env before trust
CLAUDE_BG_POST_CLEAR_RESPAWNUndocumentedMarks a respawn after a clear. The session then skips the --agent not-found check and the agent prompt step.On or off. Claude Code sets 1 on respawn attempts after the first when the session id changedBackground sessions. Not set from project env before trust
CLAUDE_BG_RENDEZVOUS_SOCKUndocumentedGives the path of the rendezvous socket for a background session. The session starts a server on it.Text. Claude Code reads it once, deletes it, and removes the socket fileBackground sessions. Not set from project env before trust
CLAUDE_BG_SOURCEUndocumentedTells how a background session started. The value spare marks a pre-started spare. A telemetry event also records it.Text. Free text is reported as otherBackground sessions. Not set from project env before trust
CLAUDE_BG_STARTUP_WEDGE_MSUndocumentedSets the time before the startup wedge watchdog fires for a background session.A number of milliseconds, 45000 by default. Whole number, default 45000 when unset or 0Background sessions. Not set from project env before trust
CLAUDE_CODE_AGENTUndocumentedHolds the agent name of the main thread. Claude Code records it in the session registry file.Text. Claude Code sets it from the --agent flagAll sessions. Not set from project env before trust
CLAUDE_CODE_AGENT_PROGRESS_SUMMARIESUndocumentedTurns on subagent progress summaries when the host check in the startup code passes.On or off. A host check gates the call. Part of a list of host-controlled namesSDK and host sessions. Not set from project env before trust
CLAUDE_CODE_AGENT_VIEW_RELAUNCHUndocumentedMarks that the agents view was relaunched. The view reads it once and deletes it.On or off. Set to 1 by Claude Code in the env of the relaunched childclaude agents view. Not set from project env before trust
CLAUDE_CODE_BG_TASKS_REPORT_RUNNINGDocumentedControls whether a non-interactive session keeps a running status after a turn ends while background work lives.On, off, or unset, on by defaultNon-interactive sessions
CLAUDE_CODE_CALM_MOCHIUndocumented GatedSets how a subagent token budget adds on top of the start budget.Text. forks and all are valid, anything else means none. Works with a feature flagSubagents, gated by a feature flag
CLAUDE_CODE_COMPILED_ACORNUndocumented GatedForces the bound Slack thread mode on or off. Claude Code then treats posts from that thread as relayed human messages.Off by default. Env value, else a feature flag, default off. Needs a prior platform checkBound Slack thread sessions, gated by a feature flag
CLAUDE_CODE_COORDINATOR_EXTRA_TOOLSUndocumented GatedAdds extra tool names to the tools that coordinator mode keeps. A tool matches when its name starts with a listed entry.A comma-separated list, empty by default. Needs coordinator modeCoordinator mode
CLAUDE_CODE_COORDINATOR_FORCE_WORKER_INHERIT_MODELUndocumented GatedMakes workers inherit the session model. The coordinator prompt and the Agent tool then say the model parameter is ignored.On or off, off by default. CLAUDE_CODE_SUBAGENT_MODEL_FORCE has the same effect on the promptCoordinator mode
CLAUDE_CODE_COORDINATOR_MODEUndocumented GatedTurns on coordinator mode, where the main session delegates work to workers.On or off. Claude Code sets it to 1 or deletes it when the session mode switchesDisabled in some remote sessions unless CLAUDE_CODE_REMOTE is set
CLAUDE_CODE_COORDINATOR_PROPAGATE_NESTED_MEMORYUndocumented GatedIn coordinator mode, copies the pending nested memory triggers from the parent context into a worker context.On or off, off by default. Skips with a debug message if the parent has noneCoordinator mode
CLAUDE_CODE_DAEMON_COLD_STARTUndocumented GatedSets the cold start mode of the background service. Overrides the daemonColdStart setting.Text. Else the setting, then a feature flagBackground service
CLAUDE_CODE_DISABLE_AGENT_VIEWDocumentedTurns off background agents and agent view. Matches the disableAgentView setting.On or off. The disable message names the variableAll sessions. Project env can set it before trust
CLAUDE_CODE_DISABLE_BACKGROUND_TASKSDocumentedTurns off background tasks, including run_in_background, auto-backgrounding and Ctrl+B.On or off. Also forced when another gate disables background workAll sessions. Project env can set it before trust
CLAUDE_CODE_DISABLE_BG_EXIT_HANDOFFDocumentedStops a background session from handing its running background work to the next process.On or off. Checked in the exit handoff code of background sessionsBackground sessions
CLAUDE_CODE_DISABLE_BG_STABLE_PATHUndocumented GatedMakes the background session pty host start from the running executable instead of a stable path lookup.On or off. Removed from the child environment. Only used on macOSMacOS background sessions
CLAUDE_CODE_DISABLE_CRONDocumentedTurns off scheduled tasks and the cron tools.On or off. Gates a feature flag checkAll sessions. Project env can set it before trust
CLAUDE_CODE_DISABLE_EXPLORE_PLAN_AGENTSDocumentedTurns off the built-in Explore and Plan subagents.On or off. Claude Code reads it once and keeps the result for the sessionAll sessions. Project env can set it before trust
CLAUDE_CODE_ENABLE_APPEND_SUBAGENT_PROMPTUndocumentedAppends the appendSubagentSystemPrompt option text to the system prompt of every subagent.On or off, off by default. Set to 1 by Claude Code when --append-subagent-system-prompt or the -file flag is used--print mode only
CLAUDE_CODE_ENABLE_TASKSDocumentedSelects the Task tools. Set to 0 to fall back to TodoWrite.On, off, or unset, on by default. Only false disablesAll sessions. Project env can set it before trust
CLAUDE_CODE_ENABLE_TODO_TOOLSDocumentedGives the task tools to every model, not only the default list.On or off, off by default. Only true countsAll sessions
🧪 CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMSDocumented GatedTurns on agent teams. The --agent-teams flag does the same.On or off, off by default. Also needs a feature flag, default onAll sessions. Project env can set it before trust
🧪 CLAUDE_CODE_EXPERIMENTAL_OBSERVER_AGENTSUndocumented GatedTurns on observer agents, which use the observer field of agent definitions.On or off, off by default. Needs a feature flag, default on. Fan-out needs a feature flagAll sessions
CLAUDE_CODE_FLEET_PAST_SESSIONSUndocumented GatedShows past sessions in the fleet agent view.Second env accessor, checked against true. Else a feature flagAgent view
CLAUDE_CODE_FLEETVIEW_SIMPLEUndocumented GatedTurns on the simple fleet view of the agent view.On or off, off by default. Else a feature flagAgent view
CLAUDE_CODE_FORK_SUBAGENTDocumented GatedControls fork mode for subagents. 0 turns it off everywhere and 1 forces it on, also in -p.On, off, or unset. Org setting forkSubagentDisabled wins. In non-interactive mode a true feature flag turns it off unless this is 1All sessions. Project env can set it before trust
CLAUDE_CODE_FORWARD_SUBAGENT_TEXTDocumentedEmits subagent text and thinking blocks in stream-json output, like --forward-subagent-text.On or off, off by default. OR-ed with the flagclaude -p with stream-json
CLAUDE_CODE_GOAL_CHECKIN_MINUTESDocumented GatedSets how long background work can defer a goal before Claude is asked to check on it.A number, on by default. Whole number from 0 to 10080, plain digits. 0 turns it offGoal mode
CLAUDE_CODE_HARBOR_KITEUndocumented GatedTurns cross-session messaging on or off.Text, on by default. Unset uses a feature flag, default on. Org setting messagingBeyondOwnAgentsDisabled winsAll sessions
CLAUDE_CODE_HARMONIC_RIDDLEUndocumented GatedLowers the effort of a subagent that sets none. A level name sets that level and a negative integer steps down the effort list.Text. Falls back to a feature flag. Applies only when it is lower than the subagent effort and that is not lowAll sessions, subagents
CLAUDE_CODE_HOST_SCHEDULED_RUNUndocumentedLets a local host declare that a run is one of its own scheduled runs, so it can name the run kind.On or off. The run kind is kept only when it is 1 to 32 lowercase letters or underscores and the host started the process with 1Host apps (desktop scheduler)
CLAUDE_CODE_LOOP_KEEPALIVEUndocumented GatedTurns the keepalive of /loop on or off. At keepalive, the loop ends when the model declines to reschedule twice.On, off, or unset, on by default. Unset follows a feature flag, default onAll sessions, /loop
CLAUDE_CODE_LOOP_PERSISTENTUndocumented GatedSelects the persistent autonomous loop preamble instead of the normal one.On or off, off by defaultAll sessions, /loop
CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTSDocumentedCaps how many subagents run at once in a session.A number, 20 by default. Whole number min 1, digits onlyAll sessions, Agent tool
CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTHDocumentedSets how many subagent layers may sit below the main conversation.A number. Whole number min 1, digits only. Unset reads a feature flag, whose fallback is 3All sessions, Agent tool
CLAUDE_CODE_MEMORY_SUBAGENT_APPENDUndocumentedWhen set, Claude Code skips one extra block that it adds to the subagent system prompt. No visible effect in a print-mode probe (Probes).On or off. Unset adds the block, except for isolated contextsSubagents
CLAUDE_CODE_PLAN_MODE_REQUIREDUndocumentedSets planModeRequired for a teammate when no team context gives it. A true value makes the teammate plan first.On or off. Project settings may set it before trust (safe_env_allowlist_AS: true)Teammates and swarm sessions
CLAUDE_CODE_PLAN_V2_AGENT_COUNTUndocumentedOverrides the agent count of a plan v2 helper. Without it the count is 3 for max 20x, team, and enterprise plans, else 1.A number. Whole number from 1 to 10. Other values are ignoredPlan mode
CLAUDE_CODE_PLAN_V2_EXPLORE_AGENT_COUNTUndocumentedOverrides the explore agent count of a plan v2 helper. Default is 3.A number. Whole number from 1 to 10. Other values are ignoredPlan mode
CLAUDE_CODE_PRINT_BG_WAIT_CEILING_MSDocumentedSets the idle wait ceiling for background work after the last turn in -p mode.A number of milliseconds. Whole number in ms of 0 or more. Docs default is 600000Non-interactive -p mode
CLAUDE_CODE_PROCESS_WRAPPERDocumentedStarts the processes that Claude Code launches from its own binary through a corporate launcher.Text. Argv prefix stringBackground service and agent view
CLAUDE_CODE_SENDMESSAGE_HANDBACKUndocumented GatedForces the subagent final-report handback tool on or off in auto mode. The tool tells a subagent to deliver its report through it.Read directly from the environment. When unset, a feature flag decides with a default of trueSubagents in auto mode. gated by a feature flag
CLAUDE_CODE_SESSION_ATTENDEDUndocumentedTells a child session that its parent session is attended by a person. Claude Code stores it as the spawned-by-attended flag.On, off, or unset. Removed from the env passed to some child processesChild sessions
CLAUDE_CODE_STREAMED_BUMBLEBEEUndocumented GatedForces a feature flag subagent budget note on or off. The note tells a subagent its token budget.On, off, or unset. The note shows only when a budget value existsSubagents. gated by a feature flag
CLAUDE_CODE_STREAMED_BUMBLEBEE_TEXTUndocumented GatedOverrides the wording of the subagent budget note. The token {N} is replaced by the budget number.Text. An empty or blank value is ignored. A feature flag is the fallbackSubagents. Needs the budget note on
CLAUDE_CODE_SUBAGENT_CACHE_EVICTUndocumented GatedForces on a feature flag behavior for subagent requests. No visible effect in a print-mode probe (Probes).On or off, off by default. Applies only on a first-party provider path. The flag is the fallback and defaults to offSubagents. gated by a feature flag
CLAUDE_CODE_SUBAGENT_CONFIG_WARNINGUndocumented GatedTurns the subagent config check warning on with 1 or off with 0. The check looks at CLAUDE.md, skills, and agents for subagents.On, off, or unset. When unset, a feature flag config decidesSubagents. gated by a feature flag
CLAUDE_CODE_SUBAGENT_PROMPT_SNAPSHOTUndocumentedMarks a subagent to start with a system prompt snapshot. The snapshot flag is set on the subagent options.On or off. It does not apply when another local condition holds. The effect of the snapshot was not read furtherSubagents
CLAUDE_CODE_TASK_LIST_IDDocumentedSets the ID of the task list that the Task tools use, so several sessions share one list.Text. Wins over team name and session id. When set, the carry-over of tasks to a forked session is skippedSessions with Task tools
CLAUDE_CODE_TEAM_TEARDOWN_PARK_TIMEOUT_MSDocumentedSets how long a non-interactive session waits at exit for its agent team to shut down.A number of milliseconds, 10000 by defaultNon-interactive sessions with agent teams
CLAUDE_CODE_WEB_FETCH_AGENTUndocumented GatedTurns on the WebFetch agent path. Env wins over a feature flag.On, off, or unset, off by default. Off when CLAUDE_CODE_SIMPLE or CLAUDE_CODE_DISABLE_WEB_FETCH is setDefault mode sessions
CLAUDE_CODE_WORKER_CHECKIN_SCHEDULEDocumentedSets waits between reminders to check on running background subagents. Needs CLAUDE_AUTO_BACKGROUND_TASKS=1. Docs only. The read site was not re-checked.A comma-separated list. Unset gives no remindersBackground subagents
CLAUDE_CODE_WORKFLOW_MAX_CONCURRENT_AGENTSDocumentedSets how many agents one workflow run executes at once.Plain digits 1 to 256. Logs the gate value when setWorkflows
CLAUDE_CODE_WORKFLOW_PREFIX_STAGGER_MSDocumentedSets how long a workflow agent waits for a same-prefix sibling before its first request.A number of milliseconds. Integer, 0 or more. Forced to 0 when DISABLE_PROMPT_CACHING is setWorkflows
CLAUDE_CODE_WORKFLOW_PROMPT_PROVENANCEUndocumented GatedAdds a provenance note to workflow prompts, such as that no user is present in a trigger run. Env wins over a feature flag.On or off, on by defaultWorkflows
CLAUDE_CODE_WORKFLOW_SIZE_WARNING_AGENTSUndocumentedSets the agent count where the workflow size warning fires.A number. Integer, at least 1. Order: env, workflowSizeGuideline, a feature flag, built-in defaultWorkflows
CLAUDE_CODE_WORKFLOW_SIZE_WARNING_TOKENSUndocumentedSets the token count where the workflow size warning fires.A number. Integer, at least 1. Order: env, a feature flag, built-in defaultWorkflows
CLAUDE_CODE_WORKFLOWSUndocumented Gated0 or false turns off workflows. 1 makes them available if the feature flag allows it.On, off, or unset. Unset means the flag decides, and default-on is off for the pro planAll sessions
CLAUDE_DISABLE_ADOPTDocumentedStops in-flight background work, and does not carry it over, when you background a session.On or off. Any true value turns off adoptionBackground sessions
CLAUDE_PTY_HEARTBEAT_MSUndocumentedSets how often the PTY host pings its clients. A client that misses 3 pings is dropped.A number of milliseconds-
CLAUDE_PTY_HOST_EXECUndocumentedMarks a PTY host started in exec mode. The host reads it, deletes it, and then removes the CLAUDE_BG_SOCKET_TOKENS_PATH file.--
CLAUDE_PTY_HOST_NO_STABLE_PATHUndocumentedWhen 1, the macOS re-exec skips the stable binary path and uses the current executable.A path-
CLAUDE_PTY_ORPHAN_CHECK_MSUndocumentedSets the interval of the orphan watchdog of the PTY host. After 30 checks with a new parent and no client, the host stops its child.A number of milliseconds-
SELF_HOSTED_RUNNER_SESSION_IDLE_MSDocumented GatedSets the idle time in ms before the self-hosted runner releases a session.Text. The --release-idle-session-min flag writes it as minutes times 60000. Help text says 0 disablesclaude self-hosted-runner only
SELF_HOSTED_RUNNER_SESSION_STOP_GRACE_MSDocumented GatedSets how long the runner waits for the Claude process to exit after a session ends, before it force-kills it.A number of milliseconds. The --session-stop-grace-sec flag writes it as seconds times 1000 and needs a positive value. The post-session hook runs afterclaude self-hosted-runner only
SELF_HOSTED_RUNNER_STARTUP_TIMEOUT_MSDocumented GatedSets the startup timeout in ms for a runner session.A number of milliseconds. Default is 900000 when unset or empty. A value of 0 or a bad number gives 0, and the maximum is 2147483647claude self-hosted-runner only
SELF_HOSTED_RUNNER_TRUST_WORKSPACEDocumented GatedControls whether the runner trusts the session workspace. The help text says 0 turns it off.On or off. Parsed as a boolean by a runner helper with a default. Help text: SELF_HOSTED_RUNNER_TRUST_WORKSPACE=0 disablesclaude self-hosted-runner only

How It Works​

A subagent is a child session with its own prompt and tools. Some variables here pass to child sessions. Others change only the parent. The Notes column says which when the code shows it.

Source: the program (variable names found in the 2.1.304 binary) and the Environment Variables page of the official docs.