What if multiple AIs code at the same time? A smart way to prevent 'collisions' in advance

An image conceptualizing AI agents of different colors sending their respective plans toward a single code repository, with Foremerge coordinating conflicts between them.
AI Summary

Foremerge is a new coordination protocol that allows multiple AI coding agents to share their work plans and alert each other to potential collisions before they write any code.

Imagine you and five teammates are building a massive Lego castle. But what happens if three of you decide to “build a bridge here” and two of you insist on “erecting a wall in this spot” and start moving at the same time? If everyone starts assembling Legos without knowing each other’s plans, the castle will eventually collapse, and time will be wasted.

The exact same thing is happening in software development these days. We have entered an era where multiple AI coding agents—AI that writes and modifies code on its own—can work on a single project simultaneously. Source 1 However, if these AI agents write code without knowing each other’s plans, serious conflicts occur when it comes time to merge the work. Today, I’d like to introduce a new technology that prevents such tragedies in advance: ‘Foremerge.’

Why is this technology important?

Until now, developers have merged code using a system called ‘Git’ (a tool that helps with software version control). However, this method only solves problems late in the process, after the code has already been written. Source 2 If two AI agents decide to change the software’s structure (architecture) in different directions, Git only informs you that “a conflict has occurred” after all the code is written. By then, time and effort have already been wasted.

This approach compromises the stability of the entire project. What if AI agents could understand each other’s ‘intent’ before writing code? This is exactly where Foremerge brings innovation. Source 10

Simply put, a ‘Shared Conference Room for AIs’

If we were to define Foremerge in one phrase, it would be a ‘shared conference room for AI agents.’

Just like sketching out a blueprint before building with Legos, Foremerge requires each agent to post its blueprint to a common repository before writing a single line of code. Source 8 Specifically, it works as follows:

  1. Intent Sharing: Agent A posts a plan: “I’m going to improve the login feature.”
  2. Scope Check: Agent B posts a plan: “Then I’ll change the database settings.”
  3. Conflict Detection: Foremerge mathematically calculates whether these two plans conflict (e.g., if both are touching the same file or if the structures are becoming tangled). Source 3
  4. Providing Advice: If a conflict is expected, Foremerge provides explainable advice to the agent: “Stop! If you continue like this, a conflict will occur later.” Source 2

An interesting point is that Foremerge does not use costly LLMs (Large Language Models) for the detection process. Source 2 Instead, it uses SQLite (a lightweight and fast database) and predefined rules to make fast and accurate judgments. Source 5

How far has it come?

Currently, Foremerge is developed as an open-source coordination protocol that operates on top of Git. Source 3 Developers can work in separate environments while sharing their work intent and planned changes through Foremerge. Source 7

It is highly flexible because it adopts an approach of providing advisory advice for developers to consider rather than forcefully stopping work. Source 2 Thanks to this, collaboration between humans and AIs, or among multiple AI agents, has become much smoother.

Will it become the standard for collaboration in the AI era?

As AI coding agents perform increasingly complex tasks, technology to coordinate them will become a necessity rather than an option. An ‘intent-based conflict prevention system’ like Foremerge is highly likely to become a standard in enterprise software development environments in the future. Source 6 In the future, the smart development environment where AIs talk to each other to avoid conflicts in advance—rather than fighting after the code is fully written—will become the norm.


References

  1. ShowHN: Foremerge – Catch Intent Conflicts Between Parallel Coding Agents https://modernorange.io/item/49789356
  2. Foremerge: catch intent conflicts before code conflicts https://foremerge.com/
  3. GitHub - naw103/foremerge: Catch intent conflicts before code conflicts https://github.com/naw103/foremerge
  4. ShowHN: Foremerge – Catch Intent Conflicts Between Parallel Coding Agents Comments https://vk.ru/wall-238001969_5977
  5. Foremerge: a Git like coordination protocol for parallel coding agents. https://users.rust-lang.org/t/foremerge-a-git-like-coordination-protocol-for-parallel-coding-agents-one-binary-sqlite-deterministic-conflict-rules/142084
  6. Foremerge: Local Coordination for Coding Agents - Open Source https://reporank.net/en/repo/naw103-foremerge.html
  7. Foremerge: Foremerge catches intent conflicts before code conflicts https://softwareontheweb.com/product/foremerge
  8. Foremerge demo - YouTube https://www.youtube.com/watch?v=miuABG2hlkg
  9. Foremerge MCP Server https://mcp.so/servers/foremerge
  10. 31 hard questions about coordinating parallel coding agents, answered https://dev.to/naw103/31-hard-questions-about-coordinating-parallel-coding-agents-answered-2md2
AD
Test Your Understanding
Q1. What distinguishes Foremerge most from existing Git conflict resolution methods?
  • It checks for conflicts after the code is completed
  • It detects potential plan conflicts before the code is written
  • The AI automatically fixes all conflicts
Instead of waiting until the code modification stage, Foremerge requires agents to share their 'intent' and 'scope' before they start working, preventing structural conflicts in advance.
Q2. Which of the following is correct regarding how Foremerge detects conflicts?
  • It uses an LLM every time to grasp the context
  • The user must review the code manually
  • It uses predefined deterministic rules and does not use an LLM
Foremerge's detection path does not include an LLM and operates based on deterministic rules utilizing technologies like SQLite.
Q3. Does Foremerge force agents to stop working?
  • Yes, it applies a hard lock
  • No, it provides advisory advice
  • It stops until user approval is granted
Foremerge does not use a forceful hard lock; instead, it provides explainable advice to the agent regarding potential conflicts.
What if multiple AIs code a...
0:00