Hikmah AI
Domain-Specific Islamic Knowledge RAG Engine
Thesis research — a RAG architecture for the Islamic knowledge domain.

Case Study
The problem
Religious questions get answered by general models that do not know the limits of their own knowledge. In Islamic jurisprudence, an answer that sounds confident but has no basis is not merely wrong — it misleads someone who asked in earnest.
Architecture
A RAG architecture that constrains answer synthesis strictly to trusted primary references. Docling parses multilingual Arabic–Indonesian digital literature; pgvector inside PostgreSQL stores the embeddings with HNSW indexing for similarity search; the Bun runtime runs the Next.js application layer.
The hard part
A kitab is not ordinary prose. Chapter numbering, legal articles and sanad/matan references are part of its meaning — if chunking severs that link, a ruling can come loose from the conditions that qualify it and change meaning entirely. Docling keeps that structure intact when documents are split.
Outcome
Semantic similarity search across thousands of reference documents runs in milliseconds through HNSW indexing, and answers stay bound to primary references — the model is not permitted to fill gaps with guesses.
System Architecture
Ingest
Docling
Parses multilingual Arabic–Indonesian digital literature.
Retrieval
pgvector · HNSW
Stores embeddings inside PostgreSQL, with HNSW indexing for similarity search.
Application
Next.js · Bun
The Bun runtime runs the Next.js application layer.
Why it is shaped this way
A RAG architecture that restricts answer synthesis to trusted primary sources only.
Engineering Decisions
Zero-Hallucination Retrieval
A RAG architecture purpose-built for Islamic knowledge — fiqh, Islamic history and general Islamic studies — constraining answer synthesis strictly to trusted primary sources.
Preserving Kitab Structure with Docling
Docling extracts and parses multilingual digital literature (Arabic-Indonesian) so chapter numbering, legal articles and sanad/matan references stay intact when split into chunks.
High-Speed Semantic Search
pgvector in PostgreSQL with HNSW indexing performs semantic similarity search across thousands of reference documents in milliseconds.