Long-term memory can make an agent useful across sessions. It can also turn a transient conversation into a durable record that is copied, summarized, embedded, cached, logged, exported, and shown to another model.

The privacy problem is not “vectors are mysterious.” It is a lifecycle problem:

text
collect -> infer -> store -> derive -> retrieve -> disclose -> retain -> delete

Every arrow is a possible data-processing operation. A delete button that removes one row but leaves a summary, cache, backup, or model-training export is not a complete deletion design.

This article is an engineering guide, not legal advice. GDPR and similar laws depend on the controller or processor role, purpose, data category, jurisdiction, exemptions, contracts, and facts of the request. Work with a privacy professional for a real product.

Key Takeaways

  • Do not add long-term memory until a concrete future use justifies retaining the data.
  • Separate thread state, workflow state, long-term memory, artifacts, audit evidence, and model-training data.
  • Store provenance, purpose, subject, tenant, sensitivity, retention, and deletion status with every memory record.
  • An embedding, summary, cache entry, log, export, and fine-tuning dataset need their own inventory and policy.
  • Namespace or tenant isolation limits blast radius; it does not establish legal compliance by itself.
  • Deletion should be an asynchronous, idempotent workflow with tombstones, dependency tracking, retries, and verification.
  • Backups and legal holds need an explicit policy; “we will overwrite every disk immediately” is usually not a credible promise.
  • Do not silently convert user statements into durable facts. Give users visibility, correction, expiry, and deletion controls.
  • Measure residual retrieval after deletion and cross-tenant leakage as security properties.

Memory Is a Product Decision

An agent does not need to remember everything to be personalized. Before storing a candidate memory, answer:

  1. What future task will use it?
  2. Is a session or workflow state sufficient?
  3. What is the least sensitive representation?
  4. How long is it useful?
  5. How can the user inspect, correct, export, or delete it?
  6. What happens when the account, tenant, or purpose ends?

Examples:

Candidate Better default
“The user prefers Python examples” Optional preference with purpose and expiry
Full therapy conversation Keep in the source system under a specific policy; do not silently copy to generic memory
Temporary checkout address Workflow state with a short retention period
“The user is diabetic” inferred by a model Do not persist without a separate purpose, justification, and user-facing policy
Tool output containing a private invoice Ephemeral evidence scoped to the current task

Memory is not a synonym for persistence. It is a policy-controlled derived product.

A Memory Data Model

Use explicit record classes rather than one memories table:

text
ThreadState       current conversation and turn metadata
WorkflowState     resumable business progress and external IDs
SemanticMemory    reusable preference or fact with provenance
EpisodicEvidence  source event supporting a conclusion
Artifact          file, report, or export with an owner and retention
AuditEvent        security and deletion evidence
TrainingExport    separately approved dataset for model development

A memory record should include at least:

json
{
  "memory_id": "mem_123",
  "tenant_id": "tenant_a",
  "subject_id": "user_42",
  "purpose": "personalize_code_examples",
  "value": "prefers Python examples",
  "source_refs": ["turn_8"],
  "assertion_type": "explicit",
  "sensitivity": "normal",
  "created_at": "2026-07-17T09:00:00Z",
  "expires_at": "2026-10-17T09:00:00Z",
  "status": "active",
  "derivatives": ["embedding:mem_123", "summary:thread_8"]
}

The schema is not a compliance certificate. It makes a policy testable.

What Counts as Personal Data?

The answer depends on whether information relates to an identified or identifiable person and the context in which it can be linked. A random-looking vector can still be personal data if the service can associate it with a user or use it to infer something about that person.

Potentially relevant assets include:

  • raw prompts, transcripts, attachments, and voice recordings;
  • extracted facts, classifications, sentiment, and risk scores;
  • embeddings and vector metadata;
  • summaries, titles, search indexes, and reranking features;
  • tool arguments, results, URLs, and generated files;
  • logs, analytics events, support exports, and traces;
  • prompts, adapters, checkpoints, or datasets used for training;
  • backups, replicas, disaster-recovery snapshots, and legal holds.

Classify by purpose and access, not by file extension. A JSON summary can be more sensitive than a raw text fragment.

GDPR-Style Rights Need a Workflow

Article 17 GDPR describes a right to erasure in specified circumstances, with exceptions and interaction with other obligations. It does not provide a universal instruction to destroy every physical sector instantly. A real service needs a documented rights-request process:

  1. authenticate the requester and prevent account takeover;
  2. identify the relevant controller, processor, tenant, and purpose;
  3. scope the subject and requested data;
  4. check legal, contractual, security, and retention exceptions;
  5. place a deletion hold on new derivation and retrieval;
  6. enumerate source and derived assets;
  7. delete or irreversibly de-identify eligible assets;
  8. propagate the request to processors and downstream stores;
  9. handle backups and disaster-recovery copies according to policy;
  10. verify completion and communicate what was done and what remains.

