feat(word-addin): chat-proposed tracked redlines + opt-in e2e video recording

↗ view on GitHub · Amalanand Muthukumaran · 2026-08-03 · 903184e2

WHY THIS MATTERS
The Actions tab could already redline the document, but chat - the
surface lawyers actually live in - could only append text below the
cursor. Competing Word integrations (Legora et al.) center on the
"discuss, then accept redlines" loop: you ask for changes in chat and
the answer lands as tracked changes you accept or reject. This commit
closes that gap by reusing the existing redline engine end-to-end.

HOW IT WORKS
1. A "Suggest tracked edits" switch in the chat composer. While on, the
   document text is always sent as context (redlines are meaningless
   without it - the model must copy ORIGINAL snippets verbatim), and
   the outgoing user turn invisibly carries the shared REDLINE_FORMAT
   contract (now exported from lib/redline.ts, single-sourced with the
   Proofread/Anonymise prompts). The transcript shows only what the
   user typed.
2. Every COMPLETED assistant message is parsed with parseRedlineEdits;
   answers containing edits gain an "Apply N tracked edits" button that
   drives the same applyTrackedEdits() search-and-replace-under-
   TrackAll path as the Actions tab, with the same honest
   applied/skipped reporting. Streaming messages are never parsed - a
   half-received REPLACEMENT must not reach the document.
3. Because parsing keys off the answer's shape rather than the toggle,
   edits proposed spontaneously by the model are applyable too.

Also: PW_VIDEO=1 makes Playwright record a webm per test (off by
default - videos slow the suite and bloat CI artifacts) so add-in
behavior can be reviewed as short clips without running anything.

TESTING
Three new hermetic specs: the redline switch forces document context
and appends the contract invisibly (request-body assertion + transcript
must not leak it); chat-proposed edits apply as tracked changes with
exact recorded Word calls; plain prose answers offer inserts but no
apply button. Suite: 64/64.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Repository open-legal-products/mike
Author Amalanand Muthukumaran <mamalanand3@gmail.com>
Authored
Committed
Parents 686f9cee
Stats 5 files changed , +219 , -32
Part of Add a Word add-in for chat and tracked rewrites

Capture this commit into my fork

Download a Markdown prompt that tells Claude how to port this exact commit into your working tree. Run it via claude -p < capture-commit-903184e2.md from inside the repo you want the change in.

⬇ Download capture-commit-903184e2.md