# Personal Memory With Privacy

> How an AI assistant can remember a person across chats while keeping that memory private, for your AI interview.

**In short:** Save only a few stable facts per person, keep each person's memory apart, let them view and delete it, and make code, not the model, decide who can read what.

AI and LLM interview question Q371, LLM system design. Advanced, occasional (our estimate). From Venkat R. Murty's free Interview Kit: https://designervenkat.online/interview/ai/personal-memory-with-privacy

## Say it in 30 seconds

A personal memory is a short list of facts an assistant saves about one person and reads back in later chats. The privacy part is simple to say and hard to build. Save only stable facts, keep each person's memory apart, let them see and delete it, and have code, not the model, decide who gets read. I would also test it by trying to pull another person's notes out.

## Say it in 2 minutes

Start with what the memory is for. A personal memory is a short list of facts an assistant saves about one person, like a preferred contact channel or the project they are on, and reads back in later chats. That makes the assistant feel like it knows them, which is also why it is risky.

Then set the rules before writing code. Save only stable facts, skip sensitive ones such as health or money, and give every fact an expiry date. Keep each person's rows apart, and let the app, not the model, add the person's ID to every read. A model can be fooled by a line hidden in a web page, so it must never be the part that decides who sees what.

Give people control. They should be able to view, edit and delete what is stored, and use a temporary chat that reads and writes nothing. When someone deletes a memory, remove it from the store, the search indexes and any copies, then test it by asking in a new chat.

Finish with what is still hard. A model can save a wrong fact, and a poisoned line can stay in memory until it expires, so say how you would spot and remove both.

## What is personal memory with privacy, in plain words?

A personal memory is a short list of facts an assistant saves about one person and reads back later: the way they like replies, the project they are on, the branch they bank at. Without it, every chat starts cold. With it, the assistant feels like it knows you, and that is exactly why it needs care.

Think of a hotel concierge. A good one remembers that you want a quiet room and a late checkout. They keep that note in the front office file, not on a sticky note by the lobby door, and you can ask to read it or have it torn up. An assistant needs the same habits: keep the file small, lock it per guest, and let the guest read it.

A real case: a benefits assistant at a mid-size insurer remembers that a member prefers WhatsApp and that her claim is with the Pune office. Those facts help her. The same chat also holds her medical details, and those should never be saved.

- **Memory store:** The database of saved facts, with each row tied to one person.
- **Scope:** Whose facts a read can touch: one person, or one project.
- **Retention:** How long a saved fact is kept before it expires and is removed.
- **Temporary chat:** A chat that reads and writes no memory at all.
- **Model:** The AI that reads the chat and writes the reply.

## How does a memory get saved and read back?

Four steps, and the model does only one of them. The model proposes a fact worth keeping. Code decides whether it is saved, under which person, and who may read it later. When the next chat starts, the app fetches only that person's rows and hands them to the model.

*Diagram, How a memory is saved and read back: The model suggests and code decides, on both the save and the read. Rows are kept per person, so a read is filtered before the model sees anything. Old facts expire unless the person confirms them again.*
1. The person's words reach the model, which proposes any facts worth keeping.
2. The candidate goes to code first, not straight into storage.
3. Code saves it only if it passes the check, under that person's ID.
4. For the next chat, code fetches only that person's rows for the model.

Save less. Keep stable facts such as a preferred channel, a working language or a project name. Skip health, money, passwords and anything the person would not expect to be kept. Store a fact like "Prefers WhatsApp replies in the evening". Never store a diagnosis.

Take the benefits assistant for 40,000 members. Each member has three or four saved facts. A fact not confirmed in 12 months expires, so an old claim office drops out by itself. When a member asks to see her file, the app returns only her rows.

Here is the idea in plain Python. No model is involved: the marked lines decide what is saved and what is read back. The sensitive flag has to be set by a rule in your code, never by the model's own say-so.

