Building Agent Memory with Knowledge Graphs
The Neural Maze (Substack) tutorial on giving AI agents persistent memory via a temporal-knowledge-graph instead of vector-based retrieval-augmented-generation. Adds a new angle to this wiki’s knowledge-graph thread: memory whose facts change over time.
The problem it names
Vector stores “lack understanding of identity, relationships, and temporal validity.” When a user’s circumstances change — the worked example is moving cities — a vector store retrieves both the old and new facts as equally relevant, because both are semantically close. The agent can’t tell which is currently true. This is a distinct failure from the ones the wiki already catalogs (see Where it fits).
The approach
- graphiti (from Zep) — incremental knowledge-graph ingestion — over a Neo4j backend, with OpenAI for entity/relationship extraction + embeddings.
- Bi-temporal modeling: every fact tracks when the event occurred and when the system learned it — so superseded facts are retained but time-bounded, not deleted, and “what is true now” is answerable.
- Entity extraction + relationship disambiguation, multi-hop traversal, and hybrid retrieval (semantic + BM25 + graph queries) — the same hybrid stack hybrid-retrieval-rag argues for, here with the graph carrying temporal state.
- Output: a runnable personal-assistant demo that visibly builds the graph during conversation.
Thesis
Graphs are “quietly replacing RAG” specifically for persistent agent systems, where “entities and relationships and how-things-change-over-time are first-class questions.” Vector RAG stays strong for static document retrieval; temporal graphs win for evolving, relationship-rich agent memory.
Where it fits
This wiki’s RAG critique splits by gap — and this source adds the fourth:
- no-accumulation gap → the llm-wiki pattern;
- exact-token gap → BM25 (hybrid-retrieval-rag);
- factual-connection gap → an explicit knowledge-graph (gbrain);
- temporal-validity / evolving-facts gap → the temporal-knowledge-graph (this source). Cross-spoke: agent memory is also an agent-building concern (runner-up agentic-tooling-wiki, where gbrain bridges as the memory layer of gstack, and harnesses like hermes-agent carry persistent memory). Routed here because the substance is knowledge-graph / retrieval architecture.
Related
temporal-knowledge-graph · graphiti · knowledge-graph · gbrain · retrieval-augmented-generation · hybrid-retrieval-rag