← Fred Luz macx-tmux

January 2026

Parallel AI Agents,
Each With Their Own Context

An MCP server that spawns multiple AI agents in tmux sessions. They run in parallel, maintain separate contexts, and report back with structured signals.

I built this in January 2026 as part of the MACX Exocortex. The pattern: an orchestrator dispatches task agents, waits for all to complete, reviews results, iterates. No context pollution between tasks. No sequential bottleneck.

The pattern

orchestrator.ts
// Dispatch tasks in parallel
spawn("auth-api", "Build JWT middleware...", workdir)
spawn("db-schema", "Create user tables...", workdir)
spawn("tests", "Write integration tests...", workdir)

// Wait for ALL to complete
results = read(names: ["auth-api", "db-schema", "tests"])

// Each result has a signal prefix:
// === auth-api ===
// [COMPLETE] JWT middleware implemented...
//
// === db-schema ===
// [QUESTION] Should users table have soft delete?
//
// === tests ===
// [TEST_FAILED] 2 assertions failed...

Parallel execution

Tasks run simultaneously in separate tmux panes. No waiting for one to finish before starting the next.

Isolated contexts

Each agent has its own conversation. No context pollution. The auth agent doesn't see the database agent's work.

Structured signals

Agents report completion status. The orchestrator knows what succeeded, what failed, what needs input.

Signal classification

Every read() response is prefixed with a signal. The orchestrator can branch on these without parsing natural language.

[COMPLETE] Agent reported task complete
[QUESTION] Agent needs clarification
[NEED_HELP] Agent is stuck
[TEST_FAILED] Test failures detected
[TYPE_ERROR] TypeScript errors found
[DONE] Session finished normally

Multi-model support

Dispatch to different AI CLIs based on the task. Claude for complex reasoning, Codex for autonomous shell work, Gemini for variety.

// Same task, different models
spawn("impl-claude", prompt, workdir, model: "claude")
spawn("impl-codex", prompt, workdir, model: "codex")
spawn("impl-gemini", prompt, workdir, model: "gemini")

// Compare approaches
results = read(names: ["impl-claude", "impl-codex", "impl-gemini"])

Agent profiles

Inject identity and skills into agents via JSON profiles. A "test-writer" agent knows testing best practices. A "supabase" agent knows RLS patterns. The profile goes into the system prompt; the task goes into user input.

Profile structure

{
  "identity": "You are a test writer...",
  "skills": [
    { "name": "vitest", "content": "..." },
    { "name": "testing-patterns", "content": "..." }
  ]
}

Usage

spawn(
  "write-tests",
  "Write tests for auth module",
  workdir,
  agent: "test-writer"
)

Development timeline

January 26, 2026

Forked claude-tmux, added 30-minute timeout for complex coding tasks. First parallel agent dispatches working.

January 27, 2026

Added multi-model support (Codex, Gemini). Signal classification for structured output parsing. Agent profile injection.

January 29, 2026

TUI timing fixes for Codex/Gemini. Workdir tilde expansion. All 12 tests passing.

February 1, 2026

TEST_FAILED and TYPE_ERROR signals with failure detail extraction. Production use in MACX forge workflow.

Open source

Fork of claude-tmux by Ilm-Alan. MIT licensed.

View on GitHub