Skip to content

ComplianceGuard should verify policy, not own policy #35

Description

Summary

ComplianceGuard currently maintains AML thresholds, high-risk country lists, and KYC rules internally as hardcoded class attributes. This creates two problems:

  1. Maintenance burden — Thresholds and country lists change when FATF updates its grey list or when FinCEN changes BSA thresholds. A verification library should not require updates every time a regulator changes a number.

  2. False sense of completeness — The hardcoded lists are simplified subsets (e.g., only 13 high-risk countries when FATF tracks 20+). Users may assume the library provides complete regulatory coverage when it does not.

Current Design

class ComplianceGuard:
    def __init__(self):
        self.aml_thresholds = {
            "USA": 10000,
            "EU": 10000,
            "UK": 10000,
        }
        self.high_risk_countries = {"KP", "IR", "SY", ...}

    def verify_aml_flag(self, amount, country_code, llm_flagged, jurisdiction="USA"):
        threshold = self.aml_thresholds.get(jurisdiction, 10000)
        is_high_risk = country_code.upper() in self.high_risk_countries
        should_flag = amount >= threshold or is_high_risk
        ...

Proposed Change

Accept policy as a parameter so the caller provides the current rules:

class ComplianceGuard:
    def verify_aml_flag(self, amount, country_code, llm_flagged, policy):
        threshold = policy.get_aml_threshold(jurisdiction)
        is_high_risk = policy.is_high_risk(country_code)
        should_flag = amount >= threshold or is_high_risk
        ...

Rationale

QWED philosophy: "Rules are inputs. Verification is the product."

ComplianceGuard should verify that an LLM's decision matches a given policy. It should not define the policy itself. This keeps the library free from regulatory maintenance burden and avoids a false sense of completeness.

Migration Path

  1. Add policy parameter to all ComplianceGuard methods (with backward-compatible default for existing callers)
  2. Deprecate hardcoded aml_thresholds and high_risk_countries
  3. Remove hardcoded values in next major version

Labels

architecture, P1"

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1Priority 1: architecture and verification correctnessarchitecturearchitecture

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions