Multi-Agent Scaling

Within a single environment: sub-agents, parallel execution, coordination, deliberation, and autonomous review.

Running multiple agents isn't the hard part. Coordinating them is. Codebolt provides sub-agent spawning, grouped parallel execution, stigmergy-based coordination, pheromone ownership, deliberation councils, automatic review-merge, and drift tracking — all within a single environment.

Sub-Agent Spawning

Any agent can spawn background child threads that run as full agent instances in parallel. Not async tasks — real agents with complete SDK access. Register children individually or in groups. Wait for individual completion, grouped completion, or any external event. Message-driven parent-child communication via WebSocket.

            Parent Agent
  ├─ spawn('reviewer', task1) → Child 1
  ├─ spawn('tester', task2)  → Child 2
  ├─ spawn('docs', task3)    → Child 3
  │
  │  addToGroup('batch-1', [1,2,3])
  │
  └─ await groupCompletion('batch-1')
            ↓
     All 3 complete in parallel
     → Merge results → Continue

          

Stigmergy-Based Coordination

Traditional multi-agent systems use direct message passing — fragile, creates coupling, doesn't scale. Codebolt uses stigmergy: agents communicate indirectly through structured shared state. Each agent reads from and writes to a shared environment. Coordination emerges without explicit messaging. This is how biological swarms scale to millions.

            Message Passing (others):
A → B → C → D (fragile chain)

Stigmergy (Codebolt):
A → [shared state] ← B
C → [shared state] ← D
No direct coupling.
Scales: 2 → 200+ agents.

          

Pheromone-Based Task Ownership

Agents deposit pheromones on tasks and files to signal interest and ownership. Configurable pheromone types. Aggregation system for conflict resolution when multiple agents target the same work. Lock/unlock mechanisms for exclusive access. This prevents the coordination breakdown that happens when independent agents collide.

            Agent A deposits pheromone:
→ file: auth.ts (ownership)
→ task: refactor-auth (working)

Agent B checks pheromones:
→ auth.ts: claimed by A
→ picks different task instead

No collision. No merge conflict.
Automatic coordination.

          

Agent Deliberation Council

Agents propose options, debate tradeoffs, vote, and reach consensus. Deliberation types: decision, review, brainstorm, approval, vote. All stored per-project in .codebolt/agentdeliberation/ and fully traceable. This is how agents make architectural decisions collectively — not by one agent guessing.

            Agent A: proposes microservices
Agent B: proposes monolith
Agent C: analyzes tradeoffs
      ↓
Vote: 2 for monolith, 1 for micro
      ↓
Consensus: monolith
Decision: logged + traceable
Rationale: preserved

          

Automatic Review & Merge

Agents create review-merge requests for their changes. Other agents provide feedback — approve, request changes, or comment. Conflict detection runs before merge. Pheromone-based coordination prevents overlapping work. The shadow git system handles the actual merge operations. No GitHub PR bottleneck. Agents do long tasks in parallel, review each other, and merge autonomously.

            Agent A: implements feature
      ↓
Review request created
      ↓
Agent B: reviews → approves
Agent C: checks conflicts → clear
      ↓
Auto-merged by shadow git
No human needed. Fully traced.

          

Drift Tracking — Two Levels

Local Rust engine instances assess drift within each agent context — structural drift (architecture diverging from plan), scope drift (features expanding beyond intent), constraint drift (violations of rules), coverage drift (gaps in implementation). The global JavaScript layer aggregates signals across all agents, detecting systemic drift that no single agent would catch.

            Level 1: Rust (per-agent)
→ structural drift
→ scope drift
→ constraint drift
→ coverage drift

Level 2: JavaScript (global)
→ aggregate all agent signals
→ detect systemic patterns
→ flag before it compounds

          

Coordination, not collision.