coding

Claude's Agent System Reverse-Engineered as Open Framework

A developer reverse-engineered Claude Code's multi-agent orchestration patterns from leaked source maps and released them as an MIT-licensed TypeScript

Claude Code Architecture Rebuilt as Open Framework

What It Is

A developer reverse-engineered the multi-agent orchestration patterns from Claude Code’s leaked source maps and released them as open-multi-agent, an MIT-licensed TypeScript framework. The project extracts the coordination logic that powers Claude’s agent teams—task decomposition, inter-agent communication, dependency management—and makes it work with any LLM provider.

The framework centers on four components: a Coordinator that breaks complex goals into discrete tasks, a MessageBus paired with SharedMemory for agent-to-agent communication, a TaskQueue managing execution order based on dependencies, and a defineTool() function using Zod schemas for type-safe tool definitions. Unlike wrapper libraries that shell out to CLI tools, this runs entirely in-process, making it viable for serverless functions, Docker containers, and CI/CD pipelines where subprocess spawning creates overhead.

At roughly 8,000 lines of TypeScript, the implementation demonstrates how Claude Code’s internal architecture handles the orchestration problem—routing subtasks to specialized agents, maintaining shared context, and coordinating parallel work streams. Developers can now apply these patterns to OpenAI models, Anthropic’s API directly, or local models without being locked into a specific provider.

Why It Matters

Multi-agent systems typically require custom orchestration code for each new project. Teams build ad-hoc solutions to split work between specialized agents, manage shared state, and handle task dependencies. This framework codifies a proven architecture from a production system, saving teams from reinventing coordination logic.

The model-agnostic design addresses a practical constraint: most organizations use multiple LLM providers based on cost, capability, or compliance requirements. A framework that works across Claude, GPT-4, and open-source models lets teams experiment with different providers for different agent roles without rewriting orchestration code. A code review agent might use Claude while a data extraction agent uses a cheaper model.

For researchers studying agent architectures, having Claude Code’s coordination patterns in readable TypeScript provides concrete implementation details. The leaked source maps revealed high-level structure, but this project translates those patterns into working code with explicit design choices around message passing, state management, and task scheduling.

The in-process execution model matters for deployment flexibility. Serverless platforms like AWS Lambda and Cloudflare Workers impose strict limits on subprocess creation. Running agents as in-process TypeScript objects rather than spawned CLI tools means the framework works in constrained environments where traditional agent frameworks fail.

Getting Started

Install the package from the GitHub repository at https://github.com/JackChen-me/open-multi-agent:

A basic coordinator setup looks like this:


const searchTool = defineTool({
 name: 'search',
 schema: z.object({
 query: z.string()
 }),
 execute: async ({ query }) => {
 // Tool implementation
 }
});

const coordinator = new Coordinator({
 agents: [
 { role: 'researcher', model: 'claude-3-opus' },
 { role: 'writer', model: 'gpt-4' }
 ],
 tools: [searchTool]
});

await coordinator.execute('Research and write an article about WebAssembly');

The coordinator automatically decomposes the goal into tasks, assigns them to appropriate agents based on role, and manages execution order. Agents communicate through the shared message bus, with the coordinator handling task dependencies.

Context

Existing multi-agent frameworks like LangGraph and AutoGen take different architectural approaches. LangGraph models agent workflows as state machines with explicit edges between nodes, giving developers fine-grained control but requiring more upfront design. AutoGen focuses on conversational patterns between agents with built-in debate and consensus mechanisms.

open-multi-agent sits between these extremes—more automated than LangGraph’s manual graph construction, more structured than AutoGen’s conversational approach. The coordinator handles decomposition automatically but exposes the task queue and message bus for customization when needed.

The framework inherits limitations from its source architecture. Task decomposition quality depends entirely on the coordinator’s LLM—poor decomposition cascades into inefficient agent utilization. The in-process design trades deployment flexibility for scalability; truly massive agent workloads might benefit from distributed architectures with separate processes.

Teams already invested in LangChain or Semantic Kernel face migration costs. The framework works best for new projects or teams specifically wanting Claude Code’s coordination patterns without Claude Code itself.