jamietso/mike-redline: feed tracked changes and comment bubbles to the LLM
Upstream mike strips redlines before the LLM sees a document - `w:del` text and comment bubbles are silently dropped. This fork keeps them, inlining `{++ins++}`, `{--del--}`, `{<<moved>>}`, and `{>>by AUTHOR: text<<}` markers so the model can answer "what did counterparty change?" on both DOCX and PDF.
The core change is in backend/src/lib/docxTrackedChanges.ts. A new extractDocxBodyText function walks word/document.xml directly (replacing the mammoth dependency) and emits inline markers at w:ins, w:del, and w:commentRangeStart boundaries. Comments are loaded once from word/comments.xml into a map keyed by w:id and spliced in at each anchor. Both the chat assistant's read_document tool and the tabular per-cell extractor call this new function; system prompts in chatTools.ts and routes/tabular.ts are updated to define the marker syntax.
PDF redlines are handled by a separate Python script, backend/scripts/redline_extract.py, which reads a PDF on stdin and emits marked-up text on stdout. It uses PyMuPDF to walk text spans and classifies fill color against three targets: red (tolerance 30 Euclidean RGB units) becomes {--deleted--}, blue becomes {++inserted++}, green becomes {<<moved>>}. The Node side in pdfRedlineExtract.ts spawns it as a subprocess and falls back to pdfjs-dist text-only extraction if Python or PyMuPDF isn't available. PYTHON_BIN sets the interpreter path.
A few things to check before pulling this in. First, the new extractDocxBodyText produces marker-annotated text - it must not be passed to the edit-planning anchor matcher (flattenParagraph), which still expects accepted-view text. The fork is explicit about this split but you need to carry it across any downstream call sites. Second, the PDF detector is purely color-based: documents whose redline colors fall outside the 30-unit tolerance window (custom color schemes, scanned PDFs, some older Litera exports) will silently return plain text with no error. Third, the commit bundles an unrelated storage.ts fix (forcePathStyle: true) and cosmetic sidebar changes - worth splitting on cherry-pick.
Spotted something wrong? Or know the PR text has fresher detail than the writeup above?