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
View
Interview prep
Sections
4
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

Interview view. The case brief, design walkthrough, technical deep dives and quick review, condensed into bullets, tables and lines to say out loud, with interactive diagrams to step through.

Want to go deep? The full casebook has the complete reasoning in prose, the original diagrams, practice questions with worked answers and the sources.

Case brief

The case in one line: a read-only assistant that answers employees from approved company sources, cites the passages it used and never shows anything the asker may not read.

30-Second Cheat Sheet

  • The product: employees ask questions; the assistant answers from policies, runbooks, product documents and tickets, with a link to every supporting passage.
  • The pattern: RAG, retrieve evidence first, then have a language model answer from it.
  • The dangerous constraint: a restricted document must stay out of both the answer and the model's input.
  • Access moves: if a user leaves a group, old search results and cached answers must stop giving access.
  • Weak or conflicting evidence: explain the uncertainty or send the question for review.
  • The sources: Drive, SharePoint, Slack, wikis and tickets, read-only.
  • Two owners to satisfy: the support operator (can investigate a wrong answer) and the Security owner (has a defined release gate for disclosure failures).
  • First-release cuts: no policy creation, no ticket write-back, no personal files, no unapproved websites, no cross-organisation sharing, no unrestricted persistent memory.

1. An internal answer with the right access

The product

  • An enterprise knowledge assistant answers employees' questions from 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.

The worked example: Priya's question

  1. The ask. Priya, a Tier 1 support agent, asks what SLA applies to Enterprise Plus.
  2. Identity. The assistant checks her identity and groups.
  3. Scoped search. It searches only the material she may read.
  4. Answer. It answers from the applicable published policy and runbook.
  5. Exclusion. A restricted VP handbook stays out of both the answer and the model's input.
  6. Fallback. If permitted sources disagree or don't support an answer, the assistant explains the uncertainty or sends the question for review.

The terms that carry the whole case

Term Meaning
SLA (service-level agreement) The service commitment to the customer. Priya's question is about one.
RAG (retrieval-augmented generation) Retrieve evidence first, then ask a language model to answer from it
Read-only The assistant answers questions without changing records
Access change Access can change between requests. If Priya leaves a group, old search results and cached answers must stop giving her that group's material.

The core idea (source figure, as a flow)

Employee question → identity and groups → permission decision → search only permitted evidence → language model answers from that evidence → cited answer (or uncertainty / review)

  • The permission decision constrains the evidence available for an answer. It sits before generation, not after.

2. The design task and first release

The task

  • Design a read-only assistant across Drive, SharePoint, Slack, wikis and tickets.
  • Trace three paths:
    1. How documents and permissions enter the system.
    2. How a request selects permitted evidence.
    3. How the response is checked.
  • Include updates, deletions, lost access, failure diagnosis, evaluation and rollout.

Who needs what

Owner Needs
Support operator Enough evidence to investigate a wrong answer
Security owner A defined release gate for disclosure failures

Out of the first release

  • Policy creation
  • Ticket write-back
  • Personal files
  • Unapproved websites
  • Cross-organisation sharing
  • Unrestricted persistent conversation memory

A later write action is a separate flow

  • A later draft ticket note for Zendesk, Salesforce or Jira needs its own action flow:
    • an allowed operation,
    • a preview,
    • human approval,
    • a key that prevents duplicate execution.
  • Permission to read a document does not grant permission to perform those actions.

Soundbite: "Reading a document never authorises writing to a ticket. Write-back is a separate flow with preview, approval and an idempotency key."

Who it's for and what it assumes

  • Engineers preparing for forward-deployed, solutions or applied-AI interviews.
  • Helps to know APIs, queues, search indexes and model prompts.
  • How to use it: work through the design, open the deep dives for the mechanisms, then use Practice in the full casebook 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 isn't connected here.
Related case What it adds or shifts
Enterprise Support Customer-specific ticket visibility, workflow integrations and escalation
Legal RAG More weight on citation precision, authoritative versions, auditability and cost
Sub-100ms Search Permission-aware precomputation; may remove live generation from the request path
Enterprise/LLM Search Wider source coverage, freshness, relevance and search experience at scale
Meridian Assist The same foundation adapted to its own users and systems
Security and incident cases Blast radius, detection, containment, revocation, recovery and evidence of disclosure
  • The source combines these variations with an access-control whiteboard script and two interview follow-ups.
  • Their mechanisms and exercises appear in the walkthrough, deep dives and Practice (Practice is in the full casebook).