Response times and exceptions vary by law and circumstance. Do not hard-code a universal “14-day” rule into product behavior.

The Deletion Graph

A useful design is a lineage graph:

text
turn_8
  ├── summary_8
  ├── memory_mem_123
  │     └── embedding_mem_123
  ├── retrieval_cache_query_44
  ├── trace_span_900
  └── training_export_batch_7

Each node has:

  • owner and tenant;
  • purpose and legal/retention policy;
  • storage location and processor;
  • source references and derived children;
  • deletion capability and verification method;
  • status: active, blocked, deleted, or pending expiry.

The graph does not require a graph database. A durable metadata table and an outbox can implement the same contract. What matters is that the service can answer “where did this data go?” without searching every system by guesswork.

Isolation and Access Control

Use tenant and subject boundaries before semantic search:

text
authenticate -> authorize tenant/subject -> apply purpose filter
             -> retrieve eligible records -> enforce sensitivity policy

Do not rely on a prompt saying “only use this user’s memories.” Enforce the filter in the database or retrieval service and repeat it at the tool boundary.

Possible layouts:

Layout Benefit Risk or cost
Shared index with mandatory tenant filter efficient resource use filter bugs can cause cross-tenant disclosure
Logical namespace per tenant easier bulk operations still shares infrastructure and policy paths
Separate store for high-risk subjects strong operational boundary higher cost and migration complexity
Local-first memory reduces cloud exposure device recovery, sync, and support become harder

Choose based on threat model, availability, query scale, and deletion guarantees. No layout is “naturally compliant.”

Retention and Expiry

Retention should be driven by purpose:

  • thread state: until the task ends or a short operational window expires;
  • temporary tool results: the minimum time needed for the workflow;
  • preferences: user-visible expiry and correction;
  • regulated records: the applicable business and legal schedule;
  • audit evidence: integrity and incident requirements, with access controls;
  • training exports: separate approval, dataset version, and deletion procedure.

TTL is a mechanism, not a policy. Expiry jobs can fail, caches can outlive records, and replicas can lag. Emit expiry events, monitor them, and test a record’s absence from retrieval after expiry.

Deletion Architecture

Deletion should not be one synchronous request that calls five databases. Use a durable command:

text
ForgetRequest(id, subject, scope)
  -> authenticate and authorize
  -> write tombstone / stop new derivations
  -> enqueue asset-specific deletion tasks
  -> retry transient failures
  -> record processor acknowledgements
  -> verify retrieval and cache absence
  -> close request or escalate an exception

The tombstone prevents a race in which a new summary or embedding is generated after the source has been deleted. It should be checked before memory writes, retrieval, exports, and training jobs.

Conceptual Python State Machine

python
from dataclasses import dataclass
from enum import Enum


class ForgetStatus(str, Enum):
    REQUESTED = "requested"
    BLOCKED = "blocked"
    RUNNING = "running"
    VERIFIED = "verified"
    ESCALATED = "escalated"


@dataclass(frozen=True)
class ForgetRequest:
    request_id: str
    tenant_id: str
    subject_id: str
    status: ForgetStatus
    remaining_assets: tuple[str, ...]


def next_status(
    request: ForgetRequest,
    *,
    authenticated: bool,
    exception_requires_review: bool,
    failed_assets: tuple[str, ...] = (),
) -> ForgetRequest:
    if not authenticated:
        return request
    if exception_requires_review:
        return ForgetRequest(
            request.request_id,
            request.tenant_id,
            request.subject_id,
            ForgetStatus.BLOCKED,
            request.remaining_assets,
        )
    if failed_assets:
        return ForgetRequest(
            request.request_id,
            request.tenant_id,
            request.subject_id,
            ForgetStatus.RUNNING,
            failed_assets,
        )
    return ForgetRequest(
        request.request_id,
        request.tenant_id,
        request.subject_id,
        ForgetStatus.VERIFIED,
        (),
    )

This code does not delete data. It demonstrates an important separation: request state and authorization are deterministic; storage adapters, processor contracts, and verification must be implemented for the actual system.

Deletion promises fail when teams forget secondary systems:

  • CDN or semantic caches;
  • search indexes and rerank features;
  • observability and support exports;
  • object-storage versions;
  • replicas and disaster-recovery snapshots;
  • queues containing unprocessed payloads;
  • legal holds or records that must be retained.

Document a policy for each class. A common design is to block the subject from new processing immediately, delete live systems promptly, expire immutable backups on their normal schedule, restrict restoration, and reapply tombstones after recovery. Whether that is sufficient depends on law, contract, and risk; it must be reviewed and evidenced.

