Kredal Docs
Adr

ADR 0009 — AI extracts, deterministic rules decide

How the Gemini AI layer coexists with the auditable scoring engine.

  • Status: Accepted
  • Date: 2026-07-14

Context

Kredal added an AI layer (server-side Gemini): document data extraction, cross-document consistency checking, and narrative drafting. ADR 0003 established that the readiness score must stay deterministic and auditable. The question was where AI is allowed to act.

Decision

AI is confined to three advisory roles; the score's decision logic stays deterministic:

  1. Extraction — Gemini reads uploaded documents (trade license, passport, Emirates ID, tenancy, bank statement) into strict JSON contracts stored on documents.extracted_text with a parse_confidence. Low confidence routes the document to needs_review, never silently into scoring.
  2. Consistency rules — new xdoc_* rules compare extracted fields against profile data (name mismatches, expired documents). The comparisons themselves are plain deterministic code in the rules catalog; identical inputs always produce identical flags.
  3. Narrative drafting — the source-of-funds draft is generated only from the founder's own answers, is clearly labelled as an AI draft, and is saved only when the founder explicitly applies and saves it. It never feeds the score.

The API key is server-only; without it the app runs normally and AI features are skipped.

Consequences

  • Positive: the "AI-core" capability is real while the score remains explainable to banks and regulators; extraction failures degrade gracefully to human review.
  • Negative: extraction quality bounds the consistency rules — hence the confidence threshold and the manual re-extract control. Free-tier rate limits (~15 requests/minute) are acceptable at pilot scale; revisit before volume onboarding.

On this page