CloudCodeTree LogoCloudCodeTree
AI NewsTutorialsAbout
CloudCodeTree Logo
CloudCodeTree
  • AI News
  • Tutorials
  • About
← Back to AI News
/fork vs /subtask: Use the Right Delegation Mode for Every Agent Task in Claude Code 2.1.212

/fork vs /subtask: Use the Right Delegation Mode for Every Agent Task in Claude Code 2.1.212

Chris Harper

2 min read

Jul 17, 2026 · 12:10 UTC

AI
Workflow
Claude Code
Agents
Best Practices

/fork creates a durable, resumable background session; /subtask is a lightweight inline helper — here's how to use both in a real parallel workflow.

Claude Code 2.1.212 splits what was one command into two with meaningfully different semantics.

/fork — durable background sessions

/fork Research the best auth pattern for our service — compare JWT, session cookies, and OAuth2 and draft a recommendation
/fork Find all usages of AuthService in the codebase and map the call sites
/fork Write a first-draft migration guide for switching from cookie sessions to JWT

Each /fork creates an independent session in claude agents with its own context window. You keep working in the main session. When the forks finish, open each via /resume or the agents view. Forked sessions persist across /clear and are resumable — they are proper parallel workers.

/subtask — lightweight inline helpers

/subtask refactor this function to use early returns
/subtask generate a docstring for the selected code

/subtask runs inline in your current session: no separate row in claude agents, result appears in-thread, and it shares the parent's context window. Best for fast, focused tasks where you want the answer immediately in your current thread.

The rule of thumb: reach for /fork when the work is complex enough to need its own context window, might run longer than your current task, or produces output you want to revisit later. Use /subtask when you just want a quick in-place answer.

Session budgets (new in 2.1.212)

If a forked session runs wild — spawning dozens of sub-searches or chaining subagents — it now hits a hard cap of 200 WebSearch calls and 200 subagent spawns. Tune per use case:

# Focused coding session (tight budget)
CLAUDE_CODE_MAX_WEB_SEARCHES_PER_SESSION=25 \
CLAUDE_CODE_MAX_SUBAGENTS_PER_SESSION=10 claude

# Open-ended research session
CLAUDE_CODE_MAX_WEB_SEARCHES_PER_SESSION=200 \
CLAUDE_CODE_MAX_SUBAGENTS_PER_SESSION=100 claude

Run /clear to reset both budgets mid-session without restarting Claude Code.

Sources: Claude Code changelog v2.1.212 · Claude Code agents — background sessions