.docx files and produce a tracked-changes document that shows exactly what changed — at the character level.
Compare two documents
Usecompare_documents to diff an original and a revised file:
| Parameter | Required | Description |
|---|---|---|
original_file_path | Yes | Path to the baseline document |
revised_file_path | Yes | Path to the modified document |
save_to_local_path | Yes | Where to write the tracked-changes output |
author | No | Author name stamped on revision marks. Defaults to "Comparison" |
engine | No | Comparison engine: "auto" (default) or "atomizer" |
You can also compare a session’s in-memory edits against the original by passing
file_path instead of original_file_path + revised_file_path. This is useful after applying edits with replace_text or insert_paragraph.The atomizer engine
The default engine ("auto") uses the atomizer, a character-level comparison algorithm with move detection. It produces fine-grained revision marks that show individual word and character changes rather than whole-paragraph replacements.
The atomizer is selected automatically for most document shapes. You can force it explicitly by setting engine: "atomizer".
Extract revisions as structured JSON
After generating a tracked-changes document, useextract_revisions to get a structured JSON summary:
offset and limit to paginate through documents with many revisions.
Accept tracked changes
To finalize a tracked-changes document and produce a clean version with no revision markup:accept_changes — it returns acceptance stats (number of insertions, deletions, and move records accepted). You can also call has_tracked_changes first to check whether a document contains revision marks before processing.
Full workflow example
Golden prompt: compare two documents
This prompt reliably produces a comparison and revision summary:Related guides
Editing documents
Make surgical edits to a single document.
Golden prompts
All known-good prompt patterns in one place.

