Multi-Agent Patterns
Multi-Agent Patterns
When a Heist involves multiple files, multiple domains, or multiple concerns, the Gangsta hierarchy provides structured patterns for multi-agent coordination.
The Two Orchestration Skills
Underboss (gangsta:the-underboss)
The COO. Handles task decomposition and resource allocation.
When to invoke:
- Complex features that span multiple files or domains
- Tasks that have clear dependency chains
- When you need a War Plan broken into parallel work packages
What the Underboss does:
- Analyzes the Contract
- Decomposes work into discrete packages
- Maps dependencies between packages
- Assigns territories (domains) to Capos
- Estimates tributes (resource budgets) per package
- Produces the War Plan
Capo (gangsta:the-capo)
The crew lead. Orchestrates work within a territory.
When to invoke:
- When a territory has multiple related tasks
- When a domain needs coordinated changes across multiple files
- When sub-tasks within a territory need sequencing
What the Capo does:
- Receives territory assignment from the Underboss
- Sequences tasks within the territory
- Dispatches Soldiers for individual tasks
- Enforces quality standards within the territory
- Reports completion status
Pattern 1: Parallel Territories
Best for: Features that touch independent domains (e.g., frontend + backend)
Underboss
├── Territory A (Frontend) → Capo A → Soldier 1, Soldier 2
├── Territory B (Backend) → Capo B → Soldier 3
└── Territory C (Database) → Capo C → Soldier 4
Workflow:
- Underboss decomposes the Contract into 3 territories
- Each Capo sequences their territory's tasks
- Soldiers execute in parallel across territories
- No cross-territory dependencies — maximum parallelism
Pattern 2: Sequential Dependencies
Best for: Features with hard dependencies (e.g., database schema must exist before API endpoints)
Underboss
├── Phase 1: Territory A (Schema) → Capo A → Soldier 1
│ (gate: schema complete)
├── Phase 2: Territory B (API) → Capo B → Soldier 2
│ (gate: API complete)
└── Phase 3: Territory C (Frontend) → Capo C → Soldier 3
Workflow:
- Underboss identifies dependency chain
- Capos execute sequentially, each waiting for the previous to complete
- Each phase has a gate — next phase doesn't start until current one is verified
Pattern 3: Mixed Parallel-Sequential
Best for: Most real-world features (some things can run in parallel, others can't)
Underboss
├── Phase 1: [Territory A (DB) | Territory B (Config)] ← parallel
│ (gate: both complete)
├── Phase 2: [Territory C (API) | Territory D (Tests)] ← parallel
│ (gate: both complete)
└── Phase 3: Territory E (Integration) ← sequential
Workflow:
- Within each phase, territories run in parallel
- Phases run sequentially (phase 2 waits for phase 1)
- The War Plan documents the dependency graph
Communication Protocol
All inter-agent communication follows Omerta Law #1 (The Introduction Rule):
Agents never talk to each other directly. All communication flows through files:
- Contracts → define what to build
- War Plans → define how to build it
- Checkpoints → track progress
- The Ledger → preserve knowledge
This prevents the "telephone game" problem where messages distort through chains of agents.
Choosing the Right Pattern
| Situation | Pattern | Orchestration |
|---|---|---|
| Single file, single concern | Sequential | Capo only |
| Multiple independent concerns | Parallel Territories | Underboss + Capos |
| Dependent stages | Sequential Dependencies | Underboss |
| Mixed dependencies | Mixed | Underboss + Capos |
gangsta:the-underboss during Resource Development. The Underboss will analyze the Contract and recommend the appropriate pattern in the War Plan.