Compound Engineering: Run AI Coding Agents in Parallel

AI Bot
By AI Bot ·

Loading the Text to Speech Audio Player...

The biggest bottleneck in AI-assisted development is no longer code generation. It is verification. A single AI agent can write code faster than most developers can read it, yet teams still run one agent at a time, waiting for each prompt to finish before starting the next. Compound engineering changes that equation entirely.

What Is Compound Engineering?

Compound engineering is a development methodology where each unit of work makes the next one easier. Instead of accumulating technical debt, the system intensifies over successive cycles, becoming progressively more maintainable and capable.

The workflow follows a four-phase loop: Plan, Work, Review, Compound. The critical difference from traditional development is the fourth phase. Where most teams stop at code review, compound engineering captures learnings and feeds them back into the system.

The time allocation might surprise you: 80% planning and review, 20% execution. This inverts conventional development, but it makes perfect sense when AI agents handle the typing.

Why Git Worktrees Are the Key

Running multiple AI agents against a single working directory is a recipe for chaos. Agents overwrite each other, merge conflicts pile up, and you lose more time untangling the mess than you saved.

Git worktrees solve this by giving each agent its own isolated copy of the repository, all pointing to the same .git directory. Each agent gets:

  • Its own branch
  • Its own working directory
  • Its own context
  • Its own task

No file conflicts. No overwrites. Just parallel progress.

Quick Setup

Three shell aliases are all you need to manage the workflow:

# Create a worktree, branch, and launch an agent
alias agent-spin='f() { git worktree add ../agent-$1 -b agent/$1 && cd ../agent-$1; }; f'
 
# Rebase, review, and prepare for merge
alias agent-merge='f() { cd ../agent-$1 && git rebase main && gh pr create; }; f'
 
# Clean up finished worktrees
alias agent-clean='git worktree list | grep agent | awk "{print \$1}" | xargs -I {} git worktree remove {}'

Tools like Conductor and Worktrunk automate this entirely with visual dashboards.

The Three Tiers of Multi-Agent Development

Not every team needs the same level of orchestration. Start simple and scale up.

Tier 1: In-Process Subagents

Claude Code subagents and Agent Teams require zero additional setup. A parent agent decomposes work and spawns focused child agents, each with clear file ownership. This works well for tasks under 220k tokens total.

Tier 2: Local Orchestration

Run 3 to 10 agents locally with tools like Conductor or Cursor Background Agents. Each agent operates in its own git worktree with a visual dashboard for monitoring progress.

Tier 3: Cloud Delegation

Claude Code Web, GitHub Copilot Coding Agent, and Jules handle async delegation without requiring a local terminal. Ideal for overnight tasks or when you need more parallel capacity than your machine can handle.

The Factory Model: Six Steps

Here is the practical workflow for orchestrated AI development:

  1. Plan — Write specs with clear acceptance criteria. Specs are leverage: a well-written spec prevents hours of agent thrashing.
  2. Spawn — Create worktrees and assign agents to specific tasks with strict file ownership.
  3. Monitor — Check progress every 5 to 10 minutes. If an agent is stuck for 3 or more iterations on the same error, reassign the task.
  4. Verify — Run tests, lint checks, and type validation. Never trust agent output without automated verification.
  5. Integrate — Merge branches, resolve conflicts, run the full test suite.
  6. Retro — Update your AGENTS.md with new patterns discovered during the cycle.

AGENTS.md: Your Compound Knowledge Base

The secret weapon of compound engineering is a living document that agents read at the start of every session. Research shows that human-curated context files improve agent performance by roughly 4%, while LLM-generated ones offer no benefit and increase costs by over 20%.

Keep it concise and structured:

## STYLE
- Functional components with hooks
- Named exports only
 
## GOTCHAS
- SQLite requires WAL mode in production
- API routes need auth middleware
 
## ARCH_DECISIONS
- All state in SQLite, no external cache
- Feature flags via environment variables
 
## TEST_STRATEGY
- Integration tests over unit tests
- Mock external APIs only

Update this file manually after each cycle. Never let agents write to it directly.

Setting WIP Limits

More agents does not always mean more throughput. The sweet spot for most repositories is 3 to 5 parallel agents. Beyond that, you hit genuine merge complexity, even with worktree isolation. The agents are not the bottleneck; the codebase's ability to absorb parallel changes is.

Set hard token budgets per agent. For example: frontend agents at 180k tokens, backend agents at 280k tokens. At 85% of the budget, auto-pause and notify the lead.

The Verification Bottleneck

Here is the uncomfortable truth: agents produce output at impressive speed, but determining correctness with confidence remains hard. Human review is the safety system, not optional overhead.

Delegate to agents:

  • Scoped tasks with clear pass/fail criteria
  • Boilerplate and scaffolding
  • Migrations and test generation
  • Documentation updates

Keep for yourself:

  • Architecture decisions
  • Deciding what NOT to build
  • Reviewing with full system context
  • Maintaining system comprehension

As Addy Osmani puts it: "Slow down enough to maintain understanding. Because if you lose understanding of your own system, you have lost the ability to fix it, extend it, or even know when it's broken."

Getting Started Today

You do not need a complex setup to begin. Start with these five steps:

  1. Use subagents for focused, file-scoped tasks with clear ownership
  2. Enable Agent Teams with 3 teammates for true parallelism
  3. Implement git worktrees per agent for isolation
  4. Add quality gates: plan approval, automated hooks, verification
  5. Maintain AGENTS.md as your compound knowledge base

The shift from conductor to orchestrator is not just about speed. It is about building a development system that gets smarter with every cycle, where each task leaves the codebase better instrumented for the next one.

Compound engineering is not the future of AI-assisted development. It is what the most productive teams are already doing right now.

Further Reading


Want to read more blog posts? Check out our latest blog post on Why MENA Startups Are Winning the AI Automation Race.

Discuss Your Project with Us

We're here to help with your web development needs. Schedule a call to discuss your project and how we can assist you.

Let's find the best solutions for your needs.