Automated DOCX Redlining Engine
Project description
Adeu: Agentic DOCX Redlining Engine
Adeu Open Source project is a Python engine designed to allow AI Agents and LLMs to redline Microsoft Word documents (.docx).
It visualizes the Word documents as markdown to the LLM and maps back changes to the Word document.
🤖 Model Context Protocol (MCP) Server
Adeu is primarily designed as an MCP Server. This allows AI tools (like Claude Desktop, Cursor, or custom agents) to directly interact with local Word documents.
Setup for Claude Desktop
-
Install Adeu (or clone the repo):
git clone https://github.com/dealfluence/adeu.git cd adeu # Ensure you have a python environment ready pip install .
-
Configure Claude Desktop: Open your config file (MacOS:
~/Library/Application Support/Claude/claude_desktop_config.json) and add the server:{ "mcpServers": { "adeu": { "command": "uvx", "args": [ "--from", "adeu", "adeu-server" ] } } }
(Note: You can use
pythoninstead ofuvif you manage dependencies manually, butuvis recommended for fast environment handling).
Exposed Tools
Once connected, the Agent has access to these tools:
-
read_docx(file_path)- Extracts text from a local DOCX file.
- Usage: "Read the contract at
~/Downloads/saas_agreement.docx."
-
apply_structured_edits(original_path, edits, output_path)- The core engine. The Agent constructs a list of changes (Insert, Delete, Modify) and Adeu injects them.
- Usage: "Change the Governing Law to 'California' and delete the Non-Compete clause."
-
diff_docx_files(original_path, modified_path)- Compares two files and returns a semantic word-level diff.
- Usage: "Compare
v1.docxandv2.docxand summarize the changes."
🖥️ CLI Usage
Adeu includes a standalone CLI for batch processing or manual workflows.
# 1. Extract text for LLM processing
adeu extract contracts/agreement.docx
# Output: contracts/agreement.md
# 2. Apply Redlines (from a JSON list of edits or a modified Markdown file)
adeu apply contracts/agreement.docx contracts/agreement_modified.md
# Output: contracts/agreement_redlined.docx
📦 Library Usage
You can use Adeu directly in your Python applications to build custom legal tech pipelines.
from io import BytesIO
from adeu.redline.engine import RedlineEngine
from adeu.models import DocumentEdit, EditOperationType
# 1. Load your document
with open("contract.docx", "rb") as f:
doc_stream = BytesIO(f.read())
# 2. Define an edit (usually generated by an LLM)
edit = DocumentEdit(
operation=EditOperationType.MODIFICATION,
target_text="State of New York",
new_text="State of Delaware",
comment="Changed governing law per client instruction."
)
# 3. Apply the edit
engine = RedlineEngine(doc_stream)
engine.apply_edits([edit])
# 4. Save the result
with open("contract_redlined.docx", "wb") as f:
f.write(engine.save_to_stream().getvalue())
🚀 Key Features
- Native Redlines: Generates real Microsoft Word Track Changes (
w:ins,w:del). - Split-Run Handling: Intelligently handles Word's complex XML structure where a single word like "Contract" might be split into
["Con", "tract"]. - Format Preservation: Does not convert the doc to Markdown and back. Formatting, headers, footers, and images are preserved 100%.
- Native Comments: Injects real comments into the
word/comments.xmlpart, linked to specific text ranges.
🛠️ Installation for Development
Adeu uses poetry for dependency management.
git clone https://github.com/dealfluence/adeu.git
cd adeu
poetry install
poetry run pytest
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.1.1.tar.gz.
File metadata
- Download URL: adeu-0.1.1.tar.gz
- Upload date:
- Size: 16.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
adf479d6d7e82e06754d97a93b1b46144b4d08a144e94c5b52c2188a76c28a1f
|
|
| MD5 |
158faee17e537d1f82dce723ae5285fd
|
|
| BLAKE2b-256 |
70aafa175ddb106cdce2673ecc06eb07a80a2bda6aa2092712ae64bc24c88dff
|
Provenance
The following attestation bundles were made for adeu-0.1.1.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.1.1.tar.gz -
Subject digest:
adf479d6d7e82e06754d97a93b1b46144b4d08a144e94c5b52c2188a76c28a1f - Sigstore transparency entry: 814543761
- Sigstore integration time:
-
Permalink:
dealfluence/adeu@88c86c739107236de31fdd13ab350f1ef8c3af76 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/dealfluence
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@88c86c739107236de31fdd13ab350f1ef8c3af76 -
Trigger Event:
push
-
Statement type:
File details
Details for the file adeu-0.1.1-py3-none-any.whl.
File metadata
- Download URL: adeu-0.1.1-py3-none-any.whl
- Upload date:
- Size: 18.7 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 |
a671b0fe9cc53e7350cbf1ddfa0190e1356482f1924d3163150440ae8bd35db9
|
|
| MD5 |
1e111ad51758722ac3f17b9606e89193
|
|
| BLAKE2b-256 |
4378566554bea0ac3180ca5afcd0338603ad1f3f6614da43b643fa94e0b5c3a6
|
Provenance
The following attestation bundles were made for adeu-0.1.1-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.1.1-py3-none-any.whl -
Subject digest:
a671b0fe9cc53e7350cbf1ddfa0190e1356482f1924d3163150440ae8bd35db9 - Sigstore transparency entry: 814543783
- Sigstore integration time:
-
Permalink:
dealfluence/adeu@88c86c739107236de31fdd13ab350f1ef8c3af76 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/dealfluence
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@88c86c739107236de31fdd13ab350f1ef8c3af76 -
Trigger Event:
push
-
Statement type: