HindsightAgent MemoryKnowledge Graph
What is Hindsight? Agent memory, knowledge graph and use cases
Hindsight is a memory system for AI agents. This guide explains why agents need memory, why entities and a knowledge graph help, how the operations retain, recall and reflect work, how Hindsight differs from RAG, and its use cases.
Key points
- Hindsight does not store conversations: it extracts what was said into typed facts and builds further knowledge on them.[1]
- It has three operations: retain stores what happened, recall finds it again, and reflect reasons over it.[1]
- Each fact is linked to the entities it mentions and to the facts that share them, so a question can be answered from two facts that were never stored together.[1]
- Recall runs four searches in parallel (semantic, keyword, graph and, when the query names a date, temporal) and fuses their results.[2]
- The documentation recommends plain RAG for questions over a static set of documents, and Hindsight for AI assistants with persistent memory.[3]
One short exchange runs through this article as the example. A user tells an agent: "Alice joined Google in March, she loves the research team." The agent replies: "Noted, I'll suggest her for the ML project."1 It comes from the Architecture Deep Dive, the interactive figure of the Hindsight documentation that is shown below.
The four interactive figures in this article are the documentation's own. The Hindsight repository, which contains them, is published under the MIT License.4 This article describes the documentation labelled version 0.10, as of October 2026.1
Why AI agents need memory
An AI agent without memory starts every conversation from zero: it has no context about who you are, what was discussed or what it has learned.1 The Hindsight documentation says the problem is harder than it looks, and names four points:1
TopicWhat is an agent harness? How it works, its parts and use cases describes where a memory system such as Hindsight plugs into the loop of an agent through hooks.- Time. "What did Alice do last spring?" asks about a period, and text that merely sounds similar does not answer it.
- Connected facts. Knowing "Alice works at Google" and "Google is in Mountain View" should allow an answer that was never stored directly.
- Consolidation. A coding assistant that remembers "the user prefers functional programming" should consolidate it into an observation and weigh it when it makes recommendations.
- Point of view. The same information means different things to memory banks with different personalities. A memory bank is the store of one user or agent.
What is Hindsight?
Hindsight is a memory system for AI agents. It does not store conversations: it extracts what was said into typed facts and then builds further knowledge on them.1 The original text is kept as a source document, but recall and reflect search the memories, not the documents.5
Apps reach Hindsight's three operations through SDKs, MCP or plain HTTP.1 All three work on one memory bank, which is isolated from the others and stored in a Postgres database with the pgvector extension.1
TopicWhat is MCP (Model Context Protocol)? How it works and its use cases describes MCP, the protocol named here.The figure runs the example through all three operations:
One detail is easy to miss: the bank already held the observation "Alice works at Microsoft". After retain, a background worker updates that observation and adds no second one, and both facts stay as its sources.1
A bank holds five types of memory. The first two are extracted from what the agent sends; the other three are built from them.1
| Memory type | What it is | Example in the documentation |
|---|---|---|
| World fact | An objective claim the bank was told1 | "Alice works at Google."1 |
| Experience fact | Something the bank itself did1 | "I recommended Python to Bob."1 |
| Observation | A belief consolidated from many facts, with its evidence and its history1 | "User was a React enthusiast, has now switched to Vue."1 |
| Mental model | A curated summary for a question you ask often: a saved reflect answer that you create16 | A model named "Team overview"1 |
| Knowledge page | A living document the bank writes about itself, kept in a tree of folders1 | A page that answers "What's our error-handling convention?"1 |
Entities and the knowledge graph
A knowledge graph is a network of real-world entities and the relationships between them: any object, place or person can be a node, and an edge defines the relationship between nodes.7 Hindsight links each fact to the entities it mentions (people, organizations, places, products and concepts) and to the other facts that share them.15
These links make a question answerable from two facts that were never stored together.1 Microsoft Research writes that the majority of RAG (retrieval-augmented generation) approaches search by vector similarity, and that baseline RAG "struggles to connect the dots" when answering a question requires traversing separate pieces of information through their shared attributes.8 Hindsight's graph search returns facts that are not similar to the query in meaning or wording but are connected to it through the graph.2
The documentation shows this with three stored facts and one question. A search by similarity retrieves only the facts about Alice; the graph leads from Alice to Project Atlas, then to Kubernetes and the outage.3
- The fact about AliceA search by similarity retrieves the facts about Alice only.3
- Linked through Project AtlasFacts that mention the same entity are linked5, so the graph leads from the first fact to this one.3
- Linked through KubernetesThis fact names the outage, where the documentation's path through the graph ends.3
The graph of one memory bank in Hindsight's own interface: 172 memories and 5,364 links between them, coloured by the kind of link (semantic, temporal, entity or causal).1
Hindsight builds this graph when the agent stores something with retain(). The figure follows two texts about the same person:5
Two things happen to entities and facts on the way in. First, different spellings become one entity: "Alice", "Alice Chen" and "Alice C." are matched by the similarity of the names, supported by which entities appear together and when. This can go wrong: on a bank with a lot of history, a short new name that resembles an existing entity, and appears alongside entities that the existing one is already associated with, can be absorbed into it.5
Second, the facts are connected by four kinds of links:5
| Link | What it connects | Question it helps to answer |
|---|---|---|
| Entity | All facts that mention the same entity | "Tell me everything about Alice" |
| Time | Facts close in time, more strongly for closer dates | "What else happened around then?" |
| Meaning | Facts with a similar meaning, also in different words | "Tell me about similar topics" |
| Cause | A cause and its effect | "Why did this happen?" |
Hindsight also tracks two times: when an event happened and when the bank was told about it. A question about 2024 then finds an event that was reported in 2025. A general fact such as a preference has no time of its own.5
Recall and reflect
The two reading operations differ in what they return: recall returns memories, and reflect returns an answer.1
Recall: four searches, one ranking
No single search method handles every kind of question, so recall runs four searches in parallel: by meaning, by exact words, through the entity graph and by time. The search by time runs only when the query names a date.2
TopicKeyword, semantic and knowledge graph search: hybrid search explained describes how the result lists of several searches are merged into one.The four result lists are merged by rank, not by score, so a memory that several searches agree on ranks higher. A cross-encoder then reads the query and each of the top candidates, 300 by default, as a pair. Three small multipliers adjust its score: how recent the memory is (at most ±10%), how close it is to a time window in the query (±10%) and, for observations, how much evidence supports it (±5%).2
Memories are taken from the top until max_tokens is used up, 4,096 tokens by default.2
Reflect: an answer with its sources
Reflect runs an agent loop over the bank. The agent decides what it needs and calls its own tools, for up to ten rounds, and it cannot answer before it has retrieved something.1
The loop reads the most refined knowledge first: mental models and knowledge pages, then observations, then raw facts through recall, and the source chunk or document when it needs the exact wording.1 An observation is marked stale when new facts are still waiting to be consolidated; the agent then verifies it against the facts.6 Only memories that were actually retrieved can be cited.1
How a bank answers depends on three settings. They shape reflect only: recall returns the same memories whoever is asking.1
| Setting | What it is | Example in the documentation |
|---|---|---|
| Mission | The bank's identity in plain language, which tells it what to prioritise1 | "I am a research assistant specializing in ML. I prefer simplicity over cutting-edge."1 |
| Directives | Hard rules it must never break1 | "Never recommend specific stocks."1 |
| Disposition | Skepticism, literalism and empathy, each on a scale from 1 to 51 | Code review: skepticism 4, literalism 5, empathy 26 |
Speed of the three operations
Hindsight does the slow work when it writes, so that reading is fast: facts are extracted, embedded and linked during retain and not during a search. The comparison table in the documentation gives these typical latencies:9
| Operation | Typical latency | Main bottleneck |
|---|---|---|
| Recall | 100–600 ms | The re-ranker, when it runs on a CPU |
| Reflect | 800–3,000 ms | The LLM that writes the answer |
| Retain | 500–2,000 ms per batch | The LLM that extracts the facts |
Extracting facts is structured work, so retain does not need a large model: the documentation recommends the model gpt-oss-20b.9
Hindsight, RAG and use cases
Traditional RAG retrieves the documents that are similar to a query. The documentation compares the two like this:3
| Capability | Traditional RAG | Hindsight |
|---|---|---|
| Search | Semantic similarity only | Semantic, keyword, graph and temporal |
| Questions across several facts | Limited to the retrieved chunks | Follows the links between entities |
| Questions about time | Matches a keyword such as "spring" | Parses the date and filters by the range |
| Entities | None | Resolves entities and tracks which appear together |
| Disposition | None | Three traits influence the interpretation |
The documentation recommends RAG for questions over a static set of documents and for search without time requirements. It recommends Hindsight for AI assistants with persistent memory, for applications that track entities, for a consistent disposition and for questions about time such as "last month".3
For coding agents the overview says "18 harnesses, one install" and shows Claude Code, Cursor and Codex among them.1 For reflect it gives disposition presets for customer support, code review, legal analysis, therapy or coaching, and research assistance.6
The bottom line
Hindsight gives an AI agent a memory that is built from facts, entities and links, not from saved conversations. Retain writes it, recall searches it in up to four ways, and reflect answers from it with sources. For questions over a static set of documents, its own documentation recommends plain RAG.
Sources
- Overview Hindsight docs
- Recall: How Hindsight Retrieves Memories Hindsight docs
- RAG vs Memory Hindsight docs
- LICENSE Hindsight repository on GitHub
- Retain: How Hindsight Stores Memories Hindsight docs
- Reflect: Agentic Reasoning with Disposition Hindsight docs
- What is a knowledge graph? IBM
- GraphRAG: Unlocking LLM discovery on narrative private data Microsoft Research
- Performance Hindsight docs
Written by Rahmatullah Musawi with the help of an AI assistant.