Skip to main content
coreydaley.dev

A pipeline engine in a day

Sixteen commits landed in my new repository today in seventy-two seconds. The first initialized a Gradle project. The last added an example pipeline. In between: a parser, a linter, an execution engine, nine node handlers, three LLM adapters, persistence, a live dashboard, and a CLI. About 10,500 lines of Kotlin.

Nobody types that fast. Every one of those commits carries a Co-Authored-By: Claude Sonnet 4.6 trailer, and so does every commit after them, thirty by tonight. And the seventy-two seconds are a little misleading, which I’ll get to.

What I’m building, and whose idea it is

The project is Attractor. The idea is not mine. It comes from StrongDM’s Software Factory and their Attractor project: a pipeline runner where you describe a workflow as a Graphviz DOT directed graph, and the engine walks it, sending work to LLMs, pausing at human gates, and branching on conditions. StrongDM wrote a detailed spec for it. Mine is a personal implementation of that spec in Kotlin on the JVM, a way to learn how agentic orchestration works by building one.

That framing matters for reading the code. Comments like // Core execution loop (Section 3.2) and Implements the 5-step edge selection algorithm from Section 3.3 point at sections of StrongDM’s spec. The shape of the engine is theirs. The Kotlin, and its mistakes, are mine and Claude’s.

A pipeline is a graph

Here’s the branching example that ships in examples/:

digraph Branch {
    graph [goal="Implement and validate a feature"]
    start     [shape=Mdiamond]
    exit      [shape=Msquare]
    implement [label="Implement", prompt="Implement: $goal"]
    validate  [label="Validate",  prompt="Run tests"]
    gate      [shape=diamond, label="Tests passing?"]
    start -> implement -> validate -> gate
    gate -> exit      [label="Yes", condition="outcome=success"]
    gate -> implement [label="No",  condition="outcome!=success"]
}

A node’s shape picks its handler:

ShapeHandler
Mdiamond / MsquareStart / exit
box (default)LLM stage
diamondConditional
hexagonWait for a human
component / tripleoctagonFan out to parallel branches / fan back in
parallelogramShell tool
houseManager loop supervising a child pipeline

An explicit type= attribute overrides the shape.

The path a pipeline takes

The architecture is a straight line from text to execution.

Parse. dot/ holds a hand-written lexer and parser that produce a DotGraph. Attribute values are typed (string, integer, float, boolean, and duration), so timeout="5m" arrives as a duration, not a string to be re-parsed later.

Transform. Two transforms in transform/ run before anything executes. One substitutes $goal into prompts. The other is the most surprising idea in the spec: a CSS-like model stylesheet. Universal, class, and id selectors with specificity ordering set llm_model, llm_provider, and reasoning_effort across the graph, without overwriting anything a node sets explicitly. Pick the model for every review stage the way you’d style every button.

Validate. lint/ runs a rule set over the graph. Errors abort the run: no start or exit node, unreachable nodes, edges to nodes that don’t exist, malformed conditions. Lesser problems are reported as warnings. A bad graph fails before it costs you an API call.

Execute. Engine.kt follows the spec’s loop almost line for line. For each node, it:

  1. stops if the node is terminal,
  2. runs the node’s handler under a retry policy,
  3. records the outcome,
  4. applies the outcome’s context updates,
  5. saves a checkpoint,
  6. selects the next edge,
  7. handles loop_restart by starting a fresh run,
  8. advances.

Retries back off exponentially with jitter, nodes can carry a timeout, and a node marked goal_gate must have succeeded before the pipeline is allowed to exit.

Route. EdgeSelector.kt picks the next edge by priority: first an edge whose condition matches, then one whose label matches the outcome’s preferred label, then a suggested next node, then the highest-weight unconditional edge, and finally a lexical tiebreak so the choice is always deterministic. The condition language is the spec’s and it’s deliberately small: =, !=, &&, bare-key truthiness, and lookups against outcome, preferred_label, and context.*. No arithmetic, no functions. Routing you can read at a glance is routing you can review.

Remember. state/ holds a thread-safe Context behind a read-write lock, an Outcome per stage, file-backed checkpoints for resume, and an artifact store. Every state change is also a typed PipelineEvent on an event bus, which is how the rest of the system watches without the engine knowing it’s being watched.

How it actually got built

Now the misleading part. The commits say today. The sprint ledger in docs/sprints/ says Sprint 001 opened yesterday afternoon, and its intent document describes an engine and dashboard that already existed and needed their real-time updates fixed. It also says “No prior sprints in this project.” The engine predates both the sprint process and the repository, and neither one records how long that first version took. Sprints 002 through 004 ran late last night; 005 and 006 ran earlier today. The sixteen-commit burst is a snapshot of all that uncommitted work, split into reviewable pieces after the fact. So: about a day, give or take a first draft that git never saw.

