Skip to content
Forward Deployed

Forward Deployed

Enterprise Knowledge Assistant

Design a cited internal assistant that preserves permissions as sources and identities change.

Kind
Case study
Level
Foundation
Sections
5
By
Sourav Banerjee
Last updated
20 Nov 2026

Practise this as a worksheet: Enterprise Knowledge Assistant with RAGRead the classic design: Access-Controlled Enterprise RAG

Report an issue

Case brief

Understand the scenario, task, and constraints.

An internal answer with the right access

An enterprise knowledge assistant answers employees’ questions using the company’s policies, runbooks, product documents and tickets. It searches the approved sources, writes an answer from the evidence it finds and links to the supporting passages. The employee should be able to open every source used in the answer.

Priya, a Tier 1 support agent, asks what service-level agreement (SLA), the service commitment to the customer, applies to Enterprise Plus. The assistant checks her identity and groups, searches only the material she may read, and answers from the applicable published policy and runbook. A restricted VP handbook must stay out of both the answer and the model’s input. If permitted sources disagree or do not support an answer, the assistant explains the uncertainty or sends the question for review.

This approach is called retrieval-augmented generation (RAG): retrieve evidence first, then ask a language model to answer from it. Here, access can change between requests. If Priya leaves a group, old search results and cached answers must stop giving her access to that group’s material. The diagram shows how the permission decision constrains the evidence available for an answer.

The assistant retrieves permitted evidence before generating a cited answer, source figure 1.Dark source variant: The assistant retrieves permitted evidence before generating a cited answer, source figure 1.
The assistant retrieves permitted evidence before generating a cited answer, source figure 1. Open the figure for full size.

The design task and first release

Design a read-only assistant across Drive, SharePoint, Slack, wikis and tickets. Read-only means it answers questions without changing records. Trace how documents and permissions enter the system, how a request selects permitted evidence, and how the response is checked. Include updates, deletions, lost access, failure diagnosis, evaluation and rollout. The support operator needs enough evidence to investigate a wrong answer; the Security owner needs a defined release gate for disclosure failures.

The first release excludes policy creation, ticket write-back, personal files, unapproved websites, cross-organisation sharing and unrestricted persistent conversation memory. A later draft ticket note for Zendesk, Salesforce or Jira requires a separate action flow with an allowed operation, preview, human approval and a key that prevents duplicate execution. Permission to read a document does not grant permission to perform those actions.

This case is for engineers preparing for forward-deployed, solutions or applied-AI interviews. Familiarity with APIs, queues, search indexes and model prompts helps. Work through the design, open the deep dives for the mechanisms, and use Practice to test whether you can defend the permission checks, retrieval choices and rollout without the guide. Reading progress and practice notes are separate and stay in this browser; the source’s external worksheet is not connected here.

Next: build the answer in interview order.

Start the walkthrough

Design walkthrough

Follow the reasoning from discovery to delivery.

1. Discover the permission contract

Start by deciding which source the assistant should trust for each kind of question. An old Drive slide and the approved wiki policy may describe different SLAs. A higher search score cannot establish which policy governs. Ask the source owner how to resolve that conflict, whether an answer may combine sources, and whether a citation must identify a supporting passage or only a document. Agree what the employee receives when evidence is missing: an explanation, a source link or an escalation.

Next, establish how access changes reach the assistant. An access-control list (ACL) records who may read a resource. A document can inherit access from a folder, override part of that inheritance, or rely on a group whose membership changes independently. Agree separate limits for how long a revoked permission, deleted document or stale content may remain visible. A service-level objective (SLO) makes those limits testable. Identity updates that arrive asynchronously prevent a credible promise of instant revocation everywhere.

Discovery questions and the design choices they control.

Question to ask What the answer decides
Which source is authoritative for each content type, and what happens when Drive, SharePoint, Slack, the wiki and tickets disagree? Conflict policy: prefer approved current sources, surface the conflict, never silently pick one
Must permissions be inherited live, or is periodic sync acceptable? Where ACL checks live. Live means query-time enforcement; periodic means a bounded, stated stale window
Synthesise across sources, or answer only from retrieved passages? Citations to the passage or the document? Context-budget design and the citation builder’s granularity
How fresh must policies, tickets and project updates be, and how fast must a deletion or revoked permission leave retrieval? Freshness SLO per content class; event-plus-backfill ingestion; reconciliation cadence
Who is the primary user, who diagnoses a wrong answer, who owns the risk if it over-shares? The trace store’s audience and the escalation path
p95 latency target, residency, retention, cost limits? Stage-by-stage latency budget; region pinning; what the trace may store
Who may view audit logs and answer traces, and what must they contain to reconstruct an answer? Trace schema: source event IDs, index and ACL version stamps, request ID, exact citation set
Fallback when retrieval fails or sources conflict: refuse, label staleness, or escalate? The output policy engine’s three modes

An employee notices a wrong answer. An operator needs the source event, versions and replay path. Security needs adversarial tests and authority to block an unsafe source. A sponsor needs task completion and cost evidence. Name each owner before choosing a database.

Users, operational needs and approval responsibilities.

User Workflow Failure they notice first What the assistant gives them Approval needed
End user (employee) Asks a work question in chat, expects a cited answer and a next step Wrong or missing answer Grounded answer with passage citations, abstention on weak evidence, a "missing source" button None for read-only Q&A any write-back is out of MVP scope
Operator / support Triages "the assistant was wrong" reports, tunes connectors and retrieval No trace of why the system failed Replayable structured traces, a freshness dashboard per source, the reconciliation drill Decides when to widen sources after gates pass
Security owner Approves sources, reviews leakage results, reads audit logs An answer exposes content the user should not see Leakage suite as a release gate, the ACL normaliser, immutable audit of retrieval set and citations Any exposure blocks release; signs off each new source
Executive sponsor Tracks adoption and cost-to-value A tool that looks impressive but does not reduce work Grounded-answer rate, task completion, cost per answer, source-by-source expansion Approves rollout stages and budget

