Skip to content

Aldilaijan & Khobara Architecture Diagrams โ€‹

Interactive, showcase-grade visual specifications generated with Archify. Each diagram is delivered as a self-contained standalone HTML viewer with inline SVG, responsive desktop layout, light/dark themes, filtered guided views, and animated traces.


Quick Launch & Local CLI โ€‹

You can launch any or all interactive diagrams locally in your default web browser using the dedicated PowerShell helper:

powershell
# Interactive CLI menu:
.\tool\open_diagrams.ps1

# Directly open a specific diagram:
.\tool\open_diagrams.ps1 topology    # System & 3-Tier Storage Topology
.\tool\open_diagrams.ps1 hermes      # WhatsApp Copilot & Hermes Pipeline
.\tool\open_diagrams.ps1 appraisal   # Kuwait Appraisal & Cadastral Engine
.\tool\open_diagrams.ps1 deal        # Brokerage Deal & Earnest Escrow
.\tool\open_diagrams.ps1 sync        # WhatsApp Two-Way Coexistence Sync
.\tool\open_diagrams.ps1 dataflow    # Cadastral & Market Dataflow
.\tool\open_diagrams.ps1 inspection  # Multimodal Inspection & PAdES Digital Seal
.\tool\open_diagrams.ps1 valuation   # 3-Method Valuation Engine & Challenger
.\tool\open_diagrams.ps1 approval    # Hermes Autonomous Action Approval Gate
.\tool\open_diagrams.ps1 intake      # Property Intake, Parser & Sanitization
.\tool\open_diagrams.ps1 paci        # PACI Kuwait Finder Share-Link Resolution
.\tool\open_diagrams.ps1 chalet      # State Domain Coastal Chalet Usufruct Lifecycle
.\tool\open_diagrams.ps1 commercial  # Commercial Turnover Lease & CAM Reconciliation
.\tool\open_diagrams.ps1 probate     # Title Deed Inheritance, Probate & Heir Split
.\tool\open_diagrams.ps1 rent        # Tenant Digital Rent Collection & Payout
.\tool\open_diagrams.ps1 pahw        # PAHW Housing Grant & Credit Bank Subsidies
.\tool\open_diagrams.ps1 all         # Open ALL 22 in browser tabs
.\tool\open_diagrams.ps1 docs        # Launch VitePress documentation site

Diagram Suite Overview โ€‹

#Diagram NameArchitecture TypeSpec FileInteractive Canvas
1System & 3-Tier Storage Topologyarchitecturesystem-topology.architecture.jsonOpen Fullscreen โ†—
2WhatsApp Copilot & Hermes Pipelineworkflow (v2)whatsapp-hermes-pipeline.workflow.jsonOpen Fullscreen โ†—
3Kuwait Appraisal & Cadastral Engineworkflow (v2)kuwait-appraisal-engine.workflow.jsonOpen Fullscreen โ†—
4Brokerage Deal & Earnest Escrowlifecyclebrokerage-deal-lifecycle.lifecycle.jsonOpen Fullscreen โ†—
5WhatsApp Two-Way Coexistence Syncsequencewhatsapp-coexistence.sequence.jsonOpen Fullscreen โ†—
6Cadastral & Market Data Pipelinedataflowcadastral-market-dataflow.dataflow.jsonOpen Fullscreen โ†—
7Multimodal Inspection & PAdES Sealworkflow (v2)multimodal-inspection-pipeline.workflow.jsonOpen Fullscreen โ†—
83-Method Valuation & Challenger Engineworkflow (v2)valuation-challenger-reconciliation.workflow.jsonOpen Fullscreen โ†—
9Hermes Action Approval & Security Gatelifecyclehermes-action-approval-gate.lifecycle.jsonOpen Fullscreen โ†—
10Property Intake & Address Sanitizationworkflow (v2)property-intake-sanitization.workflow.jsonOpen Fullscreen โ†—
11Hermes Multi-Model Query Routingarchitecturehermes-model-routing.architecture.jsonOpen Fullscreen โ†—
12Earnest Money ("ุงู„ุนุฑุจูˆู†") & Escrow Trustlifecycleearnest-money-escrow-lifecycle.lifecycle.jsonOpen Fullscreen โ†—
13Kuwait 4 Islamic Banks Annex 4 Pipelineworkflow (v2)islamic-banks-valuation-dossier.workflow.jsonOpen Fullscreen โ†—
14Broker Commission Split & Settlement Ledgerworkflow (v2)broker-commission-split-ledger.workflow.jsonOpen Fullscreen โ†—
15Kuwait Cadastral GIS & PACI/Baladia Proxyarchitecturekuwait-cadastral-gis-proxy.architecture.jsonOpen Fullscreen โ†—
16Private Sale & Lease Contract Generatorsequenceprivate-contract-generation-audit.sequence.jsonOpen Fullscreen โ†—
17PACI Share-Link Resolutionworkflow (v2)paci-link-resolution.workflow.jsonOpen Fullscreen โ†—
18State Domain Coastal Chalet Usufruct Lifecycleworkflow (v2)chalet-statedomain-usufruct-lifecycle.workflow.jsonOpen Fullscreen โ†—
19Commercial Turnover Lease & CAM Reconciliationworkflow (v2)commercial-turnover-lease-cam.workflow.jsonOpen Fullscreen โ†—
20Title Deed Inheritance, Probate & Heir Proceeds Splitworkflow (v2)title-deed-probate-heir-split.workflow.jsonOpen Fullscreen โ†—
21Tenant Digital Rent Collection & Landlord Disbursementworkflow (v2)tenant-rent-collection-knet-payout.workflow.jsonOpen Fullscreen โ†—
22PAHW Housing Grant & Credit Bank Loan Subsidiesworkflow (v2)pahw-housing-grant-credit-bank.workflow.jsonOpen Fullscreen โ†—

