Skip to content
Agentic AI
Agentic AI8 min read0 views

Claude Code Desktop Architecture for Parallel Agents

How Claude Code on desktop runs parallel agents: orchestrator loop, isolated subagent contexts, the tool bus, locks, and shared-state merge.

Run a single agent on your laptop and the mental model is easy: one loop, one context window, one tool call at a time. The moment you redesign Claude Code on desktop to run several agents at once, that simplicity disappears. Now you have multiple loops competing for the same files, the same MCP servers, the same terminal, and the same human watching the screen. The architecture you build underneath decides whether that feels like a team of engineers or a pile-up at a four-way stop.

This post walks the full stack of a desktop Claude Code build designed for parallelism — from the top-level orchestrator down to how each subagent gets its own isolated context and how their results are stitched back together. The goal is a concrete picture an engineer can hold in their head, not a marketing diagram.

Key takeaways

  • A parallel desktop build is really three layers: an orchestrator loop, a pool of isolated subagent contexts, and a shared tool/permission bus that mediates the real world.
  • Each subagent gets its own context window and message history; the orchestrator only ever sees their summaries, not their raw transcripts.
  • The tool bus is where concurrency gets dangerous — file writes, terminal sessions, and MCP connections need a lock or lease layer.
  • State is split into immutable shared context (read by all) and per-agent scratch (written by one), which avoids most race conditions by construction.
  • Token cost grows roughly with the number of active agents, so the orchestrator should fan out deliberately, not by default.

What problem the desktop build actually solves

The reason to run agents in parallel on desktop is wall-clock time. A large refactor, a multi-file migration, or a research sweep across a codebase has independent chunks. A single agent processes them one after another; a fleet of subagents can attack them simultaneously, each in its own context, and report back. The desktop is a good home for this because it already has the file system, the credentials, and the long-lived processes the work depends on.

But parallelism is only worth it when the chunks are genuinely independent. If subagent B needs the output of subagent A, you have not parallelized — you have added coordination overhead to a sequential job. The architecture's first job is to make independence cheap to express and dependence impossible to fake.

The three layers, end to end

At the top sits the orchestrator: a long-running Claude loop whose only job is to decompose work, spawn subagents, watch their results, and decide what happens next. It holds the plan and the high-level context, and it deliberately does not do the detailed work itself. Beneath it is a pool of subagents, each a fresh Claude loop with its own context window, its own system prompt, and a narrow task. At the bottom is the tool and permission bus — the single mediated path through which any agent touches the file system, the terminal, the network, or an MCP server.

Hear it before you finish reading

Talk to a live CallSphere AI voice agent in your browser — 60 seconds, no signup.

Try Live Demo →
flowchart TD
  U["User goal in desktop UI"] --> O["Orchestrator loop"]
  O --> P{"Independent chunks?"}
  P -->|No| S["Run sequentially in main context"]
  P -->|Yes| F["Fan out subagents"]
  F --> A1["Subagent: isolated context A"]
  F --> A2["Subagent: isolated context B"]
  A1 --> B["Tool & permission bus"]
  A2 --> B
  B --> R["Results & summaries back to orchestrator"]
  R --> O

The arrows that matter most are the ones pointing back up. Subagents return summaries — a compact statement of what they did, what they changed, and what they learned — not their full message history. If the orchestrator inhaled every subagent's raw transcript, its context window would fill in minutes and you would lose the very oversight the orchestrator exists to provide.

Context isolation is the load-bearing idea

The single most important architectural decision is that each subagent owns a separate context window. This is not just a token-budget trick. Isolation means subagent A cannot be confused by subagent B's intermediate reasoning, cannot accidentally act on B's half-finished file edits, and cannot inherit B's mistaken assumptions. Each agent reasons about a clean, scoped slice of the problem.

In practice the orchestrator passes each subagent three things: a task description, a read-only snapshot of the shared context it needs (relevant file paths, conventions, constraints), and a contract for what to return. The subagent does its work in private and emits a structured result. The desktop runtime never merges two subagents' contexts; it merges their outputs, which is a much smaller and safer surface.

The tool bus: where concurrency bites

Reasoning in parallel is safe because it touches nothing shared. The danger is in side effects. Two subagents editing the same file, two running npm install in the same directory, or two opening a write transaction against the same MCP-backed database will corrupt each other. The tool bus solves this with leases: before any mutating tool call executes, the bus acquires a lock on the resource — a file path, a directory, a named MCP connection — and releases it when the call returns.

