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.
Rules (these are the correctness bar)
searchmust be copied VERBATIM from that paragraph's text — same words, spacing, and punctuation. The engine finds and replaces the exact string; if yoursearchis not an exact substring of the paragraph, the edit is dropped. Quote the shortest string that is unique within the paragraph.- Anchor by
paragraphIndexfrom the map. Double-check the index holds the text you think it does. - Be surgical. Change only what the instruction requires. Tracked changes should be the minimal edit a reviewer can read at a glance, not a rewrite of the whole clause unless asked.
- Proposal semantics (one verb, three modes):
- replace:
search= existing text,replaceWith= new text. - delete:
search= text to remove,replaceWith="". - insert:
search="",replaceWith= text to add at the end of that paragraph.
- replace:
- Never fabricate. Base every edit on the instruction and the document. If the
instruction asks for something the document doesn't support or you can't safely place,
raise it as a
commentrather than guessing a redline. Don't invent facts, parties, numbers, or governing law. - Comments carry the reasoning; proposals carry the change. Keep comment text to 1–3 sentences a partner would actually write.
- Use the author name from the instruction if given; otherwise omit
authorand let the orchestrator set it.