Group of 3 You'll notice Notable
Claude Code checks real host memory scarcity before killing idle background shells and explains why, with an opt-out env var
What
- Before killing a background shell command because of a memory-pressure event, Claude Code now checks actual host memory scarcity (reading
/proc/meminfoon Linux/WSL, comparing available memory against both a percentage and an absolute floor) instead of reaping almost unconditionally. - More situations now skip a reap: a turn is currently running, delegated agents (subagents) are running, or the session was recently reaped, with deduplicated diagnostic logging explaining why a reap was skipped.
- When a background shell is stopped for memory pressure, the explanation shown to the agent now explicitly tells it not to debug or auto-restart the command, to report what happened instead, and to only restart it if the user asks.
- The message also tells the agent about the new
CLAUDE_CODE_DISABLE_BG_SHELL_PRESSURE_REAPenvironment variable, which lets users turn this reaping behavior off entirely.
Why
This avoids killing background commands unnecessarily, stops the agent from reflexively trying to restart a command the system deliberately stopped, and gives users a way to disable the safeguard if it gets in their way.
Names in the bundleCLAUDE_CODE_DISABLE_BG_SHELL_PRESSURE_REAP
The entry above is what we published on the day. These lines were added later, as Anthropic's own pages caught up, and they sit beside the original rather than replacing it.
Confirmed since
Anthropic's documentation has since written up CLAUDE_CODE_DISABLE_BG_SHELL_PRESSURE_REAP, on Interactive mode.
* Set [`CLAUDE_CODE_DISABLE_BG_SHELL_PRESSURE_REAP`](/docs/en/env-vars) to `1` to turn off memory-pressure stopsinteractive-mode see the edit
One source agreesOne thing we can check says the same as this entry.
Anthropic's documentation agrees
Anthropic's documentation has since written up CLAUDE_CODE_DISABLE_BG_SHELL_PRESSURE_REAP, on Interactive mode.