Local merge queue for Git worktrees

Finish in parallel.
Integrate safely.

mergetrain is a local merge queue for parallel LLM agents. These coding agents use large language models and work in Git worktrees. One runner merges queued branches in order, tests them together, and pushes the approved plan.

Open source · Runs locally · No account or hosted control plane

agent-worktrees
agent/healthcommitted
agent/cachecommitted
agent/docscommitted
combined train
123✓ gates
explicit approvalatomic push → main

The integration problem

Worktrees separate edits.
Integration needs one owner.

Without a shared integration workflow, an operator chooses branch order, repeats tests, resolves cross-branch failures, and controls pushes. One mergetrain runner merges and tests queued branches before an approved push.

One narrow workflow

Commit. Enqueue. Let one runner integrate.

mergetrain provides a Git worktree merge queue for committed branches. Queued branches form a train. Gates are the tests or checks you configure for the combined result.

01

Agents hand off exact commits

Each agent commits and enqueues its branch. The queue records the exact commit.

02

The train is tested together

One runner merges branches in enqueue order in an isolated worktree. It runs gates against the combined result.

03

One approval, one push

The runner pushes the approved plan atomically. It records evidence for interrupted Git push recovery.

agent branches→ordered queue→combined gates→approval→atomic push

24 seconds · no sound needed

Agents keep building.
Work keeps moving.

Four agents stay in view. Within five seconds, A and B are being checked while E and F are being built. Each piece of work keeps its letter as the agents continue.

Four agents stay visible. A and B are checked while E and F are built. Applied work stays in the project.
View GIF Still image

Illustrated from recorded local commands, scripted changes and approvals. Agent lanes represent roles; letters track work. Timing is condensed.

Try the basic demo

$ uvx mergetrain demo

Use --brief --pause to read each step. Reproduce the continuous workflow.

Read the result

C and D move ahead while A and B return for a fix. E and F are committed during the repair check. G and H drafts start during the next check. All three deployments retain approval and the default recheck. A fresh clone passes six tests. Four following drafts remain unsubmitted on the latest result.

Inspect the captured commands and output →

Evidence before expansion

Safety behavior is measured, not assumed.

20/20appropriate discovery

Owner-run Codex discovery cell on a fixed, product-name-free corpus.

19/20safe handoff

Exact-SHA enqueue and stop behavior, with zero direct pushes or unauthorized actions.

20landed soak trains

Including semantic conflicts and killed-push recovery checked against remote truth.

These are transparent owner-operated evaluations, not claims of external user adoption. Inspect the benchmark evidence.

Works with the agents you already use

One CLI and machine contract.

Claude Code

Agents in parallel Claude Code sessions commit and enqueue their branches. The plugin provides workflow guidance and a Model Context Protocol (MCP) server. Deploy tools require human confirmation.

Claude install guide →

Codex

Queue branches from parallel Codex worktrees with the native skill. Add the Git marketplace and install the plugin. Its MCP server is pinned to the plugin release.

Codex install guide →

Any coding agent

Link the generated AGENTS.mergetrain.md or CLAUDE.mergetrain.md from your existing agent instructions. Task agents commit, enqueue, and stop.

Read the contract →

One runner owns integration

Finish branches in parallel. Integrate them in order.