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.
3. Fan out — one subagent per document, in parallel
For each document, spawn the document-extractor subagent with the Task tool.
Issue the calls in parallel (multiple Task calls in a single turn) so the grid fills
concurrently — this is the whole point of the fan-out.
Default granularity is one extractor per file: it reads the document once and fills
that file's entire row across all columns. (This is cheaper and more consistent than one
subagent per cell, because the document is read a single time.) Escalate to a
per-cell extractor only for a column that is high-stakes and came back low
confidence or conflicted — re-run just that (file, column) pair with a focused prompt.
Give each extractor exactly this:
FILE: <path to the one document>
DOC_TYPE: <NDA | Commercial Lease | ... | unknown>
COLUMNS:
1. key: parties
question: Who are the parties to this agreement (full legal names)?
hint: Check the preamble and signature block.
2. key: governing_law
question: Which jurisdiction's law governs?
... (every column, with key + question, hints where useful)
Return ONLY the strict JSON object defined in your instructions.
Each extractor returns a JSON object: { file, title, docType, summary, cells: [ {key, value, reason, quote, page, location, confidence} ] }. Remember: value is short (it's
a table cell), reason is the longer sidebar explanation, quote is one verbatim
sentence, and page is the 1-based page that sentence is on.