The DOCX tracked-change pipeline
How a plain-text edit from the model becomes surgical Word tracked-change markup that preserves formatting — from the skill the model reads to the OOXML engine and LibreOffice finalization.
Tracked changes XML patterns
Insertion:
<w:ins w:id="1" w:author="Anylegal.ai" w:date="2026-05-04T00:00:00Z">
<w:r><w:rPr>...</w:rPr><w:t>inserted text</w:t></w:r>
</w:ins>
Deletion:
<w:del w:id="2" w:author="Anylegal.ai" w:date="2026-05-04T00:00:00Z">
<w:r><w:rPr>...</w:rPr><w:delText>deleted text</w:delText></w:r>
</w:del>
Minimal edit — only mark what changes (governing law change from Delaware to England and Wales):
<w:r><w:t>This Agreement is governed by the laws of </w:t></w:r>
<w:del w:id="1" w:author="Anylegal.ai" w:date="...">
<w:r><w:delText>the State of Delaware</w:delText></w:r>
</w:del>
<w:ins w:id="2" w:author="Anylegal.ai" w:date="...">
<w:r><w:t>England and Wales</w:t></w:r>
</w:ins>
<w:r><w:t>.</w:t></w:r>
Deleting an entire paragraph — mark the paragraph mark as deleted too, otherwise "Accept All" leaves an empty line:
<w:p>
<w:pPr>
<w:rPr>
<w:del w:id="1" w:author="Anylegal.ai" w:date="..."/>
</w:rPr>
</w:pPr>
<w:del w:id="2" w:author="Anylegal.ai" w:date="...">
<w:r><w:delText>The deleted clause text...</w:delText></w:r>
</w:del>
</w:p>
Rejecting a counterparty's insertion — nest your deletion inside their insertion (preserves their authorship in the audit trail):
<w:ins w:author="Counterparty" w:id="5">
<w:del w:author="Anylegal.ai" w:id="10">
<w:r><w:delText>their inserted text</w:delText></w:r>
</w:del>
</w:ins>
Restoring a counterparty's deletion — add an insertion after their deletion (do not modify their deletion):
<w:del w:author="Counterparty" w:id="5">
<w:r><w:delText>deleted text</w:delText></w:r>
</w:del>
<w:ins w:author="Anylegal.ai" w:id="10">
<w:r><w:t>deleted text</w:t></w:r>
</w:ins>