How topoteretes/cognee works
Cognee is an open-source AI memory platform: callers add text or documents, Cognee builds persistent searchable memory, and callers retrieve relevant evidence across sessions. The graph highlights that workflow, its pipeline and storage foundations, plus the documented agent/MCP interface. README statements and sampled excerpts support the main flow; unsampled subsystem links are omitted rather than inferred.
Main entry points: __init__.py Recall · pipeline.py Pipeline Runner · server.py MCP Server · graph_db_interface.py Graph Store
Components 29
Memory API
- Remember
cognee/__init__.py - Recall
cognee/__init__.py - Recall API Route
cognee/api/v1/recall/query_router.py - Custom Pipeline Entry
cognee/modules/run_custom_pipeline/run_custom_pipeline.py
Memory Processing
- Pipeline Runner
cognee/modules/pipelines/operations/pipeline.py - Pipeline Tasks
cognee/modules/pipelines/tasks/task.py - Input File Storage
cognee/tasks/ingestion/save_data_item_to_storage.py - Database Schema Ingestion
cognee/tasks/schema/ingest_database_schema.py
Memory Storage
- Graph Store
cognee/infrastructure/databases/graph/graph_db_interface.py - Graph Engine Factory
cognee/infrastructure/databases/graph/get_graph_engine.py - Vector Store
cognee/infrastructure/databases/vector/vector_db_interface.py - Vector Engine Factory
cognee/infrastructure/databases/vector/create_vector_engine.py - Unified Store
cognee/infrastructure/databases/unified/unified_store_engine.py - File Storage Manager
cognee/infrastructure/files/storage/StorageManager.py - Relational Engine
cognee/infrastructure/databases/relational/get_relational_engine.py - Hybrid Graph Adapter
cognee/infrastructure/databases/hybrid/neptune_analytics/NeptuneAnalyticsAdapter.py
Platform Foundations
- Graph Configuration
cognee/infrastructure/databases/graph/config.py - Relational Configuration
cognee/infrastructure/databases/relational/config.py - Engine Cache
cognee/infrastructure/databases/utils/closing_lru_cache.py - Embedding Configuration
cognee/infrastructure/databases/vector/embeddings/config.py - LLM Configuration
cognee/infrastructure/llm/config.py - LLM Errors
cognee/infrastructure/llm/exceptions.py - User and Tenant Identity
cognee/modules/users/models/User.py - Global Context
cognee/context_global_variables.py - Logging
cognee/shared/logging_utils.py - Usage Logging
cognee/shared/usage_logger.py
Agent Interfaces
- MCP Server
cognee-mcp/src/server.py - Cognee MCP Client
cognee-mcp/src/cognee_client.py
Other components
- Application or Agent
Connections 20
- Application or Agent → Remember: submits memory
README.md - Remember → Pipeline Runner: builds memory
README.md - Custom Pipeline Entry → Pipeline Runner: invokes
cognee/modules/run_custom_pipeline/run_custom_pipeline.py - Pipeline Runner → Pipeline Tasks: executes tasks
cognee/modules/pipelines/operations/pipeline.py - Pipeline Runner → Graph Store: persists graph
- Pipeline Runner → Vector Store: stores embeddings
- Application or Agent → Recall: queries memory
README.md - Recall → Recall API Route: available through API
- Recall → Graph Store: retrieves graph context
README.md - Recall → Vector Store: retrieves vector context
README.md - Graph Engine Factory → Graph Configuration: uses configuration
cognee/infrastructure/databases/graph/get_graph_engine.py - Graph Engine Factory → Engine Cache: uses cache
cognee/infrastructure/databases/graph/get_graph_engine.py - Vector Engine Factory → Engine Cache: uses cache
cognee/infrastructure/databases/vector/create_vector_engine.py - Vector Engine Factory → Embedding Configuration: gets embedding engine
cognee/infrastructure/databases/vector/create_vector_engine.py - Unified Store → Graph Store: uses interface
cognee/infrastructure/databases/unified/unified_store_engine.py - Unified Store → Vector Store: uses interface
cognee/infrastructure/databases/unified/unified_store_engine.py - Database Schema Ingestion → Relational Configuration: loads configuration
cognee/tasks/schema/ingest_database_schema.py - Cognee MCP Client → MCP Server: serves tools
cognee-mcp/src/server.py - MCP Server → Remember: stores memory
cognee-mcp/src/server.py - MCP Server → Recall: queries memory
cognee-mcp/src/server.py