Knowledge operations
- Filesystem and Notion connectors
- Incremental sync with content fingerprints
- Versioned Qdrant collections and alias activation
- Sync history, drift detection and rollback-aware cleanup
A local-first multilingual RAG platform with tenant-scoped retrieval, measured reranking, strict answer validation, versioned index operations and a console that keeps the evidence path visible.
Retrieval evidence is useful only when access, provenance and release policy remain explicit.
A relevant chunk is not automatically authorized, trustworthy or safe to release. The server resolves identity and tenant scope first, retrieval stays inside that boundary, and generated text is checked before the production path returns it.
The console exposes those decisions beside the answer. It is an operating and debugging surface for RAG, not a chat transcript with hidden infrastructure.
Knowledge Base RAG covers the path from source synchronization to an authorized, cited response, with the index and evaluation state available to operators.
The production path keeps authorization, relevance and answer validation separate. This matters most when an authorized document contains instructions that the model should read as data, not follow as policy.
FastAPI resolves the bearer token into a server-owned user, role and tenant context.
The tenant filter is applied before reranking or generation. Later stages cannot widen the authorized set.
Qwen3 embeddings and Qdrant BM25 search produce separate candidate lists from the active index alias.
Reciprocal rank fusion combines semantic and lexical signals without turning either score into a trust decision.
BAAI/bge-reranker-v2-m3 reranks 20 authorized candidates and passes the best 5 onward.
Document text and metadata are serialized as reference data. They never receive a system or assistant role.
The production path buffers the answer, validates citations and output policy, then releases it.
The console keeps the answer, authorized sources, retrieval stages, security state and trace waterfall together.
Access control answers which chunks a user may retrieve. Prompt trust answers what the model may do with an authorized chunk. The system treats them as different boundaries and records both in the response projection.
| Server-owned controls | Untrusted or presentational inputs |
|---|---|
|
|
Strict mode uses buffer, validate, release. Fast mode streams first and checks later, so it is a server-side opt-in for development and latency experiments, not a hidden frontend switch.
The query path starts with server-owned identity and tenant scope, then moves through dense and sparse retrieval, RRF fusion, multilingual reranking, untrusted context construction and strict validation. A separate sync path builds compatible index versions before switching the active alias.
Source changes build and validate a compatible collection before the active alias moves.
Filesystem and Notion then connects to Connectors. Connectors source documents Parse · Chunk · Fingerprint. Parse · Chunk · Fingerprint compatible build Qwen3 + BM25. Qwen3 + BM25 writes inactive version Versioned Collection. Versioned Collection validates Compatibility Check. Compatibility Check activates or rolls back kb_active Alias.
Identity and tenant scope constrain the candidate set before relevance scoring or generation begins.
React Console then connects to FastAPI Identity. FastAPI Identity creates retrieval context Mandatory Tenant ACL. Mandatory Tenant ACL filters active index Qdrant Retrieval. Qdrant Retrieval fuses RRF Fusion. RRF Fusion passes 20 BGE Reranker. BGE Reranker serializes Untrusted Context. Untrusted Context generates under answer_v3 Ollama Generation. Ollama Generation validates before release Strict Validation. Strict Validation releases Response Projection.
Runtime traces and committed benchmark artifacts meet in read-only console projections.
Sync Runs and Query Traces and Evaluation Artifacts projects FastAPI UI Aggregation. FastAPI UI Aggregation renders Operations Console.
Architecture notes
Tenant ACL filtering happens before the reranker sees a candidate. A strong relevance score cannot recover a chunk that the authenticated tenant was not allowed to retrieve.
Strict mode buffers generation until canonical citation and output-policy checks pass. Fast streaming remains an explicit server-side development option with a documented risk: output can reach the client before the post-stream check finishes.
The kb_active alias points to a compatible collection whose fingerprint covers embedding, parser, index and chunk settings. New collections are built and checked before activation, so a model or dimension change cannot silently reuse an incompatible index.
The multilingual reranker was adopted after a paired 220-query benchmark. Token-aware chunking was implemented but the 500/50 baseline stayed in production because the current short corpus showed no measurable quality or efficiency gain.
These captures come from the public repository. Each one links to its source file so the interface and the evidence shown inside it can be inspected at full size.





A paired 220-query multilingual set compared the production choices on the same retrieval task. The selected BGE model improved cross-lingual recall and MRR, but its local CPU latency is much higher. The console shows both sides of that decision.
| Configuration | Cross Recall@5 | Cross MRR | Total p95 | Decision |
|---|---|---|---|---|
| Reranking off | 0.9563 | 0.7448 | 268.4 ms | Baseline |
| Previous cross-encoder | 0.4511 | 0.3670 | 453.0 ms | Reject |
| BGE multilingual | 1.0000 | 0.9558 | 2457.7 ms | Adopt |
The selected configuration recorded 63 cross-lingual rescues and 0 drops in this benchmark. It is evidence for this dataset and runtime, not a universal ranking of rerankers.
Test counts, retrieval quality, prompt security and generation sanity describe different failure surfaces. They remain separate instead of being compressed into one project score.
| Evidence slice | Current result | What it covers |
|---|---|---|
| Repository verification | 844 backend · 18 frontend | Last recorded full run; 2 external provider checks skipped, with Ruff, typecheck, lint and production build green. |
| Multilingual reranker | 220 queries · Recall@5 1.0000 · MRR 0.9558 | 63 cross-lingual rescues and 0 drops for the selected BGE model in the committed paired benchmark. |
| Prompt security | 82 adversarial cases | Injection, spoofing, citation suppression, unauthorized citation and cross-tenant exfiltration rates were all 0.0000 in this suite. |
| Generation sanity | 26/26 successful | Citation integrity, not-found behavior and strict validation each recorded 1.0000 for the exercised baseline path. |
Production RAG Platform established the original PDF retrieval, hybrid search, reranking, citations, evaluation and tracing path. This project kept that foundation and expanded the system boundary.
Single-source ingestion, no tenant ACL and no operated index lifecycle.
Multi-source sync, versioned activation, security controls, benchmark artifacts and an operator console.
The repository is a local-first engineering reference. Its measurements belong to the committed fixtures, models, hardware path and validation configuration.