
Subagents Don't See Your Conversation: Brief Them Like a New Teammate
- كاتب موثّق
- Claude Code 2.x
محتويات المقال
fetchWithRetry must keep its public signature because two other teams call it, and that vendor/ is generated. You type "use a subagent to review my changes". The review comes back with three findings: change the signature of fetchWithRetry, add a response cache, and fix the formatting in vendor/. Every one of them is something the conversation already settled. The reviewer wasn't there for any of it.
The common misconception
It runs inside your session, starts from your prompt and works on the same repository. Claude starts it, and Claude clearly knows the context, so it seems natural that the context comes along. Since fork mode became the default, Claude can start forks, which really do inherit the whole conversation. The results come back sounding confident and fluent, so a missing piece of background is easy to miss.
context: fork all start fresh.
What actually happens
A fresh context window, on purpose
Its own system prompt, not the Claude Code system prompt The task message Claude writes when it hands off the work Your CLAUDE.md files and a git status snapshot, except for the built-in Explore and Plan agents, which skip both The full text of any skills its definition preloads
The task message is the whole briefing
Forks are the exception
/subtask followed by the task.
context: fork setting. Despite the name, such a skill runs in a fresh subagent that "doesn't see your conversation history", so its instructions have to stand on their own.
Only the result comes back
The same delegation, briefed two ways
use a subagent to review my changesUse a subagent to review my diff in src/http/ (git diff main).It can't see our chat, so tell it: fetchWithRetry's signaturestays (other teams call it), and caching is ruled out.Check that every caller handles TimeoutError and that retriesstop at 3. Skip vendor/ (generated) and style. Return at most10 findings, each as file:line plus one sentence..claude/agents/. The body becomes the subagent's system prompt:
---name: http-reviewerdescription: Reviews changes to src/http/. Use after edits there.tools: Read, Grep, Glob, Bash---You review a diff you didn't write, with no chat history.- Public signatures in src/http/index.ts are frozen.- Ignore vendor/ (generated) and formatting.Report at most 10 findings as file:line plus one sentence.If you find nothing, say so; don't invent issues.How to apply it in your project
Pick fork or fresh If the task needs the history, fork it with /subtask. If it needs independence, such as a review, use a fresh subagent.Write the brief Say the goal, what's decided or ruled out, where to look, what to skip and which tools or commands to use. Size the answer Ask for a format and a limit, such as ten findings as file:line, so the result doesn't flood your context. Save standing briefs as definitions Put repeated instructions, a tool list and the output format in .claude/agents/<name>.md, and keep the description short.Check what they cost Run /usageto see what share each subagent type takes, and setmodel: haikufor simple jobs like collecting files.
Key takeaways
A non-fork subagent starts with a fresh context window, not a copy of your session. The task message Claude writes is the whole briefing, so what you ask shapes what it knows. Explore and Plan also skip CLAUDE.md; restate rules they must follow. A fork inherits the conversation; a skill's context: forkdoesn't.Brief for the goal, the decisions, the scope and the size of the answer.
التعليقات (0)