docx-cli
Let AI agents edit Word documents without breaking them: fill forms, update tables, restyle, write reports and redline with tracked changes.
- Source repo
- kklimuk/docx-cli
- Stars
- ★ 248
- Last updated
- 11d ago
- FARS reviewed
- Oct 30, 2026
- License
- MIT
- Primary language
- TypeScript
- FA score
- 72/100 · Some gaps
At a glance
- How it runs
- Works with
- Universal · cross-platformCodex · Claude Code
- Cost
- Free, no paid service needed
- Setup effort
- Low · running in minutes
- You'll need
- Typical use
- Legal or business-operations staff having an agent work through a folder of contracts and forms: open an NDA, change "Net 90" to "Net 30", and leave every edit as a Word tracked change that can be rejected one by one.
- Not a fit if
- Teams whose agents can only call MCP tools — no MCP server is provided
- Anyone who needs page-image rendering on a server without Word or LibreOffice
- Production integrations that need a frozen CLI contract — the tool is pre-1.0
- Maintenance
- Commits in the last 30 dayslast commit 2026-11-12
- Source review
- 72/100 · Some gaps
What does this agent do, and when should you use it?
docx-cli ships two pieces: a docx command-line program that works directly on a .docx file, and a deliberately thin Agent Skills skill (skills/docx-cli) that teaches workflows and then defers to the versioned docx <command> --help the binary carries, so it cannot go stale. Most operations are expressed as creating, updating, deleting or replacing Markdown: docx read prints annotated Markdown with locator comments, and paragraphs, tables, cells, comments and revisions all get stable addresses like p3, t0:r1c2, c0 and rev1. Tracked changes are built in — track-changes on/off/list/apply turns each edit into a Word revision you can accept or reject by id, including edits from several reviewers. Everything runs locally with no telemetry: only installing/upgrading and images add given a web address touch the network, edits are surgical so the rest of the file (including Word markup it does not understand) passes through untouched, and nothing a document still points to is deleted. It is MIT-licensed, callable from Claude Code, Codex, Pi or any harness that reads the open Agent Skills format, and usable as a subprocess from your own code with exit codes 0/1/2/3 and JSON errors on stdout as the machine contract.
The docx binary opens a .docx in place and exposes the document as stable locators: docx read FILE prints annotated Markdown with locator comments, --ast prints a lossless JSON tree, and docx find FILE phrase returns the exact span. Edits go through edit, insert, replace (first match only unless --all), delete and the comments verbs, each accepting --batch FILE.jsonl (- for stdin) where every locator addresses the document as it was read. track-changes on/off/list/apply writes each edit as a Word tracked change, lists revisions (with --json), and accepts or rejects them by revN id, while DOCX_AUTHOR sets the reviewer name recorded on changes. create --from draft.md builds a new document from Markdown, diff FILE --against ORIGINAL.docx reports textual differences, validate runs the ECMA-376 XSD check, render produces page images for layout review (needs Word or LibreOffice), images add can fetch an image from a URL, and upgrade swaps a standalone binary in place using the installer embedded at build time, pinned to a release tag and SHA-256-verified. The machine contract is exit code 0 (ok), 1 (general failure), 2 (usage error) or 3 (not found), with JSON on stdout carrying code, error and hint fields on failure, and --verbose returning a JSON acknowledgement for every change.
- Legal or business-operations staff having an agent work through a folder of contracts and forms: open an NDA, change "Net 90" to "Net 30", and leave every edit as a Word tracked change that can be rejected one by one.
- An analyst updating the tables and figure captions in a report template from new data, touching only the named cells (e.g.
t0:r1c2) and leaving the rest of the layout alone. - Rewriting a résumé's styling without tripping the layout trap where date lines wrap mid-word after a margin change.
- A multi-reviewer redline: several people leave tracked changes and comments, then a single
track-changes apply --accept rev1 --reject rev0finalizes the document. - Producing a report from scratch —
create --from draft.mdturns a Markdown draft into a new document, then images and styling are added. - Embedding the binary as a subprocess in a Node or Python pipeline and branching on exit codes and JSON errors for batch document generation.
Key setup facts
Pulled from the install and usage notes below. The project README has the current values.
- Install / run
npx skills add kklimuk/docx-cli -g -ybun add -g bun-docx
- Install notes cover
- Windows · Linux
How do you install or deploy this agent?
Install the skill for your agent, install the docx program, then check the version.
Claude Code:
claude plugin marketplace add kklimuk/docx-cli && claude plugin install docx-cli@docx-cliCodex (the plugin's skills auto-discover):
codex plugin marketplace add kklimuk/docx-cliAny other agent that reads the Agent Skills format:
npx skills add kklimuk/docx-cli -g -yIf Bun is installed, install the program from npm (the package is bun-docx):
bun add -g bun-docxOtherwise install the standalone binary, verifying the checksum first, from an empty temporary directory:
curl -fsSLO https://github.com/kklimuk/docx-cli/releases/latest/download/install.sh
curl -fsSLO https://github.com/kklimuk/docx-cli/releases/latest/download/SHA256SUMS
shasum -a 256 -c SHA256SUMS --ignore-missing
REQUIRE_CHECKSUM=1 sh install.shRun the last line only after the check prints install.sh: OK; on Linux use sha256sum -c SHA256SUMS --ignore-missing instead. On Windows, download docx-windows-x64.exe, compare Get-FileHash with its SHA256SUMS line, rename it to docx.exe and put it on PATH.
Verify, and fix PATH if the binary is not found:
docx --version
export PATH="$HOME/.local/bin:$PATH"In Claude Code the skill becomes available from the next session.
How do you use this agent?
Every command operates directly on the .docx file. Read it first to get locators, then edit; keep the original or write to a new file with -o.
docx read contract.docx
docx track-changes on contract.docx
docx replace contract.docx "Net 90" "Net 30" --all
docx track-changes list contract.docx --json
docx track-changes apply contract.docx --accept rev1 --reject rev0
docx diff contract.docx --against contract.original.docxBatch several operations against one view of the document, previewing first with --dry-run:
docx edit report.docx --batch edits.jsonl --dry-runCall it from code, with DOCX_AUTHOR naming the reviewer on tracked changes:
import json, os, subprocess
env = {**os.environ, "DOCX_AUTHOR": "Acme Legal"}
subprocess.run(["docx", "track-changes", "on", "contract.docx"], check=True, env=env)
subprocess.run(["docx", "replace", "contract.docx", "Net 90", "Net 30", "--all"], check=True, env=env)
changes = json.loads(subprocess.run(
["docx", "track-changes", "list", "contract.docx", "--json"],
check=True, capture_output=True, text=True).stdout)The exit code is the success signal: 0 ok, 1 general failure, 2 usage error, 3 not found (a replace or comments add --anchor matching nothing exits 3 rather than reporting success). Errors are JSON on stdout, so capture stdout on failure too.
Safety boundaries, hardening & integrations
Operational blast radius, source-verified safety controls, and first-run hardening steps before connecting this agent to real workspaces.
Declared capability surface (blast radius)
Can run terminal commands; pair with approval gates or container/OS sandboxing.
Modifies local files; work on a clean Git branch or dedicated worktree.
Makes outbound requests; verify telemetry settings and model data routing on private repos.
FARS trust-control audit
- data-flow disclosure
What are this agent's strengths and limitations?
- On the project's own six-task Haiku 5.5 benchmark it matched Anthropic's docx skill at 6/6 while using 27% less wall-clock time, 22% fewer input tokens and 41% fewer output tokens, and it solved every task OfficeCLI got wrong (OfficeCLI: 4.7/6).
- Operations are expressed as creating, updating, deleting or replacing Markdown rather than hand-edited OOXML or JSON operation trees, which the README reports cuts context use and keeps weaker models (Haiku, Qwen 3.5 9B) usable.
- Tracked changes are first-class:
track-changes on/off/list/apply, accept/reject byrevNid,DOCX_AUTHORreviewer names, and multi-reviewer interaction. - Fully local with no telemetry — no command sends document content anywhere; only install/upgrade and
images addwith a URL touch the network. - Surgical edits plus
--dry-runpreviews anddocx diff --againstfor review; edits never delete something the document still points to. - Harness-agnostic and MIT-licensed: Claude Code, Codex, Pi or any Agent Skills reader, and callable as a subprocess via exit codes 0/1/2/3 and JSON errors — unlike the Anthropic skill, whose license limits it to Anthropic's services.
- Pre-1.0: flags can still change between minor versions, so production users should pin a version.
- No MCP server is provided, so agents must invoke it through a shell tool and MCP-only clients cannot use it directly.
docx render(page images for layout checks) requires Word on macOS/Windows or LibreOffice installed; everything else does not.- The headline benchmark was written by the project's authors: six tasks, one model, three runs, and a judge that knew which tool produced each result, so the margins are indicative rather than independent.
- Installation has real prerequisites: Bun ≥ 1.3 for the npm route, or a checksum-verified standalone binary; Windows needs manual hash comparison, renaming and PATH setup.
- The npm package is named
bun-docx— the packages nameddocxanddocx-cliare unrelated, which is an easy install mistake.
How does this agent compare with similar options?
Anthropic's docx skill is the closest alternative: the README reports identical 6/6 accuracy on its benchmark with 27% less time and fewer tokens, and unlike that skill's Anthropic-services-only license, docx-cli is MIT and runs under Codex or other agents — though the README concedes the skill was cheaper on its one from-scratch document task. OfficeCLI is compared as slower and costlier (6.0 vs 4.7 of 6, roughly half the tokens and time), with the caveat that a résumé layout trap docx-cli was built to repair accounts for part of the gap. Against Claude for Word and Copilot, docx-cli works on files directly with no open Word window and no person steering, which suits folders of contracts or scheduled jobs. Against python-docx, the Open XML SDK, generate-and-compare and pandoc, the claim is that docx-cli edits in place instead of writing throwaway code or regenerating the file; the README's pandoc round-trip example loses a text box and merges eight sections into one.
Key facts side by side with the most closely related agents.
| Agent | Source review | Form / cost | Stars | Updated | Language | Full support on |
|---|---|---|---|---|---|---|
| docx-cli This agent | 72 · Some gaps | Agent plugin / skillFree | ★ 248 | 11d ago | TypeScript | Codex · Claude Code |
| Material Learning Studio | 82 · Good | Agent plugin / skillFree | ★ 1.5k | 1mo ago | Python | Codex · Claude Code |
| GenOffice | 70 · Some gaps | Desktop appFree + model costs | ★ 13k | 1d ago | TypeScript | OpenAI API · Claude API |
| Pinvou Agent Desktop Workspace | 56 · Major gaps | Desktop appFree + model costs | ★ 3k | today | Rust | Codex · Claude Code · OpenAI API · Claude API |
How does FollowAgents rate this agent?
Why each dimension lost points
SECURITY.md states local-only operation, no telemetry, no external API, with network access limited to install/upgrade and explicit images add URLs, including SSRF guards and redirect re-checks, so data-flow transparency is strong (3). However mutating commands overwrite the target file in place with git as the only history; --dry-run and -o must be requested by the user, and there is no built-in backup/rollback (rollback 1, external_effects 1). Install scripts verify SHA-256 and the agent path forces REQUIRE_CHECKSUM=1, but a manual install without a checksum tool degrades to unverified (least_privilege 2). The dependency list includes many third-party packages with no visible vulnerability audit or pinning policy (dependency_security 2). Author and repo ownership are consistent across package.json and LICENSE, but publisher identity is unverified (source_attribution 2).
README and SECURITY.md agree on network endpoints, exit codes, and the JSON error contract, and tests corroborate USAGE/BLOCK_NOT_FOUND codes (self_consistency 2). Distribution via npm and Bun with engines Bun>=1.3, and render depends on external Word/LibreOffice, so availability is conditional (dependency_availability 2). Errors carry code/error/hint and tests assert specific hint text, so failure messaging is thorough (3).
README targets Claude Code, Codex, Pi, and any Agent Skills host, with multiple scenarios (contracts, tables, resumes, reports, redlines) (audience_and_scenarios 3). It explicitly states no MCP, render needs an external app, and Windows cannot self-upgrade, so boundaries are clear (capability_boundaries 3). Triggering relies on skill text and docx --help, but the skill content is not in the evidence, so trigger precision is only partly judgeable (trigger_precision 2). Cross-platform support is broad but Windows is unsigned and needs manual upgrades, leaving environment gaps (environment_fit 2).
README is well structured with agent setup, developer, IT admin, comparison, and security sections (information_architecture 3). Install notes are detailed with checksum steps and PATH hints (install_notes 3). But README cites 0.27.0 while package.json is 0.28.0, and the project self-describes as Pre-1.0 with changing flags, so naming stability is moderate (naming_stability 2). Examples are rich but there is no standalone FAQ (examples_and_faq 2). Known limitations exist but are scattered (known_limitations 2). LICENSE is full MIT with NOTICES covering LGPL linkage (license 3). No CHANGELOG file; version history relies on releases (versioning_changelog 1). Maintenance rests on a single author with a security contact but no governance statement (maintenance_responsibility 2).
Outputs are Word-openable docx plus locator-annotated Markdown and a JSON contract, giving high usability (output_usability 3). Marginal value versus the Anthropic skill and OfficeCLI is backed by a benchmark, but that benchmark is author-built, uses the regression suite as tasks, and the judge knew tool identity, so it is only partly credible (marginal_value 2). Cost-benefit has token/time data but is likewise affected by the self-built benchmark (cost_benefit 2).
Benchmark claims point to benchmarks/2026-10-10 with pinned versions and SHAs, aiding traceability, but that directory is not in the evidence (claim_traceability 2). Test files and README corroborate each other on error codes and batch atomicity (cross_source_corroboration 2). README explicitly separates the self-built benchmark's caveats from conclusions, so fact/inference separation is reasonable (fact_inference_separation 2).
- Mutating commands overwrite the target file in place; rollback relies on git or the user opting into -o/--dry-run, so back up real documents first.
- A manual install without a checksum tool degrades to unverified; set REQUIRE_CHECKSUM=1 explicitly.
- The benchmark is author-built, uses the regression suite as tasks, and the judge knew tool identity, so performance and correctness conclusions should be treated cautiously.
- README cites 0.27.0 while package.json is 0.28.0, and the project is Pre-1.0 with flags that may change.
- Publisher identity is unverified and the dependency list shows no visible vulnerability audit.
FAQ
Do I need Microsoft Word installed?
.docx directly; only docx render (page images for layout checks) needs Word on macOS/Windows or LibreOffice.Does my document leave the machine?
images add when you pass a web address.Can my agent call it as an MCP tool?
docx through their own shell tool, which is the setup the benchmark measures.Is it safe to depend on programmatically?
code, error and hint on stdout, and exit 3 instead of a false success when nothing matches. But it is pre-1.0 and flags can change, so pin a version and capture stdout on failure.How capable does the model have to be?
Is docx-cli free?
Is docx-cli open source?
Is docx-cli still maintained?
Who makes docx-cli?
Thanks — we use this to improve the page.
Subscribe to the FollowAgents RSS feed, or save this agent to your browser shortlist to compare on your next visit.