You stop an AI agent from citing a document it was never supposed to see by enforcing permissions at retrieval time, using the agent’s own scoped identity. The knowledge layer should only return content that identity is allowed to read. A prompt telling the model to “ignore confidential files” is not a control, because by then the file has already been fetched.

Most retrieval setups index everything into one searchable store and let the agent query it. That works well in a demo. In production, it means a question about parental leave policy can return a paragraph from a named employee’s performance review.

Retrieval doesn’t know who is asking

The typical pipeline copies documents from SharePoint, a file server, or a wiki into a vector index. During that copy, the permissions are dropped. The index holds text and embeddings, not access rules. Every query is answered from the same pool, regardless of who asked or what the agent is meant to do.

The result is a leak with no break-in. Nobody bypassed a control, because the control never made it into the index. An HR investigation summary, a draft board memo, or a compensation spreadsheet can surface in a perfectly ordinary answer, quoted helpfully and with a citation.

The common patch is a system prompt instruction to avoid sensitive material. That asks the model to guess what is sensitive from the text alone. It will get some right and some wrong, and you will not know which until someone reads the answer. Filtering after retrieval has the same flaw: the sensitive content was already in the context window, and it can influence the response even when it is not quoted.

The agent’s identity should decide what the knowledge layer returns

Permission-aware retrieval moves the decision to the only place it can be made reliably: before anything is returned. Each document chunk carries its access rules into the index, such as the groups, roles, or users allowed to read it. Each query carries the identity of the agent making it. The knowledge layer filters on that identity, so a chunk the agent cannot read is never a candidate.

This is where the Identity and Knowledge principles meet. If the agent runs on a shared service account with broad read access, the filter has nothing meaningful to filter on. The agent needs its own scoped identity, one that reflects the job it does. A procurement-support agent reads procurement contracts and supplier policies. It does not read HR files, because its identity was never granted them.

There is a second question: whose permissions apply when a person asks the agent something? Sometimes the answer is the agent’s scope, sometimes the intersection of the agent’s scope and the requesting user’s. The safer default is the narrower of the two. An agent should never let someone read, through a conversation, what they could not open directly.

In our deployments, the knowledge layer runs inside the customer’s own infrastructure and checks the agent’s identity on every retrieval. We also log what was returned and under which policy, so the answer to “why did it cite that?” is a record, not a guess. Cost matters here too: filtering before retrieval keeps unneeded content out of the prompt, which affects what an AI agent costs when every step calls the model.

The project will expose a mess you already had

Permission-aware retrieval is only as good as the permissions it inherits. In most mid-size companies, file shares have years of accumulated drift: folders shared with “Everyone” for a one-off project, departed staff who still own sensitive directories, inheritance broken halfway down a tree, and groups nobody can explain.

Before the agent arrives, this mess was partly hidden by obscurity. People did not find the board folder because they did not know where to look. A search-driven agent removes that obscurity. It will find the overshared folder in seconds, because it is built to find things.

This is not a flaw in the approach, but it changes the project. Expect a permissions cleanup to become part of the scope, and expect it to be the slow part. That is also why a diagnostic comes first: it is far better to learn what a company’s shares really expose before an agent starts answering from them.

Where it still gets hard

Inherited permissions are not always correct permissions. Syncing them faithfully means the agent faithfully reproduces whatever mistakes exist. Sometimes the right fix is to exclude a source from the index until it is cleaned up, which makes the agent less useful in the short term.

Permissions also change. If someone is removed from a group, the index must reflect that quickly. A stale access list is a quiet version of the original leak. Syncing frequently costs engineering effort, and some sources do not expose permissions cleanly at all.

Finally, some documents are individually fine but sensitive in combination, and no per-document rule catches that. Those cases take judgment and, often, a human approval gate rather than a filter.

The question to sit with

If you pointed a search tool at your file shares today, what is the worst document it could find that a junior employee could technically open? If you do not know, that is the first thing to find out, and it is what a Book a diagnostic call is for.