← Back to KB Index
Kelly Handbook: Multi-Agent Orchestration
kelly-handbook-multi-agent.md

Kelly Handbook: Multi-Agent Orchestration

Summary: Chapter 7 of the OpenClaw Handbook introduces the Kelly Router architecture — a pattern where a central orchestrator delegates all work to specialized sub-agents rather than doing the work itself. The architecture solves single-agent limitations (context overflow, sequential bottlenecks, lack of specialization) through parallel sub-agent execution, structured handoffs, and quality gates between phases.

Key Concepts

Notable Patterns

The Router Architecture

Operator → Kelly Router (main agent)               │      ┌────────┼────────┐      │        │        │  Research  Project    Test  Lead     Lead      Lead      │        │        │   Research  Planning  Testing   Sub-      Sub-      Sub-   agents    agents    agents

The main agent maintains the strategic view — tracking where things are, flagging stuck items, keeping the flow moving. It reads workflow files and spawns the correct agent for each subphase.

Sub-agent Spawning

Sub-agents are spawned with a label, task definition, and output directory. They can work in parallel — what takes 15 minutes sequentially takes 5 in parallel when three are spawned simultaneously.

The subagents tool supports: spawn, list, steer (send messages to running agents), and kill.

AGENTS.md Structure

Every project needs an AGENTS.md defining:

  1. Role — what is the main agent's job?
  2. Named agents — what specialized agents exist?
  3. Intake procedures — how is new work handled?
  4. Routing rules — which agent gets what type of work?
  5. Quality gates — what checks between phases?
  6. Escalation protocol — what when things break?
  7. Memory protocol — what gets written where?

Gate Validation Pattern

/projects/{id}/ ├── intake.md ├── research-artifacts/research-summary.md  → READY / NOT-READY ├── planning-artifacts/planning-summary.md  → PASS / FAIL └── implementation-artifacts/

Before routing to the next phase, the router confirms the gate file exists and reads its decision. Only proceeds if gate passes.

Failure Patterns and Fixes

PatternSignsFix
Context OverflowRepetitive responses, forgets instructionsBreak into smaller chunks
Going Off-ScriptOutput files not requestedBe more prescriptive
Lost Results"Done" but files missingExplicitly validate artifacts
Infinite Tool LoopsExcessive tool callsAdd explicit stopping conditions

RALPH Escalation

  1. Any sub-agent failure → retry
  2. Same failure twice → escalate (don't waste third attempt)
  3. Three failures → mandatory escalation with structured diagnostic
  4. Unrecoverable → immediate escalation with operator decision requested

Related

[[kelly-handbook-software-factory]], [[kelly-tweets-agents]], [[kelly-tweets-factory]]