Automated DOCX Redlining Engine
Project description
Adeu: Native Track Changes for AI
Adeu bridges the gap between LLM text generation and Microsoft Word.
LLMs speak Markdown; Lawyers speak "Track Changes." Adeu allows AI agents to propose edits to .docx files without breaking formatting, numbering, or complex layouts.
It treats the DOCX file as a Virtual DOM:
- Ingest: Extracts a lightweight, token-efficient text representation for the AI.
- Diff: Calculates changes based on the AI's edits.
- Reconcile: Surgically injects native XML
w:ins(insertions) andw:del(deletions) back into the original document.
⚡ Zero-Config Setup
Prerequisite: uv must be installed.
To instantly add Adeu to Claude Desktop:
uvx adeu init
Restart Claude Desktop to load the new tools.
Workflows
1. For Agents (Claude / MCP)
Adeu runs as a Model Context Protocol (MCP) server. It provides agents with specific tools to read, review, and edit documents safely.
The "Document Specialist" Prompt: Give your agent this context to maximize effectiveness:
Role: Document Specialist Tools:
read_docx(clean_view=True): Read the final "clean" version of the text to understand context.apply_edits_as_markdown: Drafting Mode. Generate a CriticMarkup preview ({--old--}{++new++}) to show the user exactly what will change.apply_structured_edits: Commit Mode. Apply specific search-and-replace edits to generate native Track Changes in the DOCX.manage_review_actions: Negotiation. Reply to comments or Accept/Reject specific changes by ID.
2. For Builders (Python SDK)
If you are building a legal-tech application or an automated pipeline, use the RedlineEngine directly. It handles the heavy lifting of XML manipulation.
from adeu import RedlineEngine, DocumentEdit
from io import BytesIO
# 1. Load the contract
with open("MSA.docx", "rb") as f:
stream = BytesIO(f.read())
# 2. Define the edit (e.g., from an LLM response)
# Adeu uses fuzzy matching to locate the target text, even if whitespace varies.
edit = DocumentEdit(
target_text="State of New York",
new_text="State of Delaware",
comment="Standardizing governing law."
)
# 3. Apply changes
engine = RedlineEngine(stream, author="AI Copilot")
engine.apply_edits([edit])
# 4. Save the result
with open("MSA_Redlined.docx", "wb") as f:
f.write(engine.save_to_stream().getvalue())
3. The CLI
Quickly inspect documents or apply batches of edits from your terminal.
# Extract clean text for RAG or prompting
adeu extract contract.docx -o contract.md
# Generate a visual diff between two versions
adeu diff v1.docx v2.docx
# Preview what an edit list (JSON) would look like
adeu markup contract.docx edits.json --output preview.md
# Apply edits to the DOCX
adeu apply contract.docx edits.json --author "Review Bot"
Key Features
🛡️ Format Safety
Adeu does not "rewrite" the document. It patches it.
- Images & Layouts: Untouched.
- Numbering & Headers: Preserved.
- Complex XML: It only modifies the text runs targeted by the edit.
📝 CriticMarkup Representation
Intermediate representations matter. Adeu uses CriticMarkup to visualize changes.
| Markup | Meaning | Example |
|---|---|---|
{--text--} |
Deletion | {--Tenant--} |
{++text++} |
Insertion | {++Lessee++} |
{>>text<<} |
Comment | {>>Clarify this term<<} |
🔍 Intelligent Mapping
Word documents are messy. A word like "Contract" might be split into XML runs like ["Con", "tract"] due to spellcheck or formatting history.
- Run Coalescing: Adeu normalizes these splits so the AI sees "Contract".
- Fuzzy Matching: It handles minor whitespace discrepancies between the LLM's memory and the actual document content.
License
MIT License. Open source and free to use in commercial 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.7.2.tar.gz.
File metadata
- Download URL: adeu-0.7.2.tar.gz
- Upload date:
- Size: 190.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
43cef59035f236b021fa878f69d740899c32f9deb531d3ba0d42513385a94650
|
|
| MD5 |
bfb8902a6e74cf5f935d9072fc4dae30
|
|
| BLAKE2b-256 |
eaa693143720ef896c75ad9796bc14d328eb22d616b3c1424cc34292072bf342
|
Provenance
The following attestation bundles were made for adeu-0.7.2.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.7.2.tar.gz -
Subject digest:
43cef59035f236b021fa878f69d740899c32f9deb531d3ba0d42513385a94650 - Sigstore transparency entry: 1096852479
- Sigstore integration time:
-
Permalink:
dealfluence/adeu@193aacd421037721aa578caea287554f88710781 -
Branch / Tag:
refs/tags/v0.7.2 - Owner: https://github.com/dealfluence
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@193aacd421037721aa578caea287554f88710781 -
Trigger Event:
push
-
Statement type:
File details
Details for the file adeu-0.7.2-py3-none-any.whl.
File metadata
- Download URL: adeu-0.7.2-py3-none-any.whl
- Upload date:
- Size: 49.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 |
a408690c5337fbceecdf85e29d78e1bdf1c53445ed2ae8bf8567efd8a60492e9
|
|
| MD5 |
9f113f1520ce02ed542dba06736392a3
|
|
| BLAKE2b-256 |
f1546786284be573ea40245667d90a00742439754e38ed61c9db0fdee7c6529c
|
Provenance
The following attestation bundles were made for adeu-0.7.2-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.7.2-py3-none-any.whl -
Subject digest:
a408690c5337fbceecdf85e29d78e1bdf1c53445ed2ae8bf8567efd8a60492e9 - Sigstore transparency entry: 1096852482
- Sigstore integration time:
-
Permalink:
dealfluence/adeu@193aacd421037721aa578caea287554f88710781 -
Branch / Tag:
refs/tags/v0.7.2 - Owner: https://github.com/dealfluence
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@193aacd421037721aa578caea287554f88710781 -
Trigger Event:
push
-
Statement type: