with one click
multi-agent-architecture
// Patterns for designing multi-agent systems with Claude Code - job description method, shared folder communication, handbook consolidation, context management. Use when building complex agent orchestrations.
// Patterns for designing multi-agent systems with Claude Code - job description method, shared folder communication, handbook consolidation, context management. Use when building complex agent orchestrations.
[HINT] Download the complete skill directory including SKILL.md and all related files
| name | multi-agent-architecture |
| description | Patterns for designing multi-agent systems with Claude Code - job description method, shared folder communication, handbook consolidation, context management. Use when building complex agent orchestrations. |
Design principles for orchestrating many sub-agents without context overflow.
Treat agent design like human hiring: write a job description first, then translate to architecture. The framing shapes every decision.
Before writing any agent code:
| JD Section | Architecture Element |
|---|---|
| Responsibilities | Agent workflows |
| Required skills | Tool permissions |
| Success indicators | Output schemas |
| Escalation criteria | Error handling |
| Onboarding materials | Skills/handbook |
Problem: Orchestrator context overwhelmed when 10+ sub-agents return detailed reports simultaneously.
Solution: Sub-agents write to temp folder ā downstream agents read directly.
.claude/workspace/
āāā phase-1/
ā āāā gmail-analysis.md
ā āāā calendar-analysis.md
ā āāā drive-inventory.md
āāā phase-2/
ā āāā client-summary.md
ā āāā action-items.md
āāā manifest.yml
Workflow:
1. Orchestrator spawns sub-agents
2. Each sub-agent:
- Does work
- Writes report to .claude/workspace/{phase}/{name}.md
- Returns only: { status: "complete", path: "..." }
3. Downstream agents read prior phase outputs directly
4. Orchestrator reads manifest, not full reports
Benefits:
Problem: Many narrow skills create fragility and maintenance burden.
Solution: One handbook organized by chapters, read foundation + relevant sections.
skills/project-manager/
āāā SKILL.md # Entry point, routes to chapters
āāā references/
āāā 01-foundation.md # Who we are, tools, escalation, standards
āāā 02-daily-ops.md # Data gathering procedures
āāā 03-dashboards.md # Structure, quality checks
āāā 04-onboarding.md # New client setup
Chapter Structure:
| Chapter | Contents |
|---|---|
| Foundation | Team, tools, data sources, escalation rules, quality standards |
| Domain chapters | Specific procedures for each responsibility area |
Reading Pattern:
Sub-agent reads:
1. Foundation chapter (always)
2. Relevant domain chapter(s) (based on task)
| Strategy | When to Use |
|---|---|
| Shared folder | 5+ sub-agents, inter-agent dependencies |
| Context proxy | Research agents returning verbose results |
| Manifest files | Orchestrator needs status, not details |
| Chunked execution | Serial phases when parallel overwhelms |
How many sub-agents?
āāā 1-3 ā Direct orchestration (return reports to main)
āāā 4-10 ā Shared folder pattern
āāā 10+ ā Phased execution with manifest
Do teammates need direct communication?
āāā No ā Sub-agents (Task tool) ā report results back only
āāā Yes ā Agent Teams ā shared task list, inter-agent messaging
āāā See agent-teams skill for full guide
āāā Best for: parallel review, competing hypotheses, multi-module features
Do sub-agents need each other's output?
āāā No ā Parallel execution, merge results
āāā Yes ā Shared folder, dependency ordering
Is orchestrator context a concern?
āāā No ā Return full reports
āāā Yes ā Status-only returns + file paths
When multiple agents can transition the same work item (issue, task, label) through states, silent race conditions cause duplicate work or skipped transitions.
Three-step guard (apply before every state write):
1. READ ā Re-fetch current state immediately before mutation (never use cached state)
2. VERIFY ā Confirm state matches expected pre-condition
3. WRITE ā Apply transition in a single atomic operation
Implementation pattern:
CURRENT_STATE = fetch_state(item_id) # live read, not cached
If CURRENT_STATE != EXPECTED_PRE_STATE:
ABORT ā log stale-race, do not mutate
Else:
apply_transition(item_id, NEW_STATE) # single atomic call
For GitHub labels specifically:
CURRENT_LABELS = gh issue view {id} --json labels
If EXPECTED_LABEL not in CURRENT_LABELS:
ABORT ā another agent already transitioned this item
Else:
gh issue edit {id} --remove-label {old} --add-label {new} # one call
Decision table:
| Scenario | Action |
|---|---|
| State matches expectation | Apply transition atomically |
| State already at target | Skip silently (idempotent) |
| State at unexpected value | Abort, log conflict, do not retry |
| Item not found | Abort, log missing item |
Why single atomic call matters: Two separate --remove-label and --add-label calls create a window where another agent reads the item in an intermediate state. Combine into one gh issue edit invocation.
| Pattern | Problem | Fix |
|---|---|---|
| Slash commands as orchestration | Context exhaustion before work starts | Move to sub-agents |
| Orchestrator relays all context | Bottleneck, signal loss | Shared folder |
| One skill per micro-task | Fragile, hard to maintain | Handbook chapters |
| Sub-agents return full reports | Context overflow at 10+ agents | Path-only returns |
Most multi-agent systems evolve through:
Skip earlier stages when building new systems.
When workers need to communicate directly with each other ā not just report back to an orchestrator ā use Agent Teams instead of sub-agents. Agent Teams provide shared task lists, inter-agent messaging, and independent context windows.
Key differences from sub-agent patterns above:
When to upgrade from sub-agents to Agent Teams:
For full setup, operations reference, and orchestration patterns, apply the agent-teams skill.