```python
# A simplified memory store: facts are kept per member, and every read is filtered in code.
STORE = {}

def remember(member_id, fact, sensitive=False):
    if sensitive:
        return "REFUSED: sensitive, not stored"
    STORE.setdefault(member_id, []).append(fact)
    return "SAVED for " + member_id

def recall(member_id):
    # The filter is code, so no prompt can ask for another member's rows.
    return STORE.get(member_id, [])

def forget(member_id):
    STORE.pop(member_id, None)
    return "DELETED " + member_id

print(remember("member-417", "Prefers WhatsApp replies in the evening"))
print(remember("member-417", "Claim is with the Pune office"))
print(remember("member-417", "Mentioned a diagnosis", sensitive=True))
print(recall("member-417"))
print(recall("member-902"))
print(forget("member-417"))
print(recall("member-417"))
```

Output:

```text
SAVED for member-417
SAVED for member-417
REFUSED: sensitive, not stored
['Prefers WhatsApp replies in the evening', 'Claim is with the Pune office']
[]
DELETED member-417
[]
```

> **Tip:** Say the rule in one breath: the model proposes, code saves and code reads. A model that can read any row can be talked into leaking one.

## What controls do people need, and what do the big assistants offer?

In its 2025 memory announcement, Anthropic says Team and Enterprise users get a separate memory for each project, full control to view and edit what Claude remembers, and incognito chat that does not save to memory. Anthropic describes the project split as a way to keep sensitive work contained. Enterprise admins can turn memory off for a whole organisation.

OpenAI's help page separates two steps. Turning Memory off does not delete past chats. A separate "Delete and turn off memory" step removes the remembered information shown in the summary. OpenAI also offers Temporary Chat for conversations that do not use or update memory.

> "Delete and turn off memory deletes the remembered information shown in the summary and turns Memory off." (OpenAI Help Center)
>
> "You control where and how the data is stored through your own infrastructure." (Anthropic, memory tool docs)

If you build your own assistant, the storage is yours. Anthropic's memory tool works this way: Claude asks for a file operation, and your application runs it. Its example maps the memory path onto a per-user directory or keys in a database. In our reading, the isolation then sits in your storage layer.

> **Tip:** A common wrong answer is that turning memory off deletes it. Check whether the product has a separate delete step, and test that it works.

## What goes wrong with a shared memory store?

Two failures matter most. The first is a leak between people. If a read does not filter by person, one member's notes can come back for another. OWASP lists memory among the live context a model can disclose.

*Diagram, How one member's notes could reach another: One read, two paths. A shared index with no filter can return anyone's notes. A filter added in code limits the read to the person asking, so the second path cannot leak another member's facts.*
1. Member B's question is ordinary and harmless.
2. The bad path searches one index that holds every member's notes.
3. The good path adds Member B's ID as a filter, in code.
4. The bad path returns Member A's notes to Member B.
5. The good path returns only Member B's own facts.

RAG means the app looks up documents and pastes the relevant parts into the prompt.

> "The model discloses live context (system prompt, RAG chunks, files, tool outputs, memory, or another session's data), often because summarization, translation, or extraction surfaces more than was asked, including visually-redacted spans." (OWASP, LLM02:2026)
>
> "A prompt-injection vulnerability occurs when input to a large language model (LLM), whether direct user input, retrieved content, tool output, image, audio, or video content, intermediate reasoning, or persistent memory, alters the model's behavior in ways the application developer did not intend." (OWASP, LLM01:2026)

The second is poisoning. A hidden line in a web page or email gets saved as if it were a fact, and then every later chat reads it back. OWASP's definition of prompt injection already counts persistent memory as an input the model can be steered through. The fix is a gate: fetched text may never write to memory without a check in code.

Keep the prompt out of the security story. A rule such as "never reveal other members' details" helps, but it cannot stop a read that returns the wrong rows.

### How would you let someone delete one memory and prove it is gone?

