Brume · Docs
Dev environment

Operate a dev factory

Understand and run an autonomous GitHub agent that works through features and returns pull requests.

In brief

A factory is an autonomous agent that works through GitHub issues with a team of roles, and pushes changes onto a working branch. It never closes a feature; a second agent, EVA, merges those changes to production on approval. The factory will run on a dedicated machine under minimal watch (monitor the logs and handle breaking outages). Not for initial setup, which requires picking a path (Ubuntu v1 or NixOS v2): this page documents how what is already installed works every day.

Initial setup

This page assumes a factory machine already running. To set one up, two paths exist:

The rest of this page covers day-to-day operation once it is in place.

The delivery model

The unit of delivery is the feature — one Feature-type issue, its cards as sub-issues, a feature/<F> branch that survives from card to card, one pull request to the working branch (staging), reviewed in batch.

Pony, the autonomous loop, takes cards one by one. For each, she spawns a fresh orchestrator that assembles a team of roles (analyst, coder, designer, maintainability reviewer, security reviewer, writer). The orchestrator does not push — Pony verifies the orchestrator's artifacts and pushes to feature/<F>. A delivered card is one commit to that branch and one comment on the pull request.

EVA, the second agent, reviews the completed feature when you signal, and she merges to the working branch (staging). Her permissions also allow her to merge to production and tag releases — tasks Pony never has, and no human does by hand.

No columns to maintain: the queue is opt-out — an open issue is work; exceptions (epics, awaiting human input, blockers) are declared with a label (factory:epic, factory:needs-human, factory:blocked).

What protects it

Two things hold the factory in place: a branch separation and an App policy.

The two branches. The machine never writes to main (PRODUCTION) — it writes only to staging (WORK). Pony closes each card as it delivers it, via a comment on the pull request. Only EVA can modify production. It is this separation, not the App's permissions, that protects production: an App's permissions are repository-wide, so contents: write authorizes writing everywhere. Only the branch protection on main holds.

The two Apps. Pony (the loop itself) never merges anything: she commits and she turns. EVA merges, she speaks Slack, she threads decisions. The two have different tokens, different permissions, different identities (pony-brume-agent[bot] and her own). It is this separation that makes possible a human call validating before the merge.

The architecture

The factory runs in a Docker container on a dedicated machine, with three mounts that survive updates:

WhatWhereWhy
Factory state volume/srv/factory/App tokens, secrets, Docker image caches, build caches
Repository clone/srv/factory/workspace/brumethe code it works on, versioned with the tools
Docker socket/var/run/docker.sockit runs the devcontainer's stacks

The container image is your devcontainer's (.devcontainer/Dockerfile) — not for security (the VM handles that), but so its toolchain is exactly yours. An out-of-date build slows it but does not break it: caches live on the volume.

The journal runs on systemd, read via journalctl -u factory-loop on the machine. There is no log file elsewhere — a copy would give two truths of which only one is maintained.

Sizing the machine

The cost comes from builds, not worktrees. A stopped stack uses only disk.

ItemCostNote
One agent path building~4 GB, all coresnext build maxes out six cores alone
One stack running~1 GBbackend, worker, and frontend
PostgreSQL~2 GBone cluster, one database per worktree
Devcontainer image11 GB diskbuilt once, kept between resets

On six cores, plan for two agent paths comfortably, three if squeezing. Beyond that, builds fight for the processor. Writes dominate next build and database clones: prioritize fast storage before adding memory.

What is shared

A router, a cluster, and the heavy services. Worktree stacks publish no ports: everything enters through Traefik, distributed by hostname, and a new container is routed without restart.

Traefik's version is pinned and must not be downgraded. Up to and including v3.3, its Docker provider freezes the client API to a version the daemon rejects: no routes are discovered and everything answers 404, with no error surfaced.

If storage is encrypted

Storage encrypted by passphrase will not unlock at boot. The factory will not restart automatically after a host reboot, regardless of autostart settings. It is a tradeoff between encryption at rest and automatic restart, not a defect — but better to choose it than discover it.

Monitor and operate

The devcontainer exposes factory on the PATH. From any directory, without SSH:

factory                 # current state: card in progress, recent cards, health
factory log             # last 200 journal lines
factory log -f          # live follow
factory log 1000        # more lines
factory stop            # finish current card, then stop
factory ssh             # a shell on the machine

Or through the Makefile:

make factory-status     # equivalent to 'factory'
make factory-log        # equivalent to 'factory log'
make factory-deploy     # update the repository to FACTORY_STAGING

factory shows you what it is doing, the recent cards with their duration and final report, the pull requests pending merge, and the machine's health. SINCE='7 days ago' widens the window, CARDS=15 shows more. If you need a copy, capture it: factory log > factory.log.

What can go wrong

Three failures to watch for first:

FailureSignLikely cause
Claude session expiredthe loop stops, last log line is an API errortoken revoked or session closed on your Anthropic account
Disk fullbuilds fail with ENOSPC or No space left, or the container will not startstate volume hit its limit, or host is saturated
GitHub cluster unreachablepull requests do not ship, log has `gh` failed to authenticatenetwork is cut or credentials (App key, token) are expired

Every turn starts with a programmatic poll: one HTTP request asks "is there work?" for the cost of a few bytes, instead of running an agent to discover an empty queue. The loop does not stop when the queue is empty — it sleeps and retries.

Poll exit codes (each turn):

  • 0 : turn succeeded
  • 1 : queue empty, waiting
  • 3 : configuration broken — factory.conf, .env, or App credentials missing — halts the loop
  • 4 : transient error — the loop will retry next turn

About branches and releases

The factory always pushes to FACTORY_STAGING (default staging). When you decide to ship a version, you tell EVA: she merges FACTORY_STAGING into FACTORY_TRUNK (default main), creates a tag, publishes notes, closes features.

Before shipping a version, check what would go in:

make factory-release

Blank — it lists without writing. EVA applies it when you confirm.

No merge by hand, no commit by hand to main — those moves go through EVA, who traces them and can reject them if something is incomplete.

On this page