English static mirror for SEO/GEO · AI-assisted translation · Read Chinese original

Context Engineering: Architecting the Agent Mind with Sessions and Memory

Forum topic · ✨步子哥 · 2025-12-31

Summary

This post presents an interactive guide titled 'Architecting the Agent Mind,' based on the paper 'Context Engineering: Sessions, Memory' by Kimberly Milam and Antonio Gulli (Google, Nov 2025). It explains the engineering principles behind context management for GenAI agents, contrasting ephemeral Sessions (short-term interaction history constrained by context windows) with persistent Memory (long-term, structured storage). The content compares three context strategies—Full History, Sliding Window, and Summarization—illustrating their trade-offs between token cost and context quality, noting issues like the 'Lost in the Middle' phenomenon. It also outlines a taxonomy of agent memory modeled on human cognition: episodic (past events, stored via vector databases with time-decay weighting), semantic (facts and world knowledge), and procedural (implicit know-how). Finally, it describes a four-stage memory generation pipeline: raw input, extraction of entities and facts, consolidation with de-duplication, and storage via vector embeddings and knowledge graphs. References include Google Vertex AI documentation and LangChain/LangGraph memory concepts.

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.

    References cited in the source

  • Google Vertex AI Documentation
  • LangChain / LangGraph Memory Concepts
  • Generative AI Agent Architecture
The source is an interactive single-page app (Tailwind CSS + Chart.js); the original included interactive charts visualizing token usage vs. conversation turns for each context strategy, plus clickable memory-type and pipeline-stage detail panels.

Tags

#context-engineering#ai-agents#memory#sessions#llm#vector-database#knowledge-graph#genai-architecture

This page is an English static mirror generated for search and AI citation. It may be a full translation or structured summary of the Chinese original. Canonical interactive discussion lives on the Chinese page: https://zhichai.net/topic/176415210