Skip to content

Run Multiple AI Coding Agents Together: Complete Integration Guide

Problem

I had three AI coding agents installed: Claude Code for reasoning-heavy tasks, Codex CLI for OpenAI’s models, and Goose for local experiments. The problem? I could only use one at a time.

Every time I wanted a second opinion, I had to:

The manual comparison cycle
Terminal 1: claude-code "Implement user auth"
↓ Wait for result
Terminal 2: codex "Implement user auth"
↓ Wait for result
Editor: Compare outputs manually
↓ Copy/paste the best parts
Terminal: Test and commit

This was tedious. I wanted to send one prompt to multiple agents and compare their outputs side-by-side. I also wanted each agent working in isolation so they wouldn’t step on each other’s changes.

The solution: multi-harness interfaces with worktree isolation.

What Is Multi-Harness Support

A harness is a CLI-based AI coding agent. Claude Code, Codex CLI, and Goose are all harnesses. They take prompts, modify code, and return results.

Multi-harness support means running different agents in the same workspace. The key capabilities:

ConceptDescription
HarnessA CLI-based AI coding agent (Claude Code, Codex CLI, Goose)
Multiple harnessesRunning different agents in the same workspace
BroadcastingSending one prompt to multiple agents simultaneously
WorktreesIsolated git worktrees where each agent operates

A Reddit user described what I wanted:

“Panes supports ‘multiple harnesses’ and ‘broadcasting to interact with several agents in their worktrees at the same time.”

This was exactly it. One prompt, multiple agents, isolated execution.

Architecture Overview

The architecture combines three concepts: a unified interface, multiple AI harnesses, and isolated worktrees.

