From a single loop to a coding-agent harness
What running a minimal coding agent forces into its harness: sub-agents as context isolation, resource-keyed parallel tool calls, and deterministic course correction.

Ask a coding agent where a function is defined and it will read a dozen files to locate it, leaving all of them in its context window for the rest of the session. A ReAct loop of think, act, and observe fits on a single page, which makes keeping one loop look sufficient and agent hierarchies look like complexity to avoid. Running it against real repositories surfaces what that page omits: routine reads that never leave the context, and multi-tool turns where the harness must govern concurrency. The design work sits in the harness rather than the loop, and the surest way to learn which pieces it needs is to start from a minimal agent and run it.
Between December 2025 and January 2026, while working in developer relations before joining a company that builds coding agents, I wrote Foundry to see how they work from the inside, studying public agents like Claude Code, Codex CLI, and Amp alongside open-source harnesses. Foundry is a TypeScript command-line coding agent running on Claude, equipped with file read and write, search, shell, and web tools, plus sessions that persist and resume. I built and tested it locally as a personal harness rather than a production service; starting from a deliberately minimal single loop, the codebase reached about 12,000 lines within three weeks, which is about as minimal as a working harness stays.
Sub-agents as context isolation
My initial specification stated the founding rule plainly: “Agents are loops, not trees,” and “No DAG of sub-agents. This is deliberate.” Keeping one loop is a sound default: execution stays predictable, all session state lives in one place, and inspecting or resuming a transcript requires no reconciliation across separate histories.
A couple of weeks of use overturned that rule. Tracing a codebase means pulling in candidate files and dead ends, and in a single loop every token of that traversal stays in the primary history for the rest of the task. Delegating that work is about context isolation rather than modeling an org chart: the parent loop needs the answer, not the files scanned to find it.
Foundry ended up with six sub-agents covering narrow roles, among them read-only search, a read-only advisor, external-repository lookup, and two-phase bulk edits in which a read-only pass lists target files before an editor without a shell applies the change. Each is an ordinary tool running a nested loop with its own prompt, history, tool subset, and turn limit; it cannot start sub-agents and returns only its final message.
Restricting exploratory and advisory sub-agents to read-only tools doubles as a safety boundary enforced by capability rather than prompt wording, an isolation model I carried into later work on parallel sub-agents and autonomous threads. Every tool call, parent or nested, still passes through the same permission layer evaluated outside the model: ordered glob rules over tool name and input where the first match returns allow, ask, or reject.
Scheduling concurrent tool calls
When Claude requests several tools in one turn, executing them serially adds avoidable latency on independent reads, while unconstrained parallelism risks races on shared files. A per-tool concurrency flag is the coarser alternative: marking read tools parallel and mutating tools serial is straightforward, yet it prevents two writes to different files from ever overlapping.
Foundry schedules on declared resource keys instead. Each tool declares the resources a call touches, such as resolved paths for file operations, and whether each access reads or writes. Two calls conflict only if they share a resource key and at least one writes. The scheduler groups the turn’s calls into conflict-free batches, runs each batch concurrently, and executes batches in order. Given calls to read a, read a, write b, and write a, the first three share no conflicting keys and run together while the write to a waits for the next batch.
The limit of declarative keys is the shell tool. Because the harness cannot statically determine what an arbitrary command reads or modifies, shell calls declare nothing and run alongside whatever shares their batch. A later platform toolkit closes that gap by falling back to per-tool concurrency where every sequential call, the shell included, acts as a barrier, trading per-path write overlap for causality safety.
Course correction
A minimal loop also has no defense against spinning on broken tool calls. When an edit stops matching or a command fails on a missing dependency, models often retry variations of the same call, and system-prompt rules against looping lose force once error traces fill recent turns.
Rather than leaving loop detection to the model, Foundry inspects recent tool history deterministically every third turn and injects a correction message if one tool has failed three times in the last ten calls, five calls have failed in a row, or a three-tool sequence has repeated. That heuristic redirects an interactive session without aborting it, while a later rule in the platform toolkit stops recovery altogether after five attempts without a new result.
Chris Chabot, January 2026