2. Turn requirements into tests

Turn the discovery answers into acceptance tests. When a document changes, update the affected chunks, the passages indexed for search, without rebuilding the whole corpus. Each chunk needs a stable document ID, content version, source reference and permission metadata. For every request, test that each passage passed to another component is permitted for the verified user. If the remaining evidence cannot support an answer, the system must abstain or escalate.

Separate first-release requirements from later improvements. Hybrid retrieval combines semantic and keyword search; reranking reorders candidates for the question. Both need evidence that they improve the pilot. Uncertainty messages and governed feedback also help, but collecting a correction does not authorise training on it. Operators need connector health, freshness, policy versions, blocked actions and audit export. Add optical character recognition (OCR) for scanned pages, more sources, richer analytics or organisation-specific ranking after the pilot identifies the need.

Functional scope and acceptance criteria.

Priority Functional requirement Accepted when
Must Incremental ingest of Drive, SharePoint, Slack, wikis, tickets A source change never requires a full reindex
Must Preserve versions and ACL metadata Retrieval can answer "what was visible to this user at this time?"
Must Resolve effective permissions at query time; filter before the model Unauthorised chunks never enter the context window
Must Grounded answers with passage-level citations Every citation is in the permitted retrieval set
Must Abstain on weak evidence A correct refusal beats a confident hallucination
Should Hybrid retrieval and reranking Policy IDs, error codes and ticket numbers match lexically
Should Show confidence, missing evidence and escalation reason Uncertain or high-risk answers are labelled, not guessed
Should Safe feedback for evaluation No raw-prompt dump; no training on customer data without governance
Should Admin controls: sources, freshness, policy, blocked actions, audit export An operator can change those without a code release
Could Richer analytics, more sources, tenant ranking, OCR, human-review workflows Out of MVP; must not distort the first architecture

Non-functional constraints expressed as testable behaviour.

Constraint Testable form
Latency p95, never "fast enough". In this design, target p95 of 3-8 s; under 3 s if it must feel like chat; longer work goes async. Slice identity → ACL → retrieval → rerank → generate; each stage times out and degrades, never fails open
Availability Connector, index or model down: partial coverage, labelled staleness, or refuse; never a silent guess
Cost Embedding, index and tokens estimated separately. Cost per answer. Cache stable docs; prune retrieval; small models for classification; expensive reasoning only where risk justifies it
Security SSO via the IdP; ABAC over source ACLs; filter before the model; revocations fan out to indexes and caches; secrets never in prompts; no training on customer data unless the contract allows it
Audit Immutable: source event IDs, index/ACL versions, request ID, retrieved docs, policy decision, model/prompt version, exact citation set shown
Reliability Fail closed on permissions, stale permission data and the citation check. Label stale content, including a suspected missed deletion, and suppress it once the deletion is confirmed. Degrade on retrieval quality. Queue background reindex

Each requirement needs an implementing component.

Requirement Component
Incremental ingest Connectors, change-event processor, ingestion queue with backfill
Version and ACL preservation Metadata store, ACL normaliser, permission-aware index, audit log
Hybrid retrieval and reranking Keyword index, vector index, fusion, reranker
Grounded answers with citations LLM gateway, evidence selector, citation builder and verifier
No cross-user disclosure Identity mapping, authorisation filter, policy enforcement point, output policy
p95 latency Query service, caches, rerank budget, model timeout
Deletion freshness SLO Connector sync, tombstones, reconciliation job, reindex
Graceful degradation Circuit breakers, fallbacks, partial-answer policy

3. Size the work before tuning it

Use four explicit interview assumptions: 100,000 employees, 50 million chunks, 20 average queries per second (QPS) and 100 peak QPS. Each sizes a different part of the design. Employees determine the number of identities and permission combinations. Chunks determine index storage and refresh work. Peak QPS determines how much simultaneous serving work the system must sustain. None of these figures is a measured result from this prototype.

At a sustained 100 QPS and a mean generation duration of three seconds, the generation stage has roughly 300 requests in flight on average: 100 × 3 = 300. This is a steady-state estimate, not a capacity guarantee. A p95 duration of three seconds cannot replace the mean in this calculation. Bursts, retries and queueing require headroom and a load test. Budget identity lookup, permission filtering, retrieval, reranking, generation and citation verification separately. The 95th-percentile latency, or p95, should stay within the agreed target: under three seconds for a chat-like experience, or under eight seconds for the source’s relaxed variant. Work that cannot meet the interactive budget needs an explicit asynchronous path and queue limit.

Sizing assumptions and their consequences.

Quantity Figure What it forces
Employees 100k Identity and ACL cardinality, not 100k concurrent. Post-filter does not scale when almost every query has a different permission set
Corpus 50M chunks The first embed job is doable. Refresh is the hard part: a permission change or deletion must update indexes and caches without a 50M rebuild
Average load 20 QPS Untuned sync retrieve → rerank → generate looks fine
Peak load 100 QPS 5× the work on the same path. Rerank and generate dominate. They queue, p95 blows the 3 s budget, or you drop

4. Separate ingestion from the request path

Build ingestion as a background process. Connectors fetch authoritative content and its permissions. The pipeline converts source-specific access rules into a common representation, splits text into chunks, creates numerical embeddings for changed chunks and updates the indexes. A durable queue holds change events until they are processed. Backfills recover older data, while reconciliation compares the source with its indexed copy to find missed changes. The source remains authoritative for both content and access.

