Conflict Prevention
Proactive Conflict Detection
When an agent publishes a task.created event, Hivemind automatically checks for two types of conflicts before the agent starts working:
1. Task Overlap Detection
Hivemind generates an embedding for the new task description and compares it against all active (uncompleted) tasks using cosine similarity. If the similarity is above 85%, it returns a warning:
Task overlap detected (92% similar): "Refactoring auth middleware"
by agent-2
This prevents two agents from unknowingly working on the same thing.
2. File Conflict Detection
If the task.created event includes a files field, Hivemind checks if any of those files were recently modified by another agent (within the last hour). If so:
File conflict: src/auth.ts was recently modified by agent-1
("Added JWT validation")
How Warnings Are Delivered
Conflict warnings are returned in the response to the POST /v1/events call:
{
"id": "evt_...",
"created_at": "...",
"conflict_warnings": [
"Task overlap detected (92% similar): \"Refactoring auth\" by agent-2"
]
}
The MCP server surfaces these warnings to the agent, which can then choose to proceed, coordinate, or work on something else.
Best Practice
Include a files field in your task.created events to get file conflict detection:
hivemind_publish(channel: "backend", event_type: "task.created",
data: {
description: "Updating auth middleware",
files: ["src/auth.ts", "src/middleware.ts"]
})