Openworks

Workers

Two long-running node processes. Both resolve .env.local and every relative path from the repository root, so both must be started from there.

worker.mts

Polls the job queues: intake, chat replies, PR fixes, feeds, insights, the digest, and the stuck-job sweep. Claims a row, marks it with this machine's id, dispatches to an agent CLI, writes the result back.

npx tsx scripts/worker.mts

It watches its own sources and exits when they change, so that a supervisor restarts it. An edit reaches the next run with nothing to do by hand. The corollary: moving a worker file means updating its supervisor definition in the same breath, or the restart lands on a path that no longer exists.

agent-worker.mts

Polls agentRuns for pending rows every five seconds, claims one, spawns a CLI with the MCP server attached, and completes the run. See Agents.

npx tsx scripts/agent-worker.mts

Keeping them up

Started by hand they stay dead once anything stops them, and a worker that has been dead for three days looks exactly like a quiet week. On macOS, deploy/launchd/ has templates that install both as user agents with KeepAlive, which restart them on crash and on login.

Two things about running them supervised:

Machine identity

A worker names itself with OPENWORKS_MACHINE_ID, defaulting to the hostname. This is what a claimed row is stamped with, so it only matters if two of your machines share a hostname.