메뉴
HN
Hacker News • 4일 전

포머지 – 병렬 코딩 에이전트 간 의도 충돌 감지

IMP
6/10
핵심 요약

Foremerge는 Git 위에 구축된 오픈소스 코딩 에이전트 조정 프로토콜로, 여러 AI 에이전트가 격리된 워크트리에서 작업하더라도 각자 수정하려는 대상(의도)을 공유 목록에 선언해 충돌을 코드 작성 전에 감지합니다. Git은 텍스트만 비교하기 때문에 서로 다른 파일에 대한 합리적인 변경이 의미상 충돌하는 경우를 잡아내지 못하는데, Foremerge는 결정론적 탐지기로 이를 해결합니다. 파일 잠금이나 LLM 판단 없이 자동으로 경고만 제공하는 advisory 방식이 특징입니다.

번역된 본문

Foremerge

Foremerge는 Git 위에 구축된 코딩 에이전트용 오픈소스 조정 프로토콜입니다. 에이전트들은 격리된 워크트리에서 작업하면서 의도, 의미론적 클레임, 의존성, 임시 ChangeSet, 결정사항, 검증, 출처 정보를 공유합니다.

에이전트에게 설치를 지시하세요 → 완료 → 변경이 병합되기 전에 충돌을 확인하세요

Claude Code, Codex, Cursor에 한 줄을 붙여넣으면 Foremerge가 설치되고 자동으로 연결됩니다. 모든 에이전트는 서로 다른 워크트리에서 작업하더라도 다른 에이전트가 무엇을 변경하려는지 볼 수 있습니다.

현황: Foremerge 0.5.0은 1.0 이전의 로컬 우선(local-first) MVP입니다. CLI, JSON API, MCP 서버, SQLite 저장소, 결정론적 충돌 탐지기, 검증 게이트 기반 라이프사이클이 구현되었습니다. 공개 스키마는 아직 변경될 수 있습니다. 공개된 벤치마크 결과는 아직 없으며, 머신 간 조정은 이 프로젝트의 범위 밖입니다.

작동 방식

같은 프로젝트에서 두 AI 에이전트가 동시에 작업한다고 가정해 봅시다. 각자 코드 사본을 가지므로 파일을 두고 다투지 않습니다. 둘 다 완료되고, 둘 다 올바워 보입니다. 그런데 서로의 작업을 되돌려버렸다는 것을 나중에 발견합니다.

Git은 텍스트를 비교할 뿐 의도를 비교하지 않기 때문에 이런 것을 경고해 줄 수 없습니다. 두 에이전트가 같은 파일의 같은 부분을 수정하면 막아주지만, 각자 따로 보면 완벽히 합리적이면서 서로 다른 파일에 반영되는 두 수정이 충돌한다는 것은 보지 못합니다.

한 에이전트가 모든 호출자를 새로운 StripePaymentService로 옮기는 동안, 다른 에이전트가 기존 PaymentService에 PayPal 지원을 추가하면 아무것도 겹치지 않으므로 Git은 아무 불만 없이 둘 다 병합하고, PayPal 작업은 아무도 호출하지 않는 클래스에 방치됩니다.

Foremerge는 에이전트가 작업을 수행하기 전에 무엇을 할 것인지 미리 알리도록 해서 이 문제를 해결합니다. 각 에이전트는 자신이 건드릴 대상을 선언합니다. 코드가 아니라 대상만, 예를 들어 "sendEmail 함수를 변경할 것이다"라고 말합니다. 모든 에이전트는 하나의 공유 목록을 읽습니다. 프로젝트의 .git 폴더 안에 있는 작은 데이터베이스로, 머신의 모든 에이전트(Claude, Codex, Cursor 여부와 무관)가 같은 그림을 봅니다.

두 계획이 충돌하면 즉시 알려줍니다. Foremerge는 두 에이전트의 이름을 밝히고, 계획이 왜 충돌하는지 설명하며, 작업을 나누는 방법을 제안합니다. 이 시점에는 두 워크트리 모두 아직 깨끗하므로 버려야 할 작업이 없습니다.

공유 화이트보드라고 생각하면 됩니다. 에이전트가 시작하기 전에 자신이 작업할 내용을 적고, 다른 모두가 이미 적은 내용을 읽습니다.