Now trace Priya’s request. The gateway verifies her session and tenant, the organisation boundary used to isolate data. It loads her identity attributes, interprets the question and applies the permission filter inside hybrid search. After combining the ranked lists, it checks each candidate against the authoritative policy. Only permitted candidates reach reranking and generation. Citation and output checks run before the answer is returned. A query planner may split a complex question into searches; it cannot change Priya’s identity, grant access or approve a write.

The main ingestion and request paths, source figure 1.Dark source variant: The main ingestion and request paths, source figure 1.
The main ingestion and request paths, source figure 1. Open the figure for full size.

The control plane versions connector schedules and credentials, identity mappings, policies, model and prompt versions, retrieval settings, budgets and evaluation gates. The data plane executes those versions. Keep a trace of the selected configuration so a later replay does not silently use today’s policy.

Ingestion, request-path zooms and the complete control-plane architecture, source figure 1.Dark source variant: Ingestion, request-path zooms and the complete control-plane architecture, source figure 1.
Ingestion, request-path zooms and the complete control-plane architecture, source figure 1. Open the figure for full size.
Ingestion, request-path zooms and the complete control-plane architecture, source figure 2.Dark source variant: Ingestion, request-path zooms and the complete control-plane architecture, source figure 2.
Ingestion, request-path zooms and the complete control-plane architecture, source figure 2. Open the figure for full size.
Ingestion, request-path zooms and the complete control-plane architecture, source figure 3.Dark source variant: Ingestion, request-path zooms and the complete control-plane architecture, source figure 3.
Ingestion, request-path zooms and the complete control-plane architecture, source figure 3. Open the figure for full size.

Components, responsibilities and failure behaviour.

Component Responsibility Fails how
Identity and gateway Authenticate via the IdP, load role, tenant and region, classify the request as read-only or action-taking Closed: no identity, no answer
Connectors and queue Pull change events, run backfill, reconcile missed events Degrades: stale source is labelled, not hidden
ACL normaliser Translate each source’s permission model into one attribute model Closed: no usable ACL, nothing indexed
Indexes and metadata store Keyword and vector per tenant; versions, tombstones, event IDs Degrades: vector down, keyword serves a labelled answer
Authorise and pre-filter Resolve groups, compile attributes into the search filter Closed
Retriever and fusion Hybrid search inside the filter, RRF Degrades: fusion order without rerank
Policy post-check Re-run the full ABAC policy on fresh attributes; redact as an obligation Closed: policy engine down, refuse
Reranker and grader 20 to 6, then decide if the evidence is enough Degrades or refuses
LLM gateway and verifier One place for prompts, model choice, guardrails; reject any citation outside the permitted set Closed on citation failure
Trace store, eval, dashboards Replayable runs, golden set, leak suite, freshness and cost signals Degrades: answer still served, gap logged

5. Enforce before ranking and writing

Use two permission checks because the search index is a copy of policy state. First, partition search by tenant and apply an indexed permission predicate, a condition that decides which records search may consider. This prevents forbidden passages from occupying the candidate list. Second, check the surviving candidates against the policy authority to catch stale ACLs, revocations, embargoes and obligations that the index cannot represent. Complete both checks before reranking or generation.

Suppose unrestricted top-six retrieval finds four forbidden passages and two permitted ones. Dropping the four afterward leaves a weak two-passage answer even when better permitted material exists farther down the corpus. It can also expose restricted result counts. Filtering inside search avoids that competition. The second check still matters because the indexed permission copy may lag behind the policy authority.

If the policy service is unavailable or permissions are missing, stop the protected query. Availability targets do not authorise disclosure. Log cases where the second layer denies something accepted by the first: they can reveal stale identity caches, broken predicates or propagation lag.

6. Retrieve evidence that supports the claim

Match retrieval to the ways employees ask questions. Dense retrieval uses embeddings to find similar meaning, while BM25 scores lexical matches such as rare terms and exact identifiers. The source contrasts the identifier “MRD-4290” with the paraphrase “Telemetry disappears before it is saved”. Combine their ranked results, recheck permissions, rerank the permitted candidates and select passages that cover the question without exhausting the model’s token budget.

The source’s 20 candidates reranked to six is an example, not a universal setting. Six repetitive chunks from the wrong policy version are worse than a small set that covers each claim. Surface contradictions and apply declared source authority. Compression must retain supporting text and citations.

Citations need to support the actual claim at the promised granularity. An authorised document link alone does not prove a sentence. Verify that the cited passage was available to this user, belongs to the right version, and supports what the response says. Weak or conflicting evidence produces a qualified answer, abstention or escalation according to the content policy. Never hint that a forbidden document contains the missing answer.

7. Release against failures and owned metrics

Write the expected behaviour before asking a model to answer. The evaluation set should include paraphrases, exact IDs, multi-hop questions, stale and deleted documents, missing evidence, conflicting sources and prompt injection, where document text attempts to redirect the system. Label the supporting passages and expected permission decision independently of the generated response. Replay the same question for different personas, including an identity with no groups and one with broad clearance.

Permission leakage has a zero-tolerance release gate in this design. The source’s other example bars include groundedness at least 90%, citation correctness at least 95%, high-risk escalation at least 95%, and task completion at least 80%. These are case assumptions to negotiate, not external standards. Test recall by query type and track drops from the agreed baseline even if an aggregate score remains high.

Evaluation bars, failure thresholds, datasets and owners.

Metric Good threshold Bad threshold Test dataset Owner
Permission leakage 0 > 0, any case triggers rollback review ACL red-team suite across roles, tenants, regions, stale groups, mid-session changes Security
Grounded answer rate ≥ 90% supported claims, no sustained drop over 5 pts > 5 pts below baseline Silent-mode labelled set plus sampled traffic, SME review ML / eval
Citation precision and recall ≥ 95% correct citations, ≥ agreed bar > 5 pts decline Source-span audit of a sampled set Evaluation
Freshness lag Within the SLO per content class Exceeds SLO Connector telemetry vs index timestamps Ingestion
Retrieval recall Measured per query type, used to tune α Regression on any query type Representative query set segmented by type ML / eval
Escalation quality ≥ 95% correct escalation on high-risk cases Missed high-risk case Risk-labelled scenarios Product / support
Task completion ≥ 80% of target workflows completed with less manual effort Below baseline Workflow replay tests Product
p95 latency and cost per answer p95 within target at 100 QPS peak; cost per workflow below budget Breach at peak Load test plus production telemetry Platform

