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: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
NodeSetnodes in the graph - connected with
belongs_to_setedges
- 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
- Memify:
- The default memify pipeline creates the
coding_agent_rulesnode set containing derived coding rules - The session persistence pipeline creates the
user_sessions_from_cachenode set from cached conversation history
- The default memify pipeline creates the
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: tagging data with NodeSets
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
NodeSetlabels.- The first document is only linked to
AI_Memory. - The second document is linked to both
AI_MemoryandGraph_RAG.
- The first document is only linked to
- When you ran
cognify(), Cognee:- Created
NodeSetnodes (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.
Filtering searches by NodeSet
Filtering searches by NodeSet
When filtering with multiple NodeSet names, you can control matching behavior by choosing whether results must be connected to all selected names or to any selected name;
by default, Cognee uses the any selected name behavior (OR-style matching).
This behaviour is controlled by passing the wanted value (
AND or OR) via the node_name_filter_operator parameter in the search function.Node-set filtering works with graph-completion search types (
GRAPH_COMPLETION, GRAPH_COMPLETION_COT, GRAPH_COMPLETION_CONTEXT_EXTENSION, GRAPH_SUMMARY_COMPLETION, TEMPORAL). It is not applied for CHUNKS, SUMMARIES, RAG_COMPLETION, CYPHER, or NATURAL_LANGUAGE.Scoping queries to specific NodeSets
Scoping queries to specific NodeSets
Use the same NodeSet names you assigned during
add() to limit retrieval to a focused subset of your graph. This is useful when one dataset contains multiple topics, teams, or workflows but you only want answers grounded in one slice of that memory.In practice, NodeSets let you keep a shared dataset while still asking targeted questions like “show only finance concepts” or “search just the Graph_RAG material” without splitting everything into separate datasets.Navigating data by project or domain
Navigating data by project or domain
Add
Where NodeSets are first attached
Cognify
How NodeSets are promoted into graph nodes
Search
Use NodeSets as anchors in queries