← All guides

Claude Code · July 11, 2026 · 3 min read

Keep Claude focused: hand subagents the heavy work

Long Claude sessions drown in file reads and logs. Subagents do the heavy work in their own context window and return only the conclusion, so your chat stays sharp.

The problem

Long Claude Code sessions rot quietly. Every file Claude reads, every test log, every search result lands in the one context window you share with it. An hour in, most of that window is filler you will never reference again, and Claude starts missing the decisions that actually matter. I wrote about rescuing a session with a handoff note when it is already too late. This guide is the prevention: stop the junk from entering your context in the first place.

How do subagents keep Claude focused?

A subagent is a worker Claude hands a task to. It runs in its own separate context window, does the heavy reading there, and returns only the conclusion to your session. The dozens of files it opened and the walls of test output it scrolled through stay in its window and die with it. Your main context receives one summary.

The mental model is context isolation, not parallelism. Subagents can run in parallel, but the real reason to reach for one is simpler: any job that produces output you will never read twice belongs in someone else’s window.

I run this site’s guide pipeline exactly this way. Each guide is drafted by a worker subagent that researches my notes on its own, then fact-checked by a second one. My main session never sees the research, only the results.

Use them with zero setup

You do not need to configure anything. Phrase the request as a delegation:

Use a subagent to investigate how our auth module handles token
refresh. Report back only the flow and the key file paths.
Use a subagent to run the test suite and report only the failing
tests with their error messages.

The magic words are “report back only”. They define the shape of the summary that comes back into your context.

For a worker you keep reusing, save it as a markdown file in .claude/agents/:

---
name: researcher
description: Investigates code and docs, reports findings. Use for any task that reads many files.
tools: Read, Grep, Glob
---

You are a research agent. Dig as deep as needed, then report only
what matters: the answer, the key file paths, and anything
surprising. Never dump raw file contents.

The tools line is an allowlist, so this worker can read anything but write nothing.

When not to use one

Keep the work in the main conversation when it needs back-and-forth with you, when phases share context (planning, building, and testing the same feature), or when it is a quick targeted change. A subagent starts fresh and has to gather its own context, so small tasks get slower, not cleaner. And if your workers need to talk to each other, that is a different pattern: running a team of agents.

A subagent's job is to burn its own context so yours stays clean.

Do this now

  1. Find the heaviest job in your current session: a codebase investigation, a full test run, a log dig.
  2. Prefix it with “Use a subagent to…” and end with “report back only…”.
  3. The second time you delegate the same kind of job, save it as a file in .claude/agents/ with read-only tools.

Claude Code

Turn this into a Claude skill

Paste this into Claude Code. It reads this guide and builds a skill shaped to how you work.

Read the guide at https://aiwithamirthan.com/guides/keep-claude-focused-with-subagents. Then build me a Claude Code skill from it, personalized to how I actually work.

1. Fetch and read the full guide at the URL above.
2. Look at my setup so the skill fits me, not a generic template: skim my repos, my CLAUDE.md / AGENTS.md files, my existing skills, and my stack.
3. Create a new skill (a SKILL.md with a clear name, description, and steps) that lets me do what this guide teaches, adapted to my tools and goals.
4. Tell me where you saved it and how to invoke it.

If anything about my setup is unclear, ask me one or two questions first.

Want to build this yourself?

Join Claude Code Academy: courses, build alongs, and builders turning AI into real systems. And I post a new build on Instagram nearly every day.