1
0 Comments

From spaghetti to a main bus: refactoring my AI agent orchestrator

My AI agent orchestrator (drafts PRDs, writes code, reviews PRs) grew into spaghetti, with silent fallbacks, dropped issues and PR ping-pong burning precious Claude tokens. Each new workflow added an if-statement here and a fallback there. Touching it became open chest surgery.

I spent a couple of weeks rejigging it around the Elm architecture. A pure reducer ("decide()") takes the current state plus an event and returns the next state and a list of side effects as plain data. An interpreter performs them. When something breaks there are exactly two places to look.

Full write-up: https://blog.mariohayashi.com/p/the-factory-must-grow-part-ii-from

on April 28, 2026