Software Architect & Builder MVP · Validated Pipeline

Rohana

Multi-Tenant Conversational AI Engine for SMEs

ClojurePathom 3Aeron IPCTurboVecDatahikeOllama (embeddings)Claude APIOpenStreetMapPresidioTelegram BotWhatsApp API

Diagramas

Message Pipeline

MESSAGE PIPELINEUserWhatsAppTelegramWebhookPOST /webhook/:canal/:tenantAeron IPCmessages.incoming.*embedded Media Driverno port · no brokerPathom 3tenant-configintent-classifyguardrail-checkrag-contextllm-response→ response/finalAeron IPCoutgoing.*no replayaudit.operational.*audit.interaction.*subscriptions to the local bus · no external broker · no reserved port

Multi-Tenant Isolation

MULTI-TENANT ISOLATIONTenant: saude-oralPathom 3 Graphtenant/id → :saude-oralTurboVec — own directorydata/turbovec/saude-oral/IdMapIndex (.tvim) + EDN payload+ CURRENT (atomic rename)audit.operational.saude-oralTenant: caram-advocaciaPathom 3 Graphtenant/id → :caram-advocaciaTurboVec — own directorydata/turbovec/caram-advocacia/IdMapIndex (.tvim) + EDN payload+ CURRENT (atomic rename)audit.operational.caram-advocaciazero cross-accessscope applied by directory:tenant-id overwritten by the path · payload from another tenant refused

Project Overview

Rohana is the multi-tenant engine and Clojure core that hosts isolated conversational AI personas; the product is sold under the Daelaam brand. Each persona has its own knowledge base, and messages flow through a local event bus before a response is generated. Personas (such as Sofia, designed for dental clinic operations) are configured via EDN files, with no code changes required. Built on this foundation are three subsystems: the Agent (WhatsApp/Telegram conversational runtime per tenant, performing RAG over the business's own documents), the Probe (a lead scraper via OpenStreetMap → signal-based qualification → Telegram alerts, yielding 88 validated leads in Niteroi at zero API cost), and the Observer (a planned operations cockpit and analytics layer). Designed under strict LGPD principles, with a fail-closed privacy gate at ingestion and a two-tier audit trail.

Architecture & Implementation

Sequential Message Flow

  1. Ingress (Webhook): Each incoming message enters through POST /webhook/:channel/:tenant (http-kit, port 8080), is normalized into an envelope ({:tenant/id :msg/text :channel/id :msg/id}), and published to the event bus.
  2. Event Bus: Transport is Aeron IPC with the Media Driver embedded in the same process (rohana.infra.aeron). There is no external broker and no reserved port — subjects are logical (messages.incoming.<tenant>, messages.outgoing.<tenant>).
  3. Graph Processing (Pathom 3): The subscriber consumes and executes p.eql/process over the Pathom 3 graph, resolving only the necessary steps on demand:
    • Tenant Identification → Intent Classification → Guardrail Check (tenant business hours) → RAG Context → Function Calling → LLM Inference → Final Response.
  4. Egress: The resulting response is published back to the bus for delivery to the respective chat channel.

RAG in Clojure, In-Process

  • Retrieval runs inside the Clojure process (rohana.resolvers.rag): expand-query → embed → vector search → rag/chunks. It is not an external microservice.
  • Query expansion (pt-BR rule dictionary, no extra LLM) compensates for nomic-embed-text's English bias on Portuguese queries.
  • Embeddings are generated via Ollama (nomic-embed-text) and the search happens in TurboVec, in-process. Chunks are 150 words with an overlap of 20.
  • No BM25 or reranker for now — Ollama does not expose a cross-encoder. The hybrid search + RRF reference lives in rag-mvp/ (Python), kept as future study.

Physical Multi-Tenant Isolation & Zero-Deploy Provisioning

  • Data Isolation: Each tenant gets its own directory in TurboVec, with an IdMapIndex (.tvim) and the EDN payloads of the same generation. The CURRENT file is swapped by atomic rename, and the store overwrites the payload's tenant-id with the directory scope, validating that identity on every search — legacy payloads, tenantless payloads, or payloads from another tenant are refused. A search never depends on a filter that could be forgotten.
  • Security (LGPD): Fail-closed privacy gate — every chunk passes through Presidio before embedding and before persistence; if the gate fails for a chunk, only that fragment is discarded. The operational audit trail is published to the bus on per-tenant subjects (audit.operational.*, audit.interaction.*).
  • Provisioning: Registering a new tenant simply involves adding an .edn file and indexing their documents — zero code changes and zero deployments.

Live Demo

Access the online demo or project page.

Access Site / Demo