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, includingreview_conflicts - Keep
EDGE_EVIDENCE_ENABLEDat its defaulttrue— the review stage is skipped when edge evidence is off
Code in Action
What Just Happened
Step 1: Remember Dated Facts
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
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
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.