What the repo does record is the process. Every sprint starts as a seed from me, usually a single unpolished sentence. Sprint 007’s was this:

if a stage fails, the pipeline run should stop and the system should try to figure out what went wrong, decide if it can fix it or not, and then fix the issue and rerun or just stop and log the error

From the seed comes an intent document. Then Claude writes a plan, Codex writes a competing plan, Codex critiques Claude’s, and a merge note records which critiques were accepted, which were rejected, and why. Sprint 001’s merge note is a good example. Codex argued that a one-second SSE heartbeat was too aggressive with several browser tabs open; that was accepted, and the heartbeat became two seconds on a shared timer. Codex also called Claude’s transport claims “over-confident”; that was rejected as a style note, since the draft already hedged. Then the code gets written.

Sprint 007 turned that seed into a failure diagnoser that classifies a failure as retry-with-hint, skip, or abort, and writes a failure_report.json when it gives up. Sprint 008 cut SSE broadcast storms and moved SQLite to WAL mode. Sprint 009 added 53 unit tests for modules that had only been tested by accident, taking the suite past a hundred test cases.

My favorite artifact from today is one I’ve already deleted. spec-audit.dot was an Attractor pipeline for auditing Attractor against StrongDM’s spec, one section per node, ending in a gap report. Its final prompt lists eight confirmed gaps, and the first is a good joke at the engine’s expense: “CodergenHandler always uses SimulationBackend.” An engine whose LLM stages only simulated couldn’t have run that audit for real, and the repo doesn’t record how those gaps were first confirmed. What it does show is that all eight have an implementation in what got committed, from checkpoint resume to parallel branch traversal, and I removed the pipeline a couple of hours later.

The parts around the engine

Handlers. Most are small. Start and exit are no-ops. The parallel handler runs each branch on a coroutine with its own cloned context, bounded by max_parallel, with join policies like wait_all, first_success, k_of_n, and quorum. The interesting one is the LLM stage’s backend, which gives the model workspace tools: read and write files, list them, and run shell commands, up to 15 tool rounds per stage.

That last tool deserves a plain warning. run_command runs /bin/sh -c with the run’s workspace as its working directory and a 120-second timeout. A working directory is not a sandbox. The same goes for the parallelogram tool node, which runs whatever tool_command the graph says through the same shell. Point this at a graph you didn’t write, or a model you don’t trust, and it can do anything your user account can do. Run it in a container or a throwaway VM.

Humans. A wait.human node asks its question through an Interviewer, and there are five implementations: console, auto-approve, queue (for tests), recording, and a callback for the web UI. The web runner currently wires in auto-approve, so gates pass straight through. The abstraction is in place; the web prompt is not. That one’s next.

Models. llm/ is a provider-agnostic client over OkHttp with adapters for Anthropic’s Messages API, OpenAI’s chat completions, and Gemini’s generateContent, plus a catalog mapping model IDs and aliases to providers. Without an API key, stages fall back to a simulation backend that returns canned responses, so you can run a whole pipeline before you’ve spent a cent.

Persistence and dashboard. RunStore keeps runs in SQLite, and on startup any run still marked running is marked failed, because a run that was mid-flight when the process died did not, in fact, finish. The dashboard runs on the JDK’s built-in HTTP server on port 7070. Each pipeline gets its own thread and tab, and stage updates stream to every open browser over Server-Sent Events. The entire UI, HTML, CSS, and JavaScript, lives as a string inside one Kotlin file of nearly 3,900 lines. That is not an architecture I’d choose on purpose. It is one that lets an agent change the server and the page in a single edit, and for now that tradeoff wins.

What I’m taking away

Speed is the headline, but it isn’t the lesson. A spec plus a disciplined loop did most of the work: seed, intent, two plans, a critique, a merge, code, tests. The spec told the agents what correct looked like. The loop kept them from wandering, and the critique step caught things a single agent would have shipped.

My job was writing the seeds, answering the planning questions, and deciding when something was done.

The README says plainly that the whole codebase was generated by AI and shouldn’t be trusted without review. I mean it, and the shell tools above are the first place I’d look. Ten thousand lines in a day is a starting point for scrutiny, not a substitute for it.

The hardest part of this project was written by someone else: StrongDM’s spec. If agents can turn a good spec into working code this quickly, is the scarce skill on your team writing the code, or writing the spec?

Related posts