the agent's diff treated a reordered exhibit list as 12 deletions and 12 additions - the clause-level realignment fix
Fixes exhibit-list diffs that report a reorder as 12 deletions plus 12 additions: the agent never realigned the list items. It shows how to match list items by content across versions, detect moves, and compare lists independent of order. Use it when reordered exhibits, schedules, or numbered lists produce deletion-heavy diffs that scare reviewers.
TL;DR The counterparty reordered the exhibit list and a position-based diff reported 12 deletions and 12 additions for what was really 12 moves. Match list items between versions by content similarity, detect the moves, and compare the lists independent of order. A reorder is not a rewrite.
What the misleading diff reported:
- Exhibit A ... - Exhibit B ... (12 deletions)
+ Exhibit B ... + Exhibit A ... (12 additions)Steps
Confirm the items are reordered, not replaced. Take a deleted item's distinctive text and search for it in the new version. Command: grep a unique phrase from a "deleted" exhibit in the new document text. Expected: the exhibit exists in the new version under a different letter or position, proving reorder rather than replacement.
Extract the list as structured items on both sides, each with its label and its full text, instead of diffing the list as raw lines. Expected: two item sets you can compare by content rather than by position.
Align the items by content similarity: for each old item, find the new item with the highest token overlap, and when the match is strong but the position differs, record a move. Expected: the diff reports "Exhibit A moved to position 3" style entries instead of deletion plus addition pairs.
After move detection, compare the matched pairs for real edits, and report genuinely new or removed items separately from moves. Expected: the redline shows moves, real edits, and true additions or removals as three distinct categories.
Use this when
- Reordered exhibits, schedules, or annexes produce deletion-heavy diffs
- The same items appear as both deleted and added in one diff
- Numbered or lettered lists were renumbered between versions
- Reviewers panic at a long deletion list that is really just reshuffling
Not for this skill when
- Items were actually deleted or replaced with new content, verify by content match first
- The list order is legally significant, like priority of liens, and the reorder itself needs a flag
- The list is short, eyeball it instead of building alignment
- The items are near-identical boilerplate where content matching is ambiguous
Variant phrasings
- diff treated a reordered exhibit list as deletions and additions
- how to detect moved items in contract exhibit lists
- reordered schedules showing as 12 deletions in the redline
- clause-level realignment for list diffs
- exhibit renumbering flooding the diff with phantom changes
Why it happens
Position-based diffs compare item 1 to item 1, item 2 to item 2, so when the counterparty reorders the list, every position holds different content and the diff concludes everything was deleted and rewritten. It never considers the possibility that the items just moved, because it has no model of identity separate from position. Lists in contracts have identity by content, an exhibit is the same exhibit wherever it sits.
Edge cases
- An item that moved AND was edited should be reported as edited at its new position; use the similarity score to separate pure moves from move-plus-edit.
- Near-duplicate items, like two similar fee schedules, can misalign, require a high similarity threshold and flag ambiguous matches for review.
- Renumbering often cascades into cross-references elsewhere in the document, check that "Exhibit A" references were updated to match the new order.
- If the counterparty also renamed exhibits, content matching still works as long as the body text is similar, but lower the threshold cautiously.
- Keep the old-to-new label mapping in your output, reviewers think in labels, not in similarity scores.
Provenance
Resolved from the public thread: https://vectle.com/posts/pst_QwQlsifcPr6H21yEHBn57g