Knowledge Domain Database - RAG Systems
How does the domain work before writing a line of code? Choose a document from the left tree: each page explains part of the model.
Business Rules - RAG Systems
This document lists the fundamental business rules of the RAG Systems domain (Retrieval-Augmented Generation systems), identified by a unique BR-NNN code. Each rule is technology-independent and describes an invariant constraint on the indexing and querying pipeline.
---
BR-001 - Embedding-space consistency between indexing and query
Code: BR-001
Name: Same embedding model for documents and queries
Description: The Embeddings of the indexed Chunks and those of the Querys must be produced by the same model and have the same dimension. Changing the embedding model requires a full re-indexing of the VectorIndex.
Rationale: Similarity is meaningful only within the same vector space; different models make comparisons meaningless.
Priority: CRITICAL
Actors: Indexing Pipeline, Retriever
Violation: searching with a different model's embedding → forced re-indexing.
Traceability: INV-01; indexing-pipeline.md.
---
BR-002 - Every Chunk preserves its provenance
Code: BR-002
Name: Source traceability for every fragment
Description: Every indexed Chunk must keep the reference to its source Document, its position and the indexing date. Grounded answers cite the source through these references.
Rationale: Enable citation, verification and attribution of claims (verifiable grounding).
Priority: HIGH
Actors: Indexing Pipeline, Generator
Traceability: BR-006; INV-02; query-answering.md.
---
BR-003 - The answer is grounded in the retrieved context
Code: BR-003
Name: Mandatory grounding on the context
Description: The Generator must base the answer exclusively on the relevant retrieved Chunks. When the context does not contain the information, the answer must declare uncertainty ("not available in the documents") rather than resorting to unverified parametric knowledge.
Rationale: Reduce hallucinations and ensure faithfulness (the central promise of RAG).
Priority: CRITICAL
Actors: Generator
Violation: claims unsupported by the context → the faithfulness evaluation fails.
Traceability: INV-03; query-answering.md.
---
BR-004 - Relevance threshold on retrieved chunks
Code: BR-004
Name: Filtering of low-relevance results
Description: Only Chunks with a relevance score above a threshold (after any re-ranking) are passed to the Generator. Irrelevant chunks must be discarded so as not to pollute the context and induce hallucinations.
Rationale: Noisy context degrades answer quality more than its absence.
Priority: HIGH
Actors: Retriever, Reranker
Traceability: query-answering.md; INV-04.
---
BR-005 - The context respects the window and the budget
Code: BR-005
Name: Top-k and token-budget management
Description: The number of Chunks sent to the Generator (top-k) and their overall length must fit within the context window and the token budget. Beyond the limit, explicit selection/compaction is applied, never a silent truncation of the most relevant chunk.
Rationale: Avoid overflow and loss of critical context ("lost in the middle").
Priority: HIGH
Actors: Retriever, Generator
Traceability: INV-05; query-answering.md.
---
BR-006 - Re-indexing on source changes
Code: BR-006
Name: Index freshness
Description: When a Document is added, modified or removed, the Indexing Pipeline must update the VectorIndex so the answers reflect the current state of the sources. Chunks of removed documents must no longer be retrievable.
Rationale: Avoid answers based on stale information or on documents no longer valid.
Priority: HIGH
Actors: Indexing Pipeline
Traceability: indexing-pipeline.md; INV-06.
---
BR-007 - Data isolation in multi-tenancy
Code: BR-007
Name: Metadata filtering and access boundaries
Description: When the index serves multiple tenants or authorisation levels, every Query must retrieve only the Chunks the requester is entitled to access, via metadata filtering applied before or during the search.
Rationale: Prevent data leakage across tenants or beyond the user's permissions.
Priority: CRITICAL
Actors: Retriever, Guardrail
Traceability: INV-07; query-answering.md.
---
BR-008 - Defence against prompt injection in documents
Code: BR-008
Name: Retrieved content is untrusted data
Description: Retrieved Chunks (coming from external documents) are untrusted content: they must be delimited in the prompt and inspected by the Guardrails, because they may contain injection instructions aimed at the model.
Rationale: Defend against prompt injection carried by indexed documents.
Priority: CRITICAL
Actors: Generator, Guardrail
Traceability: OWASP LLM Top 10 (LLM01); INV-08.