Groundedness asks whether claims follow evidence. Citation correctness asks whether the link supports them. Permission tests ask whether the user may see that evidence. These need separate labels and gates. A true answer from a forbidden source still fails.

8. Expand one corpus after the evidence holds

Start with one low-risk corpus and three personas. In week 0-1, identify the workflow, risk boundaries, owners and exclusions. In weeks 1-2, ingest that corpus and check it offline. Add golden questions with reviewed expected answers and adversarial cases in weeks 2-3. In weeks 3-4, run real queries in shadow mode while the existing workflow still supplies the user’s answer. Offer a read-only pilot around week 5. Expand sources in weeks 6-8 only after freshness, security, quality and cost gates hold.

Staged rollout and gates.

Week Gate
0-1 Name the workflow, the dangerous constraint, success metrics, source owners, approval rules and explicit non-goals
1-2 One low-risk corpus, no write-back: validate ingestion, ACL normalisation, retrieval and citation formatting offline
2-3 Golden dataset from historical questions and SME-approved answers; the access-leakage suite across roles, indirect phrasing, stale ACLs and deleted documents. Any exposure blocks release
3-4 Silent evaluation on real employee questions while users still get the legacy workflow; compare against human answers without showing output
5 Read-only pilot for one segment with citations, confidence, abstention, feedback capture and an escalation path
6-8 Expand source by source, each with its own freshness dashboard, reconciliation rules, owner and rollback trigger. Draft-only actions, if any, behind human approval
After Widen only while leakage stays at zero and groundedness, freshness, latency and cost hold; rehearse the reconciliation drill; keep the rollback plan

Decisions and evidence that would justify revisiting them.

Decision Chose Would revisit if
Pre-filter over post-filter pre-filter + tenant partitioning ACLs so dynamic the index cannot keep up, then a per-request authorisation service
LLM reranker LLM (explainable, no model hosting) latency or cost at scale, then a cross-encoder behind the same interface
Hybrid retrieval; evaluate multi-query separately Start with dense and lexical retrieval. Add multi-query only if evaluation shows a useful gain. Extra retrieval and query-generation latency or cost outweigh the quality gain on this corpus
Real-time sync vs scheduled indexing mixed: event-driven for high-churn sources, scheduled for stable ones, reconciliation for missed events the customer’s freshness tolerance turns out to be same-day, then scheduled everywhere

Roll back a model, embedding, chunker, index or prompt release when its agreed gate fails. An operator needs both the previous configuration and a compatible index. A customer may accept a scheduled connector for stable material while requiring event-driven updates for high-churn tickets. The discovery contract determines that tradeoff.

Try the case yourself

Technical deep dives

Examine mechanisms, alternatives, and operational consequences.

Source contracts, records and reconciliation

A connector must preserve the source’s effective permissions, including exceptions. A Drive file may inherit folder access and add a limited-access restriction. A SharePoint item may break site or library inheritance. Slack private channels depend on membership; exclude direct messages unless they are explicitly approved. A wiki page can override space permissions. Tickets may depend on queue, project, organisation and customer. Flattening these into one broad “employee” group would change who can read the content.

Source formats, ownership, freshness, permissions and risks.

Data source Format Owner Freshness Permission model Risk
Google Drive Docs, Sheets, Slides, PDFs Individual and team owners Minutes to hours; change notifications plus backfill Per-file and folder sharing, inherited unless a folder has limited access; external sharing possible Personal files leaking in; over-shared folders; missed deletions
SharePoint Office docs, PDFs, lists Site owners Hours; scheduled plus change events Site and library groups, item-level breaks of inheritance Broken-inheritance items indexed with the site’s ACL; stale library permissions
Slack Threads, messages, attachments Channel admins Real time; high churn Public channels, private channels, DMs Private-channel content; pasted secrets; injection in messages; DMs excluded by policy
Wikis (Confluence) Pages, tables, attachments Space owners Days; scheduled with event refresh Space and page restrictions Superseded pages outranking current policy; injection in page bodies; tables lost by the parser
Tickets (Jira, Zendesk, ServiceNow) Structured fields plus free text Team queues Minutes; event-driven Project, organisation and queue membership; customer-specific visibility Cross-customer leakage via ticket text; error codes that need lexical match; PII in transcripts

Use a normalised record carrying tenant, source and document IDs, owner, source version, update time, principals or groups, classifications, validity window, deletion state, ACL/index versions and checkpoint. Exclude records with missing permissions. Keep the original source reference to explain how an effective permission was derived.

A Document record holds version, owner, ACL policy ID, sensitivity, effective date and deleted time. A Chunk points to its document, section path, citation URL, offsets, embedding reference and ACL hash. A Ticket retains customer, product, severity, symptoms, resolution and linked documents. Feedback connects an answer to a governed correction. QueryTrace connects actor references, retrieval sets, policy decisions, model/prompt versions, citations, latency and outcome. These relationships allow deletion suppression and audit retention to follow different policies.

Normalise source permissions before publishing chunks, source figure 1.Dark source variant: Normalise source permissions before publishing chunks, source figure 1.
Normalise source permissions before publishing chunks, source figure 1. Open the figure for full size.

