---
title: "weave"
description: "Entity-level git merge driver. Resolves false conflicts git invents when independent agents edit the same file. ~95% reduction vs. line-based merge."
canonical_url: "https://skilld.dev/gh/ataraxy-labs/weave"
last_updated: "2026-10-20T08:47:59.000Z"
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> 203 supporting files sit beside this SKILL.md. When the Skill refers to one, fetch https://skilld.dev/api/skills-raw/ataraxy-labs/weave/weave/PATH with PATH replaced.
>
> If the user asked to install this Skill, run `npx skilld install ataraxy-labs/weave/weave`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/weave`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/ataraxy-labs/weave/weave) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/weave`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/weave --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/weave --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# weave

Entity-level semantic merge driver for Git. Resolves conflicts at the
function/class level instead of the line level, so two changes to different
functions in the same file never conflict.

## Setup

```bash
weave setup            # this repo: registers weave as the merge driver + .gitattributes
weave setup --global   # every repo on this machine, no per-repo step
weave setup --local    # this repo only, writes .git/info/attributes instead
```

`weave setup` auto-detects the `weave-driver` binary, writes
`merge.weave.driver` to git config, and adds `*.ts merge=weave` (etc.) for
every supported extension. The equivalent by hand, if you need it:

```bash
git config merge.weave.name "Entity-level semantic merge"
git config merge.weave.driver "weave-driver %O %A %B %L %P"
echo '*.py merge=weave' >> .gitattributes   # repeat per extension you want covered
```

After setup, `git merge` / `git rebase` / `git cherry-pick` all route through
weave automatically. No new commands to run to get a merge — only to resolve
one that still conflicts.

## The resolve loop

Most merges finish clean with no conflict markers. When one entity is
genuinely disputed by both sides, weave leaves a marker box like git's, plus
one line stating *why*:

```
<<<<<<< ours — function `process` (T, confidence: high)
// refused_by: statement_fold · collision: `    return data.upper()` +1 more
def process(data):
    return data.upper()
=======
def process(data):
    return json.dumps(data)
>>>>>>> theirs — function `process` (T, confidence: high)
```

1. **Read the `refused_by:` line first.** It names the guard that declined to
   auto-merge and quotes the exact line(s) both sides disagree about — that's
   usually enough to resolve on the spot.
2. **Still unclear? Run `weave explain <file>`.** It reads the three merge
   stages straight out of git's index and reports, per conflicted entity, the
   guard, the confidence, and the hunks *both* sides actually touched —
   narrower and more precise than diffing the whole file by eye.
3. **Edit.** Pick a side, merge by hand, or rewrite — same as any conflict.
   Remove the marker lines. The `weave explain` hint is written on the first
   box's closing marker, so it goes when the markers go. Older weave versions
   appended it as a separate trailing comment; `weave check` flags a leftover
   copy.
4. **Run `weave check`.** With no arguments it verifies the working tree —
   the file as you just edited it — against the three merge stages: markers
   left behind, lines both sides kept that went missing, anything stated more
   often than either side stated it, references that no longer resolve. One
   verdict line per file, always a sentence, never a bare empty result:

   ```
   OK: src/api.py — markers cleared, no unanimous-line loss, no duplicated
   definitions or lines, no dangling references
   ```

   A file with a real problem gets `FOUND: <file> — <what and where>` plus a
   suggested repair when one follows mechanically from the finding. Exit code
   is 0 clean / 1 findings, so it composes with a script or a pre-commit hook.

`weave check --base <rev> --ours <rev> --theirs <rev>` runs the same checks
between two revisions instead of the working tree (useful pre-merge, or with
no git repo at all via `--base-dir`/`--ours-dir`/`--theirs-dir`), and emits
JSON findings instead of the verdict sentence.

## MCP server (for agent frameworks)

```bash
claude mcp add --scope user weave -- weave-mcp
```

Or any MCP client, via stdio:

```json
{ "mcpServers": { "weave": { "command": "weave-mcp" } } }
```

`weave-mcp` discovers the repo from the first tool call's file path, the
`WEAVE_REPO` env var, or its working directory — set `WEAVE_REPO` if you
launch it from outside the repo. It lists one tool per command:
`weave_edit`, `weave_preview`, `weave_explain`, `weave_check`, `weave_land` and `weave_patch`.
For callers and blast radius use sem's MCP server. The live claim/release CRDT
layer (`weave_claim_entity`, `weave_status`, ...) is listed only with
`WEAVE_EXPERIMENTAL=1`. Each tool's description says when to call it and what an
empty result means — read that at call time, not here.

## Reference

| Command | Does |
|---|---|
| `weave setup` / `setup --off` | register / remove the git merge driver |
| `weave land` | land a merge: gate each conflicted file PROVEN / VERIFIED / REFUSED; `--onto origin/main --check sem` merges, gates, verifies and publishes |
| `weave explain <file>` | per-entity conflict detail for one conflicted file |
| `weave check` | verify the working tree (or two revisions) against the merge |
| `weave preview <branch>` | dry-run a merge before running it |
| `weave patch extract/apply` | typed entity ops — turn a diff into ops, apply them three-way to a drifted target |
| `weave stats` | lifetime counters; `--bench` / `--repo <path>` compare weave with git |
| `weave explain <file> --summary` | structured JSON summary of the markers in a file |
| `weave experimental status` / `claim` / `release` | CRDT-backed multi-agent coordination state (prototype) |

Run `weave --help` or `weave <command> --help` for full flags.

### Watching a lot of merges at once

`WEAVE_EVENT=1` makes the merge driver write one JSON line per merge to
stderr, behind a `weave-event: ` prefix:

```text
weave-event: {"schema":"weave-event","schema_version":"1.0.0","file":"src/app.py",
"outcome":"clean","exit_code":0,"confidence":"very_high","conflicts":0,"findings":0,
"entities":{...},"bytes_out":481,"ms_merge":4.43,"ms_total":5.72,...}
```

One line per merge, including the ones that fail — so "which files conflicted
in this rebase, on what, and how long did each take" is one pass over the
lines rather than four stderr channels joined by hand. Off by default; nothing
is computed for it that the driver did not already have. The fields are
described in `crates/weave-mcp/schema/weave-event.schema.json`.

## Supported languages

38 languages and data formats — TypeScript, JavaScript, Python, Go, Rust,
Java, C/C++, Ruby, C#, PHP, Swift, Kotlin, SQL, Lua, Nix, JSON, YAML and more
(see README for the full list). Anything else falls back to git's standard
line-level merge, including `.vue`, `.svelte`, `.erb` and `.hs`, which weave
can parse but does not yet merge well enough to claim.

## Build & test (contributors)

```bash
cargo build --release && cargo test --workspace   # weave, weave-driver, weave-mcp
```

License: MIT OR Apache-2.0.
