ThisCalculator

Everyday

Claude Code Multi-Agent Setup: Two Leads, Nine Projects

Updated · Standard formula, shown below

Claude Code supports multi-agent workflows where two lead agents can coordinate nine projects by dividing responsibilities—typically one lead handles planning and delegation while the other handles review and integration—using subagents, shared context files, and a structured task queue. This setup works because each lead agent operates in its own session but reads and writes to a common project state, allowing them to track progress, assign tasks, and resolve conflicts without direct conversation. Below, we break down how this coordination actually works, what tools you need, and the common pitfalls to avoid.

Background: What Is Claude Code’s Multi-Agent Model?

Claude Code is Anthropic’s command-line tool for coding with Claude. It lets you run Claude in your terminal, where it can read files, edit code, and execute commands. Multi-agent setups extend this by running multiple Claude Code instances, each with a specific role, to work on the same repository or across multiple projects. Unlike a single-agent session, multi-agent coordination requires explicit structure: agents don’t share memory, so you must use files, git branches, and task lists to keep them aligned. The two-lead model is a common pattern where one lead (the ‘planner’) breaks work into tasks, and the other (the ‘integrator’) merges results and runs tests.

How Two Leads Coordinate Nine Projects: The Core Mechanism

In practice, two leads coordinate nine projects through a combination of:

  • Shared task board: A markdown file (e.g., TASKS.md) that lists all projects, their current status, and assigned subagents. Each lead reads and updates this file after every action.
  • Subagent delegation: Each lead spawns multiple subagents (via claude --continue or the SDK) to work on individual tasks within a project, then reviews their output.
  • Git branch strategy: Each project gets its own branch. The planning lead creates branches and assigns tasks; the integration lead merges branches after passing tests.
  • Context files: A CONTEXT.md per project contains the goal, constraints, and current decisions. Both leads read this before starting work.
  • Checkpointing: After each task, the responsible lead writes a summary to a PROGRESS.md file, so the other lead knows what’s done and what’s blocked.

For example, with nine projects, you might assign projects 1-5 to lead A (planning) and projects 6-9 to lead B (integration), but both leads can delegate subagents to any project. The key is that the task board is the single source of truth, and each lead updates it before and after any significant action.

Setting Up the Two-Lead System: Step-by-Step

Here’s a concrete setup that works for nine projects:

  1. Create a workspace directory with nine subdirectories, one per project. Each contains its own git repo and a CONTEXT.md.
  2. Write a master TASKS.md in the root. Use a table with columns: Project, Lead, Current Task, Status, Next Action.
  3. Launch two Claude Code sessions in separate terminals. In session A, say: “You are the planning lead. Read TASKS.md and CONTEXT.md for projects 1-5. For each, create a list of tasks and assign them to subagents.” In session B: “You are the integration lead. For projects 6-9, review the code on each branch, run tests, and merge to main when green.”
  4. Use subagents for parallel work. In each session, you can ask Claude to spawn subagents (e.g., “Spawn a subagent to implement feature X in project 3”). The subagent works independently and reports back.
  5. Update the task board after every change. Instruct both leads to append a line to PROGRESS.md after completing a task, including what was done and any issues.
  6. Resolve conflicts via the task board. If both leads touch the same file, they should coordinate through the board—one writes “I’m working on file X” and the other checks before editing.

Choosing the Right Coordination Strategy

Not all nine projects are equal. You might use a sequential strategy if projects depend on each other, or a parallel strategy if they’re independent. For nine independent projects, a common approach is to have each lead handle a subset, but also have a shared ‘integration’ phase where both leads review each other’s work. In practice, the planning lead often handles the initial architecture and task breakdown, while the integration lead focuses on code quality and testing. If you have a mix of simple and complex projects, you might assign the complex ones to the lead with more context (e.g., the one who started them).

Common Problems and How to Avoid Them

Coordination fails when leads have stale information. For example, if lead A updates a file without notifying lead B, lead B might overwrite changes. To avoid this:

  • Always check the task board before starting a task. Make it a rule that no agent edits code without reading the latest PROGRESS.md.
  • Use git branches aggressively. Each project should have a ‘dev’ branch where subagents work, and only the integration lead merges to main.
  • Set clear boundaries. For instance, lead A never touches code in projects 6-9, and lead B never touches code in projects 1-5, unless the task board explicitly says otherwise.
  • Handle subagent failures. If a subagent fails, the lead should note it in the task board and re-assign the task to another subagent or do it themselves.

Comparison: Two Leads vs. One Lead vs. Automated Orchestration

With one lead, you get simpler coordination but a bottleneck—the single agent can only do so much at once. With two leads, you double the throughput but add coordination overhead. Automated orchestration tools (like Anthropic’s Claude Code SDK) can manage agents programmatically, but they still require you to define the workflow. For nine projects, two leads is a sweet spot: it’s manageable without a full orchestration framework, and it provides redundancy if one lead gets stuck. If you have more than 15 projects, you might need three leads or an automated system.

Costs and Resource Considerations

Running two leads means two Claude Code sessions, each consuming tokens. For nine projects, you’ll likely hit API rate limits if you run many subagents simultaneously. To manage costs, you can:

  • Use the --max-turns flag to limit how long each subagent runs.
  • Set a token budget per session (Claude Code has a --max-tokens option).
  • Use smaller models for subagents if your plan allows (e.g., Claude Haiku for simple tasks).
  • Schedule work so that only one lead is active at a time for heavy tasks.

Also, consider that each lead’s context window fills up. You can clear context with /clear but that loses memory, so instead, rely on the task board for persistence.

Safety and Accuracy in Multi-Agent Code

Multi-agent setups increase the risk of conflicting edits, untested code, and security vulnerabilities. To mitigate:

  • Require tests before merging. The integration lead must run the test suite for each project before merging to main.
  • Use code review. Have the planning lead review the integration lead’s merges, and vice versa, for critical projects.
  • Never let agents push to production branches. Keep a human in the loop for final deployment.
  • Audit the task board regularly. Check that no agent has marked a task as done without evidence (e.g., a test pass).

Alternatives to Two Leads

If two leads feels overkill, you could use a single lead with a pool of subagents, or use Claude Code’s built-in --multi flag (if available) to run multiple agents in one session. Another alternative is to use a task automation tool like GitHub Actions to trigger Claude Code on specific events, but that’s more complex. For nine projects, the two-lead model is a proven, low-tech approach that works without additional infrastructure.

Frequently Asked Questions

Q: Do the two leads need to be in the same terminal?
A: No, they can be in separate terminals or even on different machines, as long as they share the same file system (e.g., a git repo). The coordination happens through files, not direct communication.

Q: Can I use Claude Code’s subagents without a lead?
A: Yes, you can spawn subagents from a single session, but without a lead to coordinate, you risk them working on the same files. A lead provides oversight and task assignment.

Q: How do I prevent the two leads from overwriting each other’s changes?
A: Use git branches and a strict rule: only the integration lead merges to main, and only the planning lead creates branches. Also, always update the task board before editing a file.

Q: What if one lead gets stuck or hits a rate limit?
A: The other lead can take over its projects, but must first read the task board to understand the state. It’s wise to have a fallback plan, like a third session that can be started as a backup.

Q: Is this setup suitable for a solo developer?
A: Yes, you can simulate two leads by running two sessions with different prompts. The coordination overhead is worth it if you have many independent tasks.

Q: How do I know if my multi-agent setup is working?
A: Track the number of completed tasks per day and the number of merge conflicts. If conflicts are frequent, tighten the coordination rules.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.