Build your coding orchestrator from scratch part 1 A developer has built SpurCode, a terminal-UI coding agent orchestrator that pairs a "brain" coding agent with single-shot worker coding agents, letting one agent family delegate tasks to another (for example, Claude Code handing work to Codex). The design borrows Apache Spark's driver–worker model, keeps a human in the loop through the TUI, and is built on the open Agent Client Protocol (ACP) used by editors such as Zed and JetBrains. The author says the setup addresses weaker same-model code reviews, quota-driven interruptions, and poor context management across multiple agents. Six months ago, I made up my mind to build SpurCode , a TUI coding agent orchestrator, from scratch. At the time, the pain points I was facing on a daily basis mostly came from depending on a single coding agent. It was affecting code quality, productivity, and my ability to stay in a flow state because: - Using the same model family to generate and review code seemed to result in lower-quality code reviews. - Five-hour and weekly quotas kept breaking my flow state. - Context management across multiple coding agents wasn’t effective at the time. Orchestrator The idea behind an orchestrator is simple: you have a team of agents, and you can plan and assign specific tasks to different agents based on their profiles. For example, you might have an engineer agent, a product owner agent, and a sales agent. For each scope of work, you assign the task to a predefined agent. For each agent profile, you can refine: - The prompt the agent’s profile prompt and the specific agent. - The model and the reasoning effort assigned to that agent. - The tools the agent is allowed to use. And yes, many coding agents already support agent orchestration, like Kiro, Claude Code, and Codex, where the main active agent can proactively delegate work to sub-agents. But the coding agent orchestrator I’m trying to build works at a higher level than that. Instead of following the usual main agent → multiple sub-agents model, what I want is: Main coding agent → multiple worker coding agents. So, for example, a Claude Code brain/driver agent could delegate a task to a Codex worker agent. You can see the difference here: - On the left, the brain coding agent is the main interface with the user. It provides the feedback loop between the user and the brain agent. - On the right, the worker coding agent runs a single-shot, task-based session. It receives a task from the brain and asynchronously returns the outcome and artifacts to the brain for review and approval. In my mental modal: - The user me works directly with the brain agent on solutions, task planning, and problem-solving. - The user interacts through the TUI as a chat interface, similar to the chat-based interfaces we use today. - The brain agent provides the interface needed to spin up worker agents based on tasks agreed on by the user and the brain agent. - A worker coding agent should — and must — run a single-task session . - That means there’s no back-and-forth interaction between the brain and the worker while the worker is executing its task receipt. - Once the worker session is done, it reports back to the brain agent for review. - There is an internal feedback loop between brain ↔ worker . And of course, the user can interrupt and take control of that loop through HITL in the TUI: - user ↔ brain agent . This model enables a more autonomous SDLC while still keeping control. Every task should be reviewed by the brain, and HITL stays in charge of critical decisions. The idea comes from Apache Spark , with its driver–worker model. Hint: Spark’s Adaptive Query Execution AQE also gave me a lot of hints for building SpurCode’s planning mode. I’ll cover that in Part 2: the task planner for long-running tasks, planning, and execution. Now that we have a basic understanding of what SpurCode is — a TUI coding agent orchestrator — we can move on to the more technical stuff. ACP Protocol - Build on top of the giant shoulder ACP Agent Client Protocol is an open standard that connects AI coding agents to code editors and IDEs, such as Zed and JetBrains. To me, it looks like a USB protocol that allows an IDE or application to communicate with different coding agents. Why ACP ? At the beginning, I was aware of my own resources and knowledge, and I kept asking myself: - Could I build an entire coding agent from scratch? : - I felt it would be pretty foolish to believe I could build something better than existing, well-known coding agents like Claude Code and Codex. They have far more resources and are already widely adopted. - Could I fork an open-source coding agent like Codex CLI or OpenCode and build on top of it? Maybe. But that would lead to another problem: keeping my fork in sync with the upstream version. At the time, ACP was still at version 0.x.x. It wasn’t stable yet, but it looked very promising because many coding agents were starting to support it. And now, the list is much longer. With ACP, I could immediately have a working coding agent running in the background. Since there were already multiple ACP-compatible agents, the main things I needed to handle were rendering and working with the ACP protocol. The protocol was defined, and existing libraries https://github.com/agentclientprotocol/ could help with it. At the beginning, the architecture was very simple: a TUI to render and display messages from an ACP coding agent. SpurCode would also have a built-in MCP server to provide tools for the brain coding agent to delegate tasks to worker coding agents. Initially, delegation was synchronous. It looked similar to the existing sub-agent model: the brain waited for the worker coding agent to finish Rust - Rataui for TUI The TUI is the main interface between the user and the brain ACP coding agent. Rust had been on my radar for a long time. When I started this project, I barely knew Rust. But I really wanted to learn it and experiment with the beauty of the language. That’s the main reason I chose Rust. Ratatui was also a well-known choice for building TUIs. Why do we need a middle layer after Spur-ACP? Why we need midle layer after Spur-ACP for standardizing to create de-coupling layer Spur-Core to harmonize and standardize The ACP could give out unified about protocol level , but the protocol itself have downside of version pragment and each vender have some change . So, Base on my experience , the down stream the TUI should isolate from the up stream protocol versin deviation , that why we need standardizing layer through the spur-core then after spur-core , you can have standard approach for render to display the ACP messages in TUI with Rataui spur-core is more than just and de-couple layer in context of SpurCode system, but for part 1 , let tactical it as is. At begining , my intending is cover many coding agent as much as possible , that why we have native , json stream or cli wrapper , but eventually , now we most active develop on native acp Because there are many of coding agent overther and each agents have slight different implement, the adjust will go through adapters/ .rs for standardize 1. connection/native.rs — the native path: spec-shaped by construction For a spec-compliant agent, the native connection does no shaping at all — that’s the point. It parses the official JSON-RPC frame directly into the official schema types and forwards: // native.rs essence session notif tx: broadcast::Sender