> **Part of the [Ataraxy Labs](https://ataraxy-labs.com) stack**, agent-native infrastructure for software development. See also: [sem](https://ataraxy-labs.com/sem) (semantic version control) · [inspect](https://github.com/Ataraxy-Labs/inspect) (semantic code review) · [opensessions](https://github.com/Ataraxy-Labs/opensessions) (tmux sidebar for coding agents). > > Read the manifesto: https://ataraxy-labs.com/#thesis · Essays: https://ataraxy-labs.com/blogs · LLMs: https://ataraxy-labs.com/llms.txt

weave

Entity-level semantic merge for Git.
Resolves merge conflicts that Git can't by parsing code into functions, classes, and keys with tree-sitter, then merging those entities instead of lines.

How weave land works · Install · Quickstart · How It Works · MCP Server · CLI · Releases

Release Homebrew Rust Tests License Languages

Weave merge animation: two branches add different functions, git conflicts, weave merges cleanly

## How weave land works `weave land` merges code and checks the result for structural problems. Add `--onto` to integrate and publish, and `--verify-cmd` or `--check sem` to validate the final tree before publishing. [Usage and safety](#landing-an-agents-merge-weave-land) ## Quickstart ```bash weave setup # this repo now merges through weave; git merge/rebase/cherry-pick unchanged git merge # real conflicts land as markers with a `refused_by:` line stating why weave explain # per-hunk detail for one conflicted file, read off the actual git stages # ...edit to resolve... weave check # verify the working tree against the three merge stages; exits 1 on findings, 2 if it could not verify weave land --resolver # or: land it, each conflicted file labelled PROVEN / VERIFIED / REFUSED ``` See [Setup](#setup) for `--global`/`--local` variants, [CLI Commands](#cli-commands) for the rest of the `weave` binary, and [MCP Server](#mcp-server) for agent-framework integration. ## The Problem Git merges by comparing **lines**. When two branches both add code to the same file, even to completely different functions, Git sees overlapping line ranges and declares a conflict: ``` <<<<<<< HEAD export function validateToken(token: string): boolean { return token.length > 0 && token.startsWith("sk-"); } ======= export function formatDate(date: Date): string { return date.toISOString().split('T')[0]; } >>>>>>> feature-branch ``` These are **completely independent changes**. There's no real conflict. But someone has to manually resolve it anyway. This happens constantly when multiple AI agents work on the same codebase. Agent A adds a function, Agent B adds a different function to the same file, and Git halts everything for a human to intervene. ## How Weave Fixes This Weave replaces Git's line-based merge with **entity-level merge**, a 3-way merge that compares base, ours, and theirs at the level of individual functions, classes, and keys instead of individual lines. That lets it tell where the two branches actually drifted apart, rather than just where their edits happen to land on the same line numbers. It works like this: 1. Parses all three versions (base, ours, theirs) into semantic entities: functions, classes, JSON keys, etc., using [tree-sitter](https://tree-sitter.github.io/) 2. Matches entities across versions by identity (name + type + scope), including renames 3. Merges at the entity level: - **Different entities changed** → auto-resolved, no conflict - **Same entity changed by both** → attempts intra-entity merge, conflicts only if truly incompatible - **One side modifies, other deletes** → flags a meaningful conflict Run the same scenario above through weave, and it merges cleanly with zero conflicts: both functions end up in the output. This merge algorithm is deterministic and stateless: it reads three file revisions and writes one result, the same way `git merge-file` does. It is not a CRDT. (Weave separately ships a CRDT-backed coordination layer, `weave-crdt`, for tracking *live* multi-agent edits before they hit Git; see [Architecture](#architecture).) ## Weave vs Git Merge | Scenario | Git (line-based) | Weave (entity-level) | |----------|-----------------|---------------------| | Two agents add different functions to same file | **CONFLICT** | Auto-resolved | | Agent A modifies `foo()`, Agent B adds `bar()` | **CONFLICT** (adjacent lines) | Auto-resolved | | Both agents modify the same function differently | CONFLICT | CONFLICT (with entity-level context) | | One agent modifies, other deletes same function | CONFLICT (cryptic diff) | CONFLICT: `function 'validateToken' (modified in ours, deleted in theirs)` | | Both agents add identical function | **CONFLICT** | Auto-resolved (identical content detected) | | Both agents add different properties to same object | **CONFLICT** | Auto-resolved | | Different JSON keys modified | **CONFLICT** | Auto-resolved | The key difference: Git produces false conflicts on **independent changes** because they happen to be in the same file. Weave only conflicts on **actual semantic collisions** when two branches change the same entity incompatibly. ## Weave vs Mergiraf 31 hand-crafted merge scenarios across 7 languages, comparable to [mergiraf](https://mergiraf.org/)'s own test corpus. Run `weave stats --bench` to reproduce: Two of the 31 **must not** merge. When both sides add different decorators to the same Python or TypeScript function, decorator application is function composition, so the stack order is a semantic decision neither side made — `@cache` outside `@auth` serves cached responses without ever running the auth check. Weave refuses rather than fabricate an order, and a tool that merges those cleanly is wrong, not better. Annotations in Java, C# and Kotlin are unordered metadata, so weave still set-unions those. | Tool | Clean merges (of 29 mergeable) | Correct outcomes (of 31) | |------|-------------------------------|--------------------------| | **Weave** | **29/29** (100%) | **31/31** (100%) | | Mergiraf (v0.16.3) | 26/29 (90%) | 28/31 (90%) | | Git | 15/29 (52%) | 17/31 (55%) | All three tools correctly refuse the two decorator scenarios. Mergiraf fails on both-add-at-end-of-file and insert-between-existing; weave resolves those because it operates at entity granularity (functions, classes, methods) rather than AST node level. Full breakdown at [ataraxy-labs.github.io/weave](https://ataraxy-labs.github.io/weave/benchmarks.html). ## Real-World Benchmarks Replayed against real merge commits from five long-lived open-source repositories. For each of the first 500 merge commits per repo, weave re-runs the merge (base/ours/theirs from the actual git history) and compares its output to both Git's line merge and the human-authored merge commit. Reproduce with `weave stats --repo --limit 500`; full per-repo breakdown, including which files disagree and why, is at [ataraxy-labs.github.io/weave/benchmarks.html](https://ataraxy-labs.github.io/weave/benchmarks.html). - **Win**: the line-based 3-way merge conflicted, weave resolved cleanly - **Regression**: the line-based 3-way merge resolved cleanly, weave conflicted - **Human match**: of weave's wins, how many are byte-identical (whitespace-normalized) to what the developer actually wrote > **Note (0.5.3):** regenerated on the 0.5.3 engine on 2026-09-01 (`weave stats --repo > --limit 500`, fresh full clones). Read against the previous table with three caveats, stated > rather than smoothed over. First, 0.5.3 conflicts on purpose where 0.5.2 sometimes resolved > silently (divergent same-name additions, tightened same-entity and gap verdicts) — most of the > regression increase is that tightening doing its job; on CPython, whose tested window is > identical between runs, all of it is. Second, the earlier run's exact commit window was not > recorded, and `stats --repo` walks the most recent N merges — for git, Go, and TypeScript the two > runs replay substantially different commit sets, so cross-run rate comparisons there are > indicative, not exact; this run's windows are current as of the date above. Third, audited > details: the "clean line merge" baseline is a diff3 implementation (`diffy`), which disagrees > with `git merge-file` on a small number of cases; 3 of the 86 regressions are a known guard > false-positive (files whose *source code contains conflict-marker string literals* — e.g. > TypeScript's own scanner); and in 2 regressions the line merge's "clean" result differs from > what the human actually committed, i.e. weave's refusal was arguably the safer verdict. | Repository | Language | File merges tested | Wins | Regressions | Human match | |------------|----------|--------------------:|-----:|-------------:|-------------:| | [git/git](https://github.com/git/git) | C | 1,701 | 183 | 23 | 72% | | [Flask](https://github.com/pallets/flask) | Python | 67 | 15 | 1 | 33% | | [CPython](https://github.com/python/cpython) | C / Python | 256 | 11 | 10 | 45% | | [Go](https://github.com/golang/go) | Go | 1,667 | 120 | 37 | 33% | | [TypeScript](https://github.com/microsoft/TypeScript) | TypeScript | 1,280 | 15 | 15 | 53% | Across all five repos: 344 wins on 4,971 file merges (0.5.2 measured 83 wins on 4,517), with 86 total regressions spread across every repo (0.5.2 measured 3, all on TypeScript). The jump in regressions is expected and by design, not a quality drop we're hiding: 0.5.3 now conflicts on genuinely divergent concurrent additions that 0.5.2 silently merged, and no longer resolves a case that could resurrect a deleted JSON key — both changes move cases from "weave resolves" into "weave conflicts" under this benchmark's own regression definition (git resolves cleanly, weave doesn't). Wins also rose substantially on every repo. File-merge counts and human-match rates shifted too, partly because "first 500 merge commits" is a moving window and all five repos have advanced since the 0.5.2 run. See the per-repo breakdown on the benchmarks page before relying on weave for large merges in any of these languages. ## Testing The open test suite in this repository, 441 unit and integration tests plus a five-scenario sweep per supported language in `crates/weave-core/tests/language_coverage.rs`, covers the documented merge properties and runs in CI (`cargo fmt --check`, `cargo clippy -D warnings`, `cargo test --workspace`) on Linux and Windows on every push and PR. ## Conflict Markers When a real conflict occurs, weave gives you context that Git doesn't: which entity, what type, and, on the line inside the box, which internal guard declined to auto-merge and exactly which lines both sides disagree about. ``` <<<<<<< ours — function `process` (T, confidence: high) // refused_by: statement_fold · collision: ` return data.upper()` +1 more export function process(data: any) { return JSON.stringify(data); } ======= export function process(data: any) { return data.toUpperCase(); } >>>>>>> theirs — function `process` (T, confidence: high) ``` Run `weave explain ` for more detail on every conflicted entity in the file, and `weave check` after editing to verify your resolution against the three merge stages; see [Quickstart](#quickstart). ## Supported Languages TypeScript, TSX, JavaScript, Python, Go, Rust, Java, C, C++, Ruby, C#, PHP, Swift, Kotlin, Scala, Dart, Elixir, Bash, Fish, Fortran, Perl, OCaml, Zig, Elm, Clojure, EDN, D, Lua, Nix, SQL, HCL/Terraform, LaTeX, XML, JSON, YAML, TOML, CSV, Markdown. Falls back to standard line-level merge for everything else. `weave setup` derives its `.gitattributes` rules directly from the parser registry: every extension the tree-sitter grammars recognize gets a `merge=weave` line automatically, with no hand-maintained list to fall behind. Each language on it passes a five-scenario merge sweep (two sides adding different definitions merges clean, two sides rewriting the same definition conflicts, and nothing is dropped) in `crates/weave-core/tests/language_coverage.rs`, and a separate parity test (`crates/weave-core/tests/setup_extension_coverage.rs`) fails the build if a newly added grammar is ever left unclaimed and undeclined. INI files (`*.ini`, `*.cfg`) have no grammar but are claimed too (`weave_core::LINE_RULE_EXTENSIONS`): they take Git's line merge, plus the rule that unites keys two sides added to one section. Vue, Svelte, ERB and Haskell are parsed but deliberately **not** claimed: weave declines exactly these four (`weave_core::DECLINED_EXTENSIONS`), and nothing else. Their entity model treats a whole `