Dayward AIWeChat Mini Program
Build Your Own Coding Agent in 21 Days
Week 3 · D17🔒 LockedAbout 4 hours

Subagents and Parallelism: Independent Context, a Tool Allowlist, Worktree Isolation, and Result Aggregation

Split the work when one agent can't finish it alone: implement a subagent mechanism where each subagent has its own context and tool allowlist, edits files in its own git worktree without stepping on others, and aggregates results back into the main session in structured form — and work out which tasks shouldn't be parallelized.

Today's goals 0/3

Sign in to tick these off and save your progress.

Today's Goals

  1. Implement subagent dispatch and result collection, and explain its context relationship with the main session
  2. Use worktrees for file isolation, and handle conflicts when parallel work touches the same file
  3. Judge which tasks suit parallelism and which are only slower and more expensive in parallel

Yesterday put a piece of writing in front of the model at the right moment; today sends a whole model out to work. When you finish, scroll back up and tick the three goals off.

Plain-Language Walkthrough

Taking on apprentices: split the work, one desk each

When the work piles up, the old hand takes on two apprentices. And three of the arrangements they make are so obvious they never think about them.

First, they explain this one job and nothing else — they do not replay every phone call of the morning. Second, the toolbox is prepared: someone sanding a part gets sandpaper and calipers, not the cutting machine. That is not distrust; fewer tools mean fewer ways for the hand to slip. Third, one desk each — two people must never crowd the same vise fighting over the same part.

And then there is the one a new supervisor forgets: at the end of the day, check whether the two pieces of work actually fit together. If both apprentices sanded the same part, each in their own way, you cannot shut your eyes and fit whichever arrived last. That is not merging. That is quietly throwing the first one away.

Those four things are exactly what mca gets today: its own context, its own tool allowlist, its own desk, and one honest merge.

Sign in and link WeChat to read

Sign in, then link your WeChat mini program account on the account page. Linked accounts share one free article per day. Unlock additional articles with rewarded videos in the mini program.

Mini program QR code

Scan in WeChat to open Dayward AI. Open the same course and chapter, choose the rewarded video, then refresh this page after completion.

Interview questions

  • What should a subagent inherit from the main session, and what must it never inherit?子 Agent 该继承主会话的什么、绝不该继承什么?
    Common in ChinaCommon overseasBasic#subagent#context-boundary

    🔒 Unlock this chapter to see the answer keys.

  • How do you isolate parallel agents editing one repository, and how are conflicts detected and handled?并行改同一个仓库,你用什么手段隔离?冲突怎么发现和处理?
    Common in ChinaCommon overseasIntermediate#worktree#merge-conflict

    🔒 Unlock this chapter to see the answer keys.

  • Which tasks are worth dispatching to subagents, and which get worse when parallelized?什么任务适合派给子 Agent,什么任务并行反而更差?
    Common in ChinaCommon overseasDeep dive#parallelism-cost#agent-design

    🔒 Unlock this chapter to see the answer keys.

Comments