A simple, effective rule is path-scoped locking for the file system and serialized access per terminal session. Read-only calls (reading a file, querying an MCP resource) can run fully concurrently; write calls queue behind a lease. The orchestrator can further reduce contention up front by assigning non-overlapping file scopes to each subagent, so the locks are rarely contended in the first place.

Shared state versus per-agent scratch

State in a parallel build splits cleanly into two kinds. Immutable shared context is everything every agent may read but none may write during the run — the plan, the coding conventions, the snapshot of the repo at fan-out time. Per-agent scratch is everything a single agent writes — its draft edits, its notes, its tool results. Keeping these separate eliminates a whole class of race conditions, because two agents never write the same cell.

Still reading? Stop comparing — try CallSphere live.

CallSphere ships complete AI voice agents per industry — 14 tools for healthcare, 10 agents for real estate, 4 specialists for salons. See how it actually handles a call before you book a demo.

The orchestrator reconciles scratch into shared state only at join points: when a subagent finishes, the orchestrator reviews its diff, resolves any conflicts (usually by re-running an affected agent rather than auto-merging), and folds the change into the canonical state. This is the desktop equivalent of a merge step in version control, and treating it that way — explicit, reviewable, conflict-aware — is what keeps a fleet of agents from quietly clobbering each other's work.

Common pitfalls

  • Letting the orchestrator read raw subagent transcripts. Its context fills and oversight collapses. Always return compact summaries with a fixed schema.
  • Fanning out work that is actually sequential. If B depends on A, parallelism adds coordination cost and token spend for no speedup. Decompose for true independence first.
  • Shared mutable file scope. Two agents writing overlapping paths corrupts both. Assign non-overlapping scopes and lock writes at the bus.
  • One terminal for many agents. Interleaved shell output is unrecoverable. Give each agent its own session or serialize terminal access.
  • Unbounded fan-out. Token cost scales with active agents; an orchestrator that spawns by default burns budget. Cap concurrency and justify each spawn.

Ship a parallel desktop build in 6 steps

  1. Define a strict subagent result schema (changed files, summary, status, follow-ups) before writing any loop code.
  2. Build the orchestrator as a planning-only loop that never edits files directly.
  3. Add the tool bus with path-scoped write locks and concurrent reads.
  4. Split state into immutable shared context and per-agent scratch; forbid cross-agent writes.
  5. Assign non-overlapping file scopes at fan-out to minimize lock contention.
  6. Add an explicit join/merge step where the orchestrator reviews each diff before folding it in.
ConcernSingle agentParallel desktop build
Wall-clock on independent workSlow, serialFast, concurrent
Context per taskOne window, sharedIsolated per subagent
Race conditionsNoneReal; need the tool bus
Token costLowerSeveral times higher

Frequently asked questions

What is the orchestrator in a parallel Claude Code build?

The orchestrator is a long-running Claude loop that decomposes a goal into independent tasks, spawns subagents to do them, and reconciles their results. It holds the plan and high-level context but deliberately does no detailed editing itself, so its context window stays clear for oversight.

How do subagents avoid corrupting each other's work?

Through context isolation and a tool bus. Each subagent has its own context window and writes only to its own scratch space, and all mutating tool calls pass through a bus that locks the targeted file or resource until the call completes.

Does running agents in parallel cost more?

Yes. Multi-agent runs typically consume several times more tokens than a single agent, because each subagent maintains its own context and re-reads shared material. Parallelism pays off only when wall-clock time matters and the work is genuinely independent.

When should I keep work sequential instead?

Whenever later steps depend on earlier outputs. If subagent B needs A's result, parallel execution just adds coordination overhead. Reserve fan-out for chunks that share no dependencies and touch non-overlapping files.

Bringing agentic AI to your phone lines

CallSphere takes these same parallel-agent patterns and points them at conversations: multi-agent voice and chat assistants that answer every call, pull data through tools mid-conversation, and book real work around the clock. See it running at callsphere.ai.


Source & attribution: This is an independent, original explainer inspired by Anthropic's coverage on the Claude blog. Claude, Claude Code, Claude Cowork, Claude Opus, and the Model Context Protocol are products and trademarks of Anthropic. CallSphere is not affiliated with or endorsed by Anthropic.

Share

Try CallSphere AI Voice Agents

See how AI voice agents work for your industry. Live demo available -- no signup required.