ooxml-integrity is a tool for checking the integrity of Office Open XML documents, mainly targeting .docx and .pptx files. It is designed to detect silent corruption that AI agents, scripts, or libraries may introduce after editing documents, such as lost comments, tracked changes, and footnotes, as well as the problem of text overflowing text boxes in .pptx. The tool runs entirely locally, performs no rendering, makes no model calls, and accesses no network, and its results are deterministic.
Main capabilities include:
- Checking the internal reference integrity of .docx: verifying whether comments, footnotes, styles, numbering, relationships, and tracked changes are complete.
- Comparing differences before and after editing: by comparing constructed counts and text, detecting content that may be lost even if internal references are not corrupted.
- Supporting the --introduced option to report only issues newly introduced by the edit, suitable for scenarios where the original file may already be corrupted.
- Detecting .pptx text overflow: requires installing the [pptx] extra dependency (fonttools), and predicts whether text exceeds shape boundaries by parsing font metrics.
- Providing three limited repairs: anchor-replies (repairing the anchors of reply comments), renumber-revisions (renumbering duplicate revision IDs), and content-type (repairing content type overrides). Repair operations generate a verified copy and do not modify the original file.
- Outputting findings with stable codes and severity levels, supporting --json machine-readable output and --quiet to show only failing items.
- Exit codes: 0 means no findings reaching the --fail-on threshold, 1 means such findings exist, and 2 means a usage error.
Usage:
- Command line: after installation, run ooxml-integrity check report.docx, or use python -m ooxml_integrity check report.docx.
- CI integration: provides a GitHub Action that can generate JSON and SARIF reports, and SARIF findings can be displayed as code scanning annotations.
- MCP server: ooxml-integrity mcp starts a local MCP server, providing two tools, check and compare, communicating via standard input and output without opening sockets.
- Python API: available for programmatic calls.
Applicable scenarios:
- After automated scripts or AI agents edit documents, perform quality checks.
- In CI pipelines, ensure that document edits do not damage review records.
- Document processing pipelines that require local, deterministic checks.
Limitations:
- Repair capabilities are limited; only three cases can be repaired automatically, and other findings only list the reasons.
- .pptx text measurement depends on fonttools, and has only been verified against PowerPoint for Mac; Windows and slide show mode have not been tested.
- Grouped shapes, tables, SmartArt, and charts are not modeled, rotated shapes are only partially checked, and complex scripts are estimated.
- Accuracy has been verified on a synthetic corpus and has not yet been measured on customer documents.
- Requires Python 3.9+, with lxml as the core dependency (older Python versions require tomli).After agents edit documents, perform quality checks.
- In CI pipelines, ensure that document edits do not damage review records.
- Document processing pipelines that require local, deterministic checks.
Limitations:
- Repair capabilities are limited; only three cases can be repaired automatically, and other findings only list the reasons.
- .pptx text measurement depends on fonttools, and has only been verified against PowerPoint for Mac; Windows and slide show mode have not been tested.
- Grouped shapes, tables, SmartArt, and charts are not modeled, rotated shapes are only partially checked, and complex scripts are estimated.
- Accuracy has been verified on a synthetic corpus and has not yet been measured on customer documents.
- Requires Python 3.9+, with lxml as the core dependency (older Python versions require tomli).