Automated DOCX Redlining Engine
Project description
Adeu OSS: DOCX Redlining Engine
Adeu allows AI Agents and LLMs to safely "Track Changes" in Microsoft Word documents.
Most LLMs output raw text or Markdown. Legal and compliance professionals need w:ins (insertions) and w:del (deletions) to review changes natively in Word.
Adeu solves this by treating DOCX as a "Virtual DOM". It presents a clean, readable text representation to the AI, and then reconciles the AI's edits back into the original XML structure without breaking formatting, numbering, or images.
🚀 New in v0.5.0
- Comments & Threads: Full support for reading and replying to Word comments using CriticMarkup syntax (
{==Target==}{>>Comment<<}). - Negotiation Actions: Agents can now
ACCEPT,REJECT, orREPLYto specific changes and comments. - Safety: Enhanced protection against corrupting nested revisions or structural boilerplate.
Installation
pip install adeu
Ways to Use Adeu
1. As an MCP Server
Connect Adeu directly to your agentic workspace. This allows AI Agent to read contracts, propose redlines, and answer comments natively.
Add this to your claude_desktop_config.json:
{
"mcpServers": {
"adeu": {
"command": "uvx",
"args": ["adeu", "adeu-server"]
}
}
}
What the Agent sees: The agent receives a text view of the document where comments and changes are clearly marked:
The Vendor shall be liable for {==indirect damages==}{>>[Counsel] We request this be removed.<<}...
Available MCP Tools
| Tool | Description |
|---|---|
read_docx |
Reads a DOCX file. supports clean_view=True to simulate "Accept All Changes" before reading. |
diff_docx_files |
Compares two DOCX files and returns a text-based Unified Diff, ignoring formatting noise. |
apply_structured_edits |
The Core Engine. Applies a list of "Search & Replace" edits, generating native Track Changes (w:ins/w:del). |
manage_review_actions |
Review workflow. Allows the Agent to ACCEPT, REJECT, or REPLY to specific changes or comments by ID. |
accept_all_changes |
Creates a clean version of the document by accepting all revisions and removing comments. |
2. For Python Developers ("Vibe Coding")
Adeu handles the heavy lifting of XML manipulation so you can focus on the logic.
from adeu import RedlineEngine, DocumentEdit
from io import BytesIO
# 1. Load your contract
with open("NDA.docx", "rb") as f:
stream = BytesIO(f.read())
# 2. Define the change (e.g., from an LLM response)
# Adeu uses "Search & Replace" logic with fuzzy matching
edit = DocumentEdit(
target_text="State of New York",
new_text="State of Delaware",
comment="Standardizing governing law."
)
# 3. Apply the Redline
engine = RedlineEngine(stream, author="AI Associate")
engine.apply_edits([edit])
# 4. Save
with open("NDA_Redlined.docx", "wb") as f:
f.write(engine.save_to_stream().getvalue())
3. The CLI
Quickly extract text or apply patches from your terminal.
# Compare two docs and get a summary
adeu diff v1.docx v2.docx
# Apply a structured edit list (JSON) to a doc
adeu apply agreement.docx edits.json --author "Reviewer Bot"
Why Adeu?
- Native Redlines: Generates real Microsoft Word Track Changes. You can "Accept" or "Reject" them in Word.
- Format Safe: Preserves complex numbering, headers, footers, and images. It only touches the text you change.
- Token Efficient: Converts heavy XML into lightweight Markdown for the LLM context window.
- Intelligent Mapping: Handles the messy internal XML of Word documents (e.g., when "Contract" is split into
["Con", "tract"]by spellcheck).
License
MIT License. Open source and free to use in commercial legal tech applications.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file adeu-0.5.3.tar.gz.
File metadata
- Download URL: adeu-0.5.3.tar.gz
- Upload date:
- Size: 36.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
40ca321ffdfd5a7c0ff883cffe23b704156489275b49cf61b4c4e1d09a54b245
|
|
| MD5 |
22c045b0adf145fa4c3b370083af3795
|
|
| BLAKE2b-256 |
9447832430d0a44e2d8f9e3fc9c4ecafd081221045651d496b1fcba7547ba7b1
|
Provenance
The following attestation bundles were made for adeu-0.5.3.tar.gz:
Publisher:
release.yml on dealfluence/adeu
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
adeu-0.5.3.tar.gz -
Subject digest:
40ca321ffdfd5a7c0ff883cffe23b704156489275b49cf61b4c4e1d09a54b245 - Sigstore transparency entry: 847896123
- Sigstore integration time:
-
Permalink:
dealfluence/adeu@3b236fdec1e3db7943c737770091d9347f66126e -
Branch / Tag:
refs/tags/v0.5.3 - Owner: https://github.com/dealfluence
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@3b236fdec1e3db7943c737770091d9347f66126e -
Trigger Event:
push
-
Statement type:
File details
Details for the file adeu-0.5.3-py3-none-any.whl.
File metadata
- Download URL: adeu-0.5.3-py3-none-any.whl
- Upload date:
- Size: 39.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b0bc1e167170d1e54339450310827311759cc9b3589b5d68c3f12c6d33f78278
|
|
| MD5 |
da7da52fdfd886f86ef9df260260cdb3
|
|
| BLAKE2b-256 |
de3226e81ba73c5476da1f98c6672d1d40802789c1b2bd00fa485f3f12ee568f
|
Provenance
The following attestation bundles were made for adeu-0.5.3-py3-none-any.whl:
Publisher:
release.yml on dealfluence/adeu
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
adeu-0.5.3-py3-none-any.whl -
Subject digest:
b0bc1e167170d1e54339450310827311759cc9b3589b5d68c3f12c6d33f78278 - Sigstore transparency entry: 847896161
- Sigstore integration time:
-
Permalink:
dealfluence/adeu@3b236fdec1e3db7943c737770091d9347f66126e -
Branch / Tag:
refs/tags/v0.5.3 - Owner: https://github.com/dealfluence
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@3b236fdec1e3db7943c737770091d9347f66126e -
Trigger Event:
push
-
Statement type: