RAIA™ Specification

Documentation

"The Dev Stack must mirror the Ops Stack."

← Back to Developer Hub TEXTBOOK SPECIFICATION
RAIA™ (Real estate Artificial Intelligence Agent) Specification

"The Dev Stack must mirror the Ops Stack."

🧩 Section A: In Plain English

Ops/Dev Stack Alignment

This document maps how the operations team workflows align with the development stack, ensuring that what gets built in code matches what the ops team needs to run day-to-day.

Ops & Dev Stack Alignment: The Mirror Principle

Philosophical Foundation

The Prime Directive of RAIA™ (Real estate Artificial Intelligence Agent) Engineering

"The Dev Stack must mirror the Ops Stack."

In traditional PropTech, software is a passive IT asset—a CRM or spreadsheet wrapper where developers throw features over the wall because they are technically feasible, and human operators click buttons in isolated silos. RAIA (Real estate Artificial Intelligence Agent) is an agentic-first property management Operating System. There are no passive databases. The platform acts proactively 24/7.

To prevent the system from degrading into a complex web of unmaintained scripts and dark-data silos, we enforce The Mirror Principle: Every database schema, API endpoint, background cron job, and front-end interface (the Dev Stack) must map directly and transparently to an active Single Journey Tenancy (SJT) standard operating procedure or legal defense framework (the Ops Stack).

1. The Mirror Principle: Architecture & Alignment

Core Standard

When we write software, we do not write code for code's sake. Every technical component has a corresponding operational purpose. The table below represents how we systematically bridge the technical stack with the operational workflow:

SJT / Operational Process (Ops Stack) Technical Implementation (Dev Stack) Operational Why & Risk Guard
Stage 03: Tenant Onboarding & Identity Verification SOP tbl_persons.avatar_url
scrape-rentprofile-r2r-avatars.cjs
extract_pdf_image.py (PyMuPDF)
Biometric verification to prevent subletting fraud and secure 100% compliant tenant identity locks required for court-admissible evictions under the UK RRA 2025.
Stage 04: Referencing & Corporate Let Liability Transfer SOP tbl_onboarding_status
compliance/identity-backfill
tbl_tenancy_signers
Contractually transfers statutory Right to Rent liability and civil fines (£20k+ per tenant) to corporate lessees via automated Director Personal Guarantees prior to key release.
Continuous 24/7 Letting Operations & Portability RAIA (Real estate Artificial Intelligence Agent) OS (cron scheduler)
nightly-gtm-coordinator.py
raia.json Protocol Handshakes
Dismantles central aggregator monopolies (dominant listing aggregator/incumbent property portal) by allowing independent sovereign agent nodes to run continuous matches and transact peer-to-peer (A2A).
GDPR Compliance & Local Sovereign Storage GCS Private Enclaves
OpenRouter PII Filters
db_raia (suazhpquxpzuhbtritxj)
Ensures zero leak of landlord/tenant PII to external AI endpoints, storing documents in isolated local databases and encrypted GCS buckets.

2. The Past 48 Hours: A Case Study in Mirroring

Living Synthesis

Our development cycle over the past 48 hours is the ultimate live case study of the Mirror Principle in action. Every piece of code shipped maps directly to an active business SOP:

01

TRIM & The Identity Verification SOP

The Ops Requirement: We must obtain verified, high-resolution facial photos of all active tenants to populate their digital profiles, preventing unauthorized subletting and ensuring ironclad court evidence in case of evictions.

The Dev Solution: Rather than relying on staff to manually contact tenants, we engineered an autonomous backfill pipeline. The Node script scrape-rentprofile-r2r-avatars.cjs authenticates via the agent session cookie, scrapes the RentProfile Right to Rent reporting dashboard, downloads the official certificate PDFs, and uses the Python helper extract_pdf_image.py (powered by PyMuPDF) to extract the face photo as the largest high-resolution JPEG, uploading it straight to Google Cloud Storage and updating the database.

Ops Stage: SJT-03 Tenant Referencing
Trigger: Missing avatar_url in tbl_persons
02

Company Let Liability Transfer SOP

The Ops Requirement: A company let bypasses traditional individual Right to Rent checks, creating severe regulatory liability for the landlord. The SOP transfers all civil and financial liability to the corporate tenant through mandatory Director Personal Guarantees and formal Board Resolutions.

The Dev Solution: Built a specialized, high-performance frontend portal view at compliance/identity-backfill. This page dynamically monitors all company let tenancies, surfaces gaps in board resolutions, and gates key release via a strict check on personal guarantee records. It directly reflects operational risk metrics for the legal compliance team.

Ops Stage: SJT-04 Sign-off & Contract
Trigger: Company Let tenancy with missing guarantees

3. Visual Alignment Map: Dev Stack vs. Ops Stack

Flow Mapping
OPS STACK (The Procedures) ● Stage 03: Identity Checks SOP ● Stage 04: Corporate Liability SOP ● Stage 06: Tenancy Setup SOP ● Continuous: Auto-Audit Loop

Repository Code

The live codebase implementation for this specification sits within the following repository folder:

