Skip to main content
← All use cases

The scenario

You have been recording facts for months. Nobody built an ontology, nobody tagged anything — and there is already a graph of who and what keeps appearing together, because extraction names entities as it stores each memory.

Step 1 — Read the graph

Nodes are entities; edges are co-occurrence — two entities appearing in the same memory, weighted by how often.

Step 2 — Address one entity

observations fills as the space consolidates what it has stored about that entity — which is how you get a dossier nobody wrote.

Step 3 — Cut the noise

On a real space most entities are mentioned once. min_count is what turns a hairball into something readable.

Evals

  1. Record four facts that connect three entities. Check the expected edges exist with the expected weights.
  2. Raise min_count and confirm the long tail drops out.
  3. Fetch an entity and check observations is populated — if it is empty on a busy space, consolidation has not run yet rather than failed.

Guardrails

Edges are co-occurrence, not typed relationships. The graph says two entities keep showing up together. It does not say one owns, acquired or reports to the other. Do not build a UI, or a sales claim, that implies typed predicates.
  • Entity names come from extraction, so the same person can appear under two spellings if your source text does.
  • Read it as a map, not a database. It is excellent for “what is this space mostly about” and wrong for anything needing exactness.

The script

Complete and runnable: knowledge_graph.py.