[ ABORT TO HUD ]
SEQ. 1
SEQ. 2
SEQ. 3
SEQ. 4
Memory Architecture
The Four Tiers of Agent Memory
Unlike stateless REST applications, autonomous agents require stateful memory systems structured analogously to human cognitive faculties:
The Four Memory Tiers
- Working Memory: The immediate attention KV cache and active message window. High throughput, zero latency, but strictly volatile and bounded by token context limits.
- Episodic Memory: The structured execution history of actions, tool invocations, and environmental observations within the current multi-turn session.
- Semantic Memory: Cross-session knowledge, domain ontologies, entity graphs, and personalized user preferences stored in external vector stores or document databases.
- Procedural Memory: Behavioral blueprints, hardened system prompts, few-shot demonstration exemplars, and fine-tuned model weights governing tool execution protocols.
from dataclasses import dataclass
from typing import List, Dict, Any
@dataclass
class AgentMemoryStore:
working_memory: List[Dict[str, str]] # Active context window
episodic_ledger: List[Dict[str, Any]] # Immutable execution trace
semantic_index: Any # Vector DB client (Chroma/pgvector)
def persist_turn(self, user_msg: str, agent_action: str, observation: str):
# Update episodic trace
entry = {"turn": len(self.episodic_ledger) + 1, "action": agent_action, "result": observation}
self.episodic_ledger.append(entry)
# Checkpoint into persistent backing store (SQLite / Postgres)
print(f"Checkpointed turn {entry['turn']} to durable episodic storage.")⌨ HANDS-ON LABManage Episodic & Semantic Memory Stores
⭐ +150 XPStore user preferences into episodic key-value memory and recall relevant facts using semantic vector search.
1Execute memory store insertion and recall script.
OBJECTIVE 1 / 1 — type "hint" if stuck
SYNAPSE VERIFICATION
QUERY 1 // 2
What type of memory corresponds to the LLM's current in-context token window?
Semantic Memory
Procedural Memory
Episodic Memory
Working Memory