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.
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.
-
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": "uv", "args": [ "--directory", "/absolute/path/to/adeu", "run", "adeu/server.py" ] } } }(Note: You can use
pythoninstead ofuvif you manage dependencies manually, butuvis recommended for fast environment handling).
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."
Adeu includes a standalone CLI for batch processing or manual workflows.
# 1. Extract text for LLM processing
poetry run python cli.py contracts/agreement.docx
# Output: contracts/agreement.md
# 2. Apply Redlines (from a JSON list of edits or a modified Markdown file)
poetry run python cli.py contracts/agreement.docx contracts/agreement_modified.md
# Output: contracts/agreement_redlined.docxYou 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())- 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.
Adeu uses poetry for dependency management.
git clone https://github.com/dealfluence/adeu.git
cd adeu
poetry install
poetry run pytest