cognee
Frameworktopoteretes/cognee
AI memory platform for persistent agent memory with knowledge graphs.
Overview
Cognee provides persistent long-term memory for AI agents using a self-hosted knowledge graph engine. It ingests data in any format, builds knowledge graphs, and enables agents to recall, connect, and act with full context across sessions.
README Preview
\n \n \n \n\n \n\n Cognee - The Open-Source AI Memory Platform for Agents\n\n \n Demo\n .\n Docs\n .\n Learn More\n ·\n Join Discord\n ·\n Join r/AIMemory\n .\n Community Plugins & Add-ons\n \n\n\n [](https://GitHub.com/topoteretes/cognee/network/)\n [](https://GitHub.com/topoteretes/cognee/stargazers/)\n [](https://GitHub.com/topoteretes/cognee/commit/)\n [](https://github.com/topoteretes/cognee/tags/)\n [](https://pepy.tech/project/cognee)\n [](https://github.com/topoteretes/cognee/blob/main/LICENSE)\n [](https://github.com/topoteretes/cognee/graphs/contributors)\n \n\n\n \n \n \n\n\nCognee is the open-source AI memory platform that gives AI agents persistent long-term memory across sessions. Ingest data in any format, build a self-hosted knowledge graph, and let every agent recall, connect, and act with full context\n\n \n 🌐 This README is also available in:\n :\n \n Deutsch |\n Español |\n Français |\n 日本語 |\n 한국어 |\n Português |\n Русский |\n 中文\n \n\n\n\n \n\n\n\n📄 Read the research paper: [Optimizing the Interface Between Knowledge Graphs and LLMs for Complex Reasoning](https://arxiv.org/abs/2505.24478) — Markovic et al., 2025\n\n\n## About Cognee\n\nCognee is an open-source AI memory platform for AI Agents. Ingest data in any format, and Cognee continuously builds a self-hosted knowledge graph that gives your agents persistent long-term memory across sessions. Cognee combines vector embeddings, graph reasoning, and cognitive-science-grounded ontology generation to make documents both searchable by meaning and connected by relationships that evolve as your knowledge does.\n\n:star: _Help us reach more developers and grow the cognee community. Star this repo!_\n\n:books: _Check our detailed [documentation](https://docs.cognee.ai/getting-started/installation#environment-configuration) for setup and configuration._\n\n:crab: _Available as a plugin for your OpenClaw — [cognee-openclaw](https://www.npmjs.com/package
FAQ (3)
TroubleshootingWhy does cognee's KnowledgeGraph not store node and edge properties during graph extraction?
This is a known bug in cognee 1.6.4: the default extraction prompt (cognee/infrastructure/llm/prompts/generate_graph_prompt.txt) instructs the LLM to output key-value properties (e.g., 'profession', counts, measurements), but the runtime KnowledgeGraph schema in cognee/shared/data_models.py defines Node with only id/name/type/description and Edge with only source_node_id/target_node_id/relationship_name/description — there is no properties field, so values are folded into the description or silently dropped. Fix: the cognee team has resolved this; upgrade to the release after 1.6.4 with pip install -U cognee. Workaround on 1.6.4: pass a custom graph_model to cognee.cognify()/cognee.remember() whose Node and Edge pydantic models include a properties: dict field so extracted attributes have somewhere to be stored.
TroubleshootingHow to fix ladybug 'UNREACHABLE_CODE' assertion error (csr_node_group.cpp:434) during contradiction detection in cognee?
This is a known bug in cognee 1.6.1 with the default ladybug graph provider. When CONTRADICTION_DETECTION=true, the detect_contradictions task fails inside ladybug/adapter.py add_edges with Assertion failed ... csr_node_group.cpp:434: UNREACHABLE_CODE. The pipeline still reports completed, but the contradiction edges are silently dropped. Workaround: disable the feature by setting CONTRADICTION_DETECTION=false in your environment until a fix is released, since the assertion fires inside ladybug's storage layer and could risk graph integrity. Note: many of the detected 'contradictions' are false-positive entity-type conflicts (e.g., 'X is a person' vs 'X is a feature' at confidence 1.00), so disabling the feature may lose little real value.
TroubleshootingHow to fix the 'YOUR OPENAI_API_KEY' placeholder with a space in cognee's README?
This was a documentation typo, fixed in PR #6031 and merged into dev. In the 'Add an LLM to get generated answers' Python snippet, the correct placeholder has no space: os.environ["LLM_API_KEY"] = "YOUR_OPENAI_API_KEY". Replace the placeholder entirely with your actual OpenAI API key (e.g., os.environ["LLM_API_KEY"] = "sk-..."). The same typo was also corrected in the Korean and Chinese README versions.