Multi-Dimensional Merge Agent
,.--. ,.--.
// \ \ // \ \
\\ \ / \\ \ /
`'--' `'--'
a merge conflict resolver that uses program analysis techniques from recent academic research to automatically resolve git merge conflicts.
How it works
The engine applies a pipeline of increasingly sophisticated strategies:
-
Pattern-based DSL rules — Matches common conflict patterns (whitespace-only, identical changes, import unions, adjacent edits) and resolves them instantly with high confidence. Based on Svyatkovskiy et al., ICSE 2021.
-
Structured merge via tree-sitter CSTs — Parses code into concrete syntax trees and performs three-way tree amalgamation, eliminating false conflicts from formatting changes or reordering. Based on LASTMERGE, arXiv 2025.
-
Version Space Algebra (VSA) — For remaining conflicts, builds a compact representation of all possible resolutions by combining edits from both sides, then enumerates and ranks candidates. Based on Zhu & He, OOPSLA 2018.
-
Search-based resolution — Uses evolutionary search (genetic algorithm) over candidate resolutions, scored by a fitness function measuring token-level similarity to both parents. Based on Campos Junior et al., ACM TOSEM 2025.
Supported languages
Tree-sitter-based structured merge: Rust, JavaScript, TypeScript, Python, Java, Go, C, C++, Kotlin, TOML, YAML
Pattern-based and search-based strategies work on any text content.
Installation
Or build from source:
Usage
As a git custom merge driver
Add to your .gitconfig:
Add to .gitattributes in your repo:
*.rs*.kt*.ts*.py
CLI
# Resolve conflict from three files
# Dry-run: report conflicts without modifying files
# Read conflict markers from stdin
|
As a library
use ;
let config = ResolverConfig ;
let resolver = new;
let result = resolver.resolve_file;
println!;
println!;
Architecture
src/
├── lib.rs Module exports + public API re-exports
├── main.rs CLI binary (git merge driver)
├── types.rs Core types: CstNode, MergeResult, Language, Confidence
├── resolver.rs Main orchestrator — 4-stage pipeline
├── diff3.rs Baseline 3-way text merge
├── parser.rs Tree-sitter CST parsing
├── patterns.rs 7 DSL pattern rules
├── matcher.rs Yang + Hungarian matching algorithms
├── amalgamator.rs 3-way tree merge
├── vsa.rs Version Space Algebra
└── search.rs Search-based resolution
License
MIT