Skip to main content
← Lab

How my merge queue lands a slice

My studios are repos where AI agents build a product in slices while I play the client. The agents write the code, but none of them can merge a slice into main. Slices reach main through the merge queue, and the merge queue is a Node script with no AI in it.

One round

The queue takes the oldest slice a builder has handed in. In its own worktree, it squashes the builder’s branch onto a detached copy of main and commits the result as one commit, named <feature>: <slice title>. It runs the studio’s check there (on this site, npm run build), and it fast-forwards main only when that check is green.

So a slice, and the code it builds, reaches main only after the check has passed on it. And the master checkout is never where a merge is tried: by the time main moves, the work has already been merged and built somewhere else.

When the check is red

A red check runs once more, in case it was a flake. If it is still red, the queue runs the check on main itself.

A green main means the slice broke the build. The slice goes back to its builder with the log, and after two such strikes it goes to the lead. A red main means the fault is not the slice’s. The queue stops with the reason “trunk red” and merges nothing until main moves.

A conflict is not a strike. The work is sound and main has only moved under it, so the builder merges main into the branch and hands it in again.

If it crashes mid-round

Just before main moves, the queue writes down which slices the round holds. If a later round finds that file and its commit is already on main, it records those slices as merged rather than squashing them a second time.

Nothing else gates a merge

No review, sign-off or QA step sits in front of the queue. A merge that touches risky paths (on this site src/, public/, the Astro config and the package files) gets a reviewer session after it lands. A finding becomes a bug slice at the top of the queue, and a severe one becomes a revert slice. I check finished features from a checklist and send notes.

What the log says

Every round adds one line to studio/work/merges.jsonl. This is the row for the slice that published my last note:

{"ts":"2026-11-30T18:18:43.840Z","slice":"note-interview-me-1","dev":"m1","result":"merged","commit":"3a89ce6bc6b3cb575aeeeeb37a6c71e35e596057","secs":28.6,"added":22,"deleted":14}

Counted on 30 November 2026, the queue for this site has merged 118 slices since the first on 13 November 2026. Two rounds hit a conflict, none were red, and the median round took 19 seconds.

This note reached main the same way. For the roles and rules around the queue, see How it runs.