AI and agents · Context and memory · 6 min

Memory engineering: useful memory without piling up noise

An agent’s memory needs policies for writing, retrieval, retention and forgetting.

Agent memoryGraph RAGRetention

Remembering is a product decision

Not every exchange deserves to be persisted. Useful memory classifies which facts, preferences, decisions and evidence should outlive the session, who can query them and when they stop being valid.

Separating working memory, history and curated knowledge keeps an incidental conversation from contaminating an enterprise source of truth.

Events
Governed memory
Retrieved context
Writing · relevance · expiry · permissions

Retrieval must also be explainable

Each retrieved fragment must keep its origin, date, access scope and relationship to the task. That way an answer can justify not only its content but the knowledge path it used.

Expiry and review policies reduce outdated information. Memory is not an infinite archive: it is a capability that is trained, evaluated and corrected.

Reading the diagram

How to read this system

  1. 01New information arrives as a candidate, not as persistent truth.
  2. 02The agent queries relevant memory and separates session state, durable knowledge and semantic relationships.
  3. 03Short-term memory keeps current work; long-term memory requires an owner, retention and updates.
  4. 04Retrieval returns context with origin, permissions and validity to justify why it appeared.

Essential concepts

Technical terms

Working memory
Temporary context of an active task.
Expiry
Date or condition that invalidates a piece of data.
Semantic memory
Knowledge and relationships between entities.

Architecture

Implications and controls

Separating raw events, curated knowledge and retrieval indexes prevents an incidental conversation from becoming an enterprise source of truth.

Risks to consider

  • Outdated or contaminated memory.
  • Excessive retention.
  • Cross-access to sensitive information.

Checklist

  • Define which events can be written.
  • Record origin, owner and permissions.
  • Apply expiry, correction and deletion.
  • Explain why each entry was retrieved.

Conclusion

Useful memory is not an infinite archive: it is knowledge with purpose, permissions and review.