Skip to main content

Agent Privacy Is a Context Problem, Not a Model Problem

Most agent privacy failures come from what gets assembled into the context window and where that context is persisted, not from what the model was trained on.

Close-up of a server rack with patch cables and status LEDs, representing context and memory infrastructure.

Agent privacy failures are rarely caused by what a model was trained on. They are caused by what gets assembled into the context window and where that context is persisted. The controls therefore belong in the retrieval and memory pipeline, not in the model weights.

Where private data actually enters a run

Three ingress points dominate real incidents.

Retrieval joins are the largest ingress. A single unfiltered index can pull another tenant's rows into a prompt. The join is the problem: a vector search over a shared collection returns nearest neighbours regardless of principal, and the prompt assembler has no notion of tenancy unless the retrieval layer enforces one. In practice, the leak is not a malicious query; it is a routine similarity match that crosses a boundary the index never modelled.

Tool results are a second ingress. Tool output is rarely subject to the same classification rules as stored documents. A CRM lookup, a ticket fetch or a filesystem read returns text that flows straight into the next prompt. If the tool does not carry a label, the assembler cannot refuse it. The result is that the least governed data path in the system is often the one with the widest reach.

Memory writes are the durable failure. When an agent summarises a context and stores the summary, it creates a new record with a new, weaker access policy. The original document may have been tenant-scoped; the summary may be global. Nothing in the write path records who authorised the derivation or which sources contributed. The leak then persists long after the original access was revoked.

Why model-level privacy work does not cover this

Differential privacy and unlearning operate on weights. They are relevant when private data influenced training, but the leak described above happens in the assembled prompt and its logs. A perfectly private model will still emit another tenant's row if that row was placed in its context.

Redaction at the output stage is post-hoc. It cannot undo a tool call made on the basis of leaked context. If the agent already queried an external system, sent an email or wrote a record, output filtering changes nothing about the side effect.

Fiber optic cables closeup

Provider-side retention policies do not govern your own vector store or trace buffer. Those are your systems of record. A provider's data-processing terms say nothing about how long your retrieval index keeps a deleted document, or whether your trace buffer retains a prompt containing a customer identifier.

The practical consequence is that privacy work scoped to the model leaves the actual failure surface untouched. The controls have to live where context is selected, labelled, serialised and stored.

Design rules for context governance

Classify at retrieval time, not at ingestion time. The same document has different sensitivity in different joins. A support transcript is low sensitivity when joined to its own ticket and high sensitivity when joined to a billing record. Ingestion-time classification cannot express that, because it does not know the query. Retrieval-time classification can, because it sees the principal, the purpose and the join.

Carry an access label through every hop and refuse to serialise an unlabelled fragment into a prompt. This is the central invariant. A fragment without a label is not a fragment with unknown sensitivity; it is a fragment that must not enter the context window. The assembler should fail closed. The trade-off is real: fail-closed assembly breaks runs that would otherwise succeed, and it requires every tool and retriever to emit labels. Teams that skip the label contract usually discover the cost later, when they cannot answer which documents entered a given run.

Treat memory writes as a write to a system of record. A memory record needs an owner, a retention period and a deletion path. It also needs provenance: which sources contributed, under which labels, authorised by which principal. Without provenance, deletion is guesswork.

A concrete mechanism that makes this enforceable is a labelled fragment envelope. Every retriever and tool returns a structure rather than a string:

{
  "content": "...",
  "label": "tenant:acme/confidential",
  "principal": "user:17",
  "purpose": "support-triage",
  "source_id": "doc:8842",
  "derived_from": ["doc:8842", "ticket:551"]
}

The assembler accepts only envelopes whose label is compatible with the run's principal and purpose. It records every accepted envelope in a per-run manifest. Memory writes copy the label and the derived_from list, so a later deletion can walk the derivation graph.

Fiber optic cables macro

The honest trade-off is latency and complexity. Label resolution adds a lookup per fragment, and the label algebra — how to combine labels from multiple sources — is genuinely hard. A conservative rule is to take the most restrictive label in any join and to refuse joins across incompatible labels. That is safe and it will block legitimate cross-tenant analytics unless a separate, audited path exists for them. The alternative, permissive joining, is what produces the incidents.

Instrumentation that makes it testable

Privacy claims that cannot be tested are marketing. Three instruments make the pipeline testable.

Emit a per-run manifest. For each run, record which documents entered context, under which label, and which principal authorised it. The manifest is the ground truth for incident response and for the deletion tests below.

Build a deletion test. Remove a source document and assert that no derived memory survives. This is a test in the ordinary sense: it runs in CI, it fails when provenance is incomplete, and it catches the case where a summary outlives its source. Without provenance on memory writes, this test cannot be written.

Sample traces for cross-label co-occurrence. Rather than reading prompts by hand, sample traces and flag runs where labels from incompatible scopes appear together. Co-occurrence is the signal that a join crossed a boundary, and it is detectable without inspecting content, which keeps the monitoring pipeline itself out of scope for sensitive data.

These instruments also change how the system is reviewed. A reviewer can ask for the manifest of a run, the label algebra that permitted a join, and the deletion test result, instead of reading prompts and guessing.

What this means for architecture

Context governance is a pipeline property, not a model property. It requires that retrieval, tools and memory all speak the same label language, that the assembler fails closed, and that memory writes are treated as writes to a system of record with provenance. The model can then be swapped without renegotiating the privacy boundary, because the boundary was never in the model.

The remaining work is organisational: agreeing on label semantics, owning the deletion path, and accepting that fail-closed assembly will sometimes refuse a run that a human would have allowed. That refusal is the control working, not the control failing. For teams building agent systems, the useful question is not which model is used but which documents entered the context, under which label, and who authorised it.

ShareXLinkedInPermalink5 min read

Questions this answers

Why is retrieval the largest privacy ingress for agents?

A vector search over a shared index returns nearest neighbours regardless of principal. If the retrieval layer does not enforce tenancy, a routine similarity match can pull another tenant's rows into the prompt. The join, not the query, is the failure point.

Can output redaction fix a context leak?

No. Redaction is post-hoc and cannot undo a tool call made on the basis of leaked context. If the agent already queried an external system or wrote a record, filtering the output changes nothing about the side effect.

What is a labelled fragment envelope?

A structure returned by every retriever and tool that carries content plus label, principal, purpose, source identifier and derivation list. The prompt assembler accepts only envelopes whose label is compatible with the run, and records them in a per-run manifest.

How do you test that memory deletion actually works?

Remove a source document and assert that no derived memory survives. This runs in CI and fails when provenance is incomplete. It cannot be written without provenance on memory writes.