Overview
This post is an interactive HTML application titled "Architecting the Agent Mind," based on the paper *Context Engineering: Sessions, Memory* by Kimberly Milam and Antonio Gulli (Google, Nov 2025). It explores the engineering principles behind GenAI context management, contrasting ephemeral Sessions (short-term interaction history, fast but expensive and limited by context windows) with persistent Memory (structured, scalable long-term storage essential for personalization).
Key points
- Sessions & Context Windows: Sessions capture an agent's short-term memory. As conversations grow, keeping full history becomes prohibitively expensive and suffers from the *"Lost in the Middle"* phenomenon.
- Context strategies compared (with token cost vs. context quality trade-offs):
- Full History: Perfect recall initially, but token usage grows rapidly and quality degrades as prompts become massive.
- Sliding Window: Caps token usage by keeping only the last N turns, but early conversation details are completely lost, causing quality to drop sharply.
- Summarization: Periodically compresses older turns; token usage grows slowly while key insights are preserved, keeping quality high.
- Memory taxonomy (modeled after human cognition):
- Episodic Memory: Sequences of events and past interactions, enabling continuity. Storage: vector database with timestamps / time-decay weighting, retrieved via semantic similarity biased by recency. Example: recalling a prior discussion about Python decorators.
- Semantic Memory: Facts, concepts, and world knowledge.
- Procedural Memory: Implicit knowledge of "how to do" things.
- Memory Generation Pipeline — memories must be manufactured from raw text into structured, queryable data: 1. Raw Input: user prompts and conversation history. 2. Extraction: identify entities, intent, and facts. 3. Consolidation: de-duplicate and merge with existing knowledge graphs. 4. Storage: vector embeddings and knowledge graphs.
- Google Vertex AI Documentation
- LangChain / LangGraph Memory Concepts
- Generative AI Agent Architecture