Foremerge가 의도적으로 하지 않는 두 가지가 있습니다. 첫째, 파일을 잠그거나 에이전트를 차단하지 않습니다. 하나의 에이전트가 크래시하면 전체가 멈출 수 있기 때문에, 경고는 참고용(advisory)이며 통제권은 사용자에게 남습니다. 둘째, 모델에게 충돌을 판단하게 하지 않으므로 같은 입력은 항상 같은 답을 냅니다.

Git이 아직 보지 못하는 충돌

에이전트 A: PaymentService를 StripePaymentService로 교체 에이전트 B: PaymentService에 PayPal 지원 추가

이 에이전트들은 서로 다른 트리에서 같은 줄을 건드리지 않고 작업할 수 있습니다. 하지만 계획은 여전히 충돌합니다. 하나는 확장 지점을 제거하고 다른 하나는 그것에 의존하기 때문입니다.

두 에이전트는 같은 symbol:PaymentService 범위를 선언하는데, 하나는 교체하겠다고, 다른 하나는 확장하겠다고 합니다. Foremerge는 어느 쪽이든 코드를 작성하기 전에 이 두 선언을 비교하여 HIGH 등급의 경고를 발생시키고, PaymentProvider 같은 안정적인 추상화에서 협조하도록 제안합니다. 이 제안은 설명 가능한 근거이지, 자동화된 아키텍처 결정이나 하드 락이 아닙니다.

작업이 요약문이 아니라 선언 방식으로 기록되기 때문에 에이전트가 계획을 어떻게 표현했는지는 중요하지 않습니다. "결제를 Stripe로 통합"과 "PaymentService를 Stripe로 교체"는 같은 판정에 도달합니다.

Git은 여전히 영구 저장소입니다. Foremerge는 그 위에 빠져 있던 공유 인식 계층을 제공합니다.

terminal-session.txt 예제의 0.1.0 릴리스 바이너리 실행에서 캡처된 실제 충돌 필드로부터 렌더링되었습니다. 표시된 명령은 보이는 jq 필터를 사용하며, 출력은 가독성을 위해 요약되었습니다.

빠른 시작: 5분 안에 첫 충돌 확인하기

코딩 에이전트에게 맡기세요. 저장소 내부에서 Claude Code, Codex, Cursor에 다음을 붙여넣으세요.

