Skip to main content
T2 chain · legal / compliance: model: ollama/llama3.2:3b at 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:validate after, nika:assert as 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

contract-guard.nika.yaml

How it works

1

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.
2

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.
3

assert is the fail-fast guard

when: skips; nika:assert FAILS. A memo built on a bad extraction is worse than no memo, so the gate throws, loudly.

Constructs you just used

Make it yours

  • Compare against your clause playbook: nika:read the playbook + a second infer that 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.