Claude agents (also called subagents) let you delegate a task to a separate Claude instance that runs with its own context window, then reports back a single result. ## Why use them - Keep the main conversation's context clean — an agent's exploration (file reads, searches, tool calls) doesn't clutter your main thread. - Parallelize independent work — multiple agents can run at once on unrelated subtasks. - Get an independent read — an agent with no memory of your prior analysis can act as a second opinion or fresh reviewer. ## When to use one - Open-ended research or search tasks spanning a codebase or many files. - Multi-step tasks that don't need your ongoing input. - Tasks explicitly requesting a named agent type (e.g. a code-reviewer). ## When not to - Don't spawn an agent for something you can just do directly — each spawn starts cold and has to re-derive context you already have. - Skip it for quick lookups (a single file read, a targeted grep) — use the direct tool instead. - Skip it for tasks with only a few straightforward steps. ## Writing a good prompt Agents start with no memory of the conversation. A good prompt: - States the goal and why it matters. - Explains what's already been tried or ruled out. - Gives concrete specifics — file paths, line numbers, exact commands — rather than vague pointers like "based on the research, fix it." - Specifies the form of the response (e.g. "report in under 200 words"). Terse, one-line prompts tend to produce shallow, generic results. ## Verifying results An agent's summary describes what it intended to do, not necessarily what it did. Worth checking actual file diffs or outputs before treating the work as done. ## Isolation modes Agents can optionally run in an isolated git worktree (for code changes you want cleanly separated) or in a remote cloud environment (runs in the background). Default is to run inline in the current environment.