AGPL-3.0-or-later · forever.

showcase · tier 2 · business

Contract guard

Clause extraction on a local model, so the contract never leaves the machine. A validate and an assert gate the memo.

Legal-grade caution, sovereign by default. Ollama runs the whole review offline. · conformance-gated in nika-spec ↗ · re-proven at every push

The whole file

6 tasks · 6 waves · the plan falls out of the bindings, nothing is scheduled by hand.

t2-contract-guard.nika.yamlsource
nika: v1workflow:  id: contract-guard  description: "Local-model clause extraction → schema gate → risk memo"model: ollama/qwen3.5:4b   # the whole review runs offline · zero cloudvars:  contract_path:    type: string    required: true    description: "Path to the contract (markdown or plain text)"tasks:  contract:    invoke:      tool: "nika:read"      args: { path: "${{ vars.contract_path }}" }  clauses:    with:      contract: ${{ tasks.contract.output }}    infer:      prompt: |        Extract every risk-bearing clause from this contract ·        ${{ with.contract }}        Quote each clause verbatim · classify its risk.      schema:        type: object        required: [clauses]        properties:          clauses:            type: array            items:              type: object              required: [quote, type, risk]              properties:                quote: { type: string }                type: { type: string, enum: [liability, termination, ip, payment, data, other] }                risk: { type: string, enum: [low, medium, high] }  check:    with:      clauses: ${{ tasks.clauses.output }}    invoke:      tool: "nika:validate"      args:        data: "${{ with.clauses }}"        format: json        schema:          type: object          required: [clauses]          properties:            clauses:              type: array              minItems: 1  gate:    with:      extraction_ok: ${{ tasks.check.output.valid == true }}   # the whole condition crosses as ONE boundary expression    invoke:      tool: "nika:assert"      args:        condition: "${{ with.extraction_ok }}"        message: "Clause extraction failed the schema gate: refusing to write the memo"  memo:    with:      clauses: ${{ tasks.clauses.output.clauses }}    after:      gate: succeeded              # state, no data · the assert passed or the memo is cancelled    infer:      prompt: |        Write a one-page risk memo from these clauses ·        ${{ with.clauses }}        Order by risk · high first · cite the quoted text.  save:    with:      memo: ${{ tasks.memo.output }}    invoke:      tool: "nika:write"      args:        path: "./legal/risk-memo.md"        content: "${{ with.memo }}"        create_dirs: trueoutputs:  clauses:    value: ${{ tasks.clauses.output.clauses }}    description: "Typed risk-bearing clauses, verbatim quotes"  memo: ${{ tasks.memo.output }}

nika inspect · engine 0.105.0 · vendored graph, never re-derived

6 declared edges · 6 waves · the plan falls out of the bindings