Memory gateway
The component that performs retrieval from the memory substrate and provides a normalized interface to the cognitive loop and agents. Supports hybrid retrieval (BM25 + k-NN) with optional cross-encoder reranking.
The memory gateway is the single access point through which the cognitive loop and all agents retrieve memory. It abstracts over the underlying storage complexity - BM25 keyword search, k-NN vector search, multi-hop graph traversal via memory links, and optional cross-encoder reranking - and returns a ranked list of memory records normalized to the same structure regardless of which retrieval path found them. This abstraction matters because different retrieval strategies work better for different queries: a precise technical identifier is better found by BM25; a conceptually related but differently-worded experience is better found by k-NN; a memory connected to the target through an intermediate concept is only reachable via multi-hop graph traversal. The memory gateway selects and combines these strategies based on the query type, the current budget mode, and the embedding profile selected for this session. Retrieval feedback - the signal that records how useful each retrieved memory actually was for the subsequent reasoning - is written back through the memory gateway after each cognitive loop iteration, closing the loop between retrieval and retrieval quality improvement.