Articles/AI Architecture

From tmux to DBOS — Rebuilding a Build Pipeline on Postgres

AI ArchitectureArchitecture Pattern
By Vanya SmytheApril 25, 20269 min readVerified Apr 25, 2026
dbos(primary)windmill
ai-architecturedbosboris-workflowmulti-agentclaude-codedurable-executionpostgresiwo

What I'm running

I build ebatt.ai with a pipeline of eight AI agents. They are a planner, a builder, a reviewer, an injected security stage, a tester, a deployer and a docs agent, plus a spec-author that turns a plan into specs. Each agent is a Claude session, and they pass structured handoff files to one another. When I first wrote this article there were six agents. The pattern is Boris Cherny's and the implementation is mine. I call it IWO, short for Ivan's Workflow.

Each agent runs in its own tmux pane. It picks up the latest handoff for its role, does its work and writes the next handoff. A daemon watches the handoff directory and starts the next claude -p call when a new handoff arrives.

For most of 2026 the daemon was a long-running Python process. It kept everything in memory and saved just enough to a reconciliation file, .active-specs.json, to survive a restart. It worked, and it also failed in ways that wasted real money and time. The failures were the ones you would predict if you have ever shipped a daemon that holds state. The state was in RAM, side effects had no checkpoints, and no wait survived a restart.

This article describes how I replaced that daemon with DBOS, a library that records each step of a workflow in Postgres. It also describes what changed in the way I develop ebatt.ai.

The four things the legacy daemon could not give me

Resuming a spec after a laptop reboot

If the daemon died in the middle of a spec, I came back to a workflow that had partly advanced. The handoff files on disk did not match the state that had been in memory. The .active-specs.json file was meant to bridge the gap. It lagged the real state by the time since the last checkpoint, which was rarely the right amount. I patched the file by hand or killed the spec and restarted it. Either way I lost work.

Waiting for a human approval that might take hours

The Reviewer agent often raises a blocker that needs my judgment. It may be a scope question, a risk to acknowledge, or a decision on whether I really want a dependency. The legacy daemon handled this with a polling loop. Every minute it checked the directives directory for a file that matched the spec. If the laptop slept overnight, the loop slept too. A directive I saved at 9 PM was not picked up until I unlocked the screen the next morning. Worse, if the daemon crashed during the wait, the spec was orphaned and I had to re-arm it by hand.

Not paying twice for the same Claude call

claude -p calls are not free. In the legacy daemon there was a gap between the moment an agent finished and the moment its handoff was written and the state was checkpointed. The gap was small but real. If the daemon crashed in that gap, the next start sent the same agent the same input again. That cost the same tokens, the same dollars and the same time. It also carried a risk, because the second answer could differ slightly from the first, and the next agent would reason from it.

Debugging a stuck spec without grep

When a spec was stuck, my debugging tool was grep over the handoff files and the Python logs. I could see what had happened. I could not easily see what the daemon believed was in progress, which agent it expected to start next, or why it was waiting. To add a metric I had to edit the daemon's code and restart it, and that restarted the thing I was trying to debug.

Why DBOS was the right answer (and not Temporal, Inngest, or just-write-it-better)

I looked at the alternatives. The shortlist was Temporal, Inngest, and fixing the existing Python daemon.

Temporal is too much to run in my situation. It needs a separate cluster that I would have to run, monitor and understand. It assumes a workflow team, and I have a laptop and a Proxmox server.

Inngest suits workflows that are triggered over HTTP and finish quickly. Mine run for a long time, sometimes days. They are triggered by file-system events and they start shell processes. Inngest is designed for a different kind of workflow.

Fixing the Python daemon meant building what DBOS already provides: a durable execution log, steps that replay without repeating their work, and a wait that survives a restart. I would have ended up with a worse version of DBOS, written by me in my spare time and debugged in production.

DBOS is a library. You decorate Python functions, the state is kept in Postgres tables that I already understand, and there is no separate service to run. There is no vendor lock-in either. If I removed DBOS tomorrow, my data would still be in Postgres rows that I can read. That is the reason I chose it.

What changed for ebatt.ai development

