{
 "use_case": "privilege-log",
 "title": "Privilege log: four synthetic emails from a fictional freight company's lease dispute",
 "about": "Four synthetic emails from the fictional Harborline Freight: the general counsel's legal advice on a lease, the same email kept by a second custodian, that advice forwarded to an outside consultant, and a weekly ops update with the general counsel only copied. The advice must be withheld (or sent to review), the ops update produced, the duplicate treated as one document, the forward flagged for its outside party, and the log must end in a signed record that verifies.",
 "licence": "Synthetic, written for Decosa (CC0): Harborline Freight, Calder & Voss LLP and every person are fictional.",
 "inputs": [
  {
   "file": "inputs/emails.json",
   "what": "The documents: a list of {id, date, from, to, cc?, subject, body, thread_id?} (emails or memos; up to 25 per request)."
  },
  {
   "file": "inputs/people.json",
   "what": "Who the lawyers are ({name, email, role: in-house|outside, firm?}) and which mail domains are the client's and outside counsel's."
  }
 ],
 "steps": [
  {
   "id": "review",
   "method": "POST",
   "path": "/privilege/review",
   "timeout": 240,
   "body": {
    "documents": {
     "$file": "inputs/emails.json"
    },
    "people": {
     "$file": "inputs/people.json"
    },
    "samples": 0,
    "title": "Rehearsal: Harborline lease dispute (synthetic)",
    "stream": false
   }
  },
  {
   "id": "export",
   "method": "GET",
   "path": "/privilege/runs/${review.run_id}/export?format=csv",
   "as": "text"
  },
  {
   "id": "verify",
   "method": "POST",
   "path": "/record/verify",
   "auth": false,
   "body": {
    "record": {
     "$ref": "review.report.record"
    }
   }
  },
  {
   "id": "tampered",
   "method": "POST",
   "path": "/record/verify",
   "auth": false,
   "body": {
    "record": {
     "$ref": "review.report.record"
    }
   },
   "tamper": {
    "at": "record.statement.totals.not_privileged",
    "set": 4
   }
  }
 ],
 "checks": [
  {
   "says": "the general counsel's legal advice (HL-002) is withheld as privileged or sent to review",
   "path": "review.documents[id=HL-002][-1].final",
   "in": [
    "attorney_client",
    "both",
    "needs_review"
   ]
  },
  {
   "says": "the ops update with a lawyer only copied (HL-021) is produced",
   "path": "review.documents[id=HL-021][-1].final",
   "equals": "not_privileged"
  },
  {
   "says": "HL-021 is flagged: a lawyer only copied",
   "path": "review.documents[id=HL-021][-1].flags.flag",
   "any_equals": "lawyer_cc_only"
  },
  {
   "says": "the forward to an outside consultant (HL-003) is flagged for its outside party",
   "path": "review.documents[id=HL-003][-1].flags.flag",
   "any_equals": "third_party"
  },
  {
   "says": "the second custodian's copy (HL-004) is judged once, as a copy of HL-002",
   "path": "review.documents[id=HL-004][-1].copy_of",
   "equals": "HL-002"
  },
  {
   "says": "every drafted log description passed the leak check",
   "path": "review.log.entries[status=proposed].leak_check",
   "all_in": [
    "passed",
    "fallback description: the model's drafts leaked"
   ]
  },
  {
   "says": "the log (CSV) lists the withheld advice and leaves out the produced ops update",
   "path": "export",
   "contains": "HL-002"
  },
  {
   "says": "the produced ops update is not on the privilege log",
   "path": "export",
   "not_contains": "HL-021"
  },
  {
   "says": "the signed record verifies",
   "path": "verify.ok",
   "equals": true
  },
  {
   "says": "a record with its call counts changed no longer verifies",
   "path": "tampered.ok",
   "equals": false
  },
  {
   "says": "every model call has a signed receipt",
   "receipts": "signed"
  }
 ]
}
