Overview

Agent memory is the state an agent keeps between sessions by writing text to storage and reading it back, since the model itself remembers nothing once the context-window is cleared. Most designs use two tiers: a small curated file such as MEMORY.md injected into every session’s prompt, and a larger log of notes or transcripts the agent searches on demand. Hermes Agent caps its curated file at 2,200 characters; Claude Code loads the first 200 lines or 25KB of its auto-memory file.

Memory differs from instructions: a memory file records what the agent learned, while files like AGENTS.md or CLAUDE.md state the rules a human wrote. Memory text re-enters the prompt, so a poisoned entry persists across sessions; scan and review writes.

Example

A user says “I use pnpm.” The agent writes Use pnpm, not npm to MEMORY.md, and next week’s session starts with that line already in context.