Install
openclaw skills install docx-mdLow-level docx format tool for AI document review. Three operations: (1) read docx → output compact Markdown or JSON; (2) apply edits JSON back to docx (trac...
openclaw skills install docx-mdThree entry points: Read – output compact Markdown (default, token-efficient) or full JSON; Modify – apply AI-returned edits to the docx; Finalize – accept all revisions and remove all comments. Implemented via OOXML (ZIP + XML). No commercial Word libraries required.
| Goal | Action |
|---|---|
| Get document for AI | Read: run read script → Markdown (default) or JSON. Markdown includes <!-- b:N --> blockIndex markers for edit targeting. |
| Apply AI edits to docx | Modify: run apply script with docx + edits JSON → new docx with track changes and comments. |
| Deliver final version | Finalize: run finalize script → new docx with no revisions/comments. |
<!-- b:N --> prefix per block; revisions: {+inserted+} {-deleted-}; comments: [comment: text].blockIndex, originalContent, content, basis .blockIndex, originalContent, content, basis; converts to OOXML (w:ins / w:del / comment anchors), then write back to Word.See references/llm-pipeline.md for the Markdown format, JSON schema, and edit format.
word/document.xml (w:body only) and word/comments.xml.Script: scripts/read_docx.py
# Default: Markdown output (token-efficient)
python3 skills/docx-md/scripts/read_docx.py document.docx
python3 skills/docx-md/scripts/read_docx.py document.docx -o result.md
# JSON output (full structure)
python3 skills/docx-md/scripts/read_docx.py document.docx -f json -o result.json
Options:
-o, --output – Output path (default: stdout)-f, --format – md (default) or json{ modifications: [{ blockIndex, originalContent, content, basis }] } (same blockIndex as read output).w:ins / w:del / comments), then write back to Word.Script: scripts/apply_edits_docx.py. Use - as edits file to read JSON from stdin.
python3 skills/docx-md/scripts/apply_edits_docx.py document.docx edits.json -o output.docx
python3 skills/docx-md/scripts/apply_edits_docx.py document.docx - -o output.docx # stdin
Options: --author (default: "Review")
docx-revisions to accept revisions (preserves encoding), then removes comment markup via regex on raw bytes.Script: scripts/finalize_docx.py
Requires: pip install docx-revisions (see requirements.txt)
python3 skills/docx-md/scripts/finalize_docx.py input.docx -o output.docx
python3 scripts/read_docx.py document.docx [-o out.md] [-f md|json]python3 scripts/apply_edits_docx.py document.docx edits.json -o output.docxpython3 scripts/finalize_docx.py input.docx -o output.docx