Documentation
"The Dev Stack must mirror the Ops Stack."
"The Dev Stack must mirror the Ops Stack."
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 FoundationThe 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 StandardWhen 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 SynthesisOur 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:
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.
Trigger: Missing avatar_url in tbl_persons
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.
Trigger: Company Let tenancy with missing guarantees
3. Visual Alignment Map: Dev Stack vs. Ops Stack
Flow MappingRepository Code
The live codebase implementation for this specification sits within the following repository folder:
4. Developer & Agent Swarm Mandate
Mandatory Code SOPTo 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 TheoryThe 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).