What You’ll Build
Three heterogeneous sources — a plain-text developer profile, a JSON export of human/assistant coding conversations, and a Markdown guide to the Zen of Python — go into memory under two node sets, with an OWL ontology grounding the entities that get extracted. Amemify() pass then consolidates the graph, and you get two interactive HTML snapshots (before and after) plus answers to two questions: one that has to reach across the conversations and the principles document at once, and one deliberately scoped to the principles alone.
The complete runnable script is
examples/demos/comprehensive_example/cognee_comprehensive_example.py —
this page walks through its key moments rather than reproducing it.
Features in Play
- NodeSet Grouping — labels the profile and conversations as
developer_dataand the Zen guide asprinciples_data, so the second question can be answered from the principles alone - Ontology Quickstart — the bundled OWL file grounds extraction in a shared vocabulary instead of letting each source invent its own entity names
- Memify — the consolidation pass that runs between the two snapshots and enriches the connections across sources
- Graph Visualization — renders the graph twice, so the effect of consolidation is something you can look at rather than infer
- Recall — answers both questions with
GRAPH_COMPLETION, once across the whole graph and once filtered to one node set
Before You Start
- Complete Quickstart to understand basic operations
- Ensure you have LLM Providers and Embedding Providers configured
- The script sets
os.environ["LLM_API_KEY"] = "your_api_key"at the top as a placeholder — replace it with your own key, or delete the line if your.envalready carries one - Run it from a cognee repo checkout rather than a copy-paste: it reads three bundled files from the sibling
data/folder —copilot_conversations.json,zen_principles.md, andbasic_ontology.owl - The run starts with
cognee.forget(everything=True), which wipes all existing Cognee data — use a setup you can afford to reset
How It Works
Stage 1: Locate the Bundled Sources
Stage 2: Ground Extraction in the OWL Ontology
import cognee — Cognee reads env-backed settings at import time, so setting it afterwards would not take effect. Every source ingested below is extracted against this shared vocabulary.
Stage 3: Ingest Three Sources into Two Node Sets
remember() calls that differ in what they take — an inline string, a JSON path, and a Markdown path — but land in the same graph. The node sets do the sorting: the engineer’s profile and their conversations become developer_data, the Zen guide becomes principles_data. self_improvement=False skips the automatic enrichment pass so that the memify() call in the next stage is the only consolidation step, and its effect is visible in isolation.
Stage 4: Snapshot the Graph Before and After Consolidation
memify(). The first file shows what ingestion alone produced — the two node sets and the ontology-grounded entities under them; the second shows the graph after consolidation has enriched the connections between them. Opening both is the point of the stage.
Stage 5: Ask a Question That Spans Sources
AsyncWebScraper appears only in the conversation export; “Python’s design principles” only in the Zen guide. Neither source answers this question alone, and with no node-set filter the recall traverses the whole graph — so the answer has to be assembled from both.
Stage 6: Scope Recall to One Node Set
principles_data via node_name. This is what the tagging in Stage 3 bought: a question about conventions answered from the principles document, without the engineer’s own past code influencing the answer.
Run It
Python Pattern Analysis: followed by an answer that connects the scraper implementation to specific Zen principles, and Filtered search result: followed by a naming-convention answer drawn from the principles document. It also leaves two HTML files in an .artifacts folder next to the script — graph_visualization_nodesets_and_ontology.html and graph_visualization_after_memify.html — which you open in a browser to compare the graph before and after memify().
NodeSet Grouping
Learn the tagging this demo uses to keep two topics apart in one graph.
Ontology Quickstart
Step through grounding extraction in your own OWL vocabulary.
Graph Visualization
Render and bound the graph snapshots this demo compares.
Recall
See the full set of recall parameters behind both questions.