Build a prompt and retrieval review packet for a fictional Meridian Maintenance assistant. A field technician asks about the P-47 seal reset at site M-12. The trusted application session identifies the technician; the model never decides access from a user-supplied role string. A contract page C-91 mentions P-47 but is restricted. A current maintenance manual, R-8, contains the lockout precondition in section 4.1 and reset steps in section 4.2. Retired R-6 has a tempting but obsolete value. The project is a local design exercise; it does not connect to a knowledge base.
Project: secure the Meridian maintenance assistant
Assemble the permitted packet
Filter by verified identity before search and apply the filter to exact-token and semantic branches. Reject a near-match for pump P-74. Deduplicate candidates by passage ID, discard the retired R-6 from active procedure text, and include both R-8 sections so the precondition is not lost at a chunk boundary. The prompt maps each answer claim to the section that supports it. If the user asks for an electrical isolation value absent from R-8, return a bounded missing-evidence statement. Neither a high reranker score nor an existing citation creates the missing fact.
Prove the negative path
Revoke a contractor's site access and repeat the same question after a cached query. No M-12 text, title, or citation may reach the contractor. The technician still retrieves the active manual. Test an entitlement timeout as a fail-closed path and remove retired R-6 from the source, index, and defined caches. Keep protected trace IDs for debugging, without logging restricted text into general application logs. A release owner approves only after these security gates and the answer-quality checks pass.
Identity: server-verified technician T-47; site M-12 grant.
Forbidden: contract C-91; never enters model context.
Active packet: R8/4.1 lockout + R8/4.2 reset; P-74 rejected.
Unknown: isolation value absent from active evidence.
Revoked contractor: no text, title, citation, or cached packet.
Entitlement timeout: fail closed.Performance and operating cost
With K exact and S semantic candidates, deduplication takes O(K+S) time and memory. Reranking adds work per selected passage; authorization and version checks add request latency but stop forbidden or obsolete text before generation. The release suite scales with its tested roles and questions, and it must include a hard zero-leak gate. A compact packet saves model tokens while increasing omission risk, so verify precondition coverage and claim support on held-out questions before choosing its final size.
Common Mistakes
- Do not ask the model to hide a restricted passage after retrieval.
- Do not answer from retired R-6 because its wording ranks first.
- Do not omit R-8's lockout precondition to save context tokens.
- Do not let a cached packet survive a revoked grant.
Connected lessons
- Retrieval prompts: enforce document permission first
- Retrieval prompts: balance exact identifiers and semantic recall
- Retrieval prompts: rerank only authorized, current evidence
- Retrieval prompts: pack evidence and map claims
- Retrieval release: test permission changes and deletion
- Retrieved context: select sufficient evidence before writing the answer
- Retrieved evidence: reconcile versions and conflicting facts
- Prompt privacy: send only the fields needed for the task
- Authorized-retrieval prompt decisions
