What are NodeSets?
A NodeSet lets you group parts of your AI memory at the dataset level. You create them as a simple list of tags when adding data to Cognee: await cognee.add(…, node_set=[“projectA”,“finance”]) These tags travel with your data into the knowledge graph, where they become first-class nodes connected with belongs_to_set edges — and you can later filter searches to only those subsets.How they flow through Cognee
- Add:
- NodeSets are attached as simple tags to datasets or documents
- This happens when you first ingest data
- Cognify:
- carried into Documents and Chunks
- materialized as real
NodeSet
nodes in the graph - connected with
belongs_to_set
edges
- Search:
- NodeSets act as entry points into the graph
- Queries can be scoped to only nodes linked to specific NodeSets
- This lets you search within a tagged subset of your data
Why they matter
- Provide a lightweight way to organize and tag your data
- Enable graph-based filtering, traversal, and reporting
- Ideal for creating project-, domain-, or user-defined subsets of your knowledge graph
Example
What just happened?
- You reset Cognee’s memory so you’re working with a clean graph.
- You added two documents, each tagged with one or more
NodeSet
labels.- The first document is only linked to
AI_Memory
. - The second document is linked to both
AI_Memory
andGraph_RAG
.
- The first document is only linked to
- When you ran
cognify()
, Cognee:- Created
NodeSet
nodes (AI_Memory
,Graph_RAG
) in the graph. - Attached each document to the corresponding NodeSets.
- Extracted entities and relationships from the documents, then linked those entities back to the same NodeSets.
- Created
- “Cognee” appears in both documents → connects to both NodeSets.
- “AI memory” appears only in the first → connects only to AI_Memory.
- “Vector search” appears only in the second → connects to both since that document belongs to AI_Memory and Graph_RAG.
- You can filter searches by NodeSet.
- You can scope queries to specific NodeSets.
- You can navigate data by project or domain using NodeSets.