Show HN: Docx-CLI: Enabling Agents to Read and Edit Word Documents in Half the Time and Tokens
Key point
This is a CLI tool that helps AI agents efficiently edit Word documents without breaking formatting.
Details
docx-cli has been released to solve the XML structure corruption and excessive token consumption problems that occur when AI agents directly modify .docx files.
The existing approach requires agents to write OOXML directly, making it heavily dependent on the model's capability and resulting in a high probability of corrupted output files. In contrast, docx-cli provides agents with stable locators and an annotated Markdown view, allowing agents to edit using only text commands without needing to understand the complex XML structure.
Key benchmark results:
- Accuracy: Based on Claude 3.5 Sonnet, it achieved a perfect success rate of 6/6, compared to 4/6 for the existing approach.
- Cost and speed: Compared to the existing approach, token usage was reduced by about 2.2–2.6x, and execution speed improved by about 1.7–2x.
- Stability: While the existing approach frequently produced files that would not open in Word, docx-cli confirmed that all outputs opened normally.
This tool supports modifying text or leaving comments while preserving Word's existing formatting, including custom styles, theme colors, and embedded objects.
This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.
Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.