How I run a software factory with agents
In 30 days, my main project merged 211 pull requests. Agents wrote, tested and reviewed most of the code; I chose the product behaviour and merged the product PRs. The agents run in terminal sessions on a development VM, supervised by a remote orchestrator. A local orchestrator on my machine supervises that remote one and manages the infrastructure.
- 211 PRs merged in 30 days
- 1 human making product decisions
- 2 orchestrators in a hierarchy
- 30 min between remote sweeps
01 · Responsibilities
Who controls what
The local orchestrator holds the cloud credentials and can repair the VM when the remote one cannot run. The remote orchestrator runs the agents day to day. Select a box to see its responsibilities below.
Me the human
Does
- Review the local orchestrator
- Choose product behaviour and answer blocking questions
- Merge every product PR
Never
- Delegate the final product decision to reviewer consensus
Local orchestrator my machine
Does
- Hold the cloud logins (Azure, AWS, Cloudflare)
- Supervise the remote orchestrator and review its work
- Repair the VM
Never
- Delegate its cloud credentials to the remote orchestrator
Remote orchestrator development VM · every 30 min
Does
- Sweep every agent pane, nudge the stalled ones
- Route CI failures and review threads to their owner
- Launch review rounds and report progress
- Merge CI-only and runner-only PRs
Never
- Hold a cloud credential
- Supervise or control the local orchestrator
- Merge a product PR
Agents one WezTerm mux · one unix socket
Does
- Owner: carry the change through implementation and review
- Executor: complete a delegated task
- Reviewer: return findings for one review round
Never
- Merge
Supervision runs one way, from local to remote. The remote orchestrator cannot control the local one and holds no cloud credentials. I can also follow the remote one from my phone through Remote Control and answer when it asks.
02 · Work loop
From an assigned task to a merge
The PR is the unit of work: its specification, tests, implementation, CI results and review discussions travel together. The owner agent handles the change; an executor can carry out delegated work, and a reviewer examines one round of it. Review findings and CI failures go back to the owner.
The remote orchestrator's 30-minute sweep
- Agent waiting or stalled
- Read the pane and follow up with that agent.
- Failed CI or a review finding
- Route it to the PR owner to investigate and fix.
- Ready for review
- Launch a new reviewer round with a fresh brief.
- Unresolved product behaviour
- Collect the alternatives for my decision.
Example of a concrete task brief
Illustrative format, using the decision below. This is a task description, not a captured run or a tool configuration.
Task: implement the scoped-ID response contract
Blocked on: human choice for D05
Scope: update and delete by internal ID with a filter
Cases to cover:
- record exists and matches the filter
- record exists but is excluded by the filter
- record does not exist
Report: reports/scoped-id-contract.md
Include: changed files, checks run, remaining questionsA question about intended behaviour comes back to me through the decision artifact below. Once I have chosen, the implementation and tests have to match that choice. After the checks and review rounds are complete, I merge the product PR. The remote orchestrator may merge CI-only and runner-only changes.
03 · Terminal control
How the orchestrator talks to an agent
A harness is the command-line application running an agent, such as Claude Code or Codex CLI. The harness runs on the VM. My Windows WezTerm window connects over SSH through Tailscale to aWezTerm mux server: the service on the VM that owns its terminal windows, tabs and panes. Its Unix socket is local to the VM; the WezTerm protocol is carried through SSH.
On the main project's VM, my agent-spawn script creates a named workspace and, by default when tmux is installed, starts the harness in a detached tmux session. A WezTerm pane attaches to that session. The workspace groups the terminals; tmux keeps the agent running if its pane is closed. A Git worktree separately provides the code checkout.
- Windows clientWezTerm GUI and workspace pickerConnects over SSH through Tailscale
- VM: WezTerm muxWorkspace → tab → paneThe orchestrator reads and writes panes through its Unix socket
- VM: tmux + agentA detached session owns the harnessThe pane attaches; the agent can survive the pane closing
# on the VM, after installing the agent scripts and a harness
$ export WEZTERM_UNIX_SOCKET="$HOME/.local/state/wezterm/dev-server.sock"
$ agent-spawn review-123 "$HOME/projects/my-project" codex my-model -- codex
41 # example remote pane ID returned by the launcher
# send the prompt, submit it, then read the output
$ wezterm cli --no-auto-start send-text --pane-id 41 "resume the review of round 3"
$ printf '\r' | wezterm cli --no-auto-start send-text --no-paste --pane-id 41
$ wezterm cli --no-auto-start get-text --pane-id 41 | tail -n 40
# run record (illustrative values)
workspace / tmux: review-123 conversation: <saved-session-id>
model: <actual-harness-model> cwd: <working-directory>
pid: 4711 report: reports/pr-123-round-3.mdThe remote orchestrator uses that same mux socket to write withsend-text and read withget-text. Sending text types the prompt; the separate carriage return submits it. These commands run on the VM, using the remote pane ID returned by the launcher or wezterm cli list.
Finding a session and keeping it alive
My session manager opens with Ctrl+Shift+S. I can search the workspaces, select one, or create one withCtrl+Shift+A. The launcher sets CLI_IDENTITY and CLI_MODEL so the picker can show the harness and model. These arguments are labels; the harness's own configuration or command-line options choose the actual model. The shared launcher and picker now serve four project VMs; the agent commands here describe the main project's setup.
| Event | What survives |
|---|---|
| Laptop disconnects or loses its network | The agent keeps running on the VM. Reopen the box shortcut to reconnect. |
| Its WezTerm pane is explicitly closed | The tmux session keeps running. Attach again with tmux attach-session -t '=review-123'. |
| The agent's work is finished | agent-kill review-123 stops the named tmux session and closes its remaining panes. |
| The VM shuts down or reboots | The live processes end. Resume from the harness's saved conversation and the written task report. |
The picker lists WezTerm workspaces, so a detached tmux session can outlive its entry there. Closing panes with Delete in the picker does not necessarily stop the agent inside tmux. With AGENT_SPAWN_TMUX=0, or without tmux installed, the harness runs directly in the pane and loses that extra protection.
The pane ID targets a terminal. The workspace and tmux names group running processes. The harness session ID resumes a conversation. Each delegated run records its session ID, model, working directory, owned process and report path. The report preserves progress and open questions across sessions.
04 · Product decisions
Batch the questions that need my decision
Should an update to a missing record return an error or a result saying nothing changed? Either can be implemented and tested. The agent needs a product decision before it can choose the right tests.
As questions accumulate, I have them collected into an HTML artifact. Each entry shows the current behaviour, blocked PRs, alternatives and trade-offs. Fable and Astra recommend an option and score the alternatives. I go through the batch and choose. One button accepts every entry where the two agree.
Here is one entry, adapted into English. Try selecting an option. Choices on this page are not saved.
Response shape for a scoped update or delete
$iid is a record's internal ID. An update or delete can narrow its scope with $kinds, $filter or $search. Today, that form returns an array, while the same scope with $id returns an object.
Current behaviour: a scoped $iid returns [] outside the scope and [object] on a match. A scoped $id returns { updated: false } outside the scope and an error if the record does not exist.
No decisions match this status. Change the filter or reset the example.
Choosing B gives the owner two requirements: return an object for a scoped internal ID, and distinguish a missing record from one excluded by the filter. Those become implementation work and test cases.
05 · Cost efficiency
From API calls to harness subscriptions
When I was running the work through APIs, Foundry Models reached $12,156.39 in one day, on 20 Sept 2026. I then spread work across harness subscriptions. WezTerm CLI let the orchestrator operate those harnesses in their terminals, with each harness using its configured account.
$47,866.19 over the week.
$1,343.70 over the week. 97.2% lower.
Scroll the chart to see all dates →
Peak: $12,156.39 on 20 Sept. Select a bar to inspect a day.
Azure Foundry usage cost before tax; excludes subscriptions and infrastructure. The two full weeks are not adjusted for workload.
Daily figures and query method
Azure Cost Management, ActualCost / PreTaxCost, retrieved 14 Oct 2026. One subscription, all resources billed as Foundry Models. Other Azure services, harness subscriptions, other API providers and taxes are excluded. These are recorded usage costs, before reconciliation with credits or payments. The selected weeks show the change in spending; they do not establish a migration date.
Queried through Azure CLI with az rest against the Cost Management Query API. Filter: ServiceName = Foundry Models. Sum PreTaxCost daily across resource IDs; keep the returned USD currency. September and October were queried separately and checked for additional pages. The table stops on 12 October to leave time for recent charges to arrive.
| Date (2026) | Cost |
|---|---|
| $304.50 | |
| $108.57 | |
| $136.69 | |
| $156.51 | |
| $23.95 | |
| $25.12 | |
| $14.98 | |
| $796.20 | |
| $1,259.92 | |
| $627.05 | |
| $1,538.26 | |
| $504.27 | |
| $2,712.13 | |
| $8,154.50 | |
| $9,515.24 | |
| $21.77 | |
| $5,455.20 | |
| $5,816.87 | |
| $6,746.22 | |
| $12,156.39 | |
| $4,773.98 | |
| $2,334.52 | |
| $1,657.03 | |
| $3,081.69 | |
| $4,705.44 | |
| $3,616.73 | |
| $4,821.46 | |
| $1,349.79 | |
| $1,316.46 | |
| $1,360.79 | |
| $207.41 | |
| $19.83 | |
| $256.23 | |
| $143.97 | |
| $96.02 | |
| $315.87 | |
| $398.85 | |
| $297.35 | |
| $99.98 | |
| $103.79 | |
| $31.83 | |
| $52.90 |
Work covered by a harness plan uses its included capacity, subject to that plan's limits. To calculate the factory's total cost, I still need to add the subscriptions, development VM, CI and other API providers to the Foundry figures.
06 · PR process
When a PR is ready to merge
A defect fix starts with a failing regression test. The owner implements the fix, runs the checks and submits the PR for review. Findings go back to the owner to verify and fix, and then another review round starts. The stages below spell out each gate in order.
- 1
Red tests owner agent
For a defect fix, write a regression test that reproduces the defect and fails. For other changes, choose validation that demonstrates the intended behaviour.
- 2
Execution owner agent
The owner implements the change and makes the relevant checks pass. A behaviour change carries its spec, tests and implementation in the same PR.
- 3
Mutation proof owner agent
For a regression fix, remove the fix and confirm that its test fails, then restore it. The test should distinguish the broken behaviour from the corrected one.
- 4
CI for this commit disposable runners
CI checks the commit proposed for merge on fresh runners. A fix made during review changes that commit, so its checks need to run again before merge.
- 5
Bot reviewer bot
A first automated review pass on the diff.
- 6
Bloat pass DeepSeek flash
One question: what in this diff does not need to exist.
- 7
Drift pass DeepSeek flash
A second pass for single source of truth: copies of the same fact that could drift apart.
- 8
Panel Fable 5.1 · astra · Grok 4.7
Three reviewers, three harnesses. Each gets a brief that leaves out what earlier rounds found, so nobody anchors on the last reviewer.
Example An infrastructure PR passed CI, but the panel found two high-priority issues: a content-security policy baked into an image shared across environments, and a shared configuration key that would change a second environment on its next deployment.
- 9
Verify, fix, repeat owner agent · orchestrator
The owner checks findings against the code before changing it. Resolve confirmed critical and high-priority issues, then the remaining valid findings, and repeat the review. Each round uses new reviewer sessions.
Example The deepest PR so far took 17 rounds.
- 10
Confirmed orchestrator
The orchestrator confirms that the required checks and review rounds are complete. Product choices must be resolved before the PR is ready to merge.
- 11
Merge me
I merge. A CI-only or runner-only PR may be merged by the remote orchestrator instead.
Each new panel round gets a brief without the previous reviewers' findings, to reduce anchoring on their conclusions. The owner still has to verify every finding against the code. In one measured test-auditor run, about one in five findings was wrong.
07 · Results
211 PRs in 30 days
These are the merge counts and timings for one repository from 13 September to 12 October 2026. Open-to-merge time includes waiting and review, as well as implementation.
Diff sizes and weekday breakdown
115 of the 211 PRs merged within a day of opening. The log counts merged changes; it does not measure how much useful product work each one delivered.
08 · Failures
Where the workflow broke
Overlapping PRs piled up. Before assigning more work on a topic, the orchestrator needs to check the open PRs and their owners. This remains coordination work; terminal access alone does not resolve conflicting changes.
A reboot lost unwritten progress. That is why each run has a report path. A useful report names the change, the checks already run, the open questions and the next action.
A relayed approval was rejected. I had to confirm the instruction in the receiving agent's session. The orchestrator's message and the harness's permission system are separate things. The harness can still require my approval in its own session.
The VM housekeeping behind the workflow
Finished reviewers left sessions open, and worktree build caches filled the disk. With tmux, closing a WezTerm pane can leave the agent running, so finished agents need to be stopped explicitly, and obsolete worktrees and caches need to be removed. A machine-wide queue limits heavy builds to three concurrent slots.
The CI side is its own page: A fresh VM for every CI job.