The legal-document engine
LegalWork's actual legal work is defined as firm-owned agent prompts, not app code. This path walks the two flagship workflows — Word redlining and tabular review — from the user command down to the read-only subagents that do the work.
The edit plan
apply takes a plan that maps directly onto the engine's batch API. Anchor every edit by
the index from inspect (the same index works for body paragraphs and table cells) and a
verbatim search copied exactly from that paragraph's text:
{
"author": "Eigenwelt Reviewer",
"comments": [ { "paragraphIndex": 181, "text": "Cap is low for this deal — propose €75k.", "search": "EUR 55,000.00" } ],
"proposals": [ { "paragraphIndex": 181, "search": "EUR 55,000.00", "replaceWith": "EUR 75,000.00" } ]
}
commentsare margin notes (the why); they don't change text.searchoptional.proposalsare tracked-change edits.replaceWith:""deletes;search:""inserts at the end of the paragraph; both non-empty is a replacement.searchmust be VERBATIM (an exact substring of that paragraph) or the op is dropped and listed inerrors. This is also the safety net: a wrongindexcan't quietly edit the wrong clause — the search won't match, so it errors instead.