The LegalWork Atlas LegalWork's documentation, bound to the code it describes
17 documents

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)

  • search must be copied VERBATIM from that paragraph's text — same words, spacing, and punctuation. The engine finds and replaces the exact string; if your search is not an exact substring of the paragraph, the edit is dropped. Quote the shortest string that is unique within the paragraph.
  • Anchor by paragraphIndex from 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.
  • 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 comment rather 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 author and let the orchestrator set it.