Skip to document workspace
r/vRehan Vaid
AtlasRésuméInstrumentsNotesColophon

What changed between two drafts, and the clause that says so

I built this review workspace around one habit: keep the text, the comparison and the reviewer's judgment apart.

It lines up two versions of a contract by clause ID, marks every inserted and removed word, and checks the proposed version against a playbook you write. When a rule cannot be applied cleanly, it says so instead of guessing. Legal effect, enforceability and the decision to sign stay with the reader; nothing here is legal advice.

Two drafts of one agreement, the old above and the new below, with a thread for every token they share. The liability cap moved to the front, so its threads cross two other clauses; madder marks two changed numbers and the clause that was removed.

Compare two versions

The example clauses and thresholds are made up. Text you paste stays on this page and is never sent; reloading clears it, and the export is a file that contains both full documents.

Loading replaces both versions, the playbook and all notes.

Start each clause with [ID] Heading on its own line. IDs are case sensitive, 1 to 32 letters, digits, dots, underscores or hyphens. ## Heading and opening text remain unkeyed and unaligned. Duplicate IDs are kept and left unpaired.

Per version: 20,000 characters, 300 lines, 40 clauses, 5,000 tokens; at most 750 tokens per clause. Edits immediately invalidate findings, retrieval and export. Rerunning clears reviewer dispositions.

Review playbook Editable JSON / 1 to 24 rules

These thresholds are example reviewer preferences. Rules run against the proposed version only. Change the clause targets, literal phrases, units and comparisons below.

Each rule requires id, clauseId, label and kind. Open the syntax reference below for the supported fields. Unknown fields, duplicate rule IDs and invalid thresholds block the entire run.

Preparing local review workspace.

What the run covered

Document and playbook fingerprints

SHA-256 identifies this exact input snapshot. Who wrote or reviewed it is outside what a hash records.

Where the playbook reaches

