T2 chain · legal / compliance —model: ollama/llama3.1at the envelope means every model call in this file runs on your own hardware. For a contract, that’s not a preference — it’s the requirement. Belt-and-braces:schema:at infer time,nika:validateafter,nika:assertas the hard gate.
The job
Outside counsel takes a week. Pasting the contract into a cloud chatbot takes your confidentiality with it. This workflow extracts every risk-bearing clause — verbatim quotes, typed risk levels — locally, re-validates the extraction, and refuses to write the memo if the data doesn’t hold.The shape
The file
t2-contract-guard.nika.yaml
How it works
Sovereignty is one line
The envelope
model: points at Ollama. Same file, same schema, same
everything — just no cloud. Swap back to a cloud provider for
non-sensitive documents; the workflow doesn’t change shape.validate re-checks what schema promised
nika:validate runs the extraction against a second, stricter
schema (minItems: 1) and returns {valid, errors} — belt and
braces for legal-grade output.Constructs you just used
| Construct | Where | Reference |
|---|---|---|
local provider (ollama/…) | envelope model: | Providers |
nika:validate | check | Builtins |
nika:assert vs when: | gate | Builtins |
| verbatim-quote schema | clauses | The 4 verbs |
Make it yours
- Compare against your clause playbook:
nika:readthe playbook + a secondinferthat flags deviations. - Batch a folder of NDAs:
nika:glob+for_each(Localization factory shows the chained fan-out). - HR version: same shape over candidate agreements or policy docs — sensitive data, local model, typed findings.
Level up · T3 fan-out
Next tier: collections the workflow discovers at runtime, processed in
parallel with retry and a leash.