Structure Over Prompts
Deterministic control beats intelligent coordination.

I needed a system that runs multi-stage AI pipelines — content workflows, code builds, anything with sequential steps and quality gates. The obvious move: build an AI agent that manages other AI agents. Route work, handle transitions, decide when to advance.
I built a state machine instead.
The Problem with AI Orchestration
When you use an AI agent to coordinate other AI agents, you’re spending tokens on traffic control. The orchestrator doesn’t write code or produce content — it decides what happens next. That decision is almost always deterministic: stage A passes, advance to stage B. Stage B fails, stop.
An LLM does not need to make that call. A switch statement does.
But the real problem isn’t cost. It’s trust. An AI orchestrator can hallucinate a transition. It can decide stage 3 is “close enough” and skip to stage 5. It can misinterpret a failure as a success. Every judgment call at the orchestration layer is a place where the pipeline can silently break.
Foreman — the tool I built for this — takes the opposite approach. The runner is a deterministic state machine. Zero orchestration tokens. No AI between stages. The server validates every transition: agents call advance_stage() when they’re done, and the server checks whether that transition is legal. If it’s not, it doesn’t happen.

Structure enforced by code. Judgment local to each agent.
Where AI Judgment Actually Belongs
The agents inside each stage still use full LLM capabilities. A content writer agent reads findings, calibrates voice, produces drafts. A code review agent reads diffs, checks conventions, flags issues. They make real judgment calls — the kind that benefit from language understanding and context.
But they make those calls within a stage. They can’t skip ahead. They can’t reorder the pipeline. They can’t decide they know better than the workflow definition.
This is the distinction that matters: AI is excellent at judgment within constraints. It’s unreliable at defining the constraints themselves. So you let code handle the structure and AI handle the substance.
Identity by Architecture

Each agent in a Foreman pipeline gets its own MCP server instance. The server is initialized with the agent’s build_id and stage_label — baked in at spawn time. The agent never passes these as parameters. It can’t misidentify itself, log to the wrong stage, or manipulate state outside its scope.
Not because the prompt says “don’t do that.” Because the architecture makes it impossible.
The spec works the same way. When a build starts, Foreman reads the spec from disk and freezes it in SQLite. Agents read the frozen copy. The spec can’t change mid-build — not because agents are told not to change it, but because there’s no mechanism to change it.
Every constraint that matters is structural, not instructional. Prompts are suggestions. Architecture is enforcement.
The Pattern Is the Point
The specific implementation — MCP servers, SQLite with WAL mode, Claude CLI subprocesses — is one version. The pattern is what generalizes.
Any multi-step workflow where you want AI judgment within stages but deterministic control over transitions can use this approach. Code builds. Content pipelines. Sales processes. Onboarding flows. The runner doesn’t care what agents do inside a stage. It cares that stages happen in order and transitions are earned.
I’m already using the same pattern for this content pipeline. A session miner extracts findings from my coding sessions. A content judge scores them. A writer produces drafts. A reviewer checks quality. Each stage is an AI agent making real judgment calls. The transitions between them are just code.
What This Means for Builders
The instinct right now is to solve coordination problems with more AI. Agent frameworks are everywhere — tools for building agents that manage agents that manage agents. Each layer adds latency, cost, and failure modes.
The counter-intuitive move: make the orchestration layer dumber. Rigid. Deterministic. Spend zero tokens on “what happens next” because that answer should never require intelligence. Save the AI budget for the stages where judgment actually matters.
The best AI systems I’ve built aren’t the ones where AI does the most. They’re the ones where AI does the least — in exactly the right places.
Keep reading
- 10,600 Trajectories: Mutation Testing in a Video Game Pure Inference A harness flies each Kepler mission thousands of times with randomised inputs, then searches for the cheapest solution. It answers whether the puzzle has a solution at all — and it is what agentic engineering actually looks like: not generation, search.
- The Undocumented iOS Limit That Rewrote My Architecture Pure Inference I needed two concurrent speech recognition streams. Apple's docs don't mention you can't have them — the second start silently kills the first.
- Designing a Test Runner for AI Agents Pure Inference Seven stuck Ruby processes, running for hours, holding database connections. The agent that spawned them had moved on, oblivious.