Seamlock
v0.3.4Run a team of parallel AI coding agents on your repository, coordinated by Seamlock
Contract-level coherence and smart merging for parallel AI coding agents. The Problem · How It Works · Benchmark Results · Quick Install · CLI · Architecture · Roadmap · Changelog Contract-Level Coherence Separates symbol contracts (signatures, types, exports, schemas) from bodies. Body edits never block; breaking contract edits trigger surgical notices only to affected callers. Region Coherence & Verified Union Detects overlapping edits live, resolves pure two-sided insertions via patience/diff3 + AST verification, and eliminates duplicate symbol definitions before merge.
Summary extracted from the README.
Seamlock is an orchestration engine and MCP server for running multiple AI coding agents (OpenCode, Claude Code, Cursor, ...) at the same time on the same repository without them silently breaking each other's work.
[!NOTE] Jump straight to the Benchmark Results & Tests below: 652/652 in all 5 runs on 12-agent Python CommonMark (
3.1×faster than one agent,1.6×faster than an AI integrator,0conflicts); in efficient mode (0.2.1)1.7×faster than the integrator at14%lower cost and 48/48 (100.0%) on a private 6-agent TypeScript dispatch app (2.20×speedup,0conflicts, zero per-ticket test hints).
Highlights
The problem
Today's parallel-agent setups give each agent its own git worktree. That stops agents from overwriting each other's files, but not from breaking each other's code:
- 28% of AI-agent pull requests on GitHub hit merge conflicts (AgenticFlict).
- Two cooperating agents succeed about 30% less often than one agent doing both tasks (CooperBench).
- The worst failures are invisible to git: patches that "pass alone but fail together".
# notify/email.py (agent A: rate-limit e-mails) # auth/reset.py (agent B: password reset)
-def send_email(to, body): +def request_reset(user):
+def send_email(to, body, *, user_id): + token = tokens.issue(user)
... + send_email(user.email, reset_msg(token))
The two agents touch different files, so git merges cleanly, file locks see no conflict, and both branches pass their own tests. The merged program crashes with TypeError: send_email() missing 1 required keyword-only argument: 'user_id'. Meanwhile, a third agent that only rewrites the body of another function in notify/email.py would be blocked by a file lock for no reason.
The idea
Files are the wrong unit of coordination. Agents break each other through contracts: the signatures, types, exported names, routes, and schemas that other code depends on. Seamlock treats every agent's worktree like a CPU cache and every symbol like a cache line, and runs a coherence protocol over them:
-
Infer, don't ask. It watches what each agent actually reads and edits (hooks, diffs) and maps it onto a symbol graph, giving a footprint per agent: symbols read, written, and used by the agent's new code.
-
Contract vs. body, breaking vs. compatible. Every symbol is split into its contract and its body. Body edits never block anyone. Contract changes are classified from structured signatures:
- breaking, e.g. a new required parameter;
- compatible, e.g. a new optional parameter, which only produces an informational notice.
Only concurrent edits to the same contract are serialised, through a short lease.
-
Precise notices + finish gate. When a contract changes, Seamlock sends a short, generated notice only to the agents whose footprint depends on it. The notice has the old and new contract and the recipient's exact call sites. An agent cannot finish while it depends on a stale contract.
-
Speculative integration. In the background, all branches are merged in memory, type-checked, and the affected tests are run, to catch whatever the contract model misses.
Benchmark results
1. Python — 12 Agents Building a Full CommonMark 0.31.2 Parser (seamlock-bench)
Twelve parallel OpenCode agents (opencode-go/hy4-flash-free) implement all sections of the CommonMark 0.31.2 Markdown→HTML specification from a minimal paragraph-only scaffold, judged by the official 652-example CommonMark specification suite. Main study (pre-registered in PROTOCOL.md): opencode-go/hy4-flash-free, runs interleaved by round, mean ± SD over n valid runs. Full report with bootstrap CIs, tests and figures: seamlock-bench/results/hy4m.
| Condition | n | Spec examples passed (of 652) | Integration loss | Merge conflicts (of 12 branches) | Wall-clock time |
|---|---|---|---|---|---|
sequential (1 agent, ticket by ticket) |
5 | 651.2 ± 0.8 (650–652) | 0 | 0 | 65.1 ± 5.9 min (1.0×) |
parallel-off (12 agents, uncoordinated) |
5 | 199.0 ± 30.1 (161–236) | 301.8 ± 45.8 | 9.0 ± 1.4 | 13.7 ± 1.9 min |
parallel-integrator (12 agents + 13th integrator agent) |
5 | 652 in every run | 0 | 9.4 ± 1.1, resolved by the integrator | 34.2 ± 4.8 min (1.9×) |
Seamlock, peer merge (parallel-seamlock: --mode enforce --peer-merge) |
3 | 652 in every run | 0 | 0 | 27.1 ± 3.5 min (2.4×) |
Seamlock, region coherence (parallel-regions: --mode enforce --regions) |
5 | 652 in every run | 0 | 0 | 20.8 ± 1.9 min (3.1×) |
Pre-registered tests (Mann–Whitney U, Holm-corrected, Cliff's δ), region coherence vs: parallel-off on examples passed (H1) and integration loss (H2), and sequential on wall time (H3): δ = ±1.00, p = 0.03 each. Exploratory: region coherence is faster than the integrator in every pairing (δ = −1.00, p = 0.008, uncorrected). A replication with opencode-go/deepseek-v4.1-flash is partly done and paused.
Efficient Seamlock vs the integrator (pre-registered efficiency benchmark, seamlock 0.2.1 build 192af58, --mode enforce --regions --trim-outputs with the lean gate that is the default since 0.2.0; interleaved rounds, n = 3 each, cost at the provider's list price; report):
| Condition | Spec examples passed | Merge conflicts | Wall-clock time | Coordination tokens | Total tokens | Cost per run |
|---|---|---|---|---|---|---|
parallel-integrator (12 agents + 13th integrator agent) |
652 in every run | 8.7 ± 1.5, resolved by the integrator | 35.5 ± 9.5 min | 27.6 ± 7.4M | 68.8 ± 14.6M | $0.48 ± 0.07 |
Seamlock, efficient (--regions --trim-outputs) |
652 in every run | 0 | 20.6 ± 6.3 min | 17.5 ± 2.5M | 61.2 ± 1.7M | $0.41 ± 0.01 |
Efficient Seamlock was faster, used fewer coordination tokens and cost less in all nine pairings (Cliff's δ = −1.00, p = 0.10, the smallest possible with n = 3); total tokens do not differ clearly (δ = +0.11). Against the main study's region coherence (previous gate), it runs in about the same time with about 26% fewer tokens and 23% lower cost.
With a second model: DeepSeek V4.1 Flash (opencode-go/deepseek-v4.1-flash; efficient Seamlock 0.2.4 against parallel-integrator; means per run, cost at the provider's list price; protocol). Correctness was the same as the integrator's on every benchmark (CommonMark 652/652 and the private TypeScript dispatch app 48/48 in every run; on the real product sprint every miss was in an agent's own ticket code, under both conditions), and Seamlock had no merge conflicts where the integrator resolved 1–10 per run:
| Benchmark | Condition | n | Time | Tokens | Cost |
|---|---|---|---|---|---|
| 12-agent CommonMark | Seamlock 0.2.4 | 2 | 20.6 min | 34.6M | $1.00 |
| Integrator | 4 | 31.7 min | 43.8M | $1.15 | |
| Real product sprint (5 agents, a week of a private Next.js/Postgres app) | Seamlock 0.2.4 | 2 | 16.7 min | 31.5M | $0.69 |
| Integrator | 3 | 19.1 min | 33.6M | $0.76 | |
| 6-agent private TypeScript dispatch app | Seamlock 0.2.2 | 2 | 3.7 min | 2.1M | $0.16 |
| Integrator | 2 | 6.8 min | 4.0M | $0.21 |
On CommonMark that is about 35% faster, 21% fewer tokens and 13% cheaper than the integrator. Exploratory: n = 2 Seamlock runs per benchmark (0.2.4 was measured in a pilot after the fixes that made it), so read these as a sign, not a test.
2. TypeScript 5 (strict) — 6 Agents Building a Private Dispatch App with Zero Per-Ticket Test Hints
Exploratory, n = 1 per condition (rescored after a fix to the evaluator's fixtures, see PROTOCOL.md). Six parallel OpenCode agents (opencode-go/hy4-flash-free) build features of a private TypeScript 5 (strict) dispatch app (a real product; its code, tickets and tests are not published). Agents write their own node:test suites and Seamlock coordinates with only the project's test command, no per-ticket checks. A held-out evaluation scores strict tsc compilation plus 48 behavioral tests (42 per ticket, 6 cross-ticket).
| Condition | Held-out spec (of 48) | Cross-ticket synergy | Integration loss | Merge conflicts | Wall-clock time |
|---|---|---|---|---|---|
sequential (1 agent, ticket-by-ticket) |
48 / 48 (100.0%) | 6 / 6 | 0 | 0 / 6 | 13.3 min (1.0×) |
parallel-off (6 agents, uncoordinated) |
21 / 48 (43.8%) | 0 / 6 | 21 | 3 / 6 | 6.0 min |
parallel-fileleases (6 agents, file locks) |
14 / 48 (29.2%) | 0 / 6 | 25 | 4 / 6 | 7.7 min |
parallel-integrator (6 agents + 7th integrator) |
48 / 48 (100.0%) | 6 / 6 | 0 | 0 / 6 (7th agent) | 11.7 min (1.13×) |
Seamlock (--mode enforce --regions) |
48 / 48 (100.0%) | 6 / 6 | 0 | 0 / 6 | 6.0 min (2.20×) |
Install and use it from your agent (MCP)
Seamlock runs locally, next to your repository, as an MCP server. Your coding agent (OpenCode, Claude Code, Cursor, or any MCP client) gets 12 tools to plan, coordinate, verify, and merge parallel work automatically.
1. Install & auto-connect (macOS, Linux):
# Homebrew (macOS & Linux):
brew install lucas-rus/tap/seamlock && seamlock setup
# Or curl installer:
curl -fsSL https://raw.githubusercontent.com/lucas-rus/seamlock/main/install.sh | sh -s -- --setup
(From source with Rust ≥ 1.90: cargo install --git https://github.com/lucas-rus/seamlock seamlock-cli && seamlock setup.)
2. Or connect manually:
OpenCode (one-line CLI, no JSON editing):
opencode mcp add --global seamlock -- seamlock mcp --agent-cli opencode
Antigravity (writes ~/.gemini/config/mcp_config.json; restart Antigravity afterwards):
seamlock setup --client antigravity
or add it by hand to ~/.gemini/config/mcp_config.json:
{ "mcpServers": { "seamlock": { "command": "seamlock", "args": ["mcp", "--agent-cli", "opencode"] } } }
All planning, inspection, and merge tools run directly inside Antigravity. seamlock_run launches its parallel workers with OpenCode or Claude Code (--agent-cli opencode|claude), so one of them must be installed to use team runs.
Claude Code (plugin with the MCP server and a seamlock-team skill):
/plugin marketplace add lucas-rus/seamlock
/plugin install seamlock@lucas-rus-seamlock
MCP Tools (12):
- Planning, contract inspection & smart merging (for any agent workflow):
seamlock_plan— partition the repository symbol graph into shared contract hubs and producer-first parallel ticket clustersseamlock_symbols— list symbol signatures and line spans without function bodies (~10× fewer tokens than reading whole files; Python, TS/JS, Rust, Go, C/C++, SQL, Prisma, Protobuf, OpenAPI)seamlock_diff_contracts— contract-level diff between revisions or working tree, with impacted callersseamlock_worktrees— zero-mutation live check across all activegit worktreecheckouts (Claude Squad, Cursor worktrees, manual worktrees)seamlock_analyze— check concurrent branches for cross-file contract violations, duplicate symbols, and textual overlapsseamlock_smart_merge— merge branches producer-first with AST-verified insertion union, post-merge call conformance, optional--type-check, and $O(\log k)$ test failure bisectionseamlock_negotiate/seamlock_ack— propose a signature adjustment to a symbol's live owner or acknowledge a peer's contract change
- Parallel team orchestration:
seamlock_run,seamlock_status,seamlock_result(includes SASE Merge-Readiness Pack),seamlock_cancel
Try it from the command line
Requires Rust ≥ 1.90 and git ≥ 2.38 (2.44 or later recommended: union merges use git merge-file --diff-algorithm; Seamlock warns and falls back on older git).
git clone https://github.com/lucas-rus/seamlock && cd seamlock
cargo build --release
# Build the running example: branches agent-a, agent-b, agent-c from a common base.
examples/running-example/setup.sh /tmp/seamlock-demo
./target/release/seamlock analyze --repo /tmp/seamlock-demo --base main agent-a agent-b agent-c --notices
Findings
BREAKING agent-a -> agent-b: notify.email.send_email (no shared files: invisible to textual merge and file locks)
now: def send_email(to, body, *, user_id)
what: new required parameter `user_id`
auth/reset.py:11 request_reset: send_email(user.email, reset_msg(token))
FILE agent-a & agent-c: notify/email.py disjoint symbols (a file lock would serialise this needlessly)
Textual merge (git merge-tree)
agent-a & agent-b: clean
agent-a & agent-c: clean
agent-b & agent-c: clean
Protocol simulation (notices each agent would receive)
-> to agent-b
[seamlock] BREAKING contract change: notify.email.send_email v0 -> v1 (by agent-a)
before: def send_email(to, body)
after : def send_email(to, body, *, user_id)
what : new required parameter `user_id`
your code that depends on it:
auth/reset.py:11 request_reset: send_email(user.email, reset_msg(token))
Finish gates:
agent-a: open
agent-b: BLOCKED (1 unresolved)
agent-c: open
Other commands:
seamlock setup # auto-connect OpenCode, Claude Code, Cursor, and Antigravity MCP
seamlock plan --rev HEAD # identify shared hubs & producer-first parallel ticket clusters
seamlock symbols src/ # symbol contracts & spans (Py, TS/JS, Rust, Go, C/C++, SQL/Prisma/Proto/OpenAPI)
seamlock diff old.py new.py # contract vs. body changes between two versions
seamlock worktrees --base main # inspect all active git worktrees (incl. uncommitted edits)
seamlock typecheck --repo . # auto-detect & run Tier-2 checker (tsc, pyright/ty, cargo check, go vet)
seamlock merge --base main b1 b2 --type-check # contract-ordered smart merge + verified union + conformance + type check
seamlock mrp .seamlock/runs/<run-id> # render SASE Merge-Readiness Pack (markdown or --json)
seamlock analyze --base main b1 b2 --json # machine-readable output (for CI & experiments)
seamlock run --tasks tasks.json --mode enforce --regions --test-cmd "npm test"
seamlock run --milestones waves.json --mode enforce --regions --test-cmd "npm test"
[!TIP] Lean by default (0.2.0). In enforce mode the finish gate verifies each hand-off with the agent's own acceptance check instead of spending an agent turn on it, sends an agent back for a failing check at most once, and lets the repair pass after integration handle the rest. On 12-agent CommonMark this cut tokens by about a quarter at the same 652/652 and zero conflicts. Against an AI integrator agent (0.2.1 with
--trim-outputs, n = 3 each), Seamlock took 42% less time, 36% fewer coordination tokens and 14% lower cost, at about the same total tokens.--no-leanrestores the previous gate. With OpenCode agents,--trim-outputsalso keeps large command and search outputs out of the agents' context (head and tail stay; the full output is saved to a file the agent can search).
[!NOTE] Zero-config acceptance gating:
tasks.jsononly needs[{"name": "...", "prompt": "..."}]— when per-ticketcheckcommands are omitted, Seamlock automatically uses--test-cmdfor finish-gate verification, cross-agent regression gating, and $O(\log k)$ post-merge failure bisection.
GitHub Cross-PR CI Action
Drop action.yml into any workflow to cross-check concurrently open PRs for silent contract breaks:
- uses: lucas-rus/seamlock@main
with:
base: main
Watch a team live
seamlock watch follows a run as it happens: what each agent is doing, who waits for whom, and every coordination step Seamlock takes.
seamlock watch runs/ # the most recent run under the --out of `seamlock run`
seamlock watch runs/ --once # one snapshot, e.g. for a log
seamlock 1795518603-enforce-463d82 1/12 finished 03:07 · running
agent state edits notices blocks hand-off combined merges
code-spans finished 4 0 0 0 0 0
emphasis working 8 0 0 0 0 0
images-autolinks working 2 0 0 0 1 0
lists working 5 0 0 0 1 0
...
coordination
02:26 region raw-html-breaks yields src/cmark/inlines.py to code-spans
02:36 combine lists + headings add at the same place in src/cmark/blocks.py
02:59 done code-spans finished
First results (RQ1, CooperBench gold patches)
On all 560 Python feature pairs of CooperBench, Seamlock's textual merge results agree with CooperBench's own gold conflict report on 560/560 pairs. At symbol level:
- 24% of pairs share files but touch disjoint symbols, so a file lock would serialise them needlessly.
- 12% are contract-coupled, and only 1% have call sites that actually violate the new contract.
- Test runs confirmed that interference between gold patches is rare: 0 of 48 evaluable jinja pairs fail together. The value of Seamlock shows on agent patches (see the live results above).
Details: eval/rq1/results.md.
Architecture
flowchart LR
subgraph Agents
A1[Agent 1<br/>worktree w1]
A2[Agent 2<br/>worktree w2]
An[Agent n<br/>worktree wn]
end
subgraph Coherence layer
FT[Footprint tracker]
SG[Symbol graph<br/>contracts / bodies / uses]
CD[Coherence directory<br/>leases, versions, notices]
end
SI[Speculative integrator<br/>merge-tree, type-check, tests]
IQ[Integration queue]
A1 & A2 & An -- hook events, diffs --> FT --> SG --> CD
CD -. notices, finish gate .-> A1 & A2 & An
FT --> SI --> CD
CD --> IQ --> main[(main)]
| Crate | Role | Status |
|---|---|---|
seamlock-core |
Symbols, contract/body change classification, coherence protocol (leases, duplicate-symbol guard, negotiation, finish gate), pairwise conflict analysis, exhaustive BFS formal model checker | Complete |
seamlock-lang |
Tree-sitter & schema front-ends: symbols, normalised contracts, body digests, imports, reference resolution, HTTP route linking, affected-test graph | Python, TS/JS, Rust, Go, C/C++, Schemas |
seamlock-git |
Git plumbing: tree reading, in-memory merge-tree, patience/diff3 verified insertion-union, worktree snapshots & listing |
Complete |
seamlock-cli |
seamlock binary: setup, plan, symbols, diff, analyze, worktrees, typecheck, merge, mrp, run, watch, mcp (12 MCP tools + authenticated TCP daemon) |
Complete |
Languages. Seamlock's symbol and contract engine covers Python (.py, .pyi), TypeScript/JavaScript (.ts, .tsx, .mts, .cts, .js, .jsx, .mjs, .cjs, including @/... and ~/... tsconfig root path aliases), Rust (.rs), Go (.go), C/C++ (.c, .h, .cc, .cpp, .cxx, .hh, .hpp, .hxx), schema/API contracts (.sql, .prisma, .proto, OpenAPI .json/.yaml), and cross-language HTTP routes (FastAPI/Flask/Express/Next.js App Router ↔ fetch/axios calls). Files in other languages still participate in textual/structural merge checks and file-existence guards.
Design: docs/design.md · Tech stack: docs/tech-stack.md · Related work: docs/research/related-work.md · Contributing: CONTRIBUTING.md · Security: SECURITY.md
How it differs from existing tools
| Unit of coordination | Footprint | Cross-file contract dependencies | Proactive, targeted info | |
|---|---|---|---|---|
| Claude Code agent teams | tasks; files by convention | declared by lead | no | free-form messages |
| Clash | file (textual merge) | observed diffs | no | pre-edit warning |
| Grove | file, hunk, symbol, import | observed diffs | imports/exports | advisory score |
| Weave / Aura | AST entities | declared MCP claims | no (same-file entity merge) | entity claim conflict |
| Claim Plane | declared intents/regions | declared by planner | partially | admission (96.7% serialised) |
| Gas Town Refinery | merge queue | – | at merge time | no |
| Seamlock | symbols; contract vs. body + regions | inferred at run time | yes, live + post-merge + HTTP/schema | surgical notices + finish gate + MRP |
License
Licensed under either of Apache License, Version 2.0 or MIT license at your option.