Skip to main content
A minimal guide to reviewing conflicting facts with improve(). Use it when two sources in the same dataset assert different values for one attribute — here, two documents naming different CEOs for the same company — and you want Cognee to record the disagreement, ordered by each source’s date, instead of silently keeping both.

Before You Start

  • Complete Quickstart to understand basic operations
  • Ensure you have LLM Providers configured — the review stage is skipped when no LLM is available
  • Read Improve for how improve() runs its stages, including review_conflicts
  • Keep EDGE_EVIDENCE_ENABLED at its default true — the review stage is skipped when edge evidence is off

Code in Action

The dataset is kept after the run so you can inspect it, and every run uses a fresh dataset name.

What Just Happened

Step 1: Remember Dated Facts

Each source is wrapped in a DataItem whose external_metadata carries the date the source’s claims hold as of, under the key the review reads (effective_date by default, configurable with IMPROVE_EFFECTIVE_DATE_KEY). self_improvement=False keeps remember() from improving on its own, so the review runs only when the script asks for it.

Step 2: Run the Conflict Review

review_conflicts=True opts in to the review_conflicts stage of improve(), which is off by default (IMPROVE_REVIEW_CONFLICTS=true enables it too). An LLM reviews the dataset’s source facts and their dates, stores each disagreement it accepts as a FactConflict node, and updates the affected entity descriptions. result.stage("review_conflicts") returns that stage’s result, including its status.

Step 3: Inspect the Stored Conflicts

Each FactConflict node describes one attribute of one entity with competing values, and its outgoing edges link it to the entity it is about, the competing values, and the source chunks it cites. The facts themselves carry conflict marks — read_conflict_marks() reads them on any graph backend — that record each fact’s status within the conflict: current, superseded, or conflicting.

Step 4: Repeat on Unchanged Data

The review keeps a watermark per dataset and re-reviews only entities whose facts changed since the last run. With no new facts and no unfinished conflicts to repair, the second run reports the stage as already_completed instead of calling the LLM again.

Self-Improving Memory Quickstart

How improve() runs its stages and what each one does.

Temporal Knowledge Graph

The other time axis: when a fact happened, not when its source dated it.