CLAUDE_SUBAGENT_BG_SHELL_MAX_MS

Updated by

CLAUDE_SUBAGENT_BG_SHELL_MAX_MS is a Claude Code environment variable: Time cap for shell commands run by background subagents. A background agent running a full test suite or a slow build command used to be bounded only by the overall stall timeout. This adds a shell-specific cap — separate from and shorter than the session-level timeout. Removed between v2.1.252 and v2.1.266, so current releases ignore it. It is listed in the official reference.

StatusRemoved between v2.1.252 and v2.1.266
AddedAdded between v2.1.128 and v2.1.138
CategoryAgents and subagents
Official docsListed

How to set it

For one session, export it in the shell that starts Claude Code:

export CLAUDE_SUBAGENT_BG_SHELL_MAX_MS=<value>
claude

To apply it to every session, add it to the env object of a settings file:

// ~/.claude/settings.json
{
  "env": {
    "CLAUDE_SUBAGENT_BG_SHELL_MAX_MS": "<value>"
  }
}

Release notes that mention it

Related variables

Frequently asked questions

What does CLAUDE_SUBAGENT_BG_SHELL_MAX_MS do?

Time cap for shell commands run by background subagents. A background agent running a full test suite or a slow build command used to be bounded only by the overall stall timeout. This adds a shell-specific cap — separate from and shorter than the session-level timeout.

Which Claude Code version has CLAUDE_SUBAGENT_BG_SHELL_MAX_MS?

Removed between v2.1.252 and v2.1.266, so current releases ignore it.

How do I set CLAUDE_SUBAGENT_BG_SHELL_MAX_MS?

Export it before starting Claude Code (export CLAUDE_SUBAGENT_BG_SHELL_MAX_MS=value), or add it to the "env" object in ~/.claude/settings.json to apply it to every session.

All variables, searchable: Claude Code environment variables.