Specialized agents with their own context
Subagents are workers with their own context window, tool allowlist, and system prompt. The parent Claude delegates a scoped task; the subagent works in isolation; the parent gets back the result without polluting its own context. This is how you tackle large jobs without blowing the main session's budget.
Three built-ins ship out of the box: Explore (fast, read-only, runs on Haiku — the right tool for "where is X defined across this repo?"), Plan (Sonnet/Opus, gathers context and produces an implementation plan before code is touched), General-purpose (full tools, used for parallel implementation work).
Custom subagents are markdown files with YAML frontmatter — same shape as Skills but with their own config knobs: tools: allowlist, tool_denylist:, model: override, memory: always-loaded context, worktree: true for filesystem isolation. They live in .claude/agents/ (project), ~/.claude/agents/ (user), or via --agents JSON at launch. /agents opens the interactive manager.