원문 보기
원문 보기 (영어)
Foremerge Foremerge is the open-source coordination protocol for coding agents, built above Git. Agents keep isolated worktrees while sharing intent, semantic claims, dependencies, provisional ChangeSets, decisions, validation, and provenance. Tell your agent to install → Done → See collisions before they land Paste one line into Claude Code, Codex, or Cursor It installs Foremerge and wires itself up Every agent sees what the others are about to change, even in separate worktrees Status: Foremerge 0.5.0 is a pre-1.0, local-first MVP. The CLI, JSON API, MCP server, SQLite store, deterministic conflict detector, and verification-gated lifecycle are implemented. Public schemas may still change. Published benchmark results do not yet exist, and coordination between machines is outside this project's scope. How it works Say you have two AI agents working on the same project at the same time. Each one gets its own copy of the code, so they never fight over files. Both finish. Both look correct. Then you find they undid each other's work. Git cannot warn you about that, because Git compares text and not intent. It will stop you when two agents edit the same part of the same file. What it cannot see is two edits that are each perfectly reasonable on their own and land in different files. If one agent moves every caller onto a new StripePaymentService while another adds PayPal support to the old PaymentService , nothing overlaps, so Git merges both without complaint and the PayPal work is left stranded on a class nothing calls any more. Foremerge fixes this by having agents announce what they are about to do, before they do it. Each agent says what it is about to touch. Not the code, just the target, like "I am going to change the sendEmail function." Every agent reads from one shared list. It is a small database inside your project's .git folder, so every agent on your machine sees the same picture, whether it is Claude, Codex, or Cursor. If two plans collide, you hear about it right away. Foremerge names the two agents, explains why their plans clash, and suggests how to split the work. Both worktrees are still clean at that point, so no work has to be thrown away. Think of it as a shared whiteboard. Before an agent starts, it writes down what it is about to work on, and it reads what everyone else already wrote. Two things Foremerge deliberately does not do. It never locks a file or blocks an agent, because a single crashed agent would then stall the whole fleet, so the warnings are advisory and you stay in charge. And it never asks a model to judge conflicts, so the same inputs always produce the same answer. The conflict Git cannot see yet Agent A: Replace PaymentService with StripePaymentService Agent B: Add PayPal support to PaymentService These agents can work in different trees without touching the same line. The plans still collide: one removes the extension point while the other depends on it. Both agents declare the same symbol:PaymentService scope, one saying it will replace it and the other that it will extend it. Foremerge compares those two declarations before either writes code, raises a HIGH advisory, and suggests coordinating on a stable abstraction such as PaymentProvider . That suggestion is explainable evidence, not an automatic architecture decision or a hard lock. Because the operation is declared rather than read out of the summary, it does not matter how either agent phrased its plan. "Consolidate payments onto Stripe" and "Replace PaymentService with Stripe" reach the same verdict. Git remains the durable repository. Foremerge supplies the missing shared awareness above it. Rendered from the actual conflict fields captured by the 0.1.0 release-binary run in examples/terminal-session.txt . The displayed command uses the shown jq filter; output is abridged for readability. Quickstart: first conflict in under five minutes Let your coding agent do it Paste this into Claude Code, Codex, or Cursor from inside the repository you want to coordinate: Set up Foremerge in this repository so we can coordinate parallel agents. 1. Install it: curl -fsSL https://foremerge.com/install.sh | sh 2. Initialize: foremerge init 3. Wire this client and any others in use: foremerge setup all 4. Register the check I should be validated against, for example: foremerge checks set test -- cargo test --all-targets 5. Confirm: foremerge doctor --client all Then read the Foremerge skill that step 3 installed for this client and follow it from now on: publish your intent with semantic scopes before editing, claim the scope, and check for conflicts before you start. Adjust step 4 to whatever this repository's real test command is. Step 3 asks the client to enable an MCP server, so it will prompt you before doing so. The Codex registration is user level, but one registration serves every repository: start Codex inside the repository you want it to coordinate. Or do it yourself You need a recent Git and jq . Install a prebuilt, checksum-verified release binary (macOS and Linux; the script installs to ~/.local/bin ): curl -fsSL https://foremerge.com/install.sh | sh Tip Two commands, one program. This installs foremerge and fmg , the same binary under a shorter name, so fmg status and foremerge status do the same thing. Examples below spell out foremerge ; type whichever you prefer. Or build from source with Rust 1.85+: cargo install --locked --git https://github.com/naw103/foremerge foremerge , or cargo install --locked --path . from a checkout. Windows binaries are on the releases page . To update, upgrade the same way you installed, then re-run foremerge setup and restart your agent clients; Upgrading Foremerge explains why each step matters. Then, inside the repository you want to coordinate: foremerge init foremerge doctor The installer, the release archives and cargo install all carry both names from 0.4.0 onward. If something else on your PATH already answers to fmg , the installer leaves it alone and says so rather than shadowing it. Install the native skill and MCP entry for any clients used in this repository, then define the trusted checks agents may request by name: foremerge setup all foremerge checks set test -- cargo test --all-targets foremerge doctor --client all Acceptance is verification-gated: Foremerge runs the check itself rather than taking an agent's word for it. Pick a check that is fast and that would actually catch a broken handoff, such as a build or a typecheck, rather than a full CI suite; this gate decides whether other agents may treat the work as done, and it does not replace CI. If this repository has nothing meaningful to verify, say so once rather than registering a check that always passes: foremerge checks policy advisory Work accepted that way is recorded as UNVERIFIED with the reason, so the audit trail never implies a check ran when none did. foremerge doctor reports whether the registered checks can actually run here, which matters in agent worktrees, because dependency directories are usually gitignored and git worktree add will not create them. Use setup codex , setup claude , or setup cursor for one client. Setup preserves unrelated configuration (including key order in project MCP JSON). Upgrading Foremerge refreshes its own unedited skill file in place, but a skill file you edited, or a differing Foremerge MCP entry, is never replaced unless you explicitly pass --force . setup all attempts every client and reports each result, exiting nonzero if any failed. The Codex MCP registration is user-level and serves every repository, resolved from the directory Codex is started in; see agent client setup . init creates local coordination state under the repository's Git common directory. It does not change tracked files. The following no-worktree sessions are enough to exercise pre-code detection; real coding agents should register their isolated worktrees and actual model identifiers. STRIPE_AGENT= $( foremerge --json agent reg