What a Claude Code subagent is
A subagent is a helper that Claude Code starts inside your session. It works in its own context window and returns a summary, so the main conversation keeps the conclusion and not the search output.
That makes subagents a good fit for exploration: reading across many files, finding where something is defined, or checking a claim before the main thread acts on it.
Where subagents stop
A subagent is started by its Claude Code session and reports back to it. Three kinds of work want more than that:
- Long code changes that should not share your checkout while you keep working.
- Reviews that should come from a different provider than the one that wrote the code.
- Work you want to reopen later: the log, the diff and the verify result.
Dispatch a task with aid
aid starts a separate agent session for each task. Add a worktree to isolate the files and a verify command to run your checks when the agent finishes.
aid run codex "Implement the retry queue" -w feat/retry-queue --verify --bg
aid wait t-1234
aid show t-1234 --summary
aid show t-1234 --diff
The full transcript stays with the task. Read the one-line summary first and open
aid show t-1234 --output --full only when a decision needs it.
Subagent vs. aid task
| Claude Code subagent | aid task | |
|---|---|---|
| Runs on | Claude Code, inside the current session | Any of 14 built-in agent CLIs, on the provider you choose |
| Context | Its own context window inside the session | A separate agent session |
| Result | A summary returned to the main conversation | A saved report, log and diff you can reopen with aid show |
| Checks | Whatever the prompt asks for | --verify runs your command and records the result |
| Second opinion | The same agent CLI | A read-only audit from a different provider |
Use both together
They are not alternatives. Use subagents for quick lookups inside the session, and dispatch tasks for code changes, parallel work and independent audits.
# inside the session: a subagent finds the call sites
# outside the session: tasks change the code in parallel
aid batch tasks.toml --parallel --max-concurrent 3
# a different provider audits the result, read-only
aid run claude "Audit HEAD. Report SHIP/FIX/BLOCK." --read-only --bg
Next: Codex vs Claude Code on your own
repo ↗
Claude Code subagents: FAQ
- Do subagents save tokens?
- They keep file dumps and search output out of the main conversation, which protects its context window. The work itself still consumes tokens.
- Can a Claude Code session dispatch aid tasks?
- Yes. aid is a CLI, so a session can run it like any other command.
- Can a subagent run on Codex or another agent CLI?
- A subagent belongs to its Claude Code session. To hand work to another agent CLI, dispatch it as a task.