LiveIndependent · B2B SaaS2026

Rafeeq رفيق

White-label AI customer-service platform for companies · v3.1 · live demo

94–98%answers correct on 127 labelled questions, measured live
01The problem

Why it exists

Service desks answer the same questions every day, and a generic chatbot that invents a price or a policy is a liability. Rafeeq is a product companies brand as their own and embed with one line: it answers only from their documents, cites each fact, says so when it doesn't know, and brings in a person.

02The system

What I built

Company documentschunked, Arabic-normalised
Hybrid retrievalBM25 + bge-m3, relevance gate
Cited answerstreamed, or declined
Actionsverified, staff-approved
Evaluationlabelled questions in production
  1. One-click Saudi law knowledge packs (Labor, PDPL, Anti-Cyber Crime, E-Commerce; 335 articles) cited to the article
  2. Hybrid retrieval over Arabic-normalised text (FTS5 BM25 + bge-m3 embeddings, RRF) with a relevance gate calibrated on real queries, so off-topic questions are declined before any LLM call
  3. Streaming answers with [n] citations; a NO_ANSWER sentinel the visitor never sees; an extractive fallback when the model is unavailable
  4. Human handoff inbox, a knowledge-gap queue that publishes answers as FAQs in one click, regression evals, analytics (self-service rate, CSAT, p95 latency)
  5. Multi-tenant console: branding with live preview, in-browser PDF/DOCX extraction, roles, plan quotas, origin allow-list, PII masking before storage or any model call
  6. v2.0 actions: intent matched by meaning (calibrated so “how do I pay my bill?” is answered but “what's my bill?” opens a form), validated in-chat forms, one-time-code verification, a staff approvals queue, then the company's API. Personal values are discarded after each run
  7. v2.0 platform: self-serve sign-up and team invites, conversation memory, agent reply suggestions, website import with nightly change detection, HMAC-signed webhooks, retention policy, data erasure, audit export, ROI analytics
  8. v3.0 flagship: an evaluation harness of 127 labelled questions run against production. Semantic second-stage ranking lifted Hit@1 from 73% to 87%, after a cross-encoder re-ranker was tested and rejected on the data. Also two-stage action routing, OIDC single sign-on, custom roles, IP allow-lists, AES-256-GCM at rest, a hash-chained audit log, circuit breakers, idempotent APIs, a status page and OpenAPI docs
  9. v3.1 business-ready: structure-aware chunking, which raised the share of questions whose top passage contains the answer from 52% to 79% and from 32% to 81% on long handbooks. Also cross-language topics, billing with Moyasar and ZATCA-QR VAT invoices, a contained mode that sends no data to external models, CSP and HSTS, and a published security self-review
  10. v2.5 channels: WhatsApp Business with signature verification, where forms become a short Q&A and agent replies are pushed to the customer. Also a REST API with scoped, revocable keys, topic insights from clustered question embeddings, and nightly regression evals that alert on drops
  11. Saudi-dialect meanings spelled out for the model («كم ياخذ» asks how long, not the price), and WhatsApp voice notes transcribed by Whisper
  12. Borderline actions are offered ("do it now?") rather than started when the confirming model can't be asked
03The result

What it achieved

On the published evaluation (127 questions, live system): answers correct 90.4% → 94.2% (telecom) and 95.7% → 97.9% (university); follow-ups 83% → 100%; Saudi-dialect answers 76.5% → 88.2%; 100% citation precision and 100% of judged claims grounded; refusals of off-topic, injection and cross-tenant probes 100%. Weak spots are published too: end-to-end latency is model-bound on the free tier (the pipeline itself is ~250 ms). 168 automated checks, including a database tamper drill. A live re-run in November 2026 took Saudi dialect on the telecom set from 94.1% to 100% and groundedness to 100% for both organisations; the main model's free quota ran out partway, and the quality page says so.

Stack

TypeScriptCloudflare WorkersD1 FTS5Workers AI bge-m3Groq gpt-oss-120bRAGSSEMulti-tenantOIDC SSOEvaluation harness

Timeline

2026

My role

Solo build