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

See the real workflow

A disposable demo in one command.

It creates a temporary repository and runs real branches through ordered merge, combined-only failure, conflict attribution, and deployment.

$ uvx mergetrain demo
one command

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.