Agent Memory
Agent memory retains and retrieves selected state or information so an AI agent can maintain continuity within a task or across interactions.
Download Markdown (.md)Soroush’s Product Wiki · https://wiki.soroush.uk/topic/agent-memory/
01What it means
Agent memory is an application mechanism for carrying information forward into future decisions. Short-term memory commonly tracks a conversation or task; long-term memory persists information across sessions. Implementations include structured profiles, event records, summaries, and retrieved notes. Stored information affects a model only when made available through context or tools; storing a memory does not itself update model weights.[1][2]
- 01ObserveTask state, explicit preference, inferred information
- 02Select + recordProvenance, timestamp, scope, owner
- 03RetainPolicy, access, correction, deletion
- 04RetrieveRelevant authorized records only
- 05Reconcile + usePrefer newer evidence; preserve attribution
Persistence does not update model weights; retained information matters only when the application supplies it through context or tools.
02Why it matters
Continuity can reduce repeated explanations and support longer tasks, but incorrect or stale memories can influence many later interactions. Product design must define what the system remembers, whose information it uses, and how users can inspect or correct it.
03When to use it
Use memory when retained context delivers a clear benefit, such as resuming a task or honoring a stated preference. Prefer explicit profile fields for simple durable settings. Avoid collecting conversational details merely because storage is available, particularly when retention would surprise users.
04How it works
- Identify the continuity need and separate task state, explicit preferences, and inferred information.
- Define storage scope, ownership, retention, and controls for viewing, correcting, and deleting retained information.
- Write selected records with provenance and timestamps, distinguishing user statements from model-generated summaries.
- Retrieve only relevant authorized information and resolve conflicts against newer evidence before using it.
- Evaluate recall, stale information, mistaken attribution, and cross-user isolation, including behavior after correction or deletion.
05A practical example
A research assistant remembers that a user prefers brief summaries and retains a project's unresolved questions. It offers a view of saved information and keeps project notes separate from personal preferences. When the user changes the brief, the assistant updates the relevant record rather than repeatedly applying the older summary.
06Where it breaks
Summaries can omit constraints or convert uncertain statements into apparent facts. Retrieval can miss relevant records or surface obsolete ones. More retained information increases storage, retrieval, and governance work; a larger context window alone does not solve these problems.
Common mistakes
- Describing stored notes as permanent learning in the model's weights.
- Saving every message without a defined purpose or retention policy.
- Treating model-inferred preferences as confirmed user statements.
- Deleting the visible conversation while leaving associated memories active.
07Sources
- Memory overviewLangChain · Official documentationMemory overview
- Effective context engineering for AI agentsAnthropic · Official documentationEffective context engineering for AI agents