I was using Claude Code Sub-agent wrong...
Here's what I learnt after 20+ hrs trial & errors
Made my agents way more effective
👇 Thread below

First -
Why did Anthropic build sub-agents initially?
It's all about context engineer & context optimisations
It works best when focusing on planning & researching and send back with a summary plan to conversation thread
However,
Context sharing between sub-agents is non-exist
That's why if you have sub-agent do actual work, then this context is not visible to all other agents
This cause problems...
Meanwhile,
@ManusAI_HQ has this blog on how they use file storage as the ultimate context system
It inspired me to design a context sharing setup to get main agent & sub agents to share context between each other
.claude/
└ tasks/ (Updated by all agents)
└ session_context_01.md
└ session_context_02.md
└ ...
└ docs/ (Store result of each sub agent)
└
└
└
└ ...
This allow effective handover & ability to maintain context
This is how I built:
- @shadcn -ui-expert agent
- vercel-@aisdk -5-expert agent
Using principles above
Result?
It can one-shot building a fully functional chatGPT replica using latest @aisdk v5 (introduced a few weeks ago)
If you interested in learning more
We have a claude code template in @aibuilderclub_ with best hooks/agents/commands that actually useful
We do weekly build together sessions
