code wiki / (root) / nx_cuad_lib.nx

nx_cuad_lib.nx

buildroot/runtime/nx_cuad_lib.nx

10555 B275 linesdepth 8pulls 13 transitivereach 1 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_cuad_lib.nx -- THE CUAD CLAUSE TAXONOMY (41 types) as a typed, benchmark-aligned playbook. WHY (July 2026 SOTA, researched): CUAD -- 13,000+ expert labels over 510 commercial contracts from EDGAR, covering 41 clause types -- is the benchmark essentially every contract-AI product trains or evaluates against. Our clause layer had a TWO-clause playbook, so "retrieval works" was true and meaningless. This enumerates the real target so coverage becomes a number with a denominator. u2605u2605THE HONESTY MECHANISM, BUILT INTO THE ORGAN: declaring 41 constants would let us claim 41 types of coverage while only a handful can actually be detected -- exactly the coverage-gaming this house has been burned by. So the taxonomy is split in two and the split is enforced in code: DECLARED -- all 41 types exist as named constants (the complete, greppable denominator) CUED -- the subset with real discriminative detection cues cuad_coverage_permille scores against CUED types ONLY. A type that is merely declared can NEVER contribute to a coverage number. The organ literally cannot flatter itself; adding a constant does nothing until you add cues to go with it. u2605THE CONTRADICTION TOOTH: "Uncapped Liability" and "Cap On Liability" are SEPARATE CUAD types, and a contract asserting BOTH is internally inconsistent -- one clause caps exposure while another blows the cap open. Reviewers miss it because the two live pages apart and each looks fine alone. Detected here as a first-class contradiction rather than as two independent findings. u2605FAIL-CLOSED: unrecognised text is CUAD_UNKNOWN, never the nearest type. In diligence, "I could not classify this" is actionable and "probably a notices clause" is how a change-of-control provision gets skipped. license_tier: ORIGINAL LIB.

dependencies 1 imports · 1 importers

nx_clause_lib.nx nx_cuad_lib.nx nx_cuad_gate.nx

imports: nx_clause_lib.nx

imported by: nx_cuad_gate.nx

structs

none

consts

30const CUAD_UNKNOWN: i64 = 0 - 1
31const CUAD_DECLARED: i64 = 41
34const CU_DOCUMENT_NAME: i64 = 0
35const CU_PARTIES: i64 = 1
36const CU_AGREEMENT_DATE: i64 = 2
37const CU_EFFECTIVE_DATE: i64 = 3
38const CU_EXPIRATION_DATE: i64 = 4
39const CU_RENEWAL_TERM: i64 = 5
40const CU_NOTICE_TO_TERMINATE_RENEWAL: i64 = 6
41const CU_GOVERNING_LAW: i64 = 7
42const CU_MOST_FAVORED_NATION: i64 = 8
43const CU_NON_COMPETE: i64 = 9
44const CU_EXCLUSIVITY: i64 = 10
45const CU_NO_SOLICIT_CUSTOMERS: i64 = 11
46const CU_COMPETITIVE_RESTRICTION_EXCEPTION: i64 = 12
47const CU_NO_SOLICIT_EMPLOYEES: i64 = 13
48const CU_NON_DISPARAGEMENT: i64 = 14
49const CU_TERMINATION_FOR_CONVENIENCE: i64 = 15
50const CU_ROFR: i64 = 16
51const CU_CHANGE_OF_CONTROL: i64 = 17
52const CU_ANTI_ASSIGNMENT: i64 = 18
53const CU_REVENUE_PROFIT_SHARING: i64 = 19
54const CU_PRICE_RESTRICTIONS: i64 = 20
55const CU_MINIMUM_COMMITMENT: i64 = 21
56const CU_VOLUME_RESTRICTION: i64 = 22
57const CU_IP_OWNERSHIP_ASSIGNMENT: i64 = 23
58const CU_JOINT_IP_OWNERSHIP: i64 = 24
59const CU_LICENSE_GRANT: i64 = 25
60const CU_NON_TRANSFERABLE_LICENSE: i64 = 26
61const CU_AFFILIATE_LICENSE_LICENSOR: i64 = 27
62const CU_AFFILIATE_LICENSE_LICENSEE: i64 = 28
63const CU_UNLIMITED_LICENSE: i64 = 29
64const CU_PERPETUAL_LICENSE: i64 = 30
65const CU_SOURCE_CODE_ESCROW: i64 = 31
66const CU_POST_TERMINATION_SERVICES: i64 = 32
67const CU_AUDIT_RIGHTS: i64 = 33
68const CU_UNCAPPED_LIABILITY: i64 = 34
69const CU_CAP_ON_LIABILITY: i64 = 35
70const CU_LIQUIDATED_DAMAGES: i64 = 36
71const CU_WARRANTY_DURATION: i64 = 37
72const CU_INSURANCE: i64 = 38
73const CU_COVENANT_NOT_TO_SUE: i64 = 39
74const CU_THIRD_PARTY_BENEFICIARY: i64 = 40

functions

78func cuad_is_cued(t: i64) -> i64
102func cuad_cued_count() -> i64
114func cuad_cue_hit(text: *u8, t: i64) -> i64
211func cuad_classify(text: *u8) -> i64
called by 1: main calls 2: cuad_is_cuedcuad_cue_hit
223func cuad_types_present(text: *u8) -> i64
236func cuad_coverage_permille(text: *u8) -> i64
243func cuad_liability_contradiction(text: *u8) -> i64
called by 1: main calls 1: cuad_cue_hit
250func cuad_is_high_risk(t: i64) -> i64
261func cuad_high_risk_present(text: *u8) -> i64
274func cuad_declared_count() -> i64 { return CUAD_DECLARED }
called by 1: main
275func cuad_uncued_count() -> i64 { return CUAD_DECLARED - cuad_cued_count() }
called by 1: main calls 1: cuad_cued_count