DEV Community

brian austin
brian austin

Posted on

How I supervise multiple AI coding agents without losing control

How I supervise multiple AI coding agents without losing control

Running one Claude Code agent is manageable. Running five simultaneously? That's where things get interesting — and where most developers lose control.

I've been running multi-agent Claude Code setups for the past few months. Here's the supervision framework I've developed.

The core problem with multiple agents

When you run parallel agents, you get:

  • Conflicting file edits (two agents edit the same file)
  • Duplicate work (both agents research the same thing)
  • Context drift (agents lose track of what others did)
  • Token explosions (5 agents × heavy sessions = rate limits immediately)

The solution isn't better prompting. It's structural supervision.

The three-layer supervision model

Layer 1: Orchestrator (you)
    ↓
Layer 2: Coordinator agent (reads all outputs)
    ↓
Layer 3: Worker agents (do the actual work)
Enter fullscreen mode Exit fullscreen mode

You never talk to worker agents directly. The coordinator does.

Setting up the coordinator

Create a COORDINATOR.md file:

# Coordinator Instructions

You manage 3 worker agents. Your job:
1. Read outputs from /tmp/agent-[1,2,3]-output.md
2. Detect conflicts before they happen
3. Assign next tasks based on completed work
4. Report blockers to human immediately

## File ownership map
- Agent 1 owns: /src/frontend/*
- Agent 2 owns: /src/api/*  
- Agent 3 owns: /src/database/*

## Conflict rule
If two agents need the same file, STOP and ask human.
Enter fullscreen mode Exit fullscreen mode

Then start the coordinator:

claude --dangerously-skip-permissions \
  "Read COORDINATOR.md. Check all agent outputs. Report status." \
  > /tmp/coordinator-status.md &
Enter fullscreen mode Exit fullscreen mode

Starting worker agents with boundaries

# Agent 1: Frontend only
claude --dangerously-skip-permissions \
  "You are Agent 1. You ONLY modify files in /src/frontend/. \
   Write your progress to /tmp/agent-1-output.md every 10 minutes. \
   Task: Implement the new dashboard UI from design-spec.md" \
  > /tmp/agent-1-log.txt &

# Agent 2: API only  
claude --dangerously-skip-permissions \
  "You are Agent 2. You ONLY modify files in /src/api/. \
   Write your progress to /tmp/agent-2-output.md every 10 minutes. \
   Task: Build REST endpoints for dashboard data" \
  > /tmp/agent-2-log.txt &
Enter fullscreen mode Exit fullscreen mode

The supervision loop

Every 15 minutes, I run this check:

#!/bin/bash
# supervisor.sh

echo "=== SUPERVISION CHECK $(date) ==="

# Check if agents are still running
for i in 1 2 3; do
  if [ -f /tmp/agent-$i-output.md ]; then
    LAST_MODIFIED=$(stat -c %Y /tmp/agent-$i-output.md)
    NOW=$(date +%s)
    AGE=$((NOW - LAST_MODIFIED))
    if [ $AGE -gt 900 ]; then
      echo "⚠️ Agent $i hasn't written in ${AGE}s — may be stuck"
    else
      echo "✅ Agent $i active (last update ${AGE}s ago)"
    fi
  else
    echo "❌ Agent $i output file missing"
  fi
done

# Check for file conflicts
echo ""
echo "=== RECENT FILE CHANGES ==="
find /src -newer /tmp/last-check -name '*.js' 2>/dev/null | head -20
touch /tmp/last-check
Enter fullscreen mode Exit fullscreen mode

Handling rate limits across agents

This is the #1 operational problem. Five agents burning tokens simultaneously means someone hits the Claude rate limit fast.

My solution: staggered starts + API fallback.

# Stagger starts by 3 minutes each
claude [agent 1 cmd] &
sleep 180
claude [agent 2 cmd] &
sleep 180
claude [agent 3 cmd] &
Enter fullscreen mode Exit fullscreen mode

For the fallback: when agents hit rate limits, I route them through SimplyLouie — a $2/month Claude API proxy that uses ANTHROPIC_BASE_URL. Since it's a separate billing account, it has a fresh rate limit.

# In agent startup script:
export ANTHROPIC_BASE_URL=https://api.simplylouie.com
# Agent now uses separate rate limit pool
Enter fullscreen mode Exit fullscreen mode

This lets long-running multi-agent sessions continue past the point where the main account would block.

The output aggregation pattern

At the end of a multi-agent session, you need to synthesize what they all did:

claude "Read these three files:
- /tmp/agent-1-output.md
- /tmp/agent-2-output.md  
- /tmp/agent-3-output.md

Create a unified summary:
1. What each agent completed
2. What they left unfinished
3. Any conflicts I need to resolve
4. Suggested next steps

Save to /tmp/session-summary.md"
Enter fullscreen mode Exit fullscreen mode

What actually breaks multi-agent setups

After running these for months:

1. Shared state without locks
Two agents both try to update package.json. One wins, one's changes are lost. Solution: Each agent writes to its own scratch file, coordinator merges.

2. Agents that run forever
An agent gets into a research loop and burns tokens for hours with no output. Solution: timeout 3600 claude [cmd] — kill after 1 hour.

3. Over-ambitious tasks
Assigning "build the entire auth system" to one agent = too big, too vague. Solution: Tasks should be completable in 30-60 minutes.

4. No checkpointing
Agent does 2 hours of work, crashes, you lose everything. Solution: Make agents write progress to files every 10 minutes and git commit incrementally.

The minimal viable setup

If you're just starting with multi-agent work, don't try to run 5 agents. Start with 2:

# Agent A: writes the code
claude "Implement feature X. Write to /tmp/agent-a-done.md when complete" &

# Agent B: writes the tests (after A is done)
# Poll for A to finish
while [ ! -f /tmp/agent-a-done.md ]; do sleep 60; done
claude "Read agent-a-done.md. Write tests for everything A built." &
Enter fullscreen mode Exit fullscreen mode

This pipeline pattern is reliable and easy to debug before you scale up.

Tokens and cost reality

Running 3 parallel Claude Code agents for a full workday on a Max subscription will hit limits. Plan for it:

  • Morning session: 3 agents × 2 hours
  • Rate limit break: 30-60 minutes
  • Afternoon session: 3 agents × 2 hours

Or route overflow to a separate API account at $2/month. Either way, budget for the reality.


Building complex multi-agent workflows? SimplyLouie provides a $2/month Claude API endpoint — useful as a separate rate limit pool when your main account saturates during parallel sessions.

Top comments (0)