Case study · Personal project · 2026 to Present

Knowra

A RAG platform that answers from your organisation's documents, backed by citations, and restricted strictly to what you're allowed to see.

View the code ↗ Jump to architecture ↓
Role
Sole architect and engineer
Stack
FastAPI, React/TypeScript, PostgreSQL
Retrieval
FAISS + BM25, RRF, cross-encoder
LLMs
Groq, OpenAI, Gemini, Ollama
knowra.platform · Interactive Media Tour
Slide 1 of 5
Clip:
Knowra Chat Interface with Source Citations
Knowra Document Management & Collection Access
Knowra Knowledge Base Dashboard and Telemetry
Knowra Security Administration and Role Permissions
1080p 60fps Trailer
Knowra Official Showcase Trailer
Comprehensive walkthrough demonstrating cited QA, permission enforcement, and passage highlight exploration.

Results

What testing showed.

7–8 / 10

Test questions answered from the correct source document

Top 5

Where the right source consistently ranks in retrieval

~20%

Fewer hallucinated answers after cross-encoder re-ranking, with answer quality up ~15–20%

0 / 200+

Restricted-document leaks across permission test cases

2–5 s

Typical answer time; 2–3 s for direct questions

Measured on internal test sets during development.

The Problem

The answer exists. Nobody can find it.

Every company has the same productivity leak: the answer to "what's our remote work policy?" is already written down, buried in a PDF on a shared drive or in the head of whoever answered it last.

So people ask a colleague, again. Or they ask a general chatbot, which answers confidently without ever having read the handbook. In an enterprise there's a second problem: a naive RAG system will happily retrieve a document the person asking was never allowed to see.

What It Does

Ask in plain English. Get an answer you can check.

Cited answers

Each claim links to the exact source page, with the passage highlighted.

Permission-aware

Admins decide which roles can see which documents. Access is enforced before retrieval, and no authorised source means no claim.

Any document

Multi-format ingestion with structure extraction and duplicate detection.

Admin tooling

Manage collections, users and roles from one console.

Architecture

From a document to a cited answer.

Dual-pipeline system: Offline Ingestion & Indexing + Online Fail-Closed Retrieval.

A Offline Ingestion & Security Indexing Flow
Background ETL Pipeline · Asynchronous
📄 Raw Documents
Step 1 · Dedupe Gate
Parse & Checksum
PDF, DOCX, TXT. SHA-256 hash skips unchanged files.
Step 2 · Segmentation
Semantic Chunking
Splits along clause & heading boundaries (512 tokens).
Step 3 · Dual Store
FAISS + BM25 Indices
Dense vector embeddings + Sparse keyword terms.
Step 4 · Security Tag
Fail-Closed RBAC ACL
Attaches user-role access permissions to chunks.
💾 Index Ready
B Online Query & Fail-Closed Retrieval Flow
Synchronous Query Path · 2–5s Latency
💬 User Question
Step 1 · Classifier
Intent Router
Routes chat & greetings in ~60ms without search.
Step 2 · Security Gate
Pre-Retrieval RBAC
Resolves JWT role against document ACLs.
✓ Allowed → Hybrid Search ✗ Restricted → Safe Refusal
Step 3 · Hybrid Search
Parallel Retrieval
FAISS vector similarity + BM25 keyword matching.
Step 4 · Fusion
RRF Merge
Reciprocal Rank Fusion outputs Top 30 candidates.
Step 5 · Cross-Encoder
Neural Re-Ranker
Re-scores candidate pairs to extract Top 5 chunks.
Step 6 · LLM Synthesis
Grounded Engine
Writes answer strictly from verified passages.
✅ Cited Answer

Engineering Decisions

The calls that shaped it.

Filter before retrieval, not after

Post-filtering generated answers is too late: the restricted text has already been in the prompt. Resolving access first, and failing closed when it can't be resolved, makes leaks structurally impossible rather than unlikely.

Hybrid over pure vector search

Company documents are full of acronyms, product codes and policy numbers. Dense vectors handle paraphrase; BM25 handles the exact terms. RRF combines both without hand-tuned weights.

Route before you retrieve

Not every message needs a search. Classifying intent first saves latency and tokens on small talk and product-help questions, and gives one clear place to enforce guardrails.

Provider-agnostic LLM layer

One interface over Groq, OpenAI, Gemini and Ollama, so the model can be swapped for cost, latency or data-residency reasons without touching retrieval.

Production Readiness

Built to run, not to demo.

  • Auth & access

    JWT auth, RBAC across 4 roles, rate limiting.

  • Containers

    Docker Compose, non-root images, health checks.

  • Data

    PostgreSQL with Alembic migrations; incremental index updates.

  • Tests

    PyTest on the backend plus frontend test suites.

Need a knowledge assistant your team can trust?

✓ Copied to clipboard!