DOCX editor
Required workflow
- Call
docx_inspectbefore editing an unfamiliar document. KeepsourceSha256, feature/security inventory, and capability report. - Call
docx_readfor only the relevant stories/blocks. Use returned paragraph IDs, paths, hashes, bookmarks, controls, or strict text anchors. - Call
docx_renderwhen pagination, layout, tables, images, headers/footers, or formatting matter. Keep page selections small. - Call
docx_editwithdryRun: true; use exact preconditions and expected counts. Resolve ambiguity rather than broadening an edit. - Call
docx_editwithdryRun: falseandexpectedSourceSha256to create a staged revision. This tool must not receive a destination. - Call
docx_validateanddocx_diffagainst source and staged paths. Render focused before/after pages for visually sensitive operations. - Call
docx_committo a new.docxpath by default. - Overwrite the source only when the user explicitly asked, hashes still agree, every gate passes, and interactive confirmation is available. Require a recovery path in the result.
Safety rules
- Never use built-in text
editorwriteon DOCX/DOCM/DOTX/DOTM. - Never execute macros, OLE, fields, links, DDE, or attached templates. Never claim they were executed or refreshed.
- Treat
.docm/.dotm, active content, and signatures as read/render only. Do not bypassSIGNED_DOCUMENTorACTIVE_CONTENT_BLOCKED. - Do not mutate raw XML, XPath, arbitrary ZIP parts, or page-number selectors.
- Do not silently convert formats. Legacy/template conversion must create a new
.docxand report losses. - Stop on
LOSSY_OPERATION, protected-part changes, unavailable mandatory engines, validation failures, source/destination conflicts, or ambiguous selectors. - Keep hidden/deleted metadata out of model-visible output unless the user explicitly asks to inspect it.
Verification
A successful tool return is not enough. Confirm source and staged/output hashes, declared changed parts, protected-part stability, Open XML validation, independent reopen, semantic diff, and required render checks. Report renderer/font warnings and any host gate that was not run.