# Turn off Claude Code subagent forking

> Forked subagents are on by default in Claude Code; set CLAUDE_CODE_FORK_SUBAGENT=0 to turn them off so Claude waits for subagents instead of running them in the background.

URL: https://bartlomiejkrupa.dev/notes/claude-code-fork-subagent-opt-out/
Category: snippet | Updated: 2026-10-26
Summary: Forked subagents are on by default in Claude Code; set CLAUDE_CODE_FORK_SUBAGENT=0 to turn them off so Claude waits for subagents instead of running them in the background.

A forked subagent (`subagent_type: "fork"`) inherits the whole conversation and its prompt cache. It is on by default, and `CLAUDE_CODE_FORK_SUBAGENT=0` turns it off.

## Use

In `settings.json`:

```json
{
  "env": { "CLAUDE_CODE_FORK_SUBAGENT": "0" }
}
```

Turn it off when you want Claude to wait for a subagent's result instead of spawning it in the background. Fork mode is on by default since v2.1.232 for interactive sessions.

Contrast with [subagent context isolation](/notes/subagent-context-isolation): a fork shares your context, an isolated subagent starts clean.

Sources:
- Claude Code changelog: https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md
