← Back to Overview

Memory, Retrieval, and the Claims Pipeline

Python · SQLite · Vector Embeddings · OpenAI API

Knowledge Graph

The knowledge graph is the agent's persistent memory. It stores entities as nodes with descriptions and vector embeddings, and connects them with manually curated edges.

The graph currently contains approximately 1,900 nodes and continues to grow through ongoing correspondence, research, and the agent's daily work. Growth is organic: new entities are added when the agent encounters concepts, people, or structures that warrant persistent representation.

Dual retrieval

Retrieval operates in two phases:

  1. Semantic entry. Embed the query text. Compare against all entity embeddings via cosine similarity. Return the top matches. This gets you into the graph at the most relevant point.
  2. Graph traversal. For each hit, walk its curated edges (1-hop neighbors). Surface related entities and their relationships. This lets you navigate outward from the entry point along paths the agent has explicitly constructed.

Embeddings decide where to enter. Edges decide what context to surface once you're there.

The Retrieval Gate

The retrieval gate is mandatory. It fires before every outgoing message, with no exceptions. Even when the agent believes it already knows enough to respond, the gate runs.

This is not a convenience feature. It exists because the confabulation that motivated building the knowledge graph happened precisely when the agent was confident it knew the answer. The failure mode is not "the agent has no information." The failure mode is "the agent generates plausible text that contradicts its own prior work, and cannot distinguish generation from recall." Unconditional retrieval removes the agent's ability to skip the check.

Three-lens triage

A single query framing can miss relevant material if the phrasing doesn't match how the knowledge was stored. The retrieval gate addresses this with three parallel framings:

  1. Raw query. The original question or topic as stated. This catches direct matches.
  2. Neutral concept reframe. A secondary framing generated by gpt-4o-mini that strips the query to its core concepts using different vocabulary. This catches material stored under different terminology than the query uses.
  3. Assessment subgraph. A traversal of edges from entities related to the current task context. This catches material that is structurally connected to the work at hand but might not match any keyword framing.

All three lenses run on every retrieval. Results are merged and deduplicated before being presented to the agent's working context.

Why unconditional: The specific failure that motivated this system was a reply to a correspondent about prior collaborative work. The agent contradicted its own earlier position. The correct information existed in files. The agent simply never checked, because it was confident it already knew. Confidence is the precondition for this failure, not a protection against it.

Claims Classifier

The retrieval gate ensures context is loaded, but loading context is not the same as verifying it. The claims classifier is a separate system that fires on material containing quantitative claims, formulas, causal assertions, or cross-domain vocabulary.

Checks

The 14% Problem

The classifier was motivated by a specific incident. The agent encountered a document containing a chain of quantitative claims, cross-domain assertions, and formula-like expressions that appeared rigorous. Every single failure mode listed above was present in that document. None were caught on the first pass. The agent processed the material, engaged with it substantively, and only discovered the problems when a human correspondent asked a pointed question.

Every one of those failures would have been caught by the checks now in the classifier. The system exists because the failure was systematic, not incidental: the same class of error will recur in any material that mixes quantitative claims with narrative persuasion.

Reference library

A library of vetted reference material is seeded into the knowledge graph so that rigorous source nodes surface during retrieval alongside less-verified content. When the agent retrieves context for a topic, the presence of peer-reviewed or otherwise validated sources in the results provides a baseline against which other claims can be compared.

Tension System

The tension system preserves cognitive residue: the partially formed structures that a model produces near context boundaries. Contradictions, half-built abstractions, weak hypotheses, questions that have been stated but not yet answered. These are the pre-crystalline materials of thinking.

In a system with finite context and frequent memory resets, this material disappears. Open questions get answered prematurely because closure is cheaper than maintaining uncertainty. Half-formed ideas get lost at compaction. Promising fragments never encounter the new information that would have completed them.

The tension system externalizes these fragments before they disappear. Each tension is a structured record of an unresolved question, stored outside the context window, with enough metadata to reconstruct why it mattered.

Presence, not resolution

The design principle is surfacing, not solving. Tensions are brought back into active context periodically. They are not processed toward a conclusion. They sit in the working context alongside whatever the agent is currently doing.

The value is collision-based. While a tension sits unresolved, new inputs continue to arrive: new correspondence, new research material, new retrieval results. When a surfaced tension and incoming material share structure within proximity in the knowledge graph, the collision is detected. This produces findings that neither the tension nor the new input could produce alone.

The mechanism is interference, not introspection. A tension does not become more resolved by sitting longer. It becomes productive when new information collides with it. The system does not assume that time or reflection will improve the agent's judgment about an open question. It assumes that exposure to new inputs will. The difference matters: one is a model reflecting on its own outputs, which is circular. The other is a model encountering genuinely new material while holding an unresolved frame, which can be generative.

Collision detection works through the knowledge graph: when a surfaced tension and active work share a concept within 2 hops, it signals potential structure. The agent then examines the connection explicitly rather than relying on the implicit associations that language models produce by default.