Foremerge — Claude Code MCP server: coordinate parallel agents
Foremerge keeps a shared list of what each coding agent plans to touch, so clashing plans surface before anyone writes code.
Open on GitHubWhat Foremerge does
Foremerge is a coordination protocol for coding agents that sits above Git. Every agent keeps its own isolated worktree, yet announces its target before editing — a function like sendEmail, say. Those announcements live in a small database inside the project's .git folder, so Claude, Codex and Cursor on the same machine read the same picture.
When two plans collide, Foremerge names both agents, explains the clash and suggests how to split the work. Its own example: one agent swaps PaymentService for StripePaymentService while another adds PayPal to the old PaymentService. No lines overlap, Git merges both happily, and the PayPal code ends up attached to a class nobody calls. Foremerge compares the declared scopes and operations (replace versus extend) and raises a HIGH advisory before either agent writes anything.
Nothing gets locked and no agent is stopped — the warnings are advisory, so you stay in charge. A deterministic detector judges collisions rather than a model, which means identical inputs always give the same verdict. Manual setup needs a recent Git and jq; the binary installs into ~/.local/bin via the install script, or from npm on macOS and Linux with glibc. Building from source takes Rust 1.85+. Coordination across separate machines is out of scope.
What it helps with
- catch two agents undoing each other before either commits
- split parallel work across worktrees without hand-checking overlaps
- see which agent is about to touch what, right now
- register the check an agent's result must pass
- explain why two edits in different files still break each other
Example prompts for the agent
- Publish your intent for
sendEmailand check for conflicts before editing. - Register the
testcheck withforemerge checks set test -- cargo test --all-targets.
How to install Foremerge
Install
The MCP registry has no launch command for it: see the repository README
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about Foremerge
How do I install Foremerge in Claude Code?
Easiest path is to let the agent do it: paste the quickstart instruction into Claude from the repository root. It installs via curl -fsSL https://foremerge.com/install.sh | sh, runs foremerge init, then foremerge setup all, registers a check with foremerge checks set, and confirms with foremerge doctor --client all. Step 3 enables an MCP server, so the client will ask you first.
What does Foremerge do?
It collects each agent's declaration of what it is about to change into one shared list inside .git and compares them. When plans clash, it reports the two agents and the reason.
Does Foremerge lock files or block agents?
No. Warnings are advisory, files stay unlocked, and you make the call. Collisions are judged by a deterministic detector, not by a model.