Claude Code Sub Agent

Anthropic has added the ability to create and use specialized sub-agents in Claude Code. These sub-agents use a separate context window, which allows you to run separate tasks without polluting the main context, limiting the context rot effect. You can run the created sub-agents manually or let Claude Code decide when to use them.

What can be a good sub-agent? Anything that needs to be an expert in its area, doesn’t need to share the context with the main agent, can have dedicated tools, and can be designed to run self-sufficient tasks. To give you a taste of what can be made into a sub-agent, here are a couple of examples:

  1. Git sub-agent to which you can offload various git-related operations. As it can use just the local git state, and doesn’t need to have access to the global context, it is a good choice for a tool with its own context window.
  2. A book-writing sub-agent (I know, but I create book-like documents in a specific style for self-education). You provide it with a high-level plan, a set of materials, and one or two sections as examples, and let it work on a section separately from other sub-agents.

The second example would really benefit from the ability to run several sub-agents in parallel, but it looks like I’m asking too much.