Claude Code Subagents
Claude Code just released an exciting new feature: subagents.
The basic intuition: while you can work on your project with a single “do-it-all” agent, it’s more efficient to have a team of specialized agents.
The implementation is extremely simple: yet another example of what I call “the zen of Claude Code”. A subagent is defined with a simple text file. It has name, description, list of allowed tools, and system prompt. (I think it should also have a default model, Sonnet or Opus.)
As usual, you submit tasks to the main agent. But now the main agent acts as a router by redirecting tasks to the subagents. (You can also force this by telling the router to use a particular agent.)
The main agent is effectively a manager who delegates tasks to subagents, oversees the execution and reads the summary of completed tasks. And you - the user - are the manager’s manager.
The main benefit of subagents is what they do for ‘context engineering’.
As a reminder, context engineering is the art and science of managing the AI’s very limited working memory (aka context window) in a world of ~infinite context / information.
When you have a single agent that does all the work, the context window fills fast. Then everything gets slower and more expensive and you hit rate limits.
Nowadays, we’re great at putting stuff in the context window, but not so great at removing from it. Claude Code only provides two choices: clear the window completely or compact it with a short summary. Neither is ideal.
But now each agent has its own context window, containing only the information that the agent needs for its job and the history of its own work. The frontend engineer doesn’t need to read the backend code; the backend engineer doesn’t need to see every single thing the frontend engineer does.
Subagents are primarily a technique to make the context window last longer by partitioning it along functional requirements.
A few interesting questions:
Will this push us to put more effort into modularizing our code, so subagents can work independently?
Will this push us towards service architecture?
How will the ‘router->subagents’ architecture evolve? Should we give a Slack equivalent to our agents? Should we give them a Kanban board?
Are AI coding agents going to recapitulate the history of software engineering practices?