Deeper · Privacy-preserving review

Hybrid local + frontier pipeline

Confidential documents do not have to leave the machine to get a frontier-grade review. Lavern runs a local triage first, redacts the sensitive bits with a reversible mapping, sends only the redacted text to a frontier model, then de-anonymises the response back into the original context.

The loop

  1. Local triageanalyzeLocally() runs against Ollama on-device. Pulls out clauses, risks, and tentative severities. No network calls.
  2. Anonymiseanonymize() replaces entities with stable placeholders ([PARTY_1], [AMOUNT_3], …) and records a mapping table.
  3. Frontier on the redacted text — only clauses flagged for escalation go to the frontier model, and only in anonymised form.
  4. De-anonymise — the mapping table reverses every placeholder back to the original term in the response.
  5. Merge — local and frontier findings join into one set, each tagged with its source: local, frontier, or both.

Anonymiser

src/claw/anonymize.ts. All-regex, no LLM calls, no network. Six entity classes, each with stable numbered placeholders:

partyCompanies, individuals, named counterparties
amountMonetary figures with currency markers
dateCalendar dates across common formats
addressPostal addresses
emailEmail addresses
phonePhone numbers

The mapping table is returned alongside the redacted text. The same entity gets the same placeholder across the document, so the model can still reason about “[PARTY_1] indemnifies [PARTY_2]”.

What gets sent

What you get back

A single HybridAnalysisResult: merged findings, raw local result for reference, the count of clauses escalated, cost breakdown, and the originating source on every finding. Reversible. Auditable. Source-tagged.