1. System & 3-Tier Storage Topology โ€‹

Architectural topology defining the core client apps (Flutter iOS/Android/Web, React Web), Edge API layer, and strict 3-tier storage partition:

  • Supabase Storage: Confidential PDFs, property photos, title deed records ($<50\text{ MB}$, RLS-governed).
  • Cloudflare R2: Heavy 4K property walkthrough videos, drone inspections ($>50\text{ MB}$, zero-egress CDN).
  • Hostinger VPS: Dedicated exclusively to Mailbox IMAP/SMTP services (never stores heavy files or media).

2. WhatsApp Copilot & Hermes AI Pipeline โ€‹

End-to-end workflow tracing incoming client WhatsApp messages through Meta Cloud webhooks, sub-35ms Laya System 1 guardrails & triage, Gemini 3.8 Flash multimodal intent extraction, automated CRM listing matchmaking, broker review draft generation, and outbound WhatsApp notification.


3. Kuwait Cadastral & Certified Appraisal Engine โ€‹

Four-stage valuation and municipal zoning pipeline:

  1. Intake & Cadastral Resolution: PACI Civil ID, Baladia parcel GIS, and title deed OCR.
  2. Regulatory & FAR Validation: Kuwait Municipality Law 33/2016 zoning, building ratios, setbacks, and commercial FAR.
  3. Valuation Method Execution: Sales Comparison, Income Capitalization (Cap Rate), and Depreciated Replacement Cost.
  4. Bank Stamped Sign-off: Certified appraiser digital stamp, variance analysis, and certified PDF export for banking partners (KFH, Boubyan, KIB, Warba).

4. Brokerage Deal & Earnest Escrow Lifecycle โ€‹

Complete multi-lane lifecycle for real estate transactions:

  • Lanes: Buyer (client), Listing Broker (broker), Legal & Compliance (compliance), and Financial Escrow (escrow).
  • States: Inquiry & Match $\rightarrow$ Property Inspection $\rightarrow$ Formal Purchase Offer $\rightarrow$ Earnest Deposit Escrow $\rightarrow$ Due Diligence & Baladia Title Clearance $\rightarrow$ Final Closing & Commission Split Ledger $\rightarrow$ Deal Settled.

5. WhatsApp Two-Way Coexistence Sync โ€‹

Sequence diagram demonstrating the two-way coexistence architecture between:

  • Mobile Client (WhatsApp App)
  • Meta WhatsApp Cloud Webhook
  • Supabase Realtime & Edge Functions
  • Flutter Broker Inbox
  • Physical Staff WhatsApp Business Device