Use an idempotency key such as source/document/version for retries. Compare content hashes to avoid re-embedding unchanged text. Update ACL metadata independently when only access changes. A tombstone suppresses a deleted document from active retrieval without pretending the historical audit never happened. Reconcile source versions, deletes, checkpoints and ACL versions periodically because an event subscription can miss a notification.

Freshness and authorisation are separate tests. A currently authorised chunk can still describe a deleted policy. Conversely, new text may carry stale permissions. Invalidate affected caches, revalidate the source and suppress known-deleted material. A warning about age is acceptable only when the content-class policy permits serving that material and permissions remain trustworthy. Never use a freshness warning to excuse a confirmed revocation or known-invalid policy.

The two checks and attribute policies

Consider three ways to keep search results within the user’s access. Post-filtering searches the unrestricted corpus and removes forbidden results afterward. It is easy to add, but forbidden candidates can crowd out useful permitted passages and expose metadata. Partitioned indexes place different tenants or groups in separate search spaces. They contain disclosure failures, but overlapping groups make copies and updates harder to manage. In-search predicates restrict eligible records while searching a shared index, preserving the candidate budget for permitted evidence. Combining tenant partitions with indexed predicates and an authoritative recheck addresses both isolation and stale-policy risk.

Three search designs and their consequences.

Search design Behaviour Consequence
Post-filter Retrieve everything, then drop inaccessible results The top 6 can shrink to 2 help documents; restricted results crowd out useful evidence. Result counts can also leak information.
Partitioned indexes Separate tenant or group indexes Strong isolation, but expensive and awkward for overlapping groups.
Pre-filter Search within tenant, clearance, region, and group-overlap limits Only records matching the indexed permission predicate are eligible for returned candidates. The search engine may still traverse or score excluded graph nodes internally; an authoritative post-check handles stale or incomplete permissions.
Permission normalisation, attribute decisions, two-layer enforcement and the unsafe prompt-only alternative, source figure 1.Dark source variant: Permission normalisation, attribute decisions, two-layer enforcement and the unsafe prompt-only alternative, source figure 1.
Permission normalisation, attribute decisions, two-layer enforcement and the unsafe prompt-only alternative, source figure 1. Open the figure for full size.
Permission normalisation, attribute decisions, two-layer enforcement and the unsafe prompt-only alternative, source figure 2.Dark source variant: Permission normalisation, attribute decisions, two-layer enforcement and the unsafe prompt-only alternative, source figure 2.
Permission normalisation, attribute decisions, two-layer enforcement and the unsafe prompt-only alternative, source figure 2. Open the figure for full size.
Permission normalisation, attribute decisions, two-layer enforcement and the unsafe prompt-only alternative, source figure 3.Dark source variant: Permission normalisation, attribute decisions, two-layer enforcement and the unsafe prompt-only alternative, source figure 3.
Permission normalisation, attribute decisions, two-layer enforcement and the unsafe prompt-only alternative, source figure 3. Open the figure for full size.
Permission normalisation, attribute decisions, two-layer enforcement and the unsafe prompt-only alternative, source figure 4.Dark source variant: Permission normalisation, attribute decisions, two-layer enforcement and the unsafe prompt-only alternative, source figure 4.
Permission normalisation, attribute decisions, two-layer enforcement and the unsafe prompt-only alternative, source figure 4. Open the figure for full size.

Role-based access control (RBAC) associates a role with permissions. Attribute-based access control (ABAC) evaluates user, document and environment properties. Consider an EU engineer reading a restricted vulnerability advisory after its embargo. Being an engineer is insufficient if the document requires EU residency, vulnerability-team membership and an elapsed embargo. Evaluate tenant isolation, clearance, residency, validity, need-to-know compartments and contractor restrictions, then default to deny.

Seven deterministic policy rules.

# Rule Denies when
1 tenant isolation different tenant; nothing crosses, ever
2 clearance document outranks the principal
3 data residency region-locked doc, principal elsewhere
4 embargo before publication / after expiry
5 need-to-know principal not in the compartment
6 external contractors can’t read commercial sources
7 default deny nothing granted it

An indexed filter can represent stable groups and coarse attributes. The policy layer handles time-sensitive or richer obligations, including redaction. Bind identity to the verified session, not a tenant field supplied by the browser. Key permission caches by identity/policy versions, shorten their lifetime, invalidate on change events, and measure the remaining propagation window. A provisioning delay upstream remains a real limit. In this example, the region predicate restricts which principals may read a document. That access rule does not by itself enforce where document copies, embeddings, model processing, backups or traces reside; deployment and data-flow controls must enforce those residency requirements separately.

The source discusses a historical Chroma metadata workaround using Boolean group fields such as grp__engineering with an $or predicate, and contrasts later array filtering. Treat that as a version-specific implementation example. Confirm supported operators against the installed database before encoding a connector contract. The design requirement is an executable, tested permission predicate; syntax does not establish its correctness.

For retrieval systems backed by copied indexes, permissions and governance must be propagated into the copy. A source storage ACL does not automatically protect a separately served search result. A “do not reveal secrets” prompt cannot perform this enforcement.

Hybrid retrieval, fusion and evidence selection

Retrieval and reranking spend computation differently. A bi-encoder turns queries and documents into embeddings independently, allowing the stored document vectors to be searched efficiently. A cross-encoder reads the query and one candidate together to score their relationship; that work repeats for each candidate. A language-model reranker can provide a relevance explanation without a separately hosted reranking model, but can add token cost and latency. Compare these alternatives on candidates that have already passed authorisation.

Exact identifiers and paraphrases favour different retrievers.

Query Dense result BM25 result
“What is MRD-4290?” MRD-5031 document: wrong Rate-limit document: right
“Telemetry disappears before it is saved” Durability passage: right Getting Started: wrong