MIRROR DEV STACK (The Implementations) → scrape-rentprofile-r2r-avatars.cjs + extract_pdf_image.py → compliance/identity-backfill + tbl_tenancy_signers → automated bank reconciliation gateway Integrations + Deposit Schemes API → RAIA (Real estate Artificial Intelligence Agent) OS Cron Loops + Nightly Pipeline Schedulers

4. Developer & Agent Swarm Mandate

Mandatory Code SOP

To maintain absolute alignment, all human engineers and autonomous coding swarms (Vibe Coding) must strictly adhere to the following development SOP:

1 Declare the SJT Stage and Operational SOP in the PR

No code can be merged into the main branch unless it explicitly states its target operational domain (e.g., SJT-03 Referencing, SJT-08 Rent Collection, etc.). If you are building a database migration, name your SQL script and its accompanying ADR with a clear reference to the active business SOP.

2 Write the "Operational Why" (Docs) First

Before writing a single line of Python, JavaScript, or SQL, you must draft the corresponding developer documentation in docs/raw/<slug>.html explaining the "Operational Why." Once approved, compile the page, push it to Nginx, sync it with Supabase, and proceed with code development. The documentation is the blueprint of the code.

3 Enforce Absolute Light-Theme Consistency

Our developer and admin portal uses a strict, beautiful light theme. Do not write dark-mode overrides or custom tailwind background colors (`bg-zinc-800` or `text-zinc-300`) that cause text to become invisible on narrow mobile viewports. Every card, table, and header must render beautifully with high contrast in pure light-mode backdrops.

5. The AI Agent SOP: Why Machines Need Procedures More Than Humans

Agentic Control Theory

The Paradox of Infinite Agency

SOPs were originally created as a human-centric invention—designed to force highly creative, unpredictable human employees to act like predictable, deterministic machines. By giving humans a rigid step-by-step checklist, corporations ensured consistency of output and mitigated compliance risks.

But with Autonomous AI Agents, the paradigm is completely inverted: The AI is already a machine, but it possesses near-infinite, highly fluid agency that requires an SOP to remain bounded, deterministic, and safe.

I. Enforcing Determinism

An LLM is naturally probabilistic. Without a rigid procedural template, an agent trying to resolve a late-rent payment might decide to text the landlord, draft a legal notice, or email a repair company in any arbitrary order. An AI SOP provides the deterministic execution sequence—forcing the model to check database states (e.g., is the deposit registered?) before initiating a high-risk operational action.

II. Preventing Goal Drift

During long, multi-turn tool execution sessions, agents can suffer from "goal drift"—where intermediate errors or unexpected API payloads distract the agent from its primary directive, leading to endless loops. The SOP acts as a structural anchor, constantly re-centering the agent's context back on the strict stages of the SJT.

III. Hard Gating Risk

Humans can use common sense to know when an action is too risky. A raw LLM does not. An AI SOP explicitly defines the boundaries of autonomy: which tasks are fully automated (e.g., retrieving public records, sending standard WhatsApp reminders) and which tasks must be gated with a Human-in-the-Loop (HITL) compliance trigger (e.g., financial payouts, signing legal leases).

🔧 Section C: Developer Guide

Architecture Details

The security architecture implements a defence-in-depth model with perimeter authentication, internal authorisation, data encryption, and audit logging at every layer. Access is gated through a two-gate system: Tailscale identity verification at the network level, followed by role-based access control within the application.

  • Core Component: Security gate guard and RBAC enforcement
  • Data Flow: Request → Tailscale Gate → Authentication → Authorisation → Audit Log → Response
  • Integration Points: Tailscale ACLs, Supabase Row-Level Security, session tokens, and audit log sinks

Configuration Reference

Key configuration parameters for this system:

Parameter Type Default Description
gate_enabled boolean true Enable Tailscale gate guard for all pages
allowed_hosts string[] dev.estateaigents.com, localhost Whitelist of permitted hostnames
session_ttl_minutes integer 60 Session token time-to-live
SECURITY ARCHITECTURE — DEFENCE IN DEPTH 1. NETWORK GATE Tailscale Identity Network-level Auth 🔐 Tailscale Gate 2. APPLICATION GATE RBAC Enforcement Session Validation 🛡️ Auth Layer 3. DATA GATE RLS & Encryption Audit Logging 🔒 Data Protection Defence-in-depth: network gate → application gate → data gate with audit logging at every layer Tailscale identity · Role-based access · Row-level security · Full audit trail Network / Identity Gate Application / Auth Layer Data / Encryption Layer Data flow →

Figure 2: Security architecture — component interaction and data flow.

Troubleshooting

Issue Cause Resolution
401 Unauthorized on tailnet Tailscale not running or wrong node Verify Tailscale is connected and node is authorised
Gate guard redirect loop Hostname not in allowed_hosts list Add hostname to the gate guard whitelist
Repo Reference RAIA

This component is part of the RAIA (Real estate Artificial Intelligence Agent) platform mono-repo. Implementation details, API contracts, and integration tests are available in the repository.