Resolves merge conflicts that Git can't by understanding code structure via tree-sitter.
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. Instead of diffing lines, it:
Parses all three versions (base, ours, theirs) into semantic entities — functions, classes, JSON keys, etc. — using tree-sitter Matches entities across versions by identity (name + type + scope) Merges at the entity level: Different entities changed → auto-resolved, no conflict
→ auto-resolved, no conflict Same entity changed by both → attempts intra-entity merge, conflicts only if truly incompatible
... continue reading