docx-cli - AI agent CLI for reading and editing Word docs with full format fidelity
Show HN: Docx-CLI: agents read/edit Word docs using 1/2 the time and tokens
docx-cli is a command-line tool designed for AI agents like Claude and Codex to read, edit, and comment on .docx files without breaking formatting or losing content. By using stable locators and mutating XML in place, it allows agents to perform complex tasks like redlining contracts or filling NDAs with half the time and tokens compared to default methods. The tool ensures that every output opens cleanly in Microsoft Word, enabling humans to review, accept, or reject changes seamlessly. Available via npm or as a standalone binary, it serves as a robust skill for various AI harnesses, guaranteeing reliability even with weaker models.
The correctness gap is widest on the cheap Haiku tier, and a frontier model never closes it — the default skill caps at 4/6, losing the contract redline and the résumé every Sonnet run.
- kirillklimuk
I originally started this project just to build a TA agent for a professor who didn't have any TAs (my wife). So as you can imagine, it was critical that it could properly write comments and only edit with track edits mode on... and do all of this without accidentally breaking the structure of the doc that couldn't be read.
It's since then expanded to cover everything from editing tables, hyperlinks, footnotes, and a lot more. Now it's a pretty powerful tool that can trivially fill out a MNDA form, mark up a contract, author a poetry booklet, and fill out an invoice, which is now the eval suite where the numbers in the title come from.
You might be asking, "why did you do all of this?" Well, I'm building an agent harness for normies that are not gonna know what a token even is but just want their stuff not to take an epoch and a half to run. So I've got to make the tools be MUCH more optimal than they've even been.
I figure putting them out to the community and inviting all of you to help me might be a way to do that =).
- simlevesque
I've done many custom low token output CLIs like this for my day job and it's something I expect to see much more of.
- felooboolooomba
I know that the office suite format is a relic which is hard to get rid of. But I can't help feeling that in these new AI era, that we should focus on leaving that proprietary format behind.
It is one of the biggest facilitator of vendor lock in in the history of computing.
- rnxrx
This is great - and another example of how much more efficient CLI tool use ends up being in actual day-to-day use. Claude Code and Hermes took it in and it runs great in my initial tries at it. Thanks for making and sharing it!
- dbcooper
There have been a few similar posts on HN recently for working with MS Office docs:
https://github.com/iOfficeAI/OfficeCLI
https://github.com/rcarmo/python-office-mcp-server
https://github.com/espressoplease/smalldocs
It would be great to see some benchmarks for token use, correctness, features etc.