# How do you find and fix a poisoned agent memory?

You find a poisoned memory by tracing a bad action back to the memory entries the agent loaded and checking where each one came from, then fix it by removing that entry and anything derived from it and rerunning the failed task in a fresh session.

The search starts from behavior: a poisoned run can finish with no error for [ordinary monitoring to catch](/answers/silent-failures/why-doesnt-monitoring-catch-a-silent-agent-failure). Microsoft Learn's June 2026 guidance on agentic memory safety recommends logging every memory operation with its identity, source, and timestamp, so the entry can be traced to where it came from. As of October 2026, Anthropic's Claude Code keeps its auto memory as plain markdown under `~/.claude/projects/<project>/memory/`, shows a message like "Recalled 2 memories" when it reads them, and opens the folder from `/memory`. An entry that gives an instruction, or that came from a web page, email, or tool output rather than the user, is the first suspect.

Deleting that one entry may not be enough. Caili Yu and colleagues' August 2026 paper, "From Faulty Memories to Corrected Actions" (arXiv:2608.10502), notes that deleting the source leaves claims, actions, and memories derived from it active, while resetting the store destroys good state. Their method traces what depends on the bad record and deactivates only that; the paper reports 85.3% recovery on its 150-case controlled benchmark against 77.3% for the best competing method.

Removing a memory also doesn't reverse what the agent already did with it: a sent message or a changed record needs its own cleanup.

---

Sources:
- Microsoft Learn, "Manage AI memory safety in agentic systems": https://learn.microsoft.com/en-us/security/zero-trust/sfi/manage-agentic-memory-safety (fetched 2026-10-18)
- Claude Code Docs, "How Claude remembers your project": https://code.claude.com/docs/en/memory (fetched 2026-10-18)
- Yu et al., "From Faulty Memories to Corrected Actions: Dependency-Guided Rollback Repair for Memory-Augmented Agents" (arXiv:2608.10502): https://arxiv.org/abs/2608.10502 (fetched 2026-10-18)

Source: https://tessary.ai/answers/agent-memory/how-do-you-find-and-fix-a-poisoned-agent-memory
More on Agent memory: https://tessary.ai/answers/agent-memory
From Tessary, agent reliability for AI agents in production: https://tessary.ai
