Claude Code /fork Revamp: One‑Click Background Tasks Keep Your Main Workflow Running

Claude Code’s v2.1.212 overhaul turns /fork into a one‑click “clone” that spawns an independent background session with full conversation memory, letting you fix bugs or run long jobs while your primary work continues uninterrupted.

Tech Ocean
Tech Ocean
Tech Ocean
Claude Code /fork Revamp: One‑Click Background Tasks Keep Your Main Workflow Running

1. /fork Now Works as a One‑Click Clone

The old /fork created a branch inside the same conversation; the new version copies the entire dialogue into a separate background session that appears as a single line in the claude agents board. If the session has no title, the prompt becomes its name, making it easy to identify.

Because the clone inherits the full context—previous requirements, files, and decisions—it can pick up a bug‑fix task without you re‑explaining the background. /fork Example: while refactoring, you run /fork to let a “bug‑fix” session handle the issue, keeping the main refactor line running.

/fork old vs new behavior comparison
/fork old vs new behavior comparison

2. Division of Labor: /fork, /subtask, and Background Subagents

Context : /fork copies the full conversation; /subtask derives from the current session; background subagents have an independent context that knows only what the main line passes.

Lifecycle : /fork runs as an independent session; /subtask follows the current session; subagents also follow the current session.

Where to See : /fork appears as a separate line in claude agents; /subtask stays inside the current session; subagents report back to the main agent when finished.

The author’s rule of thumb: use /fork when the context is valuable, /subtask for small tasks, and background subagents for heavy or “dirty” work.

3. Real‑World Test: Writing While a Clone Works

Running claude agents --json lists both interactive and background sessions, showing their states side by side:

[
  {
    "id": "a1b2c3d4",
    "cwd": "/Users/dev/work/project-a",
    "kind": "background",
    "name": "整理模块文档",
    "state": "blocked"
  },
  {
    "cwd": "/Users/dev/personal/blog-workspace",
    "kind": "interactive",
    "name": "blog-workspace",
    "status": "busy"
  }
]

“blocked” indicates a background task waiting for your decision; “busy” shows the interactive session actively working. You can attach to the background session with:

claude attach a1b2c3d4  # enter the background session

After a quick check you can return to the main board with Ctrl+Z, which drops you back to the shell without terminating the session.

Practical case: While drafting this article, a separate documentation‑organizing task ran in a background session. The main line stayed free for research and writing, and claude agents --json showed one line “blocked” (waiting) and one line “busy” (running) simultaneously.

4. Preventing Runaway Agents: Safety Limits

Maximum subagents per session : 200 (env CLAUDE_CODE_MAX_SUBAGENTS_PER_SESSION)

Concurrent subagents : 20 (env CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS)

Subagent nesting depth : disabled by default (env CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH)

Web searches per session : 200 (env CLAUDE_CODE_MAX_WEB_SEARCHES_PER_SESSION)

You can reset the subagent count with /clear. Budget overruns are now capped; adding --max-budget-usd stops new background agents once the specified amount is spent:

claude -p "把这批文件的测试补齐" --max-budget-usd 5  # stop after $5

5. Small Upgrades

Long‑running MCP tasks (>2 min) automatically move to the background; the threshold is controlled by CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS.

Worktree permissions are now stored at the repository root, so granting once applies to all worktrees and future sessions.

From v2.1.218, skills with context: fork run in the background by default; you can disable it with background: false in the skill’s frontmatter.

Conclusion

Before these releases, achieving parallelism with Claude Code required multiple terminals and custom scripts. Now the native suite— /fork, /subtask, background subagents, the agent board, and budget limits—lets you offload heavy work with a single command, turning idle waiting time into productive parallel work.

Main line and clone parallel timeline
Main line and clone parallel timeline
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

AI automationforkbackground executionClaude Codesubagentsubtask
Tech Ocean
Written by

Tech Ocean

Focused on AI programming, sharing ready-to-use development efficiency solutions.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.