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 
๊ณต์œ 
ํƒ์ƒ‰

TweetCloner

TweetCloner๋Š” X/Twitter๋ฅผ ์œ„ํ•œ ์ฐฝ์˜์ ์ธ ๋„๊ตฌ๋กœ, ๋ชจ๋“  ํŠธ์œ—์ด๋‚˜ ์Šค๋ ˆ๋“œ๋ฅผ ๋ณต์ œํ•˜๊ณ  ๋ฒˆ์—ญํ•˜์—ฌ ์‹ ์„ ํ•œ ์ฝ˜ํ…์ธ ๋กœ ๋ฆฌ๋ฏน์Šคํ•˜๊ณ  ๋ช‡ ์ดˆ ๋งŒ์— ๋‹ค์‹œ ๊ฒŒ์‹œํ•  ์ˆ˜ ์žˆ๋„๋ก ๋„์™€์ค๋‹ˆ๋‹ค.

ยฉ 2024 TweetCloner ๋ชจ๋“  ๊ถŒ๋ฆฌ ๋ณด์œ