The
reconcile
library solves a fundamental challenge in collaborative editing: what happens
when multiple users edit the same text simultaneously but we can only capture
the end result, not the intermediary edits? Essentially, it's
diff3
(or git merge) but with automatic conflict resolution.
The
reconcile(parent: str, left: str, right: str) -> str
takes conflicting concurrent edits and intelligently merges them into a
unified result. Beyond basic conflict resolution, it offers sophisticated
merging heuristics, flexible tokenization options, and cursor position
tracking.
The algorithm begins with your chosen tokenizer, then applies Myers' diff algorithm to compare the original text with both conflicting versions. These diffs undergo transformation to preserve meaningful change sequences, before a final merge strategy—inspired by Operational Transformation reconciles all conflicting modifications without losing any edits.
For more details, see the README.
Use the tokenization options below to experiment with different strategies. The library supports user-defined tokenizers as well.