Cortex automatically detects communities - clusters of related documents and entities that share common themes. This enables topic discovery, document organization, and focused Q&A.
What Are Communities?
Communities are groups of entities (and their associated documents) that are densely connected in the knowledge graph. They represent natural topic clusters within your knowledge base.
Detection Algorithm
Cortex uses Leiden (preferred) or Louvain algorithm for community detection, with a BFS fallback when GDS is unavailable:
Key improvements in the detection pipeline:
Old community cleanup before re-detection prevents stale data accumulation
Undirected projection treats all relationships as bidirectional for community membership
Relationship weights (0-10 scale) influence community membership β strongly weighted relationships pull entities together
Co-mention edges connect entities that appear in the same chunk, providing structure even when direct entity-to-entity relationships are sparse
Distribution monitoring logs warnings for pathological distributions (e.g., one mega-community containing >50% of entities)
API Usage
Detect Communities
Start community detection (runs as a background task):
# Enable community detectionENABLE_COMMUNITY_DETECTION=true# Minimum entities per communityMIN_COMMUNITY_SIZE=3# Maximum communities to detectMAX_COMMUNITIES=50# Enable automatic summarization# (names/summaries are generated by the extraction model, GRAPH_EXTRACTION_MODEL)ENABLE_GRAPH_SUMMARIZATION=true
Use Cases
Topic Discovery - Find natural topic clusters in your documents
Content Organization - Use communities to organize collections
Focused Q&A - Ask questions about specific topic areas
Knowledge Mapping - Visualize how topics relate
Onboarding - Help new users understand the knowledge base