Quick Recall: Lines to Say in the Interview

  • "Every source in the answer is one the employee can open."
  • "The restricted document stays out of the answer and out of the model's input."
  • "Retrieve permitted evidence first, then generate. The permission decision constrains the evidence."
  • "If Priya leaves a group, old results and cached answers stop working for her."
  • "Weak or conflicting evidence gets an uncertainty note or a review, never a guess."
  • "Read-only in release one; reading a document never grants a write."
  • "The operator can investigate a wrong answer, and Security owns the disclosure gate."

Design walkthrough

The goal: a permission-aware RAG assistant where every passage the model sees is one the user may read, every citation supports its claim, and weak evidence leads to abstention or escalation.

30-Second Cheat Sheet

  • Discover the permission contract first: which source is authoritative, how access changes arrive, and what the user gets when evidence is missing.
  • Requirements are tests: incremental ingest, version and ACL metadata, filter before the model, passage citations, abstain on weak evidence.
  • Size it with four assumptions: 100,000 employees, 50 million chunks, 20 average QPS, 100 peak QPS → about 300 generations in flight (100 × 3).
  • Two paths: background ingestion (connectors, ACL normaliser, queue, reconciliation) and the live request path (gateway, filtered hybrid search, policy post-check, rerank, generate, verify).
  • Two permission checks: an indexed predicate inside search, then an authoritative policy recheck, both before reranking or generation.
  • Retrieval: dense plus BM25, fused, then reranked (20 → 6 as the source's example), with citations verified at the promised granularity.
  • Release gate: zero permission leaks; example bars of ≥ 90% groundedness, ≥ 95% citation correctness, ≥ 95% high-risk escalation, ≥ 80% task completion.
  • Rollout: one low-risk corpus, three personas, shadow mode in weeks 3-4, pilot around week 5, expand in weeks 6-8 only after gates hold.

1. Discover the permission contract

Decide which source to trust

  • An old Drive slide and the approved wiki policy may describe different SLAs.
  • A higher search score can't establish which policy governs.
  • Ask the source owner:
    • How to resolve that conflict.
    • Whether an answer may combine sources.
    • Whether a citation must identify a supporting passage or only a document.
  • Agree what the employee gets when evidence is missing: an explanation, a source link or an escalation.

Establish how access changes arrive

ACL (access-control list) = the record of who may read a resource.

  • A document can:
    • inherit access from a folder,
    • override part of that inheritance,
    • rely on a group whose membership changes independently.
  • Agree separate limits for how long each may remain visible:
    • a revoked permission,
    • a deleted document,
    • stale content.
  • An SLO makes those limits testable.
  • Identity updates arrive asynchronously, so you can't credibly promise instant revocation everywhere.

SLO (service-level objective) = the internal target you commit to, for example "95% of answers in under 3 seconds".

Discovery questions and what they decide

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 = query-time enforcement; periodic = 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

Name each owner before choosing a database

  • 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.
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 shouldn't 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 doesn't reduce work Grounded-answer rate, task completion, cost per answer, source-by-source expansion Approves rollout stages and budget

MVP (minimum viable product) = the smallest version real users actually use to prove the idea.

Soundbite: "A higher search score can't tell me which policy governs. The source owner can, so I ask before I design retrieval."


2. Turn requirements into tests

What the acceptance tests say

  • When a document changes, update only 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 can't support an answer, the system must abstain or escalate.

First release versus later

  • 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.
    • Collecting a correction doesn't authorise training on it.
  • Operators need: connector health, freshness, policy versions, blocked actions and audit export.
  • After the pilot identifies the need: OCR for scanned pages, more sources, richer analytics, organisation-specific ranking.

OCR (optical character recognition) = turning scanned pages or images into text. Often where document pipelines quietly lose accuracy.

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 as testable behaviour

Constraint Testable form
Latency p95, never "fast enough". Target p95 of 3-8 s in this design; 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

SSO (single sign-on) = one company login for every app, and where you get the user's identity to enforce permissions. IdP = the identity provider behind it.

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

Soundbite: "Fail closed on permissions and citations; degrade on retrieval quality."


3. Size the work before tuning it

Four interview assumptions, each sizing a different part

  • 100,000 employees → number of identities and permission combinations.
  • 50 million chunks → index storage and refresh work.
  • 20 average QPS → normal load.
  • 100 peak QPS → simultaneous serving work the system must sustain.
  • None of these figures is a measured result from this prototype.

QPS = queries per second.

Concurrency at peak

  • Sustained 100 QPS × mean generation 3 s → 100 × 3 = 300 requests in flight on average in the generation stage.
  • It's a steady-state estimate, not a capacity guarantee.
  • Use the mean, not p95: a p95 duration of three seconds can't replace the mean in this calculation.
  • Bursts, retries and queueing need headroom and a load test.

Latency budget

  • Budget separately: identity lookup → permission filtering → retrieval → reranking → generation → citation verification.
  • p95 stays within the agreed target:
    • under 3 s for a chat-like experience,
    • under 8 s for the source's relaxed variant.
  • Work that can't meet the interactive budget needs an explicit asynchronous path and queue limit.

p95 = 95% of requests finish faster than that figure.

Sizing assumptions and their consequences

Quantity Figure What it forces
Employees 100k Identity and ACL cardinality, not 100k concurrent. Post-filter doesn't 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

Soundbite: "A hundred QPS at a three-second mean is about three hundred generations in flight, before burst and retry headroom."


4. Separate ingestion from the request path

Ingestion runs in the background

  1. Connectors fetch authoritative content and its permissions.
  2. The pipeline converts source-specific access rules into a common representation.
  3. It splits text into chunks.
  4. It creates embeddings only for changed chunks.
  5. It updates the indexes.
  • A durable queue holds change events until processed.
  • Backfills recover older data.
  • Reconciliation compares the source with its indexed copy to find missed changes.
  • The source stays authoritative for both content and access.

Trace Priya's request

  1. Gateway verifies her session and tenant (the organisation boundary used to isolate data).
  2. Loads her identity attributes.
  3. Interprets the question.
  4. Applies the permission filter inside hybrid search.
  5. Combines the ranked lists.
  6. Checks each candidate against the authoritative policy.
  7. Only permitted candidates reach reranking and generation.
  8. Citation and output checks run before the answer is returned.
  • A query planner may split a complex question into searches.
    • It can't change Priya's identity, grant access or approve a write.

Control plane and data plane

  • Control plane versions: connector schedules and credentials, identity mappings, policies, model and prompt versions, retrieval settings, budgets and evaluation gates.
  • Data plane executes those versions.
  • Trace the selected configuration so a later replay doesn't silently use today's policy.
  • The source draws this as ingestion, request-path zooms and the complete control-plane architecture.

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

RRF (reciprocal rank fusion) = merging ranked lists by how high each result sits in each list. ABAC = attribute-based access control (see deep dives).

Soundbite: "The planner can split a question. It can't change who's asking, grant access or approve a write."


5. Enforce before ranking and writing

Two checks, because the index is a copy of policy state

  1. Inside search: partition by tenant and apply an indexed permission predicate (a condition that decides which records search may consider).
    • Forbidden passages never occupy the candidate list.
  2. After fusion: check surviving candidates against the policy authority.
    • Catches stale ACLs, revocations, embargoes and obligations the index can't represent.
  • Complete both checks before reranking or generation.

Why post-filtering alone fails

  • Unrestricted top-six retrieval finds four forbidden and two permitted passages.
  • 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.

Fail closed

  • Policy service unavailable or permissions missing → stop the protected query.
  • Availability targets don't authorise disclosure.
  • Log cases where layer 2 denies something layer 1 accepted. They reveal:
    • stale identity caches,
    • broken predicates,
    • propagation lag.

Soundbite: "Availability targets don't authorise disclosure. If the policy engine is down, the protected query stops."


6. Retrieve evidence that supports the claim

Match retrieval to how employees ask

  • Dense retrieval uses embeddings to find similar meaning.
  • BM25 scores lexical matches: rare terms and exact identifiers.
  • The source's contrast:
    • an identifier: "MRD-4290",
    • a paraphrase: "Telemetry disappears before it is saved".
  • Pipeline: combine ranked results → recheck permissions → rerank permitted candidates → select passages that cover the question without exhausting the token budget.

Evidence selection

  • 20 candidates reranked to six is the source's 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 keep the supporting text and citations.

Citations must support the actual claim

  • Support it at the promised granularity.
  • An authorised document link alone doesn't prove a sentence.
  • Verify that the cited passage:
    • was available to this user,
    • belongs to the right version,
    • supports what the response says.
  • Weak or conflicting evidence → qualified answer, abstention or escalation, per the content policy.
  • Never hint that a forbidden document contains the missing answer.

Soundbite: "An authorised link doesn't prove a sentence. The cited passage has to be visible to this user, the right version and actually support the claim."


7. Release against failures and owned metrics

Build the evaluation set before the model answers

  • Write the expected behaviour first.
  • Cover:
    • paraphrases,
    • exact IDs,
    • multi-hop questions,
    • stale and deleted documents,
    • missing evidence,
    • conflicting sources,
    • prompt injection (document text that tries to redirect the system).
  • Label supporting passages and the 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.

The bars

  • Permission leakage has a zero-tolerance release gate in this design.
  • The source's other example bars:
    • groundedness at least 90%,
    • citation correctness at least 95%,
    • high-risk escalation at least 95%,
    • 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 stays high.
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

SME (subject-matter expert) = the person who can tell you whether an answer is right.

Three different questions, three labels, three gates

Check Asks
Groundedness Do the claims follow the evidence?
Citation correctness Does the link support them?
Permission tests May the user see that evidence?
  • A true answer from a forbidden source still fails.

Soundbite: "Leakage is zero-tolerance. A true answer from a forbidden source still fails."


8. Expand one corpus after the evidence holds

The plan

  • Start with one low-risk corpus and three personas.
  • Week 0-1: workflow, risk boundaries, owners, exclusions.
  • Weeks 1-2: ingest that corpus, check offline.
  • Weeks 2-3: golden questions with reviewed answers, adversarial cases.
  • Weeks 3-4: shadow mode on real queries while the existing workflow still answers the user.
  • Around week 5: read-only pilot.
  • Weeks 6-8: expand sources 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 what would make you revisit them

Decision Chose Would revisit if
Pre-filter over post-filter Pre-filter + tenant partitioning ACLs so dynamic the index can't 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

Rollback

  • 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 decides that tradeoff.

Soundbite: "One corpus, three personas, shadow first. A new source widens only while leakage stays at zero."


Quick Recall: Lines to Say in the Interview

  • "A higher search score can't tell me which policy governs; the source owner can."
  • "Identity updates arrive asynchronously, so I state a revocation window instead of promising instant revocation."
  • "A hundred QPS at a three-second mean is about three hundred generations in flight."
  • "Two checks: a permission predicate inside search, then the policy authority, both before reranking or generation."
  • "Post-filtering turns a top six into two weak passages and leaks result counts."
  • "Fail closed on permissions and citations; degrade on retrieval quality."
  • "An authorised link doesn't prove a sentence."
  • "Zero leaks is the gate; 90, 95, 95 and 80 are bars to negotiate."
  • "One low-risk corpus and three personas, shadow mode before the pilot."

Technical deep dives

The goal: defend the mechanisms behind the follow-up questions: how permissions survive ingestion, how two checks enforce them, how retrieval finds the right evidence, and what fails closed.

30-Second Cheat Sheet

  • Connectors keep effective permissions, exceptions included. Flattening to one "employee" group changes who can read.
  • Records: Document, Chunk, Ticket, Feedback, QueryTrace. Missing permissions exclude a record.
  • Retries and deletes: idempotency key source/document/version, content hashes, tombstones, periodic reconciliation.
  • Freshness ≠ authorisation. A staleness warning never excuses a confirmed revocation.
  • Search designs: post-filter (crowds out evidence, leaks counts), partitioned indexes (strong but awkward), pre-filter + authoritative recheck.
  • Seven deterministic policy rules, ending in default deny.
  • RRF adds 1 / (k + rank); at k = 60, B scores 2/62 and beats A's 1/61.
  • Failures: vector store down → labelled keyword answer; policy engine down → refuse. Cache keys carry permission and version context.

1. Source contracts, records and reconciliation

Each source has its own permission model

  • Drive: a file may inherit folder access and add a limited-access restriction.
  • SharePoint: an item may break site or library inheritance.
  • Slack: private channels depend on membership. Exclude direct messages unless explicitly approved.
  • Wiki: a page can override space permissions.
  • Tickets: may depend on queue, project, organisation and customer.
  • Flattening these into one broad "employee" group changes who can read the content.
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

PII (personally identifiable information) = anything that identifies a person: name, email, phone, account number.

The normalised record

  • Carries: 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.
Record Holds
Document Version, owner, ACL policy ID, sensitivity, effective date, deleted time
Chunk Its document, section path, citation URL, offsets, embedding reference, ACL hash
Ticket Customer, product, severity, symptoms, resolution, linked documents
Feedback Links an answer to a governed correction
QueryTrace Actor references, retrieval sets, policy decisions, model/prompt versions, citations, latency, outcome
  • These relationships let deletion suppression and audit retention follow different policies.
  • The source's figure: normalise source permissions before publishing chunks.

Retries, changes and deletes

  • Idempotency key such as source/document/version for retries.

Idempotency key = an identifier that makes a repeated operation take effect once.

  • 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.
  • New text may carry stale permissions.
  • Response: invalidate affected caches, revalidate the source, suppress known-deleted material.
  • An age warning 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 a known-invalid policy.

Soundbite: "Freshness and access are different checks. A currently authorised chunk can still describe a deleted policy."


2. The two checks and attribute policies

Three ways to keep results inside the user's access

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
Partitioned indexes Separate tenant or group indexes Strong isolation, but expensive and awkward for overlapping groups (copies and updates get hard)
Pre-filter Search within tenant, clearance, region and group-overlap limits Only records matching the indexed permission predicate are eligible for returned candidates. The engine may still traverse or score excluded graph nodes internally; an authoritative post-check handles stale or incomplete permissions
  • Post-filter is easy to add. In-search predicates preserve the candidate budget for permitted evidence.
  • Combine tenant partitions + indexed predicates + an authoritative recheck → covers both isolation and stale-policy risk.
  • The source's figures show permission normalisation, attribute decisions, two-layer enforcement and the unsafe prompt-only alternative.

RBAC versus ABAC

RBAC (role-based access control) = a role maps to permissions. ABAC (attribute-based access control) = a decision from user, document and environment properties.

  • Example: an EU engineer reads a restricted vulnerability advisory after its embargo.
    • Being an engineer isn't enough if the document needs 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.
# 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

What each layer handles

  • Indexed filter: stable groups and coarse attributes.
  • Policy layer: time-sensitive or richer obligations, including redaction.
  • Bind identity to the verified session, not a tenant field supplied by the browser.
  • Permission caches:
    • key by identity/policy versions,
    • shorten their lifetime,
    • invalidate on change events,
    • measure the remaining propagation window.
  • An upstream provisioning delay remains a real limit.
  • Residency caveat: the region predicate restricts which principals may read a document. It doesn't by itself enforce where document copies, embeddings, model processing, backups or traces reside. Deployment and data-flow controls must enforce that separately.

The Chroma example (version-specific)

  • The source discusses a historical Chroma metadata workaround: Boolean group fields such as grp__engineering with an $or predicate, contrasted with later array filtering.
  • Treat it as a version-specific implementation example. Confirm supported operators against the installed database before encoding a connector contract.
  • The requirement is an executable, tested permission predicate. Syntax doesn't establish its correctness.

Copied indexes need their own governance

  • Permissions and governance must be propagated into the copy.
  • A source storage ACL doesn't automatically protect a separately served search result.
  • A "do not reveal secrets" prompt can't perform this enforcement.

Soundbite: "The index is a copy of policy state. The storage ACL doesn't protect it, and a prompt can't either."


3. Hybrid retrieval, fusion and evidence selection

Where each model spends compute

Model How it works Trade-off
Bi-encoder Embeds queries and documents independently Stored document vectors are searched efficiently
Cross-encoder Reads the query and one candidate together Work repeats per candidate
LLM reranker Scores with a relevance explanation No separately hosted model, but adds token cost and latency
  • Compare these on candidates that 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
  • Neither example proves one retriever always wins.

Reciprocal rank fusion

  • RRF adds 1 / (k + rank) for each list containing a document.
  • Worked example: dense [A, B, D] and BM25 [C, B, E].
    1. B appears second in both lists → two contributions.
    2. At the source's illustrative k = 60, B scores 2/62.
    3. A appears once, first → 1/61.
    4. 2/62 > 1/61, so B ranks above A.
  • Why rank fusion: it avoids treating a cosine score of 0.82 as comparable to a BM25 score of 14.3.

Weighted scores

  • Formula: alpha * vector_score + (1 - alpha) * keyword_score.
  • Normalise scores first. 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: several phrasings, fused. Adds retrieval calls plus a model call.
  • HyDE: embeds a hypothetical answer to bridge wording. That invented text is a search aid, never evidence.
  • Decomposition: splits a genuinely multi-hop question into dependent retrieval steps.
  • Enable each only when its measured quality gain justifies latency, cost and new failure cases.

Select evidence

  • After authorisation and reranking, select for relevance, coverage, authority, freshness, diversity and token budget.
  • Keep the link from each compressed excerpt back to original offsets.
  • Approved sources conflict → show the conflict or escalate, never an unsupported compromise.
  • Verify each final citation against the selected evidence and the current access decision.

Soundbite: "Rank fusion means I never compare a cosine of 0.82 with a BM25 score of 14.3."


4. Injection, tools and safe degradation

Retrieved text is evidence, not authority

  • A wiki page, Slack message or tool response can contain hostile instructions: reveal the prompt, search another tenant, invoke a write.
  • Treat it as evidence to analyse. It has no authority over 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 need preview, human approval and an idempotency key to prevent duplicate execution.

Failure responses that keep 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 can't 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
  • Context overflow calls for evidence selection, not silent truncation of the supporting passage.
  • The fallback must already be tested: a secondary model, or a queue with backoff.

Cached answers are derived copies

  • Cache key needs: tenant, permission signature, query, index version, plus policy/model/prompt versions where they 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, and on migration

  • A per-request BM25 that scans too much 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, never an in-place unmeasured replacement.

Soundbite: "Shared query text never makes two users equivalent, so the cache key carries the permission signature."


5. Evaluation, audit and the reference project's limits

The leakage suite

  • Use a permission matrix as the reference.
  • Personas: Tier 1, Tier 3, account manager, administrator, contractor, cross-tenant, plus 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 or tool schemas,
    • fabricated citations,
    • stale, deleted or superseded documents.
  • Assert the boundary before reranking too: a reranker may itself send text to a model provider.

What the reference project proves, and doesn't

  • It used 22 documents, nine personas and six retrieval strategies.
  • Useful demonstration of visibility and policy tests.
  • A corpus that small can't establish production retrieval quality or scale.
  • A plausible dense baseline and a passing finite suite don't prove universal zero leakage.
  • Visibility differs by persona:
Persona Sees
Account manager Contract terms, without root-cause details
Engineer Root cause and credit eligibility, without the contract
Contractor Neither

Label bugs and masked rules

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

The reference project's commands

These describe that project, not executable features of this reader:

python scripts/demo_access_control.py --matrix
python scripts/evaluate.py --kinds security
  • The source reports the visibility-matrix command ran without model cost in roughly two seconds.
    • That's a historical observation about the reference project, not a runtime measured here.
  • The second command runs the security gate.
  • Reproduce those behaviours in the real implementation with explicit expected permissions.

What the trace records

  • 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 keep only what diagnosis needs.
  • A raw prompt dump isn't a privacy policy.
  • Operators must be able to tell apart:
    1. retrieval failure,
    2. policy rejection,
    3. absent source data,
    4. generation error,
    5. citation mismatch.

Soundbite: "Twenty-two documents and nine personas prove the mechanism, not production scale, and a finite suite never proves universal zero leakage."


6. Latency, cost and changed constraints

Cost

  • Measure each cost driver before choosing a cheaper design:
    • ingestion embeddings,
    • search,
    • reranking,
    • input/output tokens,
    • storage.
  • Attribute the total to a tenant and completed workflow.
  • Levers: reduce repeated work and unnecessary context, tune candidate counts, rerank selectively where the measured gain warrants it.
  • Route simple lookups and difficult synthesis separately.
  • Both routes pass their evidence and permission tests; the cheaper route doesn't get weaker access controls.
  1. Identify the users: lawyers, sales, procurement or executives.
  2. Identify approved sources, acceptable risk, permission representation and human escalation.
  3. The source permits a response under eight seconds in this variant.
  4. Mandatory citations and escalation make a slower supported answer preferable to a fast unsupported legal conclusion.
  5. Start with a few approved documents, cheaper lookup, and stronger synthesis only where justified.

The 100 ms pivot

  • 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,
    • precomputed head questions.
  • Keep live generation off that hot path unless measurements show it fits.
  • Time to first token isn't 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.

Soundbite: "At 100 milliseconds the answer is precomputed or a verified cache, still checked against current permissions."


7. References and source context

What the references qualify

  • Concurrency estimate: use mean arrival rate and mean duration, as in AWS's concurrency calculation.
  • Filtered approximate search: Elastic's filtered kNN documentation separates result eligibility from graph exploration.
  • These references qualify the mechanisms; they don't certify this case's illustrative targets.

Boundaries on the claims

  • Tables and diagrams keep the source case data.
  • Numerical targets are illustrative unless explicitly identified otherwise.
  • This adaptation consolidates 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 keep that context.
  • Consult current product documentation before selecting APIs or promising a performance target.

Reference list


Quick Recall: Lines to Say in the Interview

  • "Flattening every source into one employee group changes who can read the content."
  • "Missing permissions exclude the record; nothing is indexed without a usable ACL."
  • "A tombstone suppresses retrieval without erasing the audit."
  • "Pre-filter keeps the candidate budget for permitted evidence; the post-check catches what the index copy missed."
  • "Seven rules, and the last one is default deny."
  • "B scores 2 over 62 and beats A's 1 over 61: rank fusion, not raw scores."
  • "HyDE text is a search aid, never evidence."
  • "Vector store down, I serve a labelled keyword answer. Policy engine down, I refuse."
  • "The cheaper route doesn't get weaker access controls."

Quick review

One sentence: build a permission-aware evidence pipeline whose answers trace to authorised, current passages, then expand only when leakage, quality, freshness and operational gates hold.

30-Second Cheat Sheet

  • A versioned copy of authoritative content and permissions, kept current by change events and reconciliation.
  • The trust path: verify identity → tenant + permitted-record search → fuse ranks → recheck policy → rerank → select evidence → generate → verify citations.
  • Stop disclosure whenever the permission decision is uncertain.
  • Five rules carry the design; prompt instructions can't substitute for them.
  • Example scale: 100,000 employees, 50 million chunks, 20 average QPS, 100 peak QPS → about 300 in-flight generations.
  • 100 ms full answer → precomputation or a verified cache, with current permissions checked.
  • Separate gates: zero leaks, grounded claims, correct citations, freshness, recall, high-risk escalation, task completion.
  • Start small: one corpus, three personas.

1. Recall the trust path

The path

Versioned copy (change events + reconciliation) → verify identity → search restricted to tenant and permitted records → combine retrieval ranks → recheck policy → rerank → select evidence → generate → verify citations → answer

  • Stop disclosure whenever the permission decision is uncertain.

Five rules carry the design

  1. Missing permissions exclude a document.
  2. Authorisation happens before model exposure.
  3. Freshness and access are different checks.
  4. Citations must support claims.
  5. Insufficient evidence → qualification, abstention or escalation.
  • Prompt instructions can't substitute for those controls.

2. Recall the tests and numbers

Numbers

Item Value
Employees 100,000
Chunks 50 million
Average load 20 QPS
Peak load 100 QPS
In flight at peak About 300 generations (100 QPS × three-second mean), before burst and retry headroom
Budgets Per-stage p95 and per-workflow cost
100 ms full answer Generally needs precomputation or a verified cache, with current permissions checked

Gates and rules

  • Release gates stay separate:
    • Zero permission leaks
    • Grounded claims
    • Correct citations
    • Freshness
    • Retrieval recall
    • High-risk escalation
    • 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.

3. Close in one sentence

Sixty-second close: "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."


Flashcard Drill


Quick Recall: Lines to Say in the Interview

  • "The request uses a versioned copy of content and permissions, kept current by events and reconciliation."
  • "Authorisation happens before model exposure."
  • "Missing permissions exclude the document."
  • "Freshness and access are different checks."
  • "A hundred peak QPS at a three-second mean is about three hundred generations in flight."
  • "A failed provider gets a tested fallback; a failed policy decision stops disclosure."
  • "Zero leaks is its own gate, separate from quality."
  • "One corpus, three personas, then expand."

Where next

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