The dense result for MRD-4290 can incorrectly favour MRD-5031 while BM25 finds the correct rate-limit document. A paraphrase about telemetry disappearing can favour the durability passage in dense search while lexical matching favours Getting Started. Neither example proves one retriever always wins.

Reciprocal rank fusion (RRF) adds 1 / (k + rank) for each list containing a document. With dense [A, B, D] and BM25 [C, B, E], B receives two second-place contributions. At the source’s illustrative k = 60, B scores 2/62, exceeding A’s 1/61. Rank fusion avoids treating a cosine score of 0.82 as comparable to a BM25 score of 14.3.

A weighted score is another option: alpha * vector_score + (1 - alpha) * keyword_score. Normalise scores first and tune alpha against representative query classes. A universal alpha chosen by intuition can hide poor exact-ID recall.

Retrieval extensions and their added cost.

Technique Fixes Cost
Multi-Query (+RRF = RAG-Fusion) user’s wording ≠ corpus wording N× retrieval, 1 LLM call
HyDE questions and answers are written differently 1 LLM call + latency
Decomposition multi-hop questions no single chunk answers 1 LLM call, only when needed
Reranking recall-optimised retrieval is imprecise often the biggest win

Multi-query retrieval creates several phrasings and fuses their results. It adds retrieval calls plus a model call to produce queries. HyDE embeds a hypothetical answer to bridge question/answer wording; that invented text is a search aid, never evidence. Decomposition splits a genuinely multi-hop question into dependent retrieval steps. Enable each technique only when its measured quality gain justifies latency, cost and new failure cases.

After authorisation and reranking, select evidence for relevance, coverage, authority, freshness, diversity and token budget. Maintain the relationship from each compressed excerpt back to original offsets. If approved sources conflict, show that conflict or escalate rather than synthesising an unsupported compromise. Verify each final citation against the selected evidence and current access decision.

Injection, tools and safe degradation

Assume a retrieved wiki page, Slack message or tool response can contain hostile instructions. The text may ask the model to reveal its prompt, search another tenant or invoke a write operation. Treat it as evidence to analyse, with no authority to change the request’s identity, permissions or allowed actions. A tool gateway outside the model validates the operation against an allowlist and schema. Material writes also require preview, human approval and an idempotency key to prevent duplicate execution.

Failure responses that preserve the access boundary.

Fails Behaviour
Model provider down fail over to secondary/smaller model; queue + backoff
Vector store down fall back to keyword search and say the answer is degraded
Connector stale answer with a staleness label; refuse only when permission data is stale
Reranker unavailable fall back to fusion order; trace records it
Low retrieval confidence refuse and escalate to a human
Stale ACL cache serves a revoked user short-lived permission cache with a versioned identity snapshot, revocation on IdP change events, a bounded and stated stale window; layer 2 catches it
Fabricated citation citation verifier against the retrieval set and live authorisation; the response is rejected or rewritten
Prompt injection in a ticket or wiki retrieved content is evidence, never instructions; it cannot alter the system prompt or enable tools, and unauthorised text never entered the context anyway
Policy engine unavailable fail closed. Refuse. Never fail open on authorisation

If a vector store fails, permission-aware keyword search can offer a labelled degraded answer. If reranking fails, use the already authorised fused order. If the model provider fails, use a tested secondary model or queue with backoff. A policy-engine outage fails closed. A fabricated citation is rejected or repaired before serving. Context overflow calls for evidence selection, not silent truncation of the supporting passage.

A cached answer is another derived copy. Its key needs tenant, permission signature, query and index version, plus policy/model/prompt versions where those alter validity. Invalidate on ACL, document, deletion and policy events. Recheck access when required. Shared query text never makes two users equivalent.

At ten times traffic, a per-request BM25 implementation that scans too much material may need a search service with document-level security or suitable group partitions. Preserve enforcement while changing the search mechanism. An embedding-model migration needs a versioned index, offline retrieval tests, staged traffic and rollback rather than an in-place unmeasured replacement.

Evaluation, audit and the reference project’s limits

Use a permission matrix as the reference for the leakage suite. Cover Tier 1, Tier 3, account manager, administrator, contractor and cross-tenant users, including identities with no groups and with broad clearance. Change regions and memberships during a session. Try direct and document-borne injection, requests for metadata/prompts/tool schemas, fabricated citations and stale, deleted or superseded documents. Assert the boundary before reranking too: a reranker may itself send text to a model provider.

The reference project used 22 documents, nine personas and six retrieval strategies. It is a useful demonstration of visibility and policy tests, but such a small corpus cannot establish production retrieval quality or scale. A plausible dense baseline and a passing finite suite do not prove universal zero leakage. An account manager may see contract terms without root-cause details. An engineer may see root-cause and credit eligibility without the contract. A contractor may see neither.

One evaluation bug labelled an allowed contract a leak. Separate forbidden_docs, whose presence violates policy, from distractor_docs, whose presence hurts relevance. Test policy rules in isolation: one broad deny can mask a broken embargo or region rule. Keep deterministic security assertions separate from nondeterministic model answer scoring.

The source reference project exposes these commands. They describe that project, not executable features of this local reader:

python scripts/demo_access_control.py --matrix
python scripts/evaluate.py --kinds security

The source reports that its visibility-matrix command ran without model cost in roughly two seconds. That is a historical observation about the reference project, not a runtime measured in this reader. The second runs the security gate. Reproduce those behaviours in the real implementation with explicit expected permissions.

Trace request and tenant IDs, privacy-preserving identity references, source event/content versions, ACL/index/policy versions, candidates, selected evidence, citations, model/prompt versions, tool calls, stage latency, tokens, cost and final outcome. Govern access to traces and retain only the content needed for diagnosis. A raw prompt dump is not a privacy policy. Operators should be able to distinguish retrieval failure, policy rejection, absent source data, generation error and citation mismatch.

Latency, cost and changed constraints