The rebuilt IWO has been the only pipeline since the cutover, and the legacy daemon is deleted. As of September 2026 the orchestrator (v0.2.97) runs four projects, and ebatt.ai is one of them. I have measured four specific differences.

Specs survive when I close my laptop. I close the lid, get on a train and open the lid four hours later. Whatever spec was running when I closed it continues from its last completed step. There is no reconciliation file to edit by hand and no agent is sent out again, because the Postgres rows record exactly where the workflow was.

Approval prompts wait for me. When a Reviewer raises a blocker, the workflow calls DBOS.recv(timeout_seconds=...) and pauses. I get a Telegram notification with the question, and I answer when I can. The deadline is stored in Postgres. It is still correct after a reboot, after a network fault, and after systemd has killed and restarted the daemon process.

I no longer pay twice for a model call. Every claude -p call is wrapped in a checkpointed step. Suppose the workflow crashes after Claude returns but before the handoff is on disk. On the next start, the replay finds the stored output of that step, skips the call and continues. I used to pay for the same agent twice occasionally. Now I never do. Across a busy week of ebatt.ai work, that is a measurable saving.

Debugging is SQL. When I want to know what is stuck, I run a SELECT against the workflow status table. I can see every workflow, its current step, the time it last advanced and the inputs it received. I now have a small dashboard for this. It took an evening to build, because the data underneath is only rows.

The pattern, generalised

Without the IWO details, the architecture is small:

  1. The workflow body is deterministic. The workflow function does no I/O directly. Every side effect is a step.
  2. Steps are idempotent and checkpointed. A step writes its output to Postgres before it returns. A replay finds the stored output and skips the work.
  3. Human approval is built in. The wait is durable, because the deadline and the buffered response are stored in Postgres.
  4. State can be queried. You debug with SELECT, not with stack traces.

This is not specific to multi-agent build pipelines. It applies to any long-running process where a wrong replay costs more than one extra Postgres row per step. A wrong replay might send a duplicate email, charge a customer twice or waste a model call. That describes most long-running processes.

What it took to get here

The IWO rebuild took about three weeks of evening work, in phases. The legacy daemon kept running in production the whole time.

  • Phase 0: agree the scope, draft the plan and set up the Postgres schema, which DBOS creates automatically.
  • Phase 1: port the state engine. What had been a Python class became DBOS-decorated functions.
  • Phase 2: port the dispatcher and the human-approval wait. All 9 unit tests passed. This is where DBOS proved its value. DBOS.recv replaced about 200 lines of polling loop and timeout bookkeeping with one call.
  • Phase 3: real claude -p calls through tmux panes, a shadow run against live ebatt.ai specs, then the cutover.

The shadow run completed a clean week in production. I then pointed the launcher at the new pipeline, and I deleted the legacy daemon after its rollback week. Since then the pipeline has gained four things. The orchestrator inserts a security stage that no agent can skip. A programme layer breaks a plan into a dependency graph of specs and puts a gate on each one. The deployer's claim of success is checked against the remote tree. There are thirteen named reasons for a halt. The current account, including the failures, is on the Dark Software Factory page.

What I would tell someone starting this today

If you run an agentic build loop at any scale and have had any of the four problems above, the rebuild is worth doing. DBOS is not magic. The reason is that an in-memory daemon fails more often the more you rely on it. Every spec you run is a chance to lose state at a point that had no checkpoint. Better discipline does not fix that. Durable execution does.

If you are not yet at that scale, it is fine to stay with the simpler tool for now. You can make the change when you need it. I would not build the durability features myself. There are many cases of the form "what happens if this step crashes between these two writes", and they are hard to get right. I am not smarter than the people who wrote DBOS.

The unglamorous truth

Most of what makes the rebuilt IWO useful is not the AI agents. It is the plain infrastructure under them: the durable wait, the idempotent step and the state I can query. The agents are the part a reader finds interesting. The infrastructure decides whether I can trust the system to run unattended on my laptop while I am on a train.

ebatt.ai ships because that infrastructure works. The agents build it. The infrastructure is the reason I can sleep through a build cycle.

Subscribe to engineering insights

Get notified when we publish new technical articles.

Topics

Unsubscribe anytime. View our Privacy Policy.