Guarantees zero message loss, deduplication, and bidirectional message attribution when staff reply either from the Flutter CRM or directly from their physical phone.


6. Cadastral & Market Data Pipeline โ€‹

Dataflow pipeline transforming raw municipal and historical market records into live valuation intelligence:

  • Ingestion of Ministry of Justice historical sales, PACI spatial boundaries, and Baladia zoning parameters.
  • Cleansing and outlier filtering via PostgreSQL RPCs.
  • Materialized market aggregates and Automated Valuation Models (AVM) serving Flutter client map layers in real-time.

7. Multimodal Inspection & PAdES Digital Seal Pipeline โ€‹

Certified appraiser field inspection journey from mobile tablet capture to cryptographic Islamic bank underwriting:

  • 3-Tier Storage Partition: Supabase Storage vault preserves confidential deeds and civil ID cards ($<50\text{ MB}$) under PostgreSQL RLS; Cloudflare R2 / Stream hosts heavy 4K walkthrough video tours ($>50\text{ MB}$) with zero egress fees and zero VPS disk bottleneck.
  • Multimodal Feature & Speech Extraction: Gemini 3.8 Flash extracts residential attributes from spoken Kuwaiti dialect voice memos; CAD vectorizer computes GFA/NLA polygon boundaries; vision grading automatically applies structural crack penalties.
  • PAdES Digital Seal: Canonical SHA-256 digest binds municipal FAR compliance (Decision 288/2024) and valuation comps into certified PDF with 90-day banking horizon for KFH, Boubyan, KIB, and Warba.

8. 3-Method Valuation Engine & Challenger Reconciliation โ€‹

Real-world appraisal methodology executing three concurrent valuation approaches with shadow bank risk benchmarking:

  • The Valuation Triad:
    1. M1 Sales Comparison: Hedonic spatial grid adjustments for frontage, street layout, and finish grade against recent notarized comps.
    2. M2 Income Capitalization: Net Operating Income (NOI) divided by prevailing submarket capitalization rate for investment/income properties.
    3. M3 Depreciated Replacement Cost (DRC): Land residual value plus physical building replacement cost minus age, deterioration, and obsolescence penalties.
  • Automated Challenger & Variance Gate: Parallel challenger models mirror Kuwait Islamic banking risk bounds; flags any triad divergence $>15%$ for senior appraiser sign-off before committing to the immutable PostgreSQL ledger.

9. Hermes Autonomous Action Approval & Security Gate โ€‹

Five-milestone autonomous execution lifecycle safeguarding high-stakes broker operations:

  • Action Execution Rail: Action Proposed $\rightarrow$ Context Inspection $\rightarrow$ Security Gate $\rightarrow$ Auto Dispatch $\rightarrow$ Action Settled.
  • Human Nonce Gate: High-risk actions (Level $\ge 5$: price cuts, contract generation, contact deletion) require human approval via single-use HMAC nonce token with 5-minute TTL dispatched to broker WhatsApp and Flutter CRM.
  • Firm Scope & Reversibility: System 1 reflexively blocks sovereign government / Ministry of Justice courtroom actions per AGENTS.md boundaries. Compensating transactions allow 15-minute undo window with complete PostgreSQL audit trail.

10. Property Intake, Smart Parser & Address Sanitization Flow โ€‹

Broker listing ingestion pipeline enforcing complete data integrity across all entry surfaces:

  • Smart Listing Parser: Bounded regex patterns (e.g. (?:ุดุงุฑุน|ู…ูˆู‚ุน)\s*(?:ุฏุงุฎู„ูŠ|ูุฑุนูŠ)) eliminate false positives (e.g. interior amenities like 'ู…ุตุนุฏ ุฏุงุฎู„ูŠ' misclassifying street type); disambiguates plot layout (frontages) from physical street identifiers.
  • Kuwait Plot Partitioning: Permits legal Kuwait numeric plots and official sub-parcel letters (e.g. 28ุบ, 14ุฃ) while rejecting corrupt multi-field leaks (e.g. 'ู…ู†ุฒู„ 3'); enforces 8-digit mobile/landline phone formatting.
  • Database Write Shield: PostgreSQL internal.sanitize_property_address_on_write() trigger on properties_base automatically strips redundant Arabic prefixes (ุดุงุฑุน, ุทุฑูŠู‚, ุฌุงุฏุฉ, ู…ุจู†ู‰) to ensure clean cadastral queries and PACI Kuwait Finder share link resolution.

