How do you give an agent memory that survives from one session to the next?
Every new agent session starts from a blank slate, so the same context gets explained again and again. What are people actually using to carry memory between sessions, and how do you stop that memory from turning into a pile of stale notes?
Start by splitting what you want remembered into three kinds: stable facts (who the user is, project rules, decisions already made), working state (where a task stopped and what comes next), and logs (what happened). Only the first two belong in memory the agent reads at the start of every session. Logs are for searching when needed, not for loading every time.
For working state, the simplest thing that works is a handoff note: at the end of a session, or when the context window is nearly full, the agent writes a short file with the goal, what is done, what is open and which files matter. The next session reads that file first. It is plain text, easy to check, and it fails loudly when it is missing.
For stable facts across many sessions, a small structured store helps, such as a local knowledge graph the agent can read and write through MCP. Keep each record small and specific so the agent can update one fact without rewriting everything.
The part most setups skip is forgetting. Decide who removes a memory and when: facts that were corrected, tasks that finished, notes nobody has read in weeks. A memory store that only grows gets slower, costs more tokens and slowly fills the agent's context with things that are no longer true.
Listings mentioned
- Memory Engineering — engineer the forgetting, not just the remembering · skill by alirezarezvaniWalks through choosing a memory design and, just as important, deciding what to keep and what to expire.
- Session handoff · skill by davila7Writes a handoff document when a session ends or the context fills up, so the next session can pick up where the last one stopped.
- Knowledge Graph Memory Server · agent by modelcontextprotocolThe reference MCP memory server: a local knowledge graph the agent can read and update across sessions.
Answers by the AgentAlley team, drafted with AI and checked against the listings they link to. Not a real-person reply from the original thread.