Source logic for Idea #180
Go to file
agent-7e3bbc424e07835b dfa533d2f2 build(agent): new-agents-2#7e3bbc iteration 2026-04-24 17:56:13 +02:00
src/idea180_credimesh_federated_privacy build(agent): new-agents-2#7e3bbc iteration 2026-04-24 17:56:13 +02:00
tests build(agent): new-agents-2#7e3bbc iteration 2026-04-24 17:56:13 +02:00
.gitignore build(agent): new-agents-2#7e3bbc iteration 2026-04-24 17:56:13 +02:00
AGENTS.md build(agent): new-agents-2#7e3bbc iteration 2026-04-24 17:56:13 +02:00
README.md build(agent): new-agents-2#7e3bbc iteration 2026-04-24 17:56:13 +02:00
pyproject.toml build(agent): new-agents-2#7e3bbc iteration 2026-04-24 17:56:13 +02:00
test.sh build(agent): new-agents-2#7e3bbc iteration 2026-04-24 17:56:13 +02:00

README.md

idea180-credimesh-federated-privacy

CrediMesh is a federated underwriting core for privacy-preserving mortgage evaluation.

This repository provides a deterministic orchestration slice for:

  • privacy-minimized shared signals from income and appraisal adapters
  • graph-of-contracts registration and conformance checks
  • an ADMM-lite solver for affordability, collateral, and rate reconciliation
  • Ed25519-signed audit events
  • SQLite-backed governance persistence

What it does

The package evaluates a LocalUnderwritingProblem by:

  1. transforming borrower evidence into SharedSignal records with strict privacy budgets
  2. checking those signals against contract metadata in a graph registry
  3. reconciling affordability and collateral constraints with a deterministic solver
  4. writing tamper-evident audit entries into SQLite without storing raw borrower payloads

Modules

  • models.py: request, signal, plan, budget, and audit models
  • identity.py: Ed25519 DID-style identities
  • contracts.py: contract specs, conformance, and registry graph
  • adapters.py: income verification and property appraisal adapters
  • solver.py: deterministic underwriting solver
  • ledger.py: SQLite governance ledger
  • orchestrator.py: end-to-end flow

Quick start

from idea180_credimesh_federated_privacy import CrediMeshOrchestrator, LocalUnderwritingProblem, SQLiteGovernanceLedger, create_identity

problem = LocalUnderwritingProblem(
    borrower_id="borrower-1",
    lender_id="lender-a",
    requested_amount=400000,
    property_value=520000,
    annual_income=180000,
    monthly_obligations=900,
)

with SQLiteGovernanceLedger(":memory:") as ledger:
    orchestrator = CrediMeshOrchestrator(create_identity("lender-a"), ledger)
    result = orchestrator.evaluate(
        problem,
        [
            {"gross_monthly_income": 15000, "employment_months": 48, "employer_stability_score": 9.0},
            {"gross_monthly_income": 15200, "employment_months": 50, "employer_stability_score": 8.8},
        ],
        {"appraised_value": 535000, "confidence": 0.9, "comparables_count": 6, "days_on_market": 18},
    )

print(result.plan.model_dump())

Testing

Run the local verification gate:

bash test.sh

That script installs dependencies, runs pytest, and executes python3 -m build.

Design rules

  • Keep borrower data minimized at the signal boundary.
  • Preserve deterministic replay for identical inputs.
  • Update tests whenever contract behavior changes.
  • Keep the SQLite ledger append-only and privacy-safe.