Every clause of the proposed version in order, with the rules that read it. A clause that no rule reads keeps its citation here so you can read it yourself.

    Clauses aligned by ID

    Clauses pair up only when an ID is unique in both versions; headings and wording never pair them. A one-sided ID shows where an ID appears, and its meaning is for the reader to judge. Moved marks the fewest clauses that account for the new order: every other shared clause keeps its baseline sequence.

    Every parsed clause, including unkeyed text
    Clause IDAlignment / changeBaseline sourceProposed source

    Removed textInserted textUnmarked text is equal, including whitespace.

    Exact segment spans and source links

    All changes, in document order

    One row per edit, placed by where it sits in the proposed version. Text found only in the baseline follows, in baseline order. Each citation selects its passage in the editor above.

    Changes ordered by offset, with citations
    OrderChangeClauseTextSource

    The same rules on both versions

    Each playbook rule also runs on the baseline. A rule that held in the baseline and falls outside its limit in the proposed version is marked as a move from within to outside.

    Rule outcome in the baseline and in the proposed version
    RuleTransitionBaselineProposed

    Findings and their passages

    A threshold match is a mechanical test; approval belongs to the reviewer. Missing-ID coverage is separate from a phrase not found in an existing clause. Dismissing or following up on a finding requires a reviewer note. Notes hold only their current, unsigned state, with no history.

    Find an exact phrase

    Enter an exact, case-sensitive phrase. Rule RETRIEVE-EXACT-1 counts every occurrence, including overlaps, and returns up to 20 source-linked passages or abstains. It quotes word for word.

    Method and limits

    Playbook syntax reference

    Days: kind: "days", anchor, dayBasis: "calendar" | "business" | "unqualified", operator: "lte" | "gte" | "eq" | "present". A value is required except for present, where it is forbidden. Days are whole integers from 0 to 3,650. Business days are compared as written, with no holiday calendar. The basis unqualified reads a bare count such as within 10 days.

    The entire trimmed clause body must be Payment due within 30 calendar days. for anchor Payment due within and basis calendar. Matching ignores ASCII case, uses literal single spaces, and permits an optional final period and singular day. Blank surrounding lines are allowed. Additional sentences, conditions or line breaks inside the sentence cause abstention.

    Amount: kind: "amount", anchor, three-uppercase-letter currency, and the same operator/value fields. Example body: Liability cap: USD 100000. Integers only, 0 to 1,000,000,000. The currency code is compared as written and never converted. A syntax match shows the sentence has that form; whether the cap is effective is a legal reading.

    Phrase: kind: "phrase" and a literal phrase of 3 to 100 characters. Exactly one case-insensitive occurrence gives a text match; zero gives text-not-found; multiple occurrences, including overlaps, abstain. A phrase match reports the text alone. Negation or exception markers in the heading or body cause abstention for every kind of rule.

    Every rule also needs a unique id, target clauseId, and label (1 to 100 characters). Anchors are 3 to 80 ASCII letters, spaces or colons. Rules are plain data: literal anchors and phrases, nothing executable. Numeric extraction abstains on multiple quantities, number words, signs, decimal separators, ranges, unsupported units or extra wording. The supported negation markers are not, no, never, neither, nor, unless, except, without, cannot and n't. Other ways of negating a sentence can slip past this list.

    Source spans, alignment and deterministic redline

    Source of truth: the two editable documents and your playbook. Those three texts are the only sources the engine reads. The example clauses exist to exercise the rules.

    The parser retains every character, including unkeyed opening text. Headers must be at column 1. Stable IDs are case sensitive; duplicate IDs are retained and marked uncertain. A clause whose ID changes reads as one removal and one insertion. Empty clause bodies are retained. The redline includes headings and whitespace. Tokenization separates Unicode letter/number runs, whitespace runs and punctuation. Within a matched clause, longest common subsequence alignment uses deletion-first tie breaking. Equal prefix/suffix tokens reduce the work. Whole clauses that change places are paired by ID, so their words stay equal. To say which clauses moved, the shared IDs are listed in proposed order with their baseline ranks, and the longest increasing run of ranks stays put; the clauses outside that run are the moved ones. Moving one clause marks that clause alone. When two runs are equally long, the run with the earliest proposed positions stays.

    The change inventory lists every inserted and deleted run, every added, removed and moved clause, and every clause that could not be paired. A deletion is placed at the proposed offset where its text used to sit. Each playbook rule is also applied to the baseline, so a value that moved from within its limit to outside it is named as such.

    Citations use one-based line numbers and zero-based UTF-16 half-open spans [start,end). The export contains exact source text, clause inventories, token operations, fingerprints, complete rules, findings, extracted spans and reviewer notes. Browsers normalize textarea line endings to LF; the fingerprint covers the text as the textarea holds it. The pure engine also preserves CRLF/CR when called directly. Documents, raw playbook JSON and decoded rule strings reject unpaired Unicode surrogates before hashing; valid surrogate pairs and replacement characters remain unchanged.

    Absence has no quote. A missing-ID finding records the entire searched proposed-document span, the ID inventory and any baseline passage for that ID. It records the search boundary; equivalent wording elsewhere is for the reader to find. Clauses with no corresponding rule appear in the coverage list with their citations, so they can be read directly.

    The security lab keeps the same separation for event logs: an analyst's triage note sits beside a case and leaves the recorded evidence as it was.

    Implementation and limits

    I wrote the comparison engine and the interface from scratch. The same engine runs in the browser and in Node. It is self-contained and deterministic, reads only its arguments, and its SHA-256 output matches Node's own implementation. A fingerprint identifies text; signing it would be a separate step. Correct results on the examples show that the software does what this page describes; reliability on other contracts would need its own testing.

    Inputs are plain text, compared token by token; PDF extraction, OCR, tables, footnotes, cross-references, sentence interpretation and semantic clause matching are outside it. Document bounds are enforced before diffing. Dynamic-programming work is capped at 2,000,000 cells per comparison; an over-limit run produces no export. Review runs are synchronous and size-limited. All dynamic text is rendered as text. Editing source or rules hides old results and blocks stale export. Notes are cleared on a new run, and a reload clears the workspace.

    Back to all disciplinesSecurity labDocument comparison workspace, LR-001

    Rehan Vaid 2026

    AtlasRésuméNotesEvidenceColophon