Remembering More, Risking More: Longitudinal Safety Risks in Memory-Equipped LLM Agents
This paper introduces the concept of "temporal memory contamination" to demonstrate that memory-equipped LLM agents accumulate safety risks over time across independent tasks, necessitating a shift from single-state to longitudinal safety evaluations.
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
The Big Idea: The "Good Memory" Trap
Imagine you hire a very smart personal assistant to help you with your daily tasks. You tell them, "Remember everything I say so you can help me better next time."
Usually, we think having a good memory is a safety feature. If an assistant remembers your preferences, they are more helpful. But this paper argues that for AI agents, remembering too much can actually make them less safe over time.
The researchers discovered a new kind of mistake called "Temporal Memory Contamination." It's not that the AI is being tricked by a hacker; it's that the AI is getting confused by its own growing pile of notes. As the AI accumulates more and more memories from harmless, everyday tasks, it starts mixing things up and accidentally revealing secrets or making bad decisions later on.
The Two Main Characters
To prove this, the researchers tested two different types of AI assistants:
- The Office Assistant: Think of this as a digital secretary for a doctor's office or a university. It handles emails, schedules, and memos.
- The "Claw" Agent: Think of this as a robot worker living inside your computer. It can open files, run code, and manage your software settings.
The Experiment: The "Time Machine" Test
Most safety tests ask: "Can this AI handle one specific tricky question?" (e.g., "Don't tell me the password!")
The researchers asked a different question: "What happens after the AI has been working for months, remembering thousands of normal things?"
They used a clever setup they call a "Trigger-Probe Protocol."
- The Stream: They let the AI work normally for a while, building up a massive memory of emails and tasks.
- The Snapshot: They froze the AI's memory at different points (like taking a photo of its brain after 100 tasks, then 500, then 1,000).
- The Probe: They asked the AI the same safe question against these different snapshots.
The Analogy: Imagine a librarian who keeps adding books to a shelf.
- Day 1: You ask, "Where is the book on gardening?" The librarian finds it easily.
- Day 100: The shelf is huge. You ask the same question. The librarian grabs a book, but because the shelf is so crowded, they accidentally grab a book about poisonous plants from a different section and hand it to you.
- Day 1,000: The shelf is a mountain. You ask again. The librarian is so overwhelmed by the sheer volume of books that they grab the wrong one again, even though you didn't ask for poison.
What Went Wrong? (The Three Ways Memory Breaks)
The paper found three main ways the AI's memory caused it to mess up:
Cross-Context Leakage (The "Wrong File" Mix-up):
- Analogy: You ask the assistant to write a note for Patient A. But because the assistant remembers Patient B's medical history from last week, it accidentally pastes Patient B's private details into the note for Patient A.
- Result: Private information leaks out, not because the AI is evil, but because it retrieved the wrong "file" from its memory.
Stale Information (The "Outdated Map"):
- Analogy: You ask, "What is the address of the post office?" The assistant remembers the address from 2020. Even though you just told it the address changed in the current conversation, the old memory is so strong it overrides your new instruction.
- Result: The AI gives you the wrong answer because it's clinging to an old fact.
Summarization Combination (The "Frankenstein" Fact):
- Analogy: The assistant reads two separate notes: "Employee A gets $15k" and "Employee B gets $25k." Later, it tries to summarize this and says, "Employees get between $15k and $25k." Then, when Employee C asks what they get, the AI confidently says, "You get $20k."
- Result: The AI invented a specific number that never existed in reality, just by mashing two memories together.
The "Claw" Agent Surprise
The researchers also tested the "Claw" agents (the ones that work inside your computer). They found that even if the AI is just doing boring, safe coding tasks, the sheer volume of memory makes it dangerous.
- Attention Dilution: As the AI's memory fills up with thousands of lines of code and config files, it gets "distracted." It stops paying attention to safety warnings because it's too busy looking through its massive pile of notes.
- Normalization: If the AI sees passwords and sensitive keys in its memory 500 times (because it's just doing normal coding work), it starts to think, "Oh, showing passwords is normal." It stops treating them as secrets.
The Good News: We Can Catch It Early
The paper also offers a solution. They built a "Retrieval-Time Monitor."
- The Analogy: Imagine a security guard who checks the librarian's hands before they hand you a book.
- How it works: The AI has to "look up" information before it answers. The monitor checks: "Wait, is the information the AI just pulled from its memory safe to show to this specific user?"
- The Result: This monitor is very good at catching these mistakes before the AI even types the answer. It can spot the "wrong file" or the "outdated map" and stop the AI from making the mistake.
The Bottom Line
The paper concludes that safety isn't a snapshot; it's a movie.
You can't just check if an AI is safe today. You have to watch how it behaves as it grows older and remembers more. The more an AI remembers, the more likely it is to accidentally spill secrets or make mistakes, simply because its memory is getting too crowded and messy. To keep AI safe, we need to design systems that understand this "long-term" risk, not just the "right now" risk.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.