Multi-harness architecture
┌─────────────────────────────────────────────────────────────┐
│ Unified Interface (Panes) │
│ ┌─────────────┐ │
│ │ Broadcast │──────► Send same prompt to all agents │
│ │ Controller │ │
│ └─────────────┘ │
└─────────────────────────────────────────────────────────────┘
│ │ │
▼ ▼ ▼
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Claude Code │ │ Codex CLI │ │ Goose │
│ (Harness A) │ │ (Harness B) │ │ (Harness C) │
└────────┬────────┘ └────────┬────────┘ └────────┬────────┘
│ │ │
▼ ▼ ▼
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Worktree A │ │ Worktree B │ │ Worktree C │
│ feature/auth │ │ feature/auth │ │ feature/auth │
│ (Claude's ver) │ │ (Codex's ver) │ │ (Goose's ver) │
└────────┬────────┘ └────────┬────────┘ └────────┬────────┘
│ │ │
└────────────────────┼────────────────────┘
┌─────────────────┐
│ Git Repository │
│ (shared base) │
└─────────────────┘

Each agent works in its own worktree. They share the same git history but operate on separate directories. This means:

  • No merge conflicts between agents
  • Each agent sees the full codebase context
  • You can compare implementations directly
  • Failed experiments don’t pollute the main branch

Setting Up the Environment

Step 1: Install Your Harnesses

First, install the AI coding agents you want to use.

Installing multiple AI harnesses
# Claude Code (Anthropic)
npm install -g @anthropic-ai/claude-code
export ANTHROPIC_API_KEY="your-key"
# Codex CLI (OpenAI)
npm install -g @openai/codex
export OPENAI_API_KEY="your-key"
# Goose (local/other)
# Installation varies - check Goose documentation

Step 2: Create Worktrees for Isolation

Git worktrees let you check out multiple branches in separate directories.

Creating worktrees for multi-agent workflow
# From your main repository
cd ~/projects/myapp
# Create worktrees for each agent
git worktree add ../myapp-claude feature/auth-claude
git worktree add ../myapp-codex feature/auth-codex
git worktree add ../myapp-goose feature/auth-goose
# Each directory now has the full codebase
# Agents can work independently without conflicts

Step 3: Choose Your Interface

You have three main options:

Option A: Dedicated Tool (Panes)

Running Panes
git clone https://github.com/nickg/panes.git
cd panes
npm install
npm run dev
# Panes auto-detects installed harnesses
# Configure worktrees in the workspace settings

Panes handles broadcasting and worktree management automatically. The interface shows split panes with each agent’s output.

Option B: Terminal Multiplexer (tmux)

Manual tmux setup
# Create a session with multiple panes
tmux new-session -s multi-agent
# Split into three vertical panes
tmux split-window -v
tmux split-window -v
# In each pane, run a different agent in its worktree
# Pane 1: cd ../myapp-claude && claude-code
# Pane 2: cd ../myapp-codex && codex
# Pane 3: cd ../myapp-goose && goose

This requires manual coordination but gives you full control.

Option C: Custom Orchestration Scripts

Broadcasting script
#!/bin/bash
# broadcast.sh - Send prompt to all agents
PROMPT="$1"
# Run agents in parallel
(cd ../myapp-claude && claude-code "$PROMPT" > output.txt) &
(cd ../myapp-codex && codex "$PROMPT" > output.txt) &
(cd ../myapp-goose && goose "$PROMPT" > output.txt) &
wait
echo "All agents completed. Check output.txt in each worktree."

Broadcasting in Action

Here’s how broadcasting works in practice. I send one prompt to all agents simultaneously.

Broadcasting workflow
┌─────────────────────────────────────────────────────────┐
│ Prompt: "Add rate limiting to all API endpoints" │
└─────────────────────────────────────────────────────────┘
┌───────────┼───────────┐
▼ ▼ ▼
┌─────────┐ ┌─────────┐ ┌─────────┐
│ Claude │ │ Codex │ │ Goose │
│ Code │ │ CLI │ │ │
└────┬────┘ └────┬────┘ └────┬────┘
│ │ │
▼ ▼ ▼
Rate limit Rate limit Rate limit
with Redis in-memory with file
+ sliding cache + cache +
window token simple
algorithm bucket TTL
│ │ │
└───────────┼───────────┘
Compare and choose best approach

Each agent proposes a different solution. Claude might suggest Redis with a sliding window algorithm. Codex might propose an in-memory token bucket. Goose might recommend a file-based cache.

I can then:

  1. Compare the implementations side-by-side
  2. Run tests in each worktree
  3. Pick the best approach or combine ideas
  4. Merge the chosen implementation to main

Configuration Example

If you’re using a tool like Panes, you configure your harnesses and worktrees:

workspace-config.yaml (conceptual)
broadcasting:
enabled: true
mode: parallel # or sequential
harnesses:
- name: claude-code
worktree: feature/auth-claude
model: claude-opus-4-5
- name: codex-cli
worktree: feature/auth-codex
model: gpt-4o
- name: goose
worktree: feature/auth-goose
model: default
prompts:
shared_context: true # Agents see same codebase
isolated_execution: true # Each works independently

Cross-Validation Patterns

Multi-agent setups shine for cross-validation. One agent generates code; another reviews it.

Agent cross-validation workflow
# Agent A generates implementation
cd ../myapp-claude
claude-code "Implement user authentication with JWT"
# Switch to Codex worktree (or copy changes)
cd ../myapp-codex
# Copy Claude's implementation
cp -r ../myapp-claude/src/auth ./src/
# Agent B reviews for security issues
codex "Review authentication implementation for security vulnerabilities"

A Reddit user noted:

“The auto validation and auto review do amazing things for me”

This pattern catches issues a single agent might miss. Claude might implement a feature correctly but overlook an edge case. Codex reviewing the same code might catch it.

Comparison Table

Single vs Multi-Agent Comparison
| Aspect | Single Agent | Multi-Agent Interface |
|---------------------|------------------------|----------------------------|
| Tool switching | Manual, disruptive | Seamless splits |
| Context sharing | Copy/paste | Automatic |
| Parallel work | Not possible | Core feature |
| Cross-validation | Manual | Automated |
| Provider lock-in | High | Low |
| Cost optimization | Limited | Flexible |
| Code quality | Single perspective | Multiple perspectives |
| Experimentation | One approach at a time | Multiple in parallel |

Integration Approaches

Approach 1: Unified Workspace (Panes)

The easiest path. One application manages all agents with built-in broadcasting.

Best for: Developers wanting an out-of-box solution.

Trade-offs:

  • (+) Zero configuration
  • (+) Seamless broadcasting
  • (+) Visual comparison of outputs
  • (-) Depends on tool’s development
  • (-) Less customization than DIY

Approach 2: Terminal Multiplexer + Scripts

Maximum control with tmux and custom scripts.

Best for: Terminal power users and SSH workflows.

Trade-offs:

  • (+) Full control over workflow
  • (+) Works over SSH
  • (+) Highly customizable
  • (-) Steeper learning curve
  • (-) Manual configuration required

Approach 3: Custom Orchestration

Build your own broadcasting system with shell scripts or a small application.

Conceptual orchestration pattern
interface AgentHarness {
name: string
worktree: string
command: string
status: 'idle' | 'running' | 'completed' | 'error'
}
interface BroadcastResult {
agent: string
output: string
filesChanged: string[]
executionTime: number
}
async function broadcastToAgents(
prompt: string,
harnesses: AgentHarness[]
): Promise<BroadcastResult[]> {
const results = await Promise.all(
harnesses.map(harness => executeInWorktree(harness, prompt))
)
return results
}
// Usage
const results = await broadcastToAgents(
"Add input validation to all API endpoints",
[claudeCodeHarness, codexHarness, gooseHarness]
)
// Compare and select best implementation
const bestResult = selectBestImplementation(results)

Best for: Teams with specific workflow needs.

Best Practices

1. Use Descriptive Worktree Names

Worktree naming convention
# Include feature name and agent
git worktree add ../myapp-auth-claude feature/auth-claude
git worktree add ../myapp-auth-codex feature/auth-codex
# Not: ../worktree1, ../worktree2 (too vague)

2. Clean Up After Comparison

Removing worktrees after evaluation
# After choosing the best implementation
git worktree remove ../myapp-auth-codex
git worktree remove ../myapp-auth-goose
# Keep only the winner
git worktree remove ../myapp-auth-claude
# Then merge the feature branch

3. Set Token Budgets

Different models have different costs. Set limits per agent:

Cost optimization
Claude Opus: $15/M input → Use for complex reasoning
Claude Sonnet: $3/M input → Use for routine tasks
GPT-4o: $5/M input → Use for comparison
Local models: $0/M input → Use for experimentation

4. Document Agent Strengths

Keep notes on which agent performs best for specific tasks:

Agent capabilities log
| Task Type | Best Agent | Notes |
|------------------------|---------------|--------------------------|
| Architecture decisions | Claude Code | Better reasoning |
| Quick fixes | Codex CLI | Faster response |
| Local experimentation | Goose | No API costs |
| Security review | Claude Code | More thorough analysis |
| Documentation | Any | Comparable results |

5. Verify Before Merging

Always test the chosen implementation before merging:

Pre-merge verification
# Run tests in the winning worktree
cd ../myapp-auth-claude
npm test
npm run lint
# Then merge
git checkout main
git merge feature/auth-claude

When to Use Multi-Agent

Multi-agent shines when:

  • Evaluating different architectural approaches
  • Cross-validating security-sensitive code
  • Comparing model capabilities on your codebase
  • Teaching yourself different implementation patterns
  • Working on high-stakes features where mistakes are costly

Single agent is fine for:

  • Routine bug fixes
  • Simple refactoring
  • Documentation updates
  • Quick prototyping
  • Low-risk changes

Summary

I integrated multiple AI coding agents because I wanted second opinions without the manual overhead. The multi-harness approach transformed my workflow from serial to parallel.

Key takeaways:

  1. Worktrees enable isolation - Each agent works independently without conflicts
  2. Broadcasting saves time - One prompt, multiple perspectives
  3. Cross-validation catches issues - What one agent misses, another catches
  4. Provider flexibility matters - Don’t lock into a single AI provider
  5. Start simple - One harness, then add more as needed

The Reddit insight that stuck with me: “auto validation and auto review do amazing things.” Multi-agent isn’t just about productivity. It’s about code quality through diverse perspectives.

For developers serious about AI-assisted coding, the multi-harness approach turns isolated AI tools into a collaborative development team.

Final Words + More Resources

My intention with this article was to help others share my knowledge and experience. If you want to contact me, you can contact by email: Email me

Here are also the most important links from this article along with some further resources that will help you in this scope:

Oh, and if you found these resources useful, don’t forget to support me by starring the repo on GitHub!

Comments