An enterprise retrieval prompt cannot enforce document permissions by asking the model to ignore forbidden passages. Authentication, tenant scope, document access, and permission changes belong to a trusted retrieval service. That service must obtain the caller's identity from the application session, filter candidate documents before context assembly, and fail closed when entitlement data is missing. The prompt receives only permitted passages and stable evidence identifiers. Treat document metadata supplied by the user as a request for a filter, not an authorization token. A citation to a restricted document is a disclosure even when the answer omits its full text.
Retrieval prompts: enforce document permission first
Operational case
Meridian Maintenance stores equipment instructions and separate restricted contract notes. A field technician asks how to reset pump P-47. A restricted contract page mentions the same pump and ranks first by text similarity, but the technician has no contract access. The retrieval service excludes that page before ranking and sends the model only two approved maintenance passages. The answer explains the reset with their evidence IDs. If the entitlement service times out, the assistant does not search unrestricted content and hope the prompt will hide it; it returns a bounded access-unavailable response. A supervisor with a different verified identity may see additional material through a separate request.
Caller identity: authenticated technician T-47 from server session.
Allowed corpus: maintenance manuals, site M-12.
Excluded before model context: restricted contract C-91.
Retrieved evidence: M-12/P47/A and M-12/P47/B.
On entitlement timeout: stop; do not fall back to global search.Performance and operating cost
Permission filtering adds an entitlement lookup and candidate restriction to every retrieval request. With an indexed permission field, selection depends on the search system; a naive scan across N documents would cost O(N). Cache grants only within their validity window and invalidate them when access changes, or a stale cache can leak a revoked page. The model's token cost should fall when forbidden and irrelevant passages never enter context. Count denied candidates in protected telemetry, but do not expose their titles to an unauthorized caller.
Common Mistakes
- Do not let the user supply their own access-group string as proof.
- Do not retrieve globally and ask the model to ignore restricted hits.
- Do not reveal a denied document's title in a fallback answer.
Connected lessons
- Prompt engineering applications
- Prompt Engineering
- Retrieved context: select sufficient evidence before writing the answer
- Prompt privacy: send only the fields needed for the task
- Generated output: validate again at the destination boundary
- 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
- Project: secure the Meridian maintenance assistant
- Authorized-retrieval prompt decisions