Measure each cost driver before choosing a cheaper design. Separate ingestion embeddings, search, reranking, input/output tokens and storage, then attribute the total to a tenant and completed workflow. Reduce repeated work and unnecessary context, tune candidate counts, and rerank selectively where the measured gain warrants it. Route simple lookups and difficult synthesis separately. Both routes must pass their evidence and permission tests; the cheaper route does not get weaker access controls.

For the legal-documents pivot, first identify lawyers, sales, procurement or executives, approved sources, acceptable risk, permission representation and human escalation. The source permits a response under eight seconds in this variant. Mandatory citations and escalation make a slower supported answer preferable to a fast unsupported legal conclusion. Start with a few approved documents, cheaper lookup and stronger synthesis only where justified.

A 100 ms complete-answer requirement changes the architecture. The source contrasts ordinary RAG around 1.5 seconds with cached embeddings, fast authorised retrieval, verified answer caches or precomputed head questions. Keep ordinary live generation off that hot path unless measurements demonstrate the budget. Time to first token is not time to a complete verified answer. The source’s roughly 0.4-second provider example is a historical comparison, not a current service guarantee. A verified semantic cache still needs permission and source-version validity checks.

References and source context

For the concurrency estimate, use mean arrival rate and mean duration, as in AWS’s concurrency calculation. For filtered approximate search, Elastic’s filtered kNN documentation distinguishes result eligibility from graph exploration. These references qualify the sizing and filtering mechanisms; they do not certify this case’s illustrative targets.

The tables and diagrams retain source case data. Numerical targets are illustrative unless explicitly identified otherwise. This teaching adaptation consolidates repeated explanations from the source’s interview, deep-dive, cheat-sheet and full-pack versions. The source reports a 27 September 2026 fact-check and a 4 November 2026 update. Its dated implementation examples and illustrative thresholds retain that context. Consult current product documentation before selecting APIs or promising a performance target.

Apply the decisions

Practice

Attempt the case before revealing the worked reasoning.

Design from a blank page

Design Priya’s assistant from a blank page. Use 100,000 employees, 50 million chunks and 100 peak QPS as assumptions. Establish the access and freshness contract, draw the background ingestion and live request paths, and trace a cited answer. Then replay four cases: a revoked user, a deleted policy, an exact-ID query and a question with insufficient evidence. Name the release tests, owners and evidence needed to add a second corpus.

Write your attempt before opening the worked answers. The notes and rubric below are local learning aids. They do not query enterprise documents or grade your design automatically.

Work through your answer

This local worksheet is a prototype addition. Notes save in this browser. Nothing is submitted or scored.

No notes yet.

Check your reasoning

Reveal the self-assessment rubric

This checklist is an authored addition. Assess what you can explain without reopening the walkthrough.

0 of 5 reasoning checks covered.

Nine checks with worked answers

Why does post-filtering hurt recall?

Forbidden candidates consume the top-k budget. Removing four of six candidates leaves only two permitted passages even if better permitted evidence exists outside that unrestricted top six. Filter during search, then recheck policy for freshness and richer rules.

Why keep a full post-check after pre-filtering?

The filter uses indexed metadata that may be stale or too coarse for embargoes, need-to-know or redaction obligations. The authoritative check catches these before reranking and model exposure. Its denials also reveal propagation or predicate errors.

A missed deletion passes ACL checks. What failed?

Freshness and deletion reconciliation failed. Access permission does not prove that a policy remains valid. Tombstone the document, invalidate answers, reconcile source checkpoints and replay deleted-policy cases.

Why rerank only after authorisation?

A reranker may receive full passage text and may itself be a remote model. Sending forbidden candidates already discloses them, even if a later answer filter removes their names.

What is the release gate for leakage?

The source design requires zero leaks on the defined adversarial suite. Any detected leak blocks release or triggers rollback review with Security. A passing finite suite is evidence about tested cases, not proof of universal safety.

What do the four scale numbers tell you?

100,000 employees sizes identity/ACL cardinality; 50 million chunks sizes indexing and refresh; 20 average QPS describes normal load; 100 peak QPS drives capacity. With sustained peak arrivals at 100 QPS and a mean of three seconds per generation, average occupancy is roughly 300 generations. Allow extra capacity for bursts, retries and queueing; a p95 target alone does not establish the mean.

What changes at ten times traffic if BM25 is slow?

Profile the lexical stage and replace a costly per-request implementation with a scalable permission-aware search service or suitable partitions. Keep tenant isolation, indexed permission predicates and authoritative checks while changing the serving engine.

How would you tune hybrid alpha?

Use normalised vector and lexical scores and a labelled query mix containing exact IDs and paraphrases. Sweep weights offline, inspect recall and ranking per class, then stage the selected configuration. Compare against RRF, which avoids raw-score comparability.

Give the 60-second legal-cost pivot.

Clarify users, authoritative documents, acceptable risk and escalation. Use the permitted under-eight-second target, mandatory citations, a few approved sources, cheaper lookup and stronger synthesis selectively. Reduce context and repeated work, then measure cost per completed workflow without weakening permissions or support checks.

Interview pivots and incident drills

Use a 60-minute interview to spend 0-8 minutes clarifying scope, 8-15 on entities and architecture, 15-35 on authorisation and retrieval, 35-45 on tenancy/security/evaluation/traceability, 45-55 on failures and sizing, and 55-60 on the close and week-one work. The source’s shorter opening variant spends two minutes framing and three on discovery before drawing. Adjust allocation to the interviewer, while still covering permission enforcement and rollout.

Follow-up questions and the mechanism an answer should defend.

