lawdocx
Little tools for dealing with docx files, useful for lawyers and their LLMs.
Command-line micro-tools for surfacing the mechanical artifacts that linger inside .docx contracts. Each subcommand reads one or more files (or - for stdin) and emits a newline-terminated JSON envelope that is easy for humans, scripts, or LLM prompts to consume.
Quickstart
pip install lawdocx
lawdocx comments draft.docx --verbose
Every command accepts:
- One or more
PATHarguments (globs expanded, duplicates removed;-reads stdin). --output/-oto write to a file instead of stdout.--severity(info/warning/error) to drop lower-severity findings.--fail-on-findings/-fto exit non-zero when any warning or error remains after filtering.--verbose/-vfor progress plus a severity summary.
JSON shape (stable across tools)
- Envelope:
{ lawdocx_version, tool, generated_at, files: [...] }. - File entries:
{ path, sha256, items: [...] }wherepathis the CLI display name (orstdin). - Findings:
{ id, type, severity, location, context, details }with tool-specificdetails. - Context windows come from the triggering text span;
locationalways includesstoryplus paragraph indices, with extra fields per tool.
Tools (what they actually scan)
lawdocx comments– DOCX comment threads with resolved/done markers and optional parent pointers.lawdocx changes– Tracked insertions/deletions/moves across body, headers, footers, footnotes, and endnotes. Captures author/date attributes when present.lawdocx brackets– Finds balanced square brackets by default. Pass-p/--patternmultiple times to supply custom regex (DOTALL + MULTILINE). Scans body, headers, footers, footnotes, and endnotes.lawdocx todos– TODO/NTD/TBD/placeholder markers using a fixed regex list (e.g.,TODO,FIXME,[?], "client to confirm") across body, headers, and footers.lawdocx boilerplate– Header/footer boilerplate (draft legends, firm footers, page-number artifacts, placeholder dates, temp paths) using the built-in regex catalog. Records section number and header/footer type when available.lawdocx metadata– Core, extended, and custom properties plus custom XML part references. Marks extraction failures as errors.lawdocx footnotes– Footnote/endnote references wherever they appear (body, headers, footers, note stories). Includes rendered note text when present; flags missing text indetails.status.lawdocx highlights– Highlighted runs and their colors across body, headers, footers, footnotes, and endnotes.lawdocx outline– Flags manual numbering (error) or suspicious numbering (warning) in body paragraphs that are not styled as headings. Uses simple pattern checks rather than rebuilding the full outline.lawdocx audit– Runs a selected subset of the above (--only/--exclude). Produces an outer envelope withtools: [...]containing each subcommand’s filtered output and totals across all tools.
How humans might use it
- Pre-send scrub: Run
lawdocx boilerplateandlawdocx commentsbefore emailing a draft; combine with--fail-on-findingsin a CI job to block warnings/errors. - Redline triage: Nightly
lawdocx changes deal/*.docx > changes.jsonto list insertions/deletions with context and authors for partner review. - Placeholder sweep:
lawdocx bracketsandlawdocx todosover a folder to collect unresolved variables and TODOs into a single JSON line per file. - Numbering sanity check:
lawdocx outlineon inbound paper to spot manual numbering in non-heading paragraphs that may break cross-references.
How LLM workflows can consume it
- Use
severityto gate reasoning (e.g., summarize onlywarning/error). - Ground prompts with
context.targetfor verbatim snippets andcontext.before/afterfor surrounding text;location.story+ paragraph indices help build human-readable pointers. - When reading audit output, iterate
envelope["tools"]—each nested tool already filtered by the CLI--severityvalue.
Contributing
- Follow the existing pattern: a small
collect_*helper plus arun_*wrapper that hashes inputs, supports stdin, and returns abuild_envelope(...)result. - Keep severities consistent with the tool’s intent (current tools mostly emit
infofor informational data andwarningwhen action may be needed). - Add new commands to
TOOL_RUNNERSinsrc/lawdocx/cli.pyso audit mode can orchestrate them, and prefer deterministic outputs for easy downstream use.
Metadata
Release files for lawdocx 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| lawdocx-0.2.0.tar.gz | 39.3 kB | With provenance | Details for lawdocx-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| lawdocx-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for lawdocx-0.2.0-py3-none-any.whl |
Total release size: 75.6 kB
Release files / lawdocx-0.2.0.tar.gz
| Download URL | lawdocx-0.2.0.tar.gz |
|---|---|
| Size | 39.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7e13cc1782809219d11b907aef3aefdcfe8de351269d3b83db3a4a02146d15c8
|
|
BLAKE2b-256 checksum How to use checksums |
38b2740ef45bd5ef25675e9ea4018caa63ea90cf9add5b5a08dd5131b8063c29
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 5, 2025.
Transparency logRelease files / lawdocx-0.2.0-py3-none-any.whl
| Download URL | lawdocx-0.2.0-py3-none-any.whl |
|---|---|
| Size | 36.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0b4257cd5a633b91b087d8a59275bbd2dfa6330061e345166a6836604fe72e52
|
|
BLAKE2b-256 checksum How to use checksums |
978f0e265bd83bc9ecc4e3ece290546ae7ec734e0675a47ec7e436fa606d1b12
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 5, 2025.
Transparency logSecurity for lawdocx 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for lawdocx-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 5, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.