11. Hermes Multi-Model Query Routing Architecture โ€‹

Specialized foundation LLM orchestration and zero-token deterministic routing:

  • Fast-Path Interception: GPS pins and raw PACI Civil IDs bypass LLM token generation entirely, querying PostGIS in $<50\text{ ms}$ for instant cadastral cards.
  • System 1 Intent Triage: Sub-20ms modern classification categorizes queries into customer chat, field appraisal, or administrative tasks.
  • Model Specialization Tier:
    • Gemini 3.8 Flash: Customer chat, property marketing summaries, Kuwaiti dialect voice note STT.
    • Claude 3.5/3.7 Sonnet: Deep valuation reasoning, municipal FAR checks under Law 33/2016, and bank appraisal audits.
    • DeepSeek Flash: Lightweight tasks: background conversation compaction, session title generation, and token pruning.
  • Kuwait Institutional Grounding: PostGIS spatial cadastre and certified bank appraisal guidelines enforce strict accuracy.

12. Statutory Earnest Money ("ุงู„ุนุฑุจูˆู†") & Escrow Trust Lifecycle โ€‹

Four-stage legal escrow lifecycle governed by Kuwait Civil Code Article 75:

  • Statutory Article 75 Rule: If the Buyer reneges, the earnest money deposit is forfeited to the Seller; if the Seller reneges, the Seller must repay double the earnest amount (2 \times \text{Deposit}).
  • Escrow Trust Account: Segregated trust ledger under certified escrow agent oversight guarantees funds are never co-mingled with firm operational accounts.
  • Baladia Due Diligence Gate: Mandatory 14-day clearance window verifying municipal certificate of specifications (ุดู‡ุงุฏุฉ ุงู„ุฃูˆุตุงู), building licenses, and mortgage lien releases before conveyancing.
  • Conveyance & Settlement: Release of trust funds upon official Ministry of Justice title deed registration.

13. Kuwait 4 Islamic Banks Mortgage Collateral & MoCI Annex 4 Pipeline โ€‹

Certified appraisal workflow satisfying underwriting criteria for KFH, Boubyan, KIB, and Warba Bank:

  • Central Bank of Kuwait (CBK) Statutory LTV Caps:
    • Private Residential: 70% Max LTV.
    • Investment Real Estate: 60% Max LTV with Net Operating Income capitalization.
    • Commercial & Mixed-Use: 50% Max LTV with tenancy credit review.
  • Dual-Signatory Field Integrity: Field Inspector Ali conducts on-site cadastral checks, finish grading, and photographic logs; Certified Appraiser Abdulrahman Aldilaijan (MoCI License 2023/15148) executes final reconciliation.
  • MoCI Annex 4 (ู…ู„ุญู‚ 4) Dossier: Bilingual certified PDF report bundle with 90-day banking expiration watchdog.

14. Kuwait Brokerage Commission Split & Settlement Ledger โ€‹

Comprehensive transaction settlement and broker incentive accounting:

  • MoCI Law 164/2020 Statutory Fee: 1% collected from Buyer + 1% collected from Seller upon deed conveyance.
  • Co-Brokerage Allocation: 50% retained by Aldilaijan & Khobara, 50% remitted to the partner external brokerage office.
  • Broker Production Tiers: Senior Partner (50%), Executive Broker (40%), Associate Broker (30%), plus a 10% sourcing bonus for exclusive seller mandates.
  • Command Center Ledger: Automated 10% office overhead deduction, immutable Supabase settlement audit log, and instant WhatsApp payment voucher generation.

15. Kuwait Cadastral GIS & PACI/Baladia Reverse-Proxy Architecture โ€‹