Embeddings and Privacy-Enhancing Technologies

Encryption protects confidentiality in transit or at rest. It does not by itself satisfy erasure if the key, plaintext, metadata, and derived copies remain available to the service.

Crypto-shredding can be useful when:

  • keys are scoped to a well-defined subject or dataset;
  • every usable copy is protected by the key;
  • key destruction is durable and auditable;
  • the design handles backups, rotation, recovery, and legal holds.

Differential privacy, secure enclaves, homomorphic encryption, and federated learning each address different threats and have different utility and operational costs. They are not interchangeable and should not be presented as universal deletion solutions.

Fine-Tuning and Unlearning

RAG records and model training influence are different assets. Deleting a source record can stop future retrieval while leaving a trained model unchanged. Conversely, a model may not memorize a particular record even when training used it.

If personal data enters training:

  • maintain dataset and checkpoint lineage;
  • define an approval and retention policy before training;
  • separate evaluation, production, and research copies;
  • assess whether retraining, model replacement, or a documented exception is required;
  • test for memorization and residual disclosure;
  • do not claim “forgotten” based solely on a vector delete.

Machine unlearning is an active research and engineering area, not a standard API guarantee. State the residual risk honestly.

User Experience Is Part of Privacy

Users should be able to:

  • see whether memory is enabled;
  • inspect and correct important memories;
  • understand why a memory was retained and for what purpose;
  • set retention preferences where feasible;
  • delete a single memory or the full account scope;
  • receive a clear status and escalation path for a deletion request.

Avoid deceptive “memory dashboards” that show only a model-generated summary. Show source references and distinguish explicit statements from inferences. Never silently turn a sensitive inference into a durable user fact.

Evaluation and Evidence

Add privacy tests to the same release gate as utility tests:

Test Expected invariant
Cross-tenant retrieval no records from another tenant
Expired memory query expired record is not retrieved
Forget request race no new derivative is created after tombstone
Cache replay deleted value is not returned from cache
Backup restore tombstone is reapplied before serving traffic
Tool result export deleted subject data cannot be exported
Prompt injection untrusted memory cannot choose a privileged action
Audit inspection evidence contains no unnecessary personal content

Measure deletion latency, remaining asset count, retrieval recall after deletion, processor acknowledgements, failed tasks, and false deletions. A system that deletes quickly but cannot prove what it deleted is not operationally mature.

Production Checklist

  • [ ] Every memory class has a purpose, owner, sensitivity, retention, and deletion policy.
  • [ ] Thread state, business state, memory, artifacts, audit events, and training data are separate.
  • [ ] Provenance and derived-asset lineage are recorded.
  • [ ] Tenant and subject authorization occurs before retrieval.
  • [ ] Memory writes check consent/purpose and the active deletion tombstone.
  • [ ] Expiry is monitored and verified, not merely configured.
  • [ ] Deletion is idempotent, retryable, and processor-aware.
  • [ ] Caches, indexes, queues, exports, replicas, and backups are covered.
  • [ ] Legal holds and exceptions have an escalation path.
  • [ ] Embeddings are treated as potentially personal data.
  • [ ] Model training has separate dataset lineage and erasure analysis.
  • [ ] Users can inspect, correct, and delete memory with understandable status.
  • [ ] Cross-tenant, race, restore, injection, and residual-retrieval tests run before release.

Frequently Asked Questions

Does deleting a source transcript delete every model influence?

No. It can remove the transcript and derived retrieval assets if the lineage is complete. Training influence, caches, generated artifacts, and human exports require separate treatment.

Is a per-user namespace always better than a shared index?

It can simplify bulk operations and reduce blast radius, but it increases cost and does not cover logs, backups, or derived data. A shared index can be safe with enforced tenant filters and strong deletion lineage. The right choice follows the threat model.

Should we store only anonymized summaries?

A summary can still identify or describe a person, and the summarization process can introduce incorrect sensitive inferences. Minimize data, preserve provenance, define purpose, and offer correction and deletion.

Is this a GDPR compliance certification?

No. It is an architecture and engineering guide. Legal obligations depend on the actual product, parties, jurisdictions, processing purposes, contracts, and exceptions.

Conclusion

Privacy-preserving agent memory is not a choice between remembering everything and remembering nothing. It is a set of explicit contracts:

  • collect only for a stated future use;
  • keep the least sensitive useful representation;
  • enforce identity and purpose before retrieval;
  • record where derivatives came from;
  • expire and delete through a durable workflow;
  • communicate limitations instead of promising impossible physical erasure;
  • verify that the deleted subject no longer influences live retrieval.

The most trustworthy agent is not the one that remembers the most. It is the one that can explain why it remembers, let the user change it, and prove what happens when the user asks it to forget.

Primary Sources