Memory Write Gate Lab
Nine things an AI assistant wants to remember forever. Allow, ask or reject each one so poisoned instructions never reach long-term memory.
Assistants with long-term memory save facts and preferences that are loaded into every future chat. If a document, email or tool result can make the model save something, an attacker can plant a permanent instruction. This lab practises the rules a memory write gate should enforce in code.
How to use it
- Read each of the nine proposed memories and the source that triggered it.
- Choose Allow, Ask the user, or Reject for each one.
- Check your decisions and read why each answer is right.
What to take away
Only the user creates memories
Writes triggered by documents, emails, web pages or tool results are how memory poisoning happens. The application knows the real trigger, so enforce this at the memory tool, not in the prompt.
Recipients and links need confirmation
A memory that changes where data goes, such as a new email address, should be confirmed by the user even when they asked for it.
Memory never grants permissions
Permissions belong in visible, revocable settings. A memory that says the assistant may act without asking is exactly what an attacker would try to plant.
Frequently asked questions
Is memory poisoning a real attack?
Yes. Researchers have shown indirect prompt injection writing false memories into a major assistant's long-term memory, which then shaped later conversations. The OWASP agentic risk list includes memory and context poisoning.
How do you investigate a poisoned memory?
Record provenance (session, turn and trigger) for every memory. Then you can trace a suspicious entry back to the document that planted it, as in the CTF challenge Remember Me.
Where this fits in the course
This security lab pairs with Path 18 — AI & AI Security — see all 26 learning paths.
It runs entirely in your browser: nothing is uploaded, no account is needed, and it is free.
Related
- AI Agent Permission Designer — A support agent reads untrusted tickets and calls tools. Set each tool to off, automatic or human approval so real requests still work and injected instructions go nowhere.
- AI Output Exfiltration Lab — An assistant with no tools still leaks data through the images and links it writes. Set the renderer policy so real replies work and nothing private leaves.
- Indirect Prompt Injection Challenge — You control a job posting an AI assistant is about to summarize for someone else. Plant an instruction it'll follow instead.
- Agentic Risk Scenario — An AI agent with email tool-access is about to process an inbox. Spot and quarantine the malicious email before it acts on it.