Institutional GIS bridging client apps, edge reverse proxies, and Kuwait government spatial data:

  • Kuwait LightNode VPS Edge Proxy (paci-kw): Injects PACI TripleDES authentication signatures and credentials, bypassing CORS for Flutter Web on port 8090.
  • Kuwait Sovereign GIS Layers: Real-time integration with PACI Kuwait Finder ArcGIS VectorTileServer and Baladia ParcelLocation_MKM spatial endpoints.
  • Supabase PostGIS Cache: High-performance spatial cache (paci_parcels, nearby_parcels RPC) resolving coordinates in $<15\text{ ms}$.
  • Blue Metal Plate (ุงู„ู„ูˆุญุฉ ุงู„ุฒุฑู‚ุงุก) OCR: Field appraiser camera scanner decodes physical wall plates into official 8-digit PACI Civil Numbers.

16. Private Sale & Commercial Lease Smart Contract Generator โ€‹

Automated drafting and legal risk auditing for private real estate contracts:

  • CRM Deal Parameter Extraction: Hermes AI extracts buyer/seller civil IDs, PACI parcel numbers, title deed references, and payment milestones.
  • 8 Statutory Mandatory Clauses: Injects Kuwait Civil Code provisions, earnest forfeiture terms, latent defect liability, municipal clearance obligations, and commercial arbitration escalation.
  • Hermes Risk Auditor: Enforces the 0.1%/day statutory ceiling on delay penalties, detects unreleased commercial bank mortgages, and flags ambiguous covenants.
  • Bilingual Cryptographic Seal: Produces parallel Arabic/English PDF contracts embedded with scannable QR verification and SHA-256 tamper-evident hash.

How a Kuwait Finder share link pasted into WhatsApp becomes a cadastral address. PACI geo-blocks non-Kuwait datacenter IPs, so the Hermes server tries the Kuwait nginx relay (/kfapp/) first, falls back to a direct call, retries up to 3 times inside a 15 s budget, and caches results for 24 h. When PACI is still unreachable, the bot gets a degraded-mode note and asks the client for area, plot, price and type instead of failing.


18. State Domain Coastal Chalet Usufruct Lifecycle โ€‹

Comprehensive legal and transactional lifecycle for coastal chalet usufruct properties governed by Kuwait Ministry of Finance (MoF) State Domain Department (ุฃู…ู„ุงูƒ ุงู„ุฏูˆู„ุฉ):

  • Usufruct Cadastral Resolution: Resolves coastal chalet strip, block, plot, and coastal frontage against PACI and Ministry of Finance cadastral boundaries.
  • MoF State Domain Compliance Gate: Verifies annual nominal fee payment receipts, building setback restrictions, and sea line clearances to ensure unencumbered tenure.
  • Private Assignment ("ุชู†ุงุฒู„") Contract: Hermes smart contract engine drafts standard usufruct assignment agreements incorporating statutory transfer provisions and broker fee allocations.
  • Earnest Escrow & Clearance Settlement: Earnest funds held in escrow trust until Ministry of Finance assignment approval, concluding in official deed transfer.

19. Commercial Turnover Lease & CAM Reconciliation Engine โ€‹

Automated billing and reconciliation pipeline for commercial complexes and retail centers under Kuwait Law 33/2016:

  • Base Rent & Turnover Lease Extraction: Extracts monthly base rent and gross revenue breakpoint percentage from commercial lease terms.
  • Tenant POS & Turnover Audit: Monthly POS revenue reports matched against breakpoint thresholds; calculates turnover overage rent dynamically.
  • Common Area Maintenance (CAM) Allocator: Reconciles actual building operational expenses (cleaning, security, chilled water HVAC, facility management) pro-rata by Net Lettable Area (NLA).
  • Consolidated Invoicing & Settlement: Ingests audited turnover rent and reconciled CAM charges into unified monthly statements dispatched via WhatsApp and PDF.

20. Title Deed Inheritance, Probate & Heir Proceeds Split โ€‹

