What happens when three AI agents push to main at once? Without a queue, agents collide and can break main. With Mergetrain, agents enqueue, one runner assembles the train, gates run once on the combined result, and one atomic push keeps main green. MERGETRAIN · A LOCAL MERGE TRAIN FOR AI CODING AGENTS What happens when 3 AI agents push to main at once? WITHOUT A QUEUE Agent A worktree/a Agent B worktree/b Agent C worktree/c main broken force-push clobbers a sibling’s landing each branch green, combined = red you re-serialize your work by hand The time you saved running agents in parallel is spent again integrating them. WITH A MERGE TRAIN 1 Agents enqueue — and stop nobody ever pushes main directly A · B · C FIFO queue SQLite · crash-safe 2 One runner assembles the train in a throwaway worktree, in order main +A +B +C 3 Gates run ONCE on the combination fails together? bisect names the conflicting pair tests · lint · scans ✓ the exact train you approve is what ships 4 One atomic push, exactly once write-ahead marker — safe even if the laptop dies mid-push git push --atomic main green main stays green · agents never push · your parallelism stays parallel queue, lock, gates and recovery all live on your machine — no hosted service github.com/yongjip/mergetrain pip install mergetrain · MIT