Multea is a terminal-based multi-agent orchestrator that runs Anthropic's Claude Code agents across multiple repositories with a unified Terminal UI (TUI) and a top-level AI coordinator. This document provides a brief overview of its architecture.
The system is built as a monolithic Node.js application utilizing React and Ink for the terminal interface. It acts as a sophisticated wrapper and orchestrator for the @anthropic-ai/claude-agent-sdk, allowing users to spawn, manage, and coordinate multiple LLM-driven agents concurrently.
-
Terminal UI (
src/app.tsx,src/components/)- Built with React and Ink, rendering a rich terminal interface.
- Manages the visual layout including panes for standard input (command bar), agent outputs, orchestrator chat, tasks, and file browsing.
- Listens to internal events emitted by the
AgentManagerandOrchestratorto update UI state (e.g., streaming agent output, task progress).
-
AgentManager (
src/core/agent-manager.ts)- Acts as central registry and controller for all active project agents.
- Maintains a map of
AgentRunnerinstances (one per registered project). - Handles the task queue, resolving dependencies between tasks, and dispatching tasks to the appropriate idle agents.
- Emits unified events (
agentStateChange,agentOutput,taskComplete) that drive the UI.
-
AgentRunner (
src/core/agent-runner.ts)- The execution engine for a specific project workspace.
- Wraps the
@anthropic-ai/claude-agent-sdk'squeryfunction. - Manages the interaction loop with Claude Code: passing prompts, handling permissions, keeping track of sessions, buffering outputs, and parsing structured LLM responses (text, tool uses, tool results, errors).
- Supports execution control mechanisms like pause, resume, and abort.
-
Orchestrator (
src/orchestrator/index.ts)- The top-level coordinator of the system, capable of understanding higher-level instructions.
- Translates human instructions / slash commands (e.g.,
/dispatch,/broadcast) into structured tasks. - Includes a Scheduler and DAG Planner (
src/orchestrator/scheduler/) for resolving complex task dependencies and determining execution order. - Uses an EventBus to facilitate decoupled communication between modules.
- Stores workspace state and execution plans in a MemoryStore.
- Initialization: The app reads
multea.config.jsonto load registered projects and initializes instances ofAgentManagerandOrchestrator. - Scheduling a Task:
- A user types a prompt or a command (like
/dispatch frontend Fix button) in the command bar. - The
Apppasses the prompt toAgentManagerwhich enqueues aTaskItem. - If there are dependencies (e.g.,
AFTER:1,2), the task remainsblockeduntil prerequisites complete.
- A user types a prompt or a command (like
- Execution:
- When an agent is idle and has a
pendingtask,AgentManagercallsAgentRunner.sendPrompt(). AgentRunneropens an async stream via the Claude Agent SDK setting the specific project'scwd.- As chunks arrive from the LLM,
AgentRunneremitsoutputevents. AgentManagerforwards these events to the React UI, which updates the agent's specific terminal pane.
- When an agent is idle and has a
- Completion:
- Upon success or error, the
AgentRunneremits adoneevent. AgentManagermarks the task complete, unblocks any dependent tasks, and tries dispatching the next task in the queue.
- Upon success or error, the
- Runtime: Node.js
- UI Framework: React & Ink (React renderer for terminal)
- Language: TypeScript
- AI Integration:
@anthropic-ai/claude-agent-sdk(powers individual agents) - State Persistence: Local JSON state file (
.multea-state.json) and configuration (multea.config.json)