$git clone https://github.com/yuch85/word-ai-redlinerAI-powered Microsoft Word add-in that applies word-level tracked changes using a structure-aware diff strategy — plus document summarization with comment extraction and tracked changes analysis.
| 1 | # Word AI Redliner |
| 2 | |
| 3 | AI-powered Microsoft Word add-in that applies word-level tracked changes using |
| 4 | a structure-aware diff strategy — plus document summarization with comment |
| 5 | extraction and tracked changes analysis. |
| 6 | |
| 7 | <p align="center"> |
| 8 | <a href="https://www.youtube.com/watch?v=SusffH8eT-Y"> |
| 9 | <img src="docs/word-ai-redliner.gif" alt="Word AI Redliner demo" /> |
| 10 | </a> |
| 11 | </p> |
| 12 | |
| 13 | **Project history**: This library was extracted from a private codebase and open-sourced as a standalone project in Jan 2026. |
| 14 | |
| 15 | ## Features |
| 16 | |
| 17 | ### Core: AI Redlining (v0.1.0) |
| 18 | - Word-level diffs with tracked changes via [office-word-diff](https://github.com/niclasgrunworked/office-word-diff) |
| 19 | - Token map strategy with sentence fallback, block replace as last resort |
| 20 | - Configurable LLM backends: Ollama and vLLM (OpenAI-compatible) |
| 21 | |
| 22 | ### v0.2.0: Prompt System + Document Summary |
| 23 | |
| 24 | **Three-Category Prompt System** |
| 25 | - Context, Amendment, and Comment prompt categories with dedicated tabs |
| 26 | - Full CRUD: create, save, update, delete prompts per category |
| 27 | - Per-category activation with `{selection}` placeholder replacement |
| 28 | - Prompts persist in localStorage across sessions |
| 29 | |
| 30 | **Document Comment Summary** |
| 31 | - 4th "Summary" tab — extract all document comments, send to LLM, generate a formatted Word document |
| 32 | - `{comments}` placeholder inserts structured comment data (author, annotated text, comment text) |
| 33 | - `{whole document}` placeholder extracts full document text with configurable richness: |
| 34 | - **Plain** — raw paragraph text |
| 35 | - **Headings** — markdown-style heading markers (`## Section Title`) |
| 36 | - **Structured** — headings + list item numbering and indentation |
| 37 | - `{tracked changes}` placeholder extracts revision marks via OOXML parsing (w:ins, w:del, w:moveFrom, w:moveTo) |
| 38 | - Generated summary document includes annex with numbered source comments |
| 39 | - LLM markdown output auto-converted to HTML via [marked](https://github.com/markedjs/marked) |
| 40 | - Tables in generated documents render with visible borders |
| 41 | |
| 42 | **Tracked Changes Extraction (OOXML)** |
| 43 | - Parses `body.getOoxml()` with browser DOMParser — no external dependencies |
| 44 | - Handles `pkg:package` wrapper, `w:proofErr` normalization |
| 45 | - Pairs adjacent `w:del` + `w:ins` from same author as replacements |
| 46 | - Detects move operations (`w:moveFrom` / `w:moveTo`) |
| 47 | - Skips table row revision markers (`w:ins`/`w:del` inside `w:trPr`) |
| 48 | - Namespace-aware querying with prefix fallback for cross-browser compatibility |
| 49 | - Author identity prominently included in LLM-formatted output |
| 50 | |
| 51 | **Async Comment Queue** |
| 52 | - Bookmark-based range persistence for async comment insertion |
| 53 | - Comment status bar with pending count and retry-on-error |
| 54 | - WordApi 1.4 detection with graceful degradation |
| 55 | |
| 56 | **Settings & UX** |
| 57 | - Settings auto-save on every change (no Save button) |
| 58 | - Live token estimation with real document metrics (async Word API read, cached, debounced) |
| 59 | - Document extraction richness dropdown (Summary mode only) |
| 60 | - Tracked changes extraction toggle (Summary mode only) |
| 61 | - Mode switching: Amendment/Comment tabs disabled when Summary is active |
| 62 | - Review button relabels to "Generate Summary" in Summary mode |
| 63 | |
| 64 | **Backend Selector** |
| 65 | - Ollama and vLLM backends with unified OpenAI-compatible API |
| 66 | - Model dropdown auto-populated from backend `/v1/models` endpoint |
| 67 | - Configurable endpoint URL and optional API key |
| 68 | - Track Changes and Line Diff toggles |
| 69 | |
| 70 | ### v0.3.0: Whole-Document Processing |
| 71 | |
| 72 | **Parallel LLM Orchestration** |
| 73 | - Full-document amendment and commenting: parse, chunk, dispatch to LLM in parallel, reassemble |
| 74 | - Worker-pool concurrency with configurable limits (auto-tuned: 4 workers for large chunks, 6 for smaller) |
| 75 | - AbortController-based cancellation stops pending chunks immediately |
| 76 | - Progress tracking with per-chunk ETA estimation |
| 77 | - Retry failed chunks without re-processing successful ones |
| 78 | |
| 79 | **Document Parsing & Chunking** |
| 80 | - Paragraph-level document parsing with style and heading detection |
| 81 | - Token-aware chunking with configurable max size (default 6K tokens) |
| 82 | - Heading-based chunk boundaries (H1/H2 |