💡 Why toAIIntermediate✨ AI-assisted

Claude Code Subagents Explained: When to Fork, When to Spawn Fresh

WittyTech··2 min read
#claude-code#subagents#context

In a long Claude Code session, every file read, search result and test log adds to the conversation. Eventually the important information gets harder for Claude to find among everything else. Subagents help by doing work in a separate context. There are two ways to start one, and they suit different situations.

Starting a fresh subagent

A fresh subagent has no knowledge of your conversation. It receives only the prompt you give it, works in its own context and returns a summary.

Use a fresh subagent when:

  • The task stands on its own, such as "find every call to the billing API" or "list the tests that cover the auth module".
  • You want a view that isn't shaped by assumptions made earlier in the session.
  • The task involves reading many files you don't need in your main context.

The downside is that you have to brief it well. It doesn't know what you've learned, so write the prompt the way you'd write a ticket for a colleague who hasn't been involved.

Forking

A fork starts with a copy of the full conversation, including decisions, failed attempts and constraints you've discussed.

Fork when:

  • The side task depends on context that would take a long time to explain.
  • You want to try a different approach without cluttering the main conversation.
  • You want work to continue in the background while you keep going.

The downside is that a fork also inherits any mistaken assumptions, and forking a very long conversation carries all of that context with it.

Custom agents for repeated work

For tasks you delegate often, create a custom agent as a markdown file in .claude/agents/. The frontmatter sets its tools and model, and the body contains its instructions. A read-only reviewer or code explorer with a restricted tool list is a good first one.

Guidelines

  • Searching and exploring code: start fresh. You need the findings, not every file it read.
  • Trying an alternative approach: fork.
  • Several independent tasks at once: fresh subagents, each with a clear brief.
  • Small tasks: do them directly. Starting a subagent has overhead, which isn't worth it for a quick rename.

Things to watch

  • Only the final report comes back. Ask for a short, structured summary that includes file paths.
  • A fresh subagent can't know about decisions you haven't written down. Include them in the brief.
  • Parallel subagents editing the same files will conflict. Divide the work by file or area.

A simple test: if briefing a colleague on the task would take more than a paragraph, fork. Otherwise, start fresh.

← More in AI