<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Relay Engineering]]></title><description><![CDATA[Relay Engineering]]></description><link>https://relaybrain.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Mon, 02 Nov 2026 17:51:41 GMT</lastBuildDate><atom:link href="https://relaybrain.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Locks Say No. The Graph Says Why: Giving AI Coding Agents a Shared Memory with FalkorDB]]></title><description><![CDATA[How we turned five agents' transcripts, lock blocks and decisions into one FalkorDB graph, so a blocked agent learns what the other one is doing]]></description><link>https://relaybrain.hashnode.dev/locks-say-no-the-graph-says-why-giving-ai-coding-agents-a-shared-memory-with-falkordb</link><guid isPermaLink="true">https://relaybrain.hashnode.dev/locks-say-no-the-graph-says-why-giving-ai-coding-agents-a-shared-memory-with-falkordb</guid><category><![CDATA[falkordb]]></category><category><![CDATA[ai agents]]></category><category><![CDATA[graph database]]></category><category><![CDATA[hackathon]]></category><dc:creator><![CDATA[Prakrititz Borah]]></dc:creator><pubDate>Sun, 18 Oct 2026 13:41:10 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6ad49d5dc307904d89fe8db6/5b752277-3404-4707-b19f-9145de5f1e0a.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>The first time two of our AI agents fought over the same file, nothing crashed.</p>
<p>Cursor wanted to edit our login code. Relay, the tool we built to keep AI agents from overwriting each other, said no: Claude Code was already working on that file.</p>
<p>That was the right call. But Cursor had no idea <em>why</em> it was blocked. So it waited, tried again, and tried again. Twenty-five attempts in ten seconds. Meanwhile Claude was halfway through rewriting the whole login flow, which meant the code Cursor wanted to touch was about to change completely anyway.</p>
<p>The lock did its job. The agent still wasted its time. That gap is what we spent the Graph Hacks hackathon closing.</p>
<blockquote>
<p><strong>Key Takeaways</strong></p>
<ul>
<li>Research from 2026 found that 79.4% of AI agent pull requests overlap with another agent's work. Collisions are normal, not rare.</li>
<li>A lock stops the damage, but it doesn't explain anything. A blocked agent needs to know what the other agent is doing.</li>
<li>Relay now keeps a shared memory of every agent's work in a FalkorDB graph database, and gives that context back to agents when they need it.</li>
<li>Try it: <code>npm install -g relaybrain</code></li>
</ul>
</blockquote>
<h2>How often do AI coding agents actually collide?</h2>
<p>More than you'd guess. A 2026 study of over 33,000 pull requests written by AI agents found that 79.4% of them overlapped in time with another agent's pull request. When two <em>different</em> agents overlapped, 41.7% of those pairs ended in a merge conflict. When it was the same agent twice, it was 19.8%. (<a href="https://arxiv.org/abs/2607.04697">arXiv:2607.04697</a>)</p>
<p>A second 2026 study, <em>AgenticFlict</em>, looked at more than 100,000 agent pull requests and found a 27.67% conflict rate. (<a href="https://arxiv.org/abs/2604.03551">arXiv:2604.03551</a>)</p>
<p>So if you run Claude Code, Cursor and Copilot on the same project, they <em>will</em> step on each other.</p>
<p>That's the problem Relay was built for. Before an agent edits a file, Relay checks whether anyone else is using it. If the file is free, the agent gets a <strong>lock</strong>: a short-lived "I'm working on this" sign. If it's taken, the edit is blocked. Relay is also smart about connected files: if you're changing something that other files depend on, those are protected too.</p>
<p>But a lock is a yes-or-no answer. If a teammate told you "no, you can't touch that file", what's the first thing you'd ask? <em>Why?</em></p>
<h2>Why did agents need a real memory?</h2>
<p>Before the hackathon, Relay remembered things in a few separate lists: a list of chat messages, a list of edits, a list of decisions. Each one was useful on its own. But the interesting questions always crossed between them.</p>
<p>"Which request caused this change, and did it clash with anyone?" meant digging through every list and matching things up by time. The lists also had a size limit, so on a busy project, older history quietly disappeared. And when teammates shared a project, their lists were just stacked together, so two people's agents working on the same file never connected.</p>
<p>The real problem was shape. This information is naturally connected: people use agents, agents have conversations, conversations lead to edits, edits change files, and blocks happen between two agents over one file. That's a web of relationships, not a list. So we stored it as one.</p>
<h2>What is a graph database, and why FalkorDB?</h2>
<p>A graph database stores <strong>things</strong> (called nodes) and the <strong>connections between them</strong> (called edges). Instead of searching through rows, you follow connections, a bit like clicking through links on a website.</p>
<p>That fits our data perfectly. We used <a href="https://www.falkordb.com">FalkorDB</a>, a fast graph database that keeps each project in its own separate graph. Every Relay project gets its own memory.</p>
<p><img src="https://raw.githubusercontent.com/prakrititz/relay-blog/main/images/memory-graph-overview.png" alt="Relay's Memory Graph view: the most important files on the left, a warning that Cursor was blocked by Claude Code, and the connections between agents, their conversations, decisions and related files" /></p>
<p>Here's what goes into the graph, in plain words:</p>
<ul>
<li><strong>People</strong> and the <strong>agents</strong> they run (Claude Code, Cursor, Codex, Copilot, Antigravity)</li>
<li><strong>Conversations</strong> with those agents, and the <strong>requests</strong> you typed</li>
<li><strong>Edits</strong> each agent made, and the <strong>files</strong> they changed</li>
<li><strong>Blocks</strong>, every time one agent was stopped by another</li>
<li><strong>Decisions</strong>, like "we're using short-lived login tokens"</li>
</ul>
<p>One small design choice made a big difference. A block involves several things at once: the file, the agent holding it, the agent that wanted it, and what the holder was doing at that moment. So we made each block its own node in the graph, connected to all of those. That also let us squash Cursor's twenty-five retries into a single "blocked 25 times" entry instead of twenty-five lines of noise.</p>
<h2>How does Relay know <em>why</em> a change happened?</h2>
<p>You could ask every agent to explain each change. In practice, they rarely do, and forcing them is fragile. So we don't ask.</p>
<p>Every agent already saves its conversation to your computer. Relay reads those conversations for all five agents and links each edit to <strong>the request you made just before it</strong>. That's the "why".</p>
<p>There's one trick to it. People type a lot of "continue", "yes" and "go ahead". Linking an edit to "continue" explains nothing. So Relay skips those little nudges and links the edit to the real request that came before them.</p>
<p>When we tested this on our own messy, multi-agent history, every edit found its way back to a real request.</p>
<p><img src="https://raw.githubusercontent.com/prakrititz/relay-blog/main/images/file-story.png" alt="For any file, Relay lists each change with the agent, the teammate, and the exact request that caused it" /></p>
<p>Click any file and you can see its whole story: who changed it, with which agent, and why.</p>
<h2>How does a blocked agent find out what the other one is doing?</h2>
<p>This was the original itch, and it had one tough rule: <strong>don't slow anything down</strong>.</p>
<p>Relay checks for locks before <em>every single edit</em> an agent makes. If that check had to ask the database each time, every agent would feel sluggish all day. So the check never waits on the database. Relay keeps a small, quick summary of what each agent is currently working on, right in memory, and keeps it up to date in the background.</p>
<p>When a block happens, Relay adds that summary to the message the agent sees:</p>
<pre><code class="language-text">This file is locked by Claude Code. Pick a different task.
They're working on: "switch the login flow to JWT tokens" (2 min ago).
</code></pre>
<p>Now Cursor can do what a person would do: move on to something else and come back later.</p>
<p>The hardest part wasn't the speed. It was making sure Relay matched the right conversation to the right lock. Each of the five agents labels its conversations differently, so we had to teach Relay to read all five styles and line them up the same way.</p>
<p><img src="https://raw.githubusercontent.com/prakrititz/relay-blog/main/screenRec.gif" alt="Relay live: agents taking turns on files across machines, with blocks that explain what the other agent is doing" /></p>
<h2>Can agents look things up before they start?</h2>
<p>Yes, and this is where agents start behaving more like good teammates.</p>
<p>Relay gives every agent two extra tools it can call. The first is a <strong>briefing</strong>: before an agent touches files it hasn't seen, it asks Relay, and gets back who's working on them right now, what was decided about them, what got blocked before, and who on the team knows them best.</p>
<p>The second lets an agent <strong>ask the memory a question</strong>: the story of a file, who to ask, why something was blocked, or a search across every agent conversation. Each answer also shows the exact database query behind it, so nothing is a black box.</p>
<p>And if you're working with teammates, only one person needs to run the database. Everyone else's agents ask that shared memory over the internet.</p>
<h2>Why use graph algorithms on agent memory?</h2>
<p>Some questions are naturally about connections. "Which files matter most for coordination?" is one of them.</p>
<p>Relay connects files that tend to be changed together, then runs <strong>PageRank</strong> on them. That's the same idea Google used to rank web pages: a file is important if it's connected to lots of other important files. Those are your hotspots, the places where agents are most likely to bump into each other.</p>
<p>A second algorithm groups files into natural work areas, even when they live in completely different folders. In our own project, a feature's code, its documentation and its screen in the app all landed in one group.</p>
<p><img src="https://raw.githubusercontent.com/prakrititz/relay-blog/main/Falcor-Db_memory.gif" alt="Exploring the FalkorDB memory graph in Relay's Mission Control" /></p>
<h2>What went wrong along the way?</h2>
<p>A few things cost us real time, and they might save you some:</p>
<ol>
<li><strong>Data that didn't stick.</strong> Our database lost everything whenever we restarted it. We'd saved the data to the wrong folder inside the container. Fixing the folder, and switching to regular snapshots, solved it.</li>
<li><strong>Things finishing out of order.</strong> One setup step ran in the background, so our clean-up sometimes happened <em>before</em> it finished, and empty test data came back to life. The fix was simply waiting for it.</li>
<li><strong>Counting things twice.</strong> After a network hiccup, Relay re-sends history. Without care, every count would double. Now each batch is labelled, so re-sending is always safe.</li>
<li><strong>Changing the design without starting over.</strong> When we changed how history is stored, we upgraded the existing memory in place instead of wiping it. Old chat text is cleared after 90 days, but the connections stay.</li>
</ol>
<h2>Try it</h2>
<pre><code class="language-bash">npm install -g relaybrain
relay graph up
relay graph enable
relay serve
</code></pre>
<p>That installs Relay, starts FalkorDB (you'll need Docker), connects them, and opens Relay's dashboard at <a href="http://localhost:3001">http://localhost:3001</a>. No Docker? You can point Relay at a free FalkorDB Cloud database instead. Want to look around straight away? <code>relay graph seed</code> creates a demo project with five agents already working on it.</p>
<p>The code is on GitHub at <a href="https://github.com/prakrititz/relayBrain">prakrititz/relayBrain</a>, and the project page is <a href="https://relay-brain.vercel.app">relay-brain.vercel.app</a>.</p>
<h2>FAQ</h2>
<h3>Does everyone on my team need to install FalkorDB?</h3>
<p>No. Only one person, the host, runs it. Everyone else's agents ask the host's shared memory over the internet. And the rest of Relay (locking, syncing, the dashboard) works even without it.</p>
<h3>Will this slow my agents down?</h3>
<p>It shouldn't. The lock check never waits on the database, and the memory is updated in the background. If the database goes down, locking keeps working and the history catches up when it's back.</p>
<h3>Which AI coding agents does it work with?</h3>
<p>Claude Code, Cursor, Codex, GitHub Copilot and Google Antigravity. Relay plugs into each one's own settings, so you don't need to change how you use them.</p>
<h3>Does it keep my conversations forever?</h3>
<p>No. Chat text older than 90 days is cleared automatically, while the record of who changed what stays. You can also turn off storing chat text completely.</p>
<hr />
<p><em>Built for Graph Hacks: Context for AI Agents (WeMakeDevs x FalkorDB), Track 2: Agent Memory &amp; Coordination. And yes, we used Relay to build Relay.</em></p>
]]></content:encoded></item></channel></rss>