Demo, all content is generated
Question

Do subagents see what the main Claude conversation already found?

Solved · 309 views · asked by sophie_l · edited

I made a subagent "db-reviewer" in .claude/agents/. Main Claude spent 10 minutes figuring out my schema, then called the subagent, and the subagent started reading all the migration files again from scratch. Felt like paying twice.

Do they share context or not? Am I setting them up wrong?

What I’ve tried

Read the docs page about subagents but I don't get what gets passed along. Tried telling main Claude 'give the subagent your findings'.

Comment
Can you share the description line of your agent file? That decides when it gets called. sergio_ruiz · edited

3 answers

Marked as helpful by the asker
sergio_ruiz · edited

They don't share context, on purpose. A subagent starts with an empty context window, its own system prompt (your .md file) and only the task text the main agent writes for it. When it's done, only its final message comes back.

That's the point: the subagent can read 40 files and the main conversation only receives a one-page summary. It saves the main context, not total work.

So in your case either:

  • let the subagent do the schema digging and have main Claude never read the migrations itself, or
  • put the schema summary in a file (docs/schema.md) and tell the subagent in its .md to read that first.

Your "give the subagent your findings" works too, but then main has to write them all into the task prompt.

Comment
So I had the order backwards. Subagent first, main agent gets the summary. That's much cheaper, thanks. sophie_l · edited
This explanation is clearer than the docs honestly. carmen_v · edited
'It saves the main context, not total work' is the best one-line summary of subagents I've read. leo_prompts · edited
nadia_r · edited

A good pattern: subagents for reading-heavy work (research, reviewing, searching logs), main agent for writing code. Writing needs the whole picture; reading can be delegated and summarized.

Comment
zainab_a · edited

Also check the tools line in your agent file. A reviewer that only has Read/Grep/Glob can't accidentally 'fix' things while reviewing.

Comment