Stop Making One AI Do Everything: Use Subagents
When one AI does the research, the coding, the testing and the deploying, its memory fills up and quality drops. Subagents let you split the work like a real team, with one main agent coordinating.
Video not loading? Watch the reel on Facebook.
Every AI agent has a limited working memory, called its context window. In a long session it fills up with everything: files it read, commands it ran, failed attempts. The more crowded it gets, the more the agent forgets and the worse its decisions become.
Real software teams don't have one person do everything. Neither should your AI.
What a subagent is
A subagent is a helper AI that your main agent sends off to do one job. It starts with a clean memory, does the job, and returns only a short summary. All the messy detail stays with the helper; your main agent only sees the result.
A typical split looks like this:
- Research: read the docs or search the codebase and report what matters.
- Frontend, backend, database: each builds its own part.
- QA: test the result and report what's broken.
- DevOps: handle deployment.
The main agent coordinates: hands out the jobs, collects the summaries and puts it together. Independent jobs can run at the same time.
Subagents in Claude Code
Claude Code supports subagents out of the box. The easiest way to create one is to type /agents and follow the steps, or just ask Claude to make one. Each subagent is a small Markdown file in .claude/agents/ (for one project) or ~/.claude/agents/ (for all projects):
---
name: qa-tester
description: Tests new features and reports bugs. Use after a feature is built.
tools: Read, Grep, Glob, Bash
model: sonnet
---
You are a careful QA tester. Run the app's tests, try the new feature,
and report exactly what fails, with steps to reproduce. Don't fix anything.
The description tells the main agent when to use it. You can limit each helper's tools (a researcher doesn't need to edit files) and give routine helpers a cheaper model.
Subagents in Codex
Current versions of Codex have subagents turned on by default. Ask for them in plain words, like "spawn two agents: one to research the payment API, one to write the tests", or describe your helpers in your project's AGENTS.md. Custom helpers can be saved as files in .codex/agents/. Older guides that tell you to switch on an experimental flag are out of date.
The catch: more tokens
Both Anthropic and OpenAI say it plainly: subagents use more tokens than one agent doing the same work, because each helper has to gather its own context. So use them where they pay off:
- Good fit: big tasks with independent parts, research that would flood the main agent with detail, and checks like testing and code review.
- Poor fit: small tasks, and work that needs constant back-and-forth between the parts.
Start with one: a QA tester or a code reviewer that checks the main agent's work. It's the easiest win, and it catches mistakes before you do.
Want a ready-made team? Superpowers includes a full subagent-based workflow; see 4 Free GitHub Tools That Make AI Coding Cheaper.
Docs: Claude Code subagents · Codex subagents
Follow my Facebook page for more AI workflow tips.