项目简介
Cognee 通过自托管知识图谱引擎为 AI 智能体提供持久长期记忆。它能够以任意格式摄取数据,构建知识图谱,使智能体能够在不同会话之间回忆、连接并基于完整上下文行动。
README 预览
\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
常见问题 (3)
故障排除为什么 cognee 的 KnowledgeGraph 在图提取过程中不存储节点和边的属性?
这是 cognee 1.6.4 中的一个已知 bug:默认的抽取提示词(cognee/infrastructure/llm/prompts/generate_graph_prompt.txt)指示 LLM 输出键值对属性(例如 'profession'、计数、度量值),但 cognee/shared/data_models.py 中运行时的 KnowledgeGraph schema 定义的 Node 仅包含 id/name/type/description,Edge 仅包含 source_node_id/target_node_id/relationship_name/description——没有 properties 字段,因此这些值会被折叠进 description 中或被静默丢弃。修复方法:cognee 团队已解决此问题;请使用 pip install -U cognee 升级到 1.6.4 之后的版本。在 1.6.4 上的临时解决方案:向 cognee.cognify()/cognee.remember() 传入自定义的 graph_model,使其 Node 和 Edge 的 pydantic 模型包含 properties: dict 字段,从而让抽取出的属性有地方存储。
故障排除如何修复在 cognee 中进行矛盾检测时出现的 ladybug 'UNREACHABLE_CODE' 断言错误(csr_node_group.cpp:434)?
这是 cognee 1.6.1 中默认 ladybug 图提供程序的一个已知 bug。当 CONTRADICTION_DETECTION=true 时,detect_contradictions 任务会在 ladybug/adapter.py 的 add_edges 中失败,报错 Assertion failed ... csr_node_group.cpp:434: UNREACHABLE_CODE。流水线仍会报告已完成,但矛盾边被静默丢弃。解决方法:在修复版本发布之前,在您的环境中设置 CONTRADICTION_DETECTION=false 以禁用该功能,因为该断言在 ladybug 的存储层内部触发,可能会危及图的完整性。注意:检测到的许多"矛盾"都是误报的实体类型冲突(例如,置信度为 1.00 的"X 是一个人"与"X 是一个功能"),因此禁用该功能可能不会损失多少实际价值。
故障排除如何修复 cognee 的 README 中带空格的 'YOUR OPENAI_API_KEY' 占位符?
这是文档中的一个拼写错误,已在 PR #6031 中修复并合并到 dev 分支。在"Add an LLM to get generated answers"的 Python 代码片段中,正确的占位符不含空格:os.environ["LLM_API_KEY"] = "YOUR_OPENAI_API_KEY"。请将该占位符整体替换为你实际的 OpenAI API 密钥(例如 os.environ["LLM_API_KEY"] = "sk-...")。同样的拼写错误也已在韩语和中文版本的 README 中修正。