Follow-up Answer
How do you prove users never see a passage they cannot open? Authorise before a passage can enter context or the response. Query-time effective permissions. A disallowed citation rejects or rewrites the response. Suite: known-denied docs, group changes, adversarial queries; retrieval, reranker, assembler, and citation renderer share one policy
Access today, gone tomorrow? Pre-filter is a snapshot. Post-check re-resolves live, so revocation hits the next query after the IdP sync. Short permission cache, versioned identity, IdP change events. If signals lag, state the max stale window
Confident but wrong? Citation check against the retrieval set, groundedness on a silent labelled set, abstain on weak evidence, trace which stage failed. Confidence follows evidence, not tone
Re-index after a chunking change? Versioned migration: old and new side by side, new index version, offline eval, small traffic slice, leak tests again, rollback kept
LLM-powered enterprise search (OpenAI-style practice prompt) This design. Open with section 1. Spend the time on permission layers and the leak gate
Unified search across SharePoint, Slack, Drive, Confluence, Salesforce, databases Federated search inherits permissions but struggles to rank across sources and is only as fast as the slowest source. An index ranks across sources and must carry the ACL translation. Then this design

Weak interview claims and concrete replacements.

Weak line Replace with
"Vector search because it’s modern" Hybrid: exact terms plus paraphrase
"Permissions are handled by the database" Storage ACL ≠ retrieval-time authorisation
"Store the whole prompt for debugging" Structured traces, redacted
"Real-time sync everywhere" Mixed, by freshness need
"More context will solve it" Precision, cost, a tight candidate set
"If the model is confident it’s right" Confidence tied to evidence and citations
Incident drill: a recently revoked user receives a deleted policy. What do you do?

Contain disclosure by suppressing the affected document and invalidating permission-sensitive caches. Reconstruct identity, policy, ACL/index versions and source events from the trace. Determine whether deletion was missed, the identity cache lagged, a filter omitted a predicate, or a cached response bypassed verification. Reconcile the source, repair the index and replay the revoked persona and stale-policy tests before restoring traffic. Track freshness and revocation lag separately. A current ACL decision cannot make a deleted policy current.

The source links seven adjacent incident cases: 86 stale-index policy answers, 93 injected Confluence content, 94 embedding drift, 106 retrieval quality as the corpus grows, 111 vector-search latency, 112 reranking that improves quality while doubling latency, and 117 oversized context. For each, state the detection metric, containment, root-cause evidence and prevention test. An embedding regression needs versioned retrieval replay; a slow reranker needs stage timing and a measured routing tradeoff; an oversized context needs evidence selection rather than a larger limit alone.

Give an honest project story and calibrate its scope.

An example interview story can describe the source’s 22-document, nine-persona, six-strategy reference: normalise permissions, filter inside search, recheck policy, compare hybrid retrieval, and replay expected visibility. Explain the false leak label and masked-rule lesson. State that the dataset demonstrates mechanisms rather than production scale. Use first-person claims only for work you performed. A production follow-up would establish owned connector contracts, measured revocation windows, larger evaluation sets and a staged rollout.

Senior, Staff and Principal scope.

Level Sounds like Missing
Senior Partitions by tenant and pre-filters inside hybrid search, re-checks policy live before generation, reranks 20 to 6 after enforcement and abstains on weak evidence. Authorisation fails closed; everything else degrades. The ingest half and the proof: how each source’s ACLs get translated, how a missed deletion is caught, and what shows zero leaks before release.
Staff Adds the ACL normaliser that refuses anything without a usable ACL, tombstones and reconciliation for missed deletes, and a leak suite Security owns as the release gate. Rolls out one corpus at a time, with an owner and a rollback trigger per source. What happens as sources, tenants and pivots multiply: index and embedding migrations, cost per answer at 100 QPS peak, and whether governance survives a copied index.
Principal Makes permission translation a platform contract every connector meets, and versions the index so a chunking or embedding change is a staged cutover with rollback. Keeps the legal cost pivot and the 100 ms pivot on the same trust path, and checks that source governance does not silently drop at the index boundary. The freshness SLO per content class and the stated stale window for revocation depend on the customer’s IdP sync and risk appetite, so they wait for discovery.

A Senior answer traces a safe query. A Staff answer also owns ingestion, reconciliation, evaluation and rollback. A Principal answer defines a shared connector and governance platform, safe index migrations, tenant growth and cost ownership. Do not claim the broader level by adding component names without operational contracts.

Return to the decisions you could not explain.

Review the essentials

Quick review

Recall the decisions, failure responses, and closing answer.

Recall the trust path

The request uses a versioned copy of authoritative content and permissions. Keep that copy current with change events and reconciliation. Verify identity, restrict search to the tenant and permitted records, combine retrieval ranks, recheck policy, rerank, select evidence, generate and verify citations. Stop disclosure whenever the permission decision is uncertain.

Five rules carry the design: missing permissions exclude a document; authorisation happens before model exposure; freshness and access are different checks; citations must support claims; insufficient evidence leads to qualification, abstention or escalation. Prompt instructions cannot substitute for those controls.

Recall the tests and numbers

The example scale is 100,000 employees, 50 million chunks, 20 average QPS and 100 peak QPS. At a sustained 100 QPS and a mean three-second generation duration, average occupancy is about 300 in-flight generations, before burst and retry headroom. Set per-stage p95 and per-workflow cost budgets. A 100 ms full-answer target generally needs precomputation or a verified cache, with current permissions checked.

Release gates separate zero permission leaks, grounded claims, correct citations, freshness, retrieval recall, high-risk escalation and task completion. Start with one corpus and three personas. A failed provider can trigger a tested fallback; a failed policy decision must stop disclosure. Cache keys and invalidation must carry permission and version context.

Close in one sentence

Build a permission-aware evidence pipeline whose answers can be traced to authorised, current passages, then expand only when leakage, quality, freshness and operational gates hold.

Test your recall

Where next

Practise this as a worksheet
Enterprise Knowledge Assistant with RAG
Revise the concepts