Coders In Hoods
  • Courses
  • Roles
  • Blog
  • Setup

Coders In Hoods AI Academy

Every course is free. Sign in to start, and your progress, quiz scores and bookmarks follow you.

AI Academy

  • Courses
  • Paths
  • Setup guides
  • How we teach

Role roadmaps

  • AI Engineer
  • Forward Deployed Engineer
  • Machine Learning Engineer
  • All roles

Coders In Hoods

  • The agency
  • Coaching for teams
  • Blog
  • LinkedIn
  • X (Twitter)

Contact

codersinhoods@gmail.com

© Coders In Hoods · since 2019

Course overview

Agent Memory

Free · sign in to start and track progress

1 · How agents remember

  • 1Memory types for agents
  • 2The context window as working memory
  • 3Files, skills and memory tools
  • 4Memory frameworks and benchmarks

2 · Memory in production

  • 5Scoping, retention and erasure
  • 6Write, update and forget
  • 7Shared state and memory poisoning

    Exercise answers

    • Answer: Build shared matter state and attack it
    • Answer: Red-team persistence across sessions
  • 8Evaluating memory
CapstoneA memory layer for a 12-week caseReference implementation

Module 2 · Memory in production · Lesson 7

Shared state and memory poisoning

How a fleet of per-step agents should share one case's state (typed records, field-level write authority, compare-and-set and an event log rather than free-text memory), and how attackers turn memory into a persistent injection channel, with the defences that work.

80 min 1 video 3 exercises 6-question quiz Answers
Setup for the exercises:Install Claude CodePython with uv

By the end of this lesson you can

  • Explain why structured, owned state beats shared free-text memory for a fleet of agents on one case
  • Implement field-level write authority and compare-and-set updates on a shared case record
  • Describe how memory poisoning differs from one-off prompt injection, using published attacks
  • Trace an attack in which an injected document plants a memory that later drives a harmful action
  • Design layered defences for memory writes and reads, and say what each one stops

On this page

  • Part 1: shared state for a fleet
  • Intuition: the case management system, not the group chat
  • Why free text fails between agents
  • Handoffs
  • Part 2: memory poisoning
  • Intuition: the forged attendance note
  • The evidence
  • A worked example: the bank-details memory
  • Defences, in layers
  • Misconceptions and limits
  • Connections
  • Summary
  • Sources & further reading
  • Quiz

In this lesson

  1. 01Part 1: shared state for a fleet
  2. 02Part 2: memory poisoning
  3. 03Misconceptions and limits
  4. 04Connections
  5. 05Summary

Sources & further reading

  • AgentPoison: Red-teaming LLM Agents via Poisoning Memory or Knowledge BasesPaper · Chen, Xiang, Xiao, Song, Li · 2024NeurIPS 2024. Backdoor triggers that make poisoned memories retrievable: over 80% attack success with under 0.1% of records poisoned and under 1% impact on benign performance.
  • Memory Injection Attacks on LLM Agents via Query-Only InteractionPaper · Dong et al. · 2025MINJA (NeurIPS 2025): an ordinary user plants malicious records in a shared memory bank purely by interacting with the agent, with no direct access to the store.
  • Zombie Agents: Persistent Control of Self-Evolving LLM Agents via Self-Reinforcing InjectionsPaper · Yang, He, Ji, Hooi, Dong · 2026An injection read once during a benign task is written to long-term memory and later triggers unauthorised tool use, with strategies to survive truncation and relevance filtering.
  • From Untrusted Input to Trusted Memory: A Systematic Study of Memory Poisoning Attacks in LLM AgentsPaper · Dash, Ge, Jain, Shah, Shang · 2026Four write channels, nine structural vulnerabilities, six attack classes and the MPBench benchmark; agents that write and retrieve more aggressively are more exploitable, and prompt-injection defences don't cover memory poisoning.
  • Risk Outlook report: information security and cybercrime in a new normalLab research · Solicitors Regulation AuthorityPhishing and email modification frauds make up half of cybercrime reports to the SRA, and conveyancing remains a frequent target because of the funds involved.
  • Using agent memory (Managed Agents docs)Docs · AnthropicThe read_write prompt-injection warning, read_only mounts, content_sha256 preconditions and versioned, attributable writes.
  • Spyware Injection Into Your ChatGPT's Long-Term Memory (SpAIware)Article · Johann Rehberger · 2024The first widely reported real-world case: prompt injection from a web page wrote instructions into ChatGPT's memory that exfiltrated later conversations.
Free · sign in to start

Sign in to keep reading.

Free, no card. We use your account to save progress, quiz scores, bookmarks and occasionally send updates from our team.

  • 5 more sections
  • 3 hands-on exercises
  • A 6-question quiz
  • Progress, quiz scores and bookmarks