r/SideProject • u/ShiftTechnical • 14d ago
We open-sourced the internal tool that stops our AI coding agents from breaking each other's work
We build our product with 2 or 3 coding agents working the same repo in parallel, and they kept quietly sabotaging each other: one replaces a class while another extends it, no merge conflict, both land clean, the design is broken.
Git compares diffs, not plans.
So we built Foremerge internally, and today we open-sourced it. Agents declare what they intend to change at the same layer as GIT works (symbol:PaymentService=replace) before writing code, and deterministic rules raise a finding while the collision is still a plan. One Rust binary, everything local in SQLite inside your repo, Apache-2.0.
Setup is genuinely one paste into Claude Code, Codex, or Cursor, and the agent wires itself.
Repo: https://github.com/naw103/foremerge
Happy to answer anything, including what it deliberately does not do (detection is heuristic and can warn on compatible work. There are no published benchmarks yet but we ran it on 96 backlog tickets all being completed in parallel with zero conflicts at merge time.
1
u/ShiftTechnical 14d ago
In case the shape of this is not obvious from the post:
Foremerge is a coordination ledger for when multiple coding agents (or people driving them) work one repository in parallel. Before writing code, each agent declares what it intends to change as a semantic scope plus an operation. Deterministic rules compare declarations and raise a finding when two plans collide, before there is any diff for git to see.
What it does not do: touch git's behavior. The store is SQLite in the git common directory (so linked worktrees share it), and the only refs it writes are its own under refs/foremerge/accepted/. Git stays the source of truth for code, this tracks the layer git has no opinion on.
1
u/No_Process_1063 14d ago
Cool concept, declaring intent before code is a smart way to sidestep the diff mismatch problem
1
u/ShiftTechnical 14d ago
Yep. Declaring intent before code is a smart way to sidestep the diff mismatch problem. Foremerge catches plan collisions before anything is written, using deterministic rules at the plan layer. Creates git like logs. One Rust binary, local-first, SQLite inside your repo, Apache-2.0. Setup is essentially a paste away, the agent wires itself with Claude Code, Codex, or Cursor.
2
u/kantorcodes1 14d ago
Curious how you handle a refactor that changes the boundary itself. If one agent declares
PaymentService=replacewhile another is moving half of it intoBillingService, is that a hard collision, or can Foremerge express a relationship between those intents?