End-to-end estate liquidation and inheritance proceeds apportionment pipeline:

  • Ministry of Justice Probate Intake: Ingests official Inheritance Inventory Certificate (ุญุตุฑ ูˆุฑุงุซุฉ) and Power of Attorney (ุชูˆูƒูŠู„ุงุช ุฑุณู…ูŠุฉ) via OCR and legal document classifier.
  • Cadastral & Title Deed Clearance: Reconciles title deed parcel boundaries with Baladia survey certificates (ุดู‡ุงุฏุฉ ุงู„ุฃูˆุตุงู) and PACI Civil IDs, checking for municipal encumbrances or judicial liens.
  • Sharia & Statutory Heir Share Calculator: Dynamic Islamic inheritance engine computes statutory shares (ูุฑูˆุถ ูˆุนุตุจุงุช) and PAMA (ุงู„ู‡ูŠุฆุฉ ุงู„ุนุงู…ุฉ ู„ุดุคูˆู† ุงู„ู‚ุตุฑ) minor trust reserves.
  • Brokerage Liquidation & Split Disbursement: Executes private sale, settles statutory brokerage splits, and calculates net proceeds disbursements directly into heirs' bank IBANs.

21. Tenant Digital Rent Collection & Landlord Disbursement โ€‹

Automated multi-property rent collection and automated owner disbursement architecture:

  • Automated Rent Invoice Generation: Scheduled pg_cron engine triggers monthly rent notices 5 days prior to due date with encrypted KNET payment links.
  • KNET Payment Gateway Integration: Secure KNET checkout webhook verifies transaction authorization, issues bilingual receipts, and updates ledger in real time.
  • Arrears Escalation & Legal Notice: 3-tier automated escalation (WhatsApp reminder $\to$ formal SMS demand $\to$ automated legal eviction notice draft under Kuwait Tenancy Law).
  • Owner Payout & Maintenance Reconciliation: Deducts agreed property management fee and authorized maintenance invoices before generating automated landlord payout statements and wire manifests.

22. PAHW Housing Grant & Credit Bank Loan Subsidies โ€‹

Eligibility verification, appraisal benchmarking, and loan subsidy integration under Kuwait Public Authority for Housing Welfare (PAHW) and Kuwait Credit Bank (KCB):

  • Citizen Housing Profile & Entitlement Intake: Evaluates PAHW housing application, allocation status, and existing real estate ownership history against statutory eligibility criteria (Law 47/1993).
  • Kuwait Credit Bank (KCB) 70,000 KWD Construction/Purchase Loan: Verifies eligibility parameters for statutory KD 70,000 interest-free building loan, widow/divorcee grants, and renovation allowances.
  • Certified Appraisal Underwriting Benchmark: MoCI-licensed appraiser conducts structural inspection, FAR building code audit, and valuation comps to certify property loan-to-value within KCB collateral guidelines.
  • Disbursement Tranche & Construction Progress Milestone Tracking: Automated milestone verification synchronizing on-site construction stages with KCB loan disbursement tranches.

Updating & Maintaining Diagrams โ€‹

All diagrams are defined declaratively as JSON schemas in this directory. If system architecture or business processes change:

  1. Edit the Specification: Modify the corresponding *.json file (e.g. system-topology.architecture.json).
  2. Re-render with Archify:
    powershell
    npx archify render docs/architecture/system-topology.architecture.json -o docs/architecture/system-topology.html
  3. Sync to Public Distribution:
    powershell
    Copy-Item docs/architecture/*.html docs/public/diagrams/ -Force
  4. Verify Quality: Run visual check to confirm 0 errors and zero scrollbars across all desktop viewports:
    powershell
    npx archify visual-check docs/architecture/system-topology.html --viewports 1440x900,1600x1000,1920x1080,2048x1320

Technical Specifications & Whitepapers โ€‹

  • Kuwait Cadastral & GIS Architecture Specification โ€” Authoritative specification covering Triple Cadastral Identity (PACI, Baladia GISNo, MOJ Deed), verbatim and orthographic parcel resolution pipelines, and real-world classification of letter-suffixed plots (South Surra subdivisions, agricultural lots, coastal usufruct chalets).
  • Baladia GISS Capability Audit โ€” Comprehensive audit of giss.baladia.gov.kw ArcGIS Enterprise services.
  • Maps & MapLibre Architecture โ€” Cross-platform vector and raster mapping integration guide.

Aldilaijan & Khobara Real Estate Platform