Rohana
Multi-Tenant Conversational AI Engine for SMEs
Diagramas
Message Pipeline
Multi-Tenant Isolation
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
- Ingress (Webhook): Each incoming message enters through
POST /webhook/:channel/:tenant(http-kit, port8080), is normalized into an envelope ({:tenant/id :msg/text :channel/id :msg/id}), and published to the event bus. - 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>). - Graph Processing (Pathom 3): The subscriber consumes and executes
p.eql/processover 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.
- 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. TheCURRENTfile is swapped by atomic rename, and the store overwrites the payload'stenant-idwith 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
.ednfile and indexing their documents — zero code changes and zero deployments.
Live Demo
Access the online demo or project page.