1. **Delete the row, not just hide it:** Remove the stored fact by its ID, so the app can no longer read it.
2. **Clear the copies:** Remove it from caches, from search indexes (the lookup tables that find text fast), and from any embeddings made from it (number lists that stand for the meaning of text, used for search).
3. **Log the deletion without the fact:** Keep a log line with the time and the ID, never the text that was deleted.
4. **Set the backup expiry:** Backups age out on a set schedule, and you tell the person when that happens.
5. **Test from the user's side:** Ask in a new chat and check that the store and the index return nothing.

For high-sensitivity data, OWASP gives a clear direction: "Isolate per-tenant indexes for high-sensitivity workloads." Separate indexes make a missed filter fail smaller.

## What does the interviewer want to hear?

**A strong answer covers**

- [ ] A plain definition: facts saved per person and read back later.
- [ ] Privacy starts with saving less: stable facts only, with expiry.
- [ ] Every read is filtered by person in code, never by the prompt.
- [ ] Users can view, edit, delete, and use a temporary chat.
- [ ] Leaks and poisoning are named, each with its own fix.
- [ ] Deletion covers the store, indexes and copies, and is tested.

**Common traps**

- Trap: "Tell the model to keep memories private." Better: A prompt is a partial control. Filter by person in code, so the model never receives other rows.
- Trap: "Turning memory off deletes it." Better: Not always. Check for a separate delete step, and test that it works.
- Trap: "Store everything, it may help later." Better: Every stored fact is a leak risk and a retention duty. Save only stable facts, with expiry.

## Can you spot the leak?

**Spot the leak:** Which design lets one member's notes reach another member?

A. Every read filters rows by the member ID that the app checked at login.
B. The search runs over one shared index, with no member filter.
C. The system prompt tells the model never to reveal other members' details.
D. Facts expire 12 months after the member last confirmed them.

**Answer:** B. Only the shared index with no filter lets rows from other members through. The first option is the fix, because the app adds the ID, not the model. The prompt rule and the expiry help, but neither stops a read that returns the wrong rows.

**Quick check:** A claims assistant at an insurer remembers each member's preferred channel and open claim office. Which change protects privacy most?

A. A bigger model that can hold more context in each chat
B. Keep only stable facts, let them expire, and let users delete them
C. A lower temperature so the saved facts come out more accurate
D. A longer system prompt that tells it to keep secrets

**Answer:** B. Saving less, expiring it, and letting the person delete it shrinks what can leak and keeps control with the person. Model size, temperature and prompt wording do not decide who can read the stored rows.

## Can you answer these from memory?

**Flash cards**

- **What is personal memory?** Facts an assistant saves about one person and reads back in later chats.
- **The biggest privacy rule?** Filter every read by the person's ID in code, never by the prompt.
- **Does turning memory off delete it?** Not necessarily. OpenAI lists a separate "Delete and turn off memory" step.
- **What is memory poisoning?** A hidden line gets saved as a fact and replayed in every later chat.
- **What is a temporary chat?** A chat that uses and adds to no memory. Anthropic calls it incognito chat.
- **Who runs the memory tool?** Your app does. Claude asks for a file operation, and your code runs it.

## Likely follow-up questions

- Q163 Short-term vs long-term agent memory? https://designervenkat.online/interview/ai/short-term-vs-long-term-agent-memory
- Q191 What is memory poisoning? https://designervenkat.online/interview/ai/what-is-memory-poisoning
- Q199 How do agents use files as memory? https://designervenkat.online/interview/ai/how-do-agents-use-files-as-memory
- Q097 What is structured note-taking (external memory)? https://designervenkat.online/interview/ai/what-is-structured-note-taking-external-memory
- Q201 What is prompt injection? https://designervenkat.online/interview/ai/what-is-prompt-injection
- Q459 GDPR basics for AI apps? https://designervenkat.online/interview/ai/gdpr-basics-for-ai-apps

## Learn it in depth

- [Memory Systems](https://designervenkat.online/learn/ai-engineering/memory-systems)
- [Security and Privacy Concerns](https://designervenkat.online/learn/ai-engineering/security-and-privacy-concerns)
