When a side task shows up in the middle of a Claude Code session, you can keep it out of the main conversation in several ways. They differ in who drives the side task, whether its file edits are isolated, how much context it starts with, and where its result ends up. Each command is explained in Branching a session.

/branch/fork/subtask/btwFresh session or /clear
What you getA copy of the conversation, and you switch into itA copy running as a separate background sessionA background subagent that inherits the conversationOne answer in an overlayAn empty conversation
Who drives itYouThe copy, on its own; you can attachThe subagentNobody, single responseYou
Starts withThe whole conversationThe whole conversationThe whole conversationThe whole conversation, read-onlyOnly CLAUDE.md and memory
ToolsAllAllSame tool pool as the main sessionNoneAll
File editsSame files as the originalIts own git worktree (in a git repo)Same working directory as the sessionNoneSame files
Result goesStays in the branch; /resume the originalStays in the copy; nothing comes back on its ownArrives as a message in your conversationNever enters the historyStays there
Main contextUntouched (you left it)UntouchedOnly the final result is addedUntouchedGone, unless you go back with /resume

When to pick which

  • You want to steer the side task, give input and test by hand: /branch. You work in the copy and come back with /resume. Keep in mind the files are shared.
  • The side task can run unattended and should leave its own commits: /fork with a prompt. It works in its own worktree; check on it in claude agents.
  • You need the answer here, in the current task (tests for code you just changed, a quick investigation): /subtask. Only the result lands in your context.
  • You just want to ask something about the session: /btw. Nothing is added to the history; press f in its overlay to turn the question into a forked subagent if it needs tools.
  • The session is full of noise or failed attempts: start fresh with /clear or a new session and a short summary. Every copy above inherits that noise. The Claude Code best practices suggest clearing after two failed corrections on the same issue.

All copies spend their own tokens from the same usage limits, though their first request reads the original’s prompt cache.

Citations

  1. Manage sessions: branch a session
  2. Agent view: copy the session with /fork
  3. Create custom subagents: fork the current conversation
  4. Interactive mode: side questions with /btw
  5. Commands
  6. Best practices for Claude Code: manage your session
  7. How Claude Code uses prompt caching: subagents and the cache