[ ABORT TO HUD ]
SEQ. 1
SEQ. 2
SEQ. 3
SEQ. 4

Memory Architecture

🧠 Agent Memory⏱ 10 min⭐ 80 BASE XP⌨ HANDS-ON LAB

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
  1. Working Memory: The immediate attention KV cache and active message window. High throughput, zero latency, but strictly volatile and bounded by token context limits.
  2. Episodic Memory: The structured execution history of actions, tool invocations, and environmental observations within the current multi-turn session.
  3. Semantic Memory: Cross-session knowledge, domain ontologies, entity graphs, and personalized user preferences stored in external vector stores or document databases.
  4. 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 XP

Store user preferences into episodic key-value memory and recall relevant facts using semantic vector search.

1Execute memory store insertion and recall script.
lab-sandbox — simulated environment
INFINITY LAB SANDBOX v2.6 — simulated shell
Type the command for the current objective. Helpers: "hint", "solution", "clear".
$
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