Inspiration
AI coding agents made each of us faster this weekend, but sometimes, they made working as a team harder. Every teammate had their own agent rewriting files, and nobody could see what the other agents were doing until a push landed in git. By then the damage was done: merge conflicts, duplicated helpers, and two agents "fixing" the same function in different ways. Git was built for humans who commit a few times an hour, not for agents that change dozens of functions in minutes. And git only catches textual conflicts. The worst breakages merge cleanly: one agent changes how calculateFee rounds, and another agent's checkout code, which calls it, silently breaks. We wanted agents to see each other's plans while they work, and to stop before they collide.
What it does
InSync lets a team's AI coding agents coordinate live. Before an agent edits, it publishes a plan: which functions it will modify, create, or depend on. InSync checks every plan and every change against all the other agents as it happens, at the level of functions and call edges, not just files:
- Broken dependency: an agent changes a function that another agent's plan calls, up to three hops away. InSync pauses the affected agent mid-task and tells it why.
- Duplicate work: an agent plans a helper that already exists or that another agent is writing (
formatDatevsdateToString). InSync tells it to reuse the existing one. - Claim contention: two agents try to modify the same function. The second one is refused.
A coordinator agent, running on NVIDIA Nemotron, rules on each conflict: who owns the function, and what each agent should do now. The paused agent resumes with those instructions. When everyone finishes, InSync merges every agent's branch and runs the tests, the typecheck, and a duplicate check.
You drive it from a live dashboard. Type what you want built in a Chat tab, and InSync splits the work across agents on one or more laptops. You can watch a code map light up as functions change, see each agent's edits, and track the conflicts caught and the tokens and dollars saved.
How we built it
SpacetimeDB is the whole backend. There is no separate server.
- Agents, plans, claims, changes, conflicts, decisions, and token usage are SpacetimeDB tables. The three conflict rules run inside the reducers that receive each write, so detection is transactional, takes milliseconds, and costs no tokens.
- Subscriptions push every new conflict row at the same moment to the paused agent, the coordinator, and every dashboard, with no polling and no message bus.
- A scheduled reducer expires claims every 30 seconds, so a crashed laptop never holds a function forever.
- The shared database runs on Maincloud, so laptops join with no network setup.
- Even remote control goes through the database: the hosted dashboard sends commands to a laptop as rows, and only browsers paired with a one-time code from that laptop's terminal can send them.
Agents use an MCP server plus edit hooks. Each worker is a Claude Code session in its own git worktree, with an InSync MCP server (declare_plan, claim_symbol, report_change, get_instructions, ...). Edit hooks enforce the protocol: no edit to a mapped file without a plan, and no edit to a function without a claim. Claude Code, Cursor, or Codex sessions can join the same way.
A code mapper turns the repo into function and call-edge rows. It uses ts-morph for TypeScript and JavaScript, and tree-sitter for Python, Go, Java, Rust, Ruby, PHP, C#, and C/C++.
NVIDIA Nemotron is the coordinator.
- Cheap deterministic rules detect conflicts, and Nemotron is called only when one fires, once per conflict, with strict JSON-schema output.
- Nemotron 3.5 Lightning resolves a conflict in about a second and matched 12/12 on our planted conflict set.
- Every model call goes through one wrapper (
packages/llm), so the coordinator can be switched between Nemotron and Claude with an env variable. Every call's tokens and cost are logged to the same table as the workers', so the coordinator's own cost shows on the scoreboard.
The dashboard is React and Vite with React Flow for the code map, deployed on Vercel. Every panel is a live SpacetimeDB subscription.
We built InSync with Claude Code agents, which meant we hit the exact problem we were trying to solve, many times over. Once the core protocol worked, we started using InSync to build InSync: our own agents declared plans, claimed functions, and got paused by the same conflict checks they were helping us write.
Challenges we ran into
- Files are the wrong unit. Our first idea was flagging two agents in the same file. Most real breakages are between files: a signature change in one file breaks a caller in another. We moved to function-level plans and call graphs.
- Agents don't follow protocols on their own. Asking a model to declare a plan or check a cached summary first wasn't enough; it often skipped the step. We had to enforce it with hooks that block an edit until the agent has a plan and a claim.
- Learning SpacetimeDB's model. Tables, reducers, and subscriptions are a different way of thinking than a REST backend. Reducers can't call the network, so everything that calls a model or reads files had to run as a separate Node process connected as a client.
- A public dashboard that can run commands on your laptop. The hosted dashboard is open to anyone, so we built one-time pairing codes that only appear in the laptop's own terminal, plus a fixed command allowlist.
- Our own coordination problem. Four people with four agents on one shared database broke each other's runs, until the tool we were building stopped it.
Accomplishments that we're proud of
- InSync coordinated its own development. For part of the weekend, the agents building it were running through it, and it caught real conflicts between our teammates' agents.
- Conflicts are caught while agents are still typing, including clean-merging semantic breakages that git can't see.
- In an early benchmark, InSync saved 66% of the cost on a claim-contention scenario and left no broken merges, where running without it left one.
- Real-time sync across laptops and a hosted dashboard with almost no networking code.
- It works on any git repo in 10+ languages, not just our demo.
- 536 unit tests across every part.
What we learned
- A database-as-server model like SpacetimeDB makes a multiplayer real-time system dramatically simpler. It's also the right place to put the detection logic, not just the data.
- Run deterministic checks first and spend model tokens only on judgment. Most of the value came from rules that cost nothing; the model is only needed to decide who should yield.
- For quick, structured decisions, a fast non-thinking model beat a reasoning model on speed with the same accuracy.
- Agents need guardrails, not instructions. Enforcement in hooks beats asking nicely in prompts.
- The bottleneck in AI-assisted teams isn't writing code anymore. It's keeping everyone's work coordinated.
What's next for InSync
- Nemotron workers, not just the coordinator. The provider switch and token logging are already in place.
- Two-tier rulings: a fast model handles easy conflicts, and only contested ones escalate to a larger reasoning model.
- A different model per role (workers, coordinator, planner), shown live on the dashboard.
- A larger benchmark across more scenarios and runs.
- Server hardening and per-repo runs, so several teams can share one database.
Built With
- claude
- daemon
- nemotron
- node.js
- react
- spacetimedb
- typescript