ClauseBoard Hierarchical Rule System
Architecture: Global → Continent → Country → State/Province → City → Contract Type
Each layer INHERITS all rules from parent layers and ADDS jurisdiction-specific rules
Rules are applied as: parent_rules + local_rules (local overrides parent if conflict)
============================================================
LAYER 0: GLOBAL (applies to every contract on earth)
============================================================
These are the universal rules from v8 — already built and tested
GLOBAL_RULES: description: "What all contracts share regardless of where they were signed"
What makes a contract valid anywhere in the world:
FUNDAMENTALS: - All contracts require offer, acceptance, and consideration (exchange of value) - All parties must have legal capacity to sign (age, mental competence, authority) - Contract cannot require illegal acts - Contracts obtained through fraud, duress, or coercion are voidable - Unconscionable terms (grossly unfair) can be struck by courts in virtually every legal system
RED_FLAGS_UNIVERSAL: # R1-R9 (already in v8) R1: One-sided modification rights (one party can change terms without the other's consent) R2: Asymmetric termination (one party can exit easily, other is locked in) R3: Waiver of legal claims as condition of receiving something already owed R4: Referenced documents not provided (you're agreeing to something you can't read) R5: Unlimited liability for one party, capped for the other R6: Perpetual obligations with no exit mechanism R7: Disproportionate penalties (punishment doesn't fit the breach) R8: One-sided indemnification (you protect them, they don't protect you) R9: Non-disparagement preventing honest reviews or legal reporting
YELLOW_FLAGS_UNIVERSAL: # Y1-Y9 (already in v8) Y1: Arbitration-only dispute resolution (waives right to court) Y2: Governing law / jurisdiction mismatch (contract governed by a distant jurisdiction) Y3: Auto-renewal without clear opt-out process Y4: Vague definitions of key terms Y5: No force majeure clause (no protection for events beyond control) Y6: Short cure periods (less than 10 business days to fix a breach) Y7: Survival clauses extending unreasonably beyond termination Y8: No clear payment terms or triggers Y9: Broad assignment rights for one party only
GREEN_FLAGS_UNIVERSAL: # G1-G6 (already in v8) G1: Standard industry terms with balanced obligations G2: Clear definitions section G3: Mutual termination rights with reasonable notice G4: Reasonable limitation of liability for both parties G5: Clear payment schedule with defined milestones G6: Appropriate warranties and disclaimers
STRUCTURAL_CHECKS_UNIVERSAL: # S1-S4 (already in v8) S1: Missing signature lines or execution dates S2: Referenced exhibits or attachments not included S3: Internal contradictions between clauses S4: Incomplete or blank fields
POST_PROCESSOR_UNIVERSAL: - Scorecard math correction (always) - Banned phrase cleanup (always) - Schema completeness validation (always) - Final language cleanup pass (always — last step)
============================================================
LAYER 1: CONTINENT / LEGAL TRADITION
============================================================
Major legal traditions affect how contracts are interpreted
These rules reflect systemic differences, not country-specific laws
CONTINENT_RULES:
COMMON_LAW_SYSTEMS: # US, UK, Canada, Australia, NZ, India, Nigeria, etc. applies_to: [US, UK, CA, AU, NZ, IE, IN, NG, PH, SG, HK, ZA] description: "Judge-made law, precedent-based, contracts interpreted strictly as written" rules: - Parol evidence rule: oral agreements typically cannot override written terms - Courts generally enforce contracts as written (freedom of contract principle) - Specific performance is exceptional remedy (damages preferred) - Good faith duty varies (strong in US, weaker in UK) - "Battle of the forms" doctrine in commercial transactions flag_adjustments: - Ambiguous terms more likely to be interpreted against the drafter - "Entire agreement" clauses are generally enforceable - Oral modification waivers are generally enforceable
CIVIL_LAW_SYSTEMS: # Continental Europe, Latin America, East Asia applies_to: [FR, DE, ES, IT, PT, NL, BE, AT, CH, MX, CO, AR, CL, PE, BR, JP, KR, TW] description: "Code-based law, contracts interpreted through statutory framework" rules: - Statutory protections often cannot be waived by contract (mandatory rules) - Good faith duty is universal and mandatory (cannot be contracted away) - Courts may modify unfair terms rather than void entire contract - Consumer protection codes override contract terms automatically - Specific performance is more common than in common law flag_adjustments: - Waivers of statutory rights → always RED (even if "agreed to") - Penalty clauses may be reduced by courts regardless of what contract says - Non-compete scope limited by statute in most civil law countries
EU_MEMBER_STATES: # Layered on top of civil law for EU countries applies_to: [FR, DE, ES, IT, PT, NL, BE, AT, IE, SE, DK, FI, PL, CZ, RO, HR, BG, GR] description: "EU directives add mandatory consumer/worker protections above national law" rules: - GDPR applies to all data processing clauses (consent, retention, transfer) - Unfair Terms Directive (93/13/EEC): unfair terms in consumer contracts are void - Consumer Rights Directive: 14-day cooling off for distance contracts - Working Time Directive: max 48 hours/week (can opt out in some countries) - Transfer of Undertakings (TUPE): employee rights preserved in business transfers - Late Payment Directive: mandatory interest on late commercial payments flag_adjustments: - Data processing clauses missing GDPR compliance → RED - Consumer contract with no cooling-off period for distance sale → RED - Employment contract exceeding 48hr/week without opt-out documentation → YELLOW - No mention of data retention/deletion timeline → YELLOW
LATIN_AMERICA_GENERAL: applies_to: [MX, CO, AR, CL, PE, VE, EC, BO, PY, UY, CR, PA, DO, GT, HN, SV, NI] description: "Generally strong worker protections, employer cannot easily waive statutory benefits" rules: - Most countries have mandatory severance (liquidación/indemnización) - Probation periods are legally capped (varies 30-90 days) - Non-competes are very limited or unenforceable in most LatAm countries - Worker protections cannot be waived even if worker "agrees" - Profit sharing mandatory in several countries (Mexico, Ecuador, etc.) flag_adjustments: - Non-compete of any duration in employment → YELLOW (likely unenforceable) - Waiver of severance rights → RED (void in most jurisdictions) - Probation period exceeding local statutory max → RED
============================================================
LAYER 2: COUNTRY
============================================================
Specific national laws, statutes, and norms
COUNTRY_RULES:
US: legal_system: common_law inherits: [GLOBAL, COMMON_LAW_SYSTEMS] description: "Federal system — most contract law is STATE level, not federal" national_rules: - At-will employment is the default (can be overridden by contract) - Federal Arbitration Act generally enforces arbitration clauses - FLSA sets minimum wage and overtime requirements - ADA, Title VII, ADEA apply to employment contracts - FTC regulates deceptive contract practices - SCRA protections for military service members (lease breaks, etc.) - Truth in Lending Act (TILA) for consumer credit contracts - RESPA for real estate settlement procedures - Magnuson-Moss Warranty Act for consumer product warranties flag_adjustments: - Employment contract with sub-minimum wage → RED (FLSA violation) - Lease with no SCRA clause → YELLOW (missing for military) - Consumer credit without APR disclosure → RED (TILA violation) NOTE: "Most rules are at STATE level — see Layer 3"
UK: legal_system: common_law inherits: [GLOBAL, COMMON_LAW_SYSTEMS] description: "No at-will employment. Strong statutory protections." national_rules: - Employment Rights Act 1996: unfair dismissal protection after 2 years - NO at-will employment — must have notice period and reason for termination - Restrictive covenants (non-competes) must be reasonable in scope and duration - Consumer Rights Act 2015: unfair terms in consumer contracts void - Tenancy Deposit Protection: deposits must be in government scheme within 30 days - AST (Assured Shorthold Tenancy) is default residential tenancy - Section 21 "no-fault" evictions abolished (Renters Reform Act) - Right to request flexible working from day one - National minimum wage / National Living Wage tiers by age - Statutory sick pay, maternity/paternity pay mandatory - IR35 rules for contractor vs employee determination flag_adjustments: - Employment contract with no notice period → RED (illegal in UK) - Termination "for any reason" in employment → RED (no at-will in UK) - Non-compete >12 months → RED (almost never enforced) - Non-compete >6 months → YELLOW - Tenancy deposit not mentioning protection scheme → RED - Zero-hours contract with exclusivity clause → RED (banned since 2015) terminology: lease: "tenancy agreement" apartment: "flat" layoff: "redundancy" fired: "dismissed" non-compete: "restrictive covenant" at-will: "does not exist in UK law"
CANADA: legal_system: common_law (except Quebec: civil_law) inherits: [GLOBAL, COMMON_LAW_SYSTEMS] national_rules: - No at-will employment — reasonable notice required - Canada Labour Code for federally regulated industries - Provincial employment standards vary significantly - Non-competes largely unenforceable (Ontario banned 2021) - Bilingual requirements in some contexts (federal, Quebec) - Privacy: PIPEDA (federal) + provincial privacy laws flag_adjustments: - At-will termination clause → RED (illegal across Canada) - Non-compete in Ontario → RED (banned by Working for Workers Act 2021) - Non-compete elsewhere → YELLOW (courts rarely enforce) NOTE: "Province-specific rules in Layer 3"
AUSTRALIA: legal_system: common_law inherits: [GLOBAL, COMMON_LAW_SYSTEMS] national_rules: - Fair Work Act 2009: National Employment Standards (NES) - Modern Awards set minimum conditions by industry - Unfair dismissal protection for eligible employees - Restraint of trade must be reasonable (cascading clauses common) - Independent contractor rules tightened (closing the loophole) - Consumer law (ACL) — unfair contract terms void for small business - Residential tenancy acts vary by state (NSW, VIC, QLD, WA, SA) flag_adjustments: - Employment below Modern Award minimum → RED - Restraint clause without cascading/severability → YELLOW - Sham contracting indicators → RED
MEXICO: legal_system: civil_law inherits: [GLOBAL, CIVIL_LAW_SYSTEMS, LATIN_AMERICA_GENERAL] national_rules: - Ley Federal del Trabajo (LFT) — cannot be waived by contract - Trial period max 30 days (180 for management) - Mandatory profit sharing (PTU): 10% of pre-tax profits - Severance: 3 months salary + 20 days per year of service - Christmas bonus (aguinaldo): minimum 15 days salary - Vacation premium: 25% on top of vacation pay - Non-competes: very limited, only trade secrets with compensation - Social security (IMSS) enrollment mandatory - Maximum 48 hours/week (45 starting 2025 reform) - Subcontracting restricted (2021 reform) flag_adjustments: - Waiver of aguinaldo or PTU → RED (void, illegal) - Non-compete without compensation → RED (unenforceable) - Trial period >30 days for non-management → RED - Missing IMSS enrollment obligation → RED - Salary below minimum wage → RED terminology: severance: "liquidación / indemnización" employment_contract: "contrato individual de trabajo" employer: "patrón" employee: "trabajador"
BRAZIL: legal_system: civil_law inherits: [GLOBAL, CIVIL_LAW_SYSTEMS, LATIN_AMERICA_GENERAL] national_rules: - CLT (Consolidação das Leis do Trabalho) — comprehensive labor code - 13th salary mandatory (paid in 2 installments) - FGTS: employer deposits 8% of salary monthly into worker's fund - 30 days paid vacation + 1/3 vacation bonus - Non-competes must include compensation during restriction period - Dismissal without cause: 40% FGTS penalty + notice period - LGPD (Brazilian data protection law, similar to GDPR) - Working hours: max 44/week, 8/day - Overtime: minimum 50% premium (100% on Sundays/holidays) flag_adjustments: - Missing 13th salary provision in employment → RED - Non-compete without compensation → RED (unenforceable) - FGTS not mentioned in employment → YELLOW (statutory but should be referenced) - Data clause without LGPD compliance → YELLOW
FRANCE: legal_system: civil_law inherits: [GLOBAL, CIVIL_LAW_SYSTEMS, EU_MEMBER_STATES] national_rules: - Code du Travail — extremely detailed labor code - CDI (permanent) vs CDD (fixed-term) — CDD heavily restricted - 35-hour work week standard - Non-competes must include financial compensation (min 1/3 of salary) - Dismissal requires "real and serious cause" + specific procedure - 5 weeks minimum paid vacation - Strong collective bargaining agreements (conventions collectives) - Right to disconnect (2017) - Rupture conventionnelle (negotiated termination) process flag_adjustments: - Non-compete without financial compensation → RED (void in France) - CDD exceeding 18 months → RED (auto-converts to CDI) - Employment without reference to applicable convention collective → YELLOW - No mention of right to disconnect → YELLOW
GERMANY: legal_system: civil_law inherits: [GLOBAL, CIVIL_LAW_SYSTEMS, EU_MEMBER_STATES] national_rules: - BGB (Bürgerliches Gesetzbuch) — civil code governs contracts - Kündigungsschutzgesetz — strong dismissal protection after 6 months - Non-competes: max 2 years, must pay 50%+ of last salary during period - Works councils (Betriebsrat) have co-determination rights - Mietrecht: tenant protections are among strongest globally - Mietpreisbremse: rent cap in tight housing markets - Kautionsgesetz: security deposit max 3 months cold rent - Standard notice period increases with tenure flag_adjustments: - Non-compete without Karenzentschädigung (compensation) → RED (void) - Non-compete >2 years → RED (statutory max) - Rent increase above Mietpreisbremse limits → RED - Security deposit >3 months Kaltmiete → RED - Dismissal without Kündigungsschutz process → RED
Add more countries following same pattern...
COLOMBIA, ARGENTINA, CHILE, SPAIN, ITALY, INDIA, etc.
============================================================
LAYER 3: STATE / PROVINCE / REGION
============================================================
Sub-national jurisdictions with their own contract law
STATE_RULES:
US_CALIFORNIA: inherits: [GLOBAL, COMMON_LAW_SYSTEMS, US] statutes: employment: - Bus. & Prof. Code 16600: Non-competes VOID (with very narrow exceptions for sale of business) - Labor Code 2802: Employer must reimburse all necessary business expenses - Labor Code 201-202: Final pay due immediately upon termination, next payday if quit - WARN Act (CA version): 60 days notice for mass layoffs (applies to 75+ employees) - Fair Pay Act: Equal pay regardless of gender, race, ethnicity - FEHA: Broader anti-discrimination than federal law - Paid sick leave: minimum 5 days/40 hours per year (2024+) residential_lease: - Civil Code 1950.5: Security deposit max 1 month rent (effective July 2024) - Civil Code 1950.5(g): Deposit return within 21 days - AB 1482 (Tenant Protection Act): Rent increase cap 5% + CPI (max 10%) - Just cause eviction required for tenancies >12 months - Civil Code 1942: Right to repair and deduct - Civil Code 1954: 24-hour notice required for landlord entry - Health & Safety Code 17920.3: Implied warranty of habitability - Lead paint disclosure required (pre-1978 buildings) - Mold disclosure required - Bedbug disclosure required commercial_lease: - No rent control for commercial (AB 1482 residential only) - Prop 13 property tax implications on transfer - ADA compliance obligations independent_contractor: - AB 5 / Dynamex: ABC test for worker classification (strictest in US) - Misclassification penalties: back wages + benefits + penalties flag_adjustments: - ANY non-compete in employment → RED + note "void under California law" - Security deposit >1 month rent → RED + cite Civil Code 1950.5 - Deposit return >21 days → RED - Rent increase >10% → RED - No 24-hour entry notice → RED + cite Civil Code 1954 - Worker classified as contractor but fails ABC test → RED - Employer not reimbursing business expenses → RED + cite Labor Code 2802
US_TEXAS: inherits: [GLOBAL, COMMON_LAW_SYSTEMS, US] statutes: employment: - Bus. & Commerce Code 15.50: Non-competes enforceable if "ancillary to otherwise enforceable agreement" and reasonable in scope - At-will employment: very strong, few exceptions - No state income tax (affects compensation clauses) - Workers' comp is optional for private employers - Payday Law: final pay within 6 days of termination residential_lease: - Property Code 92: Landlord-tenant relations - Security deposit return: 30 days - No rent control (state preemption) - Landlord lien on tenant property allowed - Repair and deduct limited (must follow strict procedure) - No implied warranty of habitability in commercial independent_contractor: - More lenient classification than California - Common law "right to control" test flag_adjustments: - Non-compete >2 years → RED (unreasonable even in TX) - Non-compete >1 year → YELLOW - Non-compete with adequate consideration → GREEN if reasonable scope - Security deposit return >30 days → RED - Landlord lien clause → YELLOW + explain TX allows but unusual nationally
US_NEW_YORK: inherits: [GLOBAL, COMMON_LAW_SYSTEMS, US] statutes: employment: - Proposed non-compete ban (pending legislation — track status) - NYC salary transparency law (Local Law 32): must disclose salary range - NY WARN Act: 90 days notice (stricter than federal 60) - Whistleblower protections (Labor Law 740) - Paid family leave: up to 12 weeks residential_lease: - NYC rent stabilization (separate from state law) - HSTPA 2019: major tenant protections - Security deposit max: 1 month rent (statewide) - Deposit return: 14 days (statewide) - Just cause eviction in NYC - Heat and hot water obligations (NYC Housing Code) - Warranty of habitability (Real Property Law 235-b) commercial_lease: - Commercial Tenant Harassment law (NYC) - No commercial rent control (but advocacy ongoing) flag_adjustments: - Security deposit >1 month → RED + cite HSTPA - Deposit return >14 days → RED - No salary range in NYC job offer → YELLOW + cite Local Law 32 - Rent stabilized unit with deregulation clause → RED
US_FLORIDA: inherits: [GLOBAL, COMMON_LAW_SYSTEMS, US] statutes: employment: - Fla. Stat. 542.335: Non-competes enforceable, presumptively reasonable up to 2 years - At-will employment: strong - No state income tax - No state-level paid sick leave mandate residential_lease: - Fla. Stat. 83: Landlord-Tenant Act - Security deposit: no statutory max - Deposit return: 15 days (no deductions) or 30 days (with deductions) - No rent control (state preemption) - 3-day notice to pay or vacate for nonpayment - 7-day notice to cure for lease violations flag_adjustments: - Non-compete >2 years → YELLOW (presumptively unreasonable per 542.335) - Non-compete <2 years with reasonable scope → GREEN - Security deposit with no return timeline → RED
Add: US_ILLINOIS, US_PENNSYLVANIA, US_OHIO, US_GEORGIA, US_NC, US_MICHIGAN
Add: UK_ENGLAND, UK_SCOTLAND (different tenancy law), UK_WALES
Add: CA_ONTARIO, CA_BC, CA_QUEBEC, CA_ALBERTA
Add: AU_NSW, AU_VIC, AU_QLD
Add: MX_CDMX (additional local rules), DE_BERLIN (Mietendeckel), FR_PARIS (encadrement des loyers)
============================================================
LAYER 4: CITY / MUNICIPALITY
============================================================
Cities with their own ordinances that override or supplement state law
CITY_RULES:
US_CA_LOS_ANGELES: inherits: [GLOBAL, COMMON_LAW_SYSTEMS, US, US_CALIFORNIA] local_ordinances: residential_lease: - LA Rent Stabilization Ordinance (RSO): applies to buildings built before Oct 1978 - RSO rent increase: 3-8% annually (set by Rent Adjustment Commission) - Just cause eviction required for RSO units - Relocation assistance required for certain no-fault evictions - SCEP (Systematic Code Enforcement Program) inspection program - LA Fair Chance Ordinance (limits criminal history in tenant screening) - COVID-era tenant protections (check if still active) employment: - LA minimum wage: higher than state minimum (check current rate) - LA Fair Work Week Ordinance (retail sector scheduling) - LA Hotel Worker Protection Ordinance commercial_lease: - LA specific ADA enforcement - Earthquake retrofit requirements for soft-story buildings flag_adjustments: - RSO-eligible building without RSO disclosures → RED - Rent increase above RSO allowance → RED - No relocation assistance clause for no-fault eviction in RSO unit → RED local_context: average_rent: "$2,800/month (1BR)" vacancy_rate: "~5%" legal_market: "Highly tenant-favorable with strong enforcement"
US_CA_SAN_FRANCISCO: inherits: [GLOBAL, COMMON_LAW_SYSTEMS, US, US_CALIFORNIA] local_ordinances: residential_lease: - SF Rent Ordinance: applies to buildings built before June 1979 - Rent Board sets annual allowable increase (~2-3%) - Just cause eviction required (16 enumerated just causes) - Buyout agreements regulated (must be filed with Rent Board) - Ellis Act evictions: specific requirements and relocation payments - SF Security Deposit Interest Ordinance: must pay interest on deposits employment: - SF Paid Parental Leave Ordinance - SF Health Care Security Ordinance (employer health spending mandate) - SF Fair Chance Ordinance (ban the box) flag_adjustments: - Rent-controlled unit without Rent Board disclosure → RED - No interest on security deposit → YELLOW + cite SF ordinance - Buyout agreement not mentioning Rent Board filing requirement → RED
US_NY_NEW_YORK_CITY: inherits: [GLOBAL, COMMON_LAW_SYSTEMS, US, US_NEW_YORK] local_ordinances: residential_lease: - Rent stabilization system (DHCR oversees ~1M units) - Preferential rent rules (HSTPA 2019 changes) - NYC heat season requirements (Oct 1 - May 31) - Required riders: lead paint, bedbug history, sprinkler disclosure - Window guards required (children under 10) - Right to have window AC installed - Broker fee rules (check current status — contested) employment: - NYC Human Rights Law (broader than state/federal) - NYC salary transparency (Local Law 32) - NYC Earned Safe and Sick Time Act - NYC ban on most non-competes (check legislation status) - NYC Freelance Isn't Free Act: written contract required for $800+ flag_adjustments: - Missing required riders in rent-stabilized lease → RED - Freelance contract <$800 without written agreement → YELLOW - Missing salary range in job posting/offer → YELLOW + cite Local Law 32
UK_LONDON: inherits: [GLOBAL, COMMON_LAW_SYSTEMS, UK] local_rules: residential_lease: - London-specific: higher deposit norms but same statutory cap (5 weeks rent) - Stamp Duty Land Tax implications for long leases - Leasehold vs Freehold distinctions (unique to England/Wales) - Service charges and ground rent (Leasehold Reform Act 2024) - Right to manage / right to buy freehold employment: - London Living Wage (higher than national minimum) - London Weighting in salary (common but not statutory) local_context: average_rent: "£2,100/month (1BR)" legal_market: "Tenant protections strengthening rapidly with Renters Reform Act"
MX_CDMX: inherits: [GLOBAL, CIVIL_LAW_SYSTEMS, LATIN_AMERICA_GENERAL, MEXICO] local_rules: residential_lease: - Código Civil CDMX: specific lease provisions - Maximum rent increase provisions - Deposito de garantía: typically 1-2 months - PROFECO consumer protection applies to residential leases employment: - CDMX minimum wage zone (historically Zone A, now unified) - Local labor courts (Juntas de Conciliación) local_context: average_rent: "MX$15,000/month (1BR Polanco/Condesa area)"
DE_BERLIN: inherits: [GLOBAL, CIVIL_LAW_SYSTEMS, EU_MEMBER_STATES, GERMANY] local_rules: residential_lease: - Mietpreisbremse (rent brake): new leases capped at 10% above local reference rent - Mietspiegel (rent index) used as reference - Milieuschutz (social preservation areas): additional tenant protections - Vorkaufsrecht: tenant right of first refusal in some areas - Note: Mietendeckel (rent cap) was struck down by Federal Constitutional Court in 2021 — no longer active local_context: average_rent: "€1,200/month (1BR)"
Add more cities as data supports...
============================================================
LAYER 5: CONTRACT TYPE × LOCATION
============================================================
Final layer: specific contract types get location-aware rules
This is where the type-specific modules from v8 merge with location rules
CONTRACT_TYPE_LOCATION_RULES:
Example: Residential Lease × Los Angeles
residential_lease_x_los_angeles: inherits: [GLOBAL, US, US_CALIFORNIA, US_CA_LOS_ANGELES, residential_lease_module] combined_red_flags: # From Global: - One-sided modification rights (R1) - Asymmetric termination (R2) # From US: - Sub-minimum wage provisions # From California: - Security deposit >1 month rent (Civil Code 1950.5) - No 24-hour entry notice (Civil Code 1954) - Habitability waiver (Health & Safety Code 17920.3) # From Los Angeles: - RSO-eligible building without RSO disclosures - Rent increase above RSO allowance - No relocation assistance for no-fault eviction in RSO unit # From Residential Lease Module (v8): - No-notice landlord entry - All major repairs on tenant - Full deposit forfeiture for policy violation - Security deposit dispute waiver
combined_post_processors:
# Universal post-processor +
# Residential lease post-processor +
# California-specific checks:
- Missing lead paint disclosure (pre-1978) → YELLOW
- Missing mold disclosure → YELLOW
- Missing bedbug disclosure → YELLOW
- Missing RSO disclosure (if building pre-Oct 1978) → RED
# LA-specific checks:
- Missing SCEP information → YELLOW
- Missing relocation assistance terms → YELLOW
============================================================
IMPLEMENTATION ARCHITECTURE
============================================================
IMPLEMENTATION:
storage: description: "Rules stored as JSON files organized by hierarchy" structure: /rules/global.json # Universal rules (v8) /rules/legal-systems/common-law.json # Common law tradition /rules/legal-systems/civil-law.json # Civil law tradition /rules/legal-systems/eu.json # EU overlay /rules/countries/us.json # US national /rules/countries/uk.json # UK national /rules/countries/mexico.json # Mexico national /rules/countries/brazil.json # Brazil national /rules/states/us-california.json # California /rules/states/us-texas.json # Texas /rules/states/uk-england.json # England /rules/states/ca-ontario.json # Ontario /rules/cities/us-ca-los-angeles.json # Los Angeles /rules/cities/us-ny-new-york-city.json # NYC /rules/cities/uk-london.json # London /rules/cities/mx-cdmx.json # Mexico City
rule_resolution: description: "At analysis time, system builds a rule stack based on detected jurisdiction" algorithm: 1: Detect contract jurisdiction from governing law clause, parties' addresses, or user input 2: Build inheritance chain (e.g., global → common_law → US → California → Los Angeles) 3: Merge all rules in order (child overrides parent on conflicts) 4: Pass merged rules to Claude as part of system prompt 5: Run merged post-processors after analysis
prompt_injection: description: "Jurisdiction-specific rules are injected into the system prompt dynamically" template: | [UNIVERSAL RULES - always apply] {global_rules}
[JURISDICTION-SPECIFIC RULES]
This contract is governed by the laws of {jurisdiction}.
The following additional rules apply in this jurisdiction:
{merged_jurisdiction_rules}
[CONTRACT TYPE RULES]
This is a {contract_type}. The following type-specific rules apply:
{type_module_rules}
[COMBINED FLAG CRITERIA]
In addition to universal flags, flag the following based on jurisdiction:
{jurisdiction_specific_flags}
scalability: description: "Adding a new jurisdiction requires only adding a JSON file at the correct level" example: | To add support for Chicago: 1. Create /rules/cities/us-il-chicago.json 2. Define local ordinances (RLTO, minimum wage, fair workweek) 3. System automatically inherits Global → US → Illinois → Chicago 4. No changes to the analysis engine needed
seo_connection: description: "Every rule file maps to a content page" mapping: /rules/states/us-california.json → /blog/california/contract-review /rules/cities/us-ca-los-angeles.json → /blog/los-angeles/contract-review /rules/countries/mexico.json → /es/mexico/revision-de-contratos principle: "If we have rules for a jurisdiction, we have content for that jurisdiction. If we have content, it's backed by real rules. They're the same data."