Financially Active Contracts — Design

Issue: #278 — Support financially active contracts (loans, leases, subscriptions) Date: 2026-02-22

Problem

Contracts with recurring financial obligations (loans, leases, insurance, subscriptions) are classified as generic contracts, indistinguishable from NDAs or framework agreements. Finance teams cannot filter or identify them at a glance.

Contract-Type Enum Expansion

Expand contract-type from 6 values to 11:

Type German Examples Financially Active
loan Darlehensvertrag, Kreditvertrag, Finanzierungsvertrag Yes
lease Leasingvertrag (equipment, vehicles, machinery) Yes
rental Mietvertrag, Pachtvertrag (real estate, space) Yes
insurance Versicherungsvertrag, Versicherungspolice Yes
subscription SaaS-Vertrag, Lizenzvertrag (recurring), Wartungsvertrag Yes
purchase Kaufvertrag, Erwerbsvertrag No
service Dienstleistungsvertrag, Beratungsvertrag No
supply Liefervertrag, Beschaffungsvertrag No
nda Geheimhaltungsvereinbarung, NDA No
framework Rahmenvertrag, Master Agreement No
other Anything else No

No database migration needed — contract-type is stored in structured_data JSONB, not as a PostgreSQL enum.

Financially-Active Derivation

Pure function, derived from contract-type:

(def financially-active-types #{"loan" "lease" "rental" "insurance" "subscription"})
(defn financially-active? [contract-type] (contains? financially-active-types contract-type))

No DB column, no trigger changes. Used by UI layer only.

Classification Prompt Changes

Update the classification prompt in classification.clj to teach the LLM about expanded contract types with German examples. Key disambiguation rules:

Extraction Prompt Changes

Update the contract extraction prompt to include the expanded contract-type enum so the LLM returns correct values during extraction.

Schema Changes

Update contract-type enum in schema/contract/structured_data.clj:

[:enum "loan" "lease" "rental" "insurance" "subscription" "purchase"
       "service" "supply" "nda" "framework" "other"]

UI Changes

Financial Badge on Document List

Contracts where financially-active? returns true show a "Financial" badge (blue/teal) alongside lifecycle badges (Active/Expiring/Expired).

Contract-Type Badge

Show contract sub-type as a secondary badge (e.g., "Loan", "Lease", "Rental") on the document list for all contracts.

Financially Active Filter

Add a filter option on the Document Management page. SQL:

WHERE document.type = 'contract'
  AND document.structured_data->>'contract-type'
      IN ('loan','lease','rental','insurance','subscription')

Out of Scope