Cognee:AI Agent 長期記憶平台,從聊天上下文走向可查證的知識圖譜
Threads 介紹 Cognee 作為 AI Agent 長期記憶系統;本文查證 GitHub、PyPI、官方網站、MCP/Claude Code/OpenClaw 整合與 arXiv 論文,整理其向量+知識圖譜定位、Apache-2.0 授權、部署前提與對 Hermes/Allen KB 的架構啟發。
AI Memory · Knowledge Graph · Agent Infrastructure
0xspeter 的 Threads 把 Cognee 描述成「AI 的長期記憶系統」:讓 Agent 不只記住當前對話,而能把文件、筆記、工作經驗整理成可回想的記憶。查證後,Cognee 確實是一個 GitHub 上活躍的開源 AI memory platform,重點是把資料轉成向量+知識圖譜,供 Agent 跨 session 召回。
來源查證
| 項目 | 查到的事實 | 意義 |
|---|---|---|
| GitHub | topoteretes/cognee;描述為 open-source AI memory platform for agents;約 29k stars、2.7k forks;主語言 Python;更新活躍。 | 不是只有社群貼文,確有大型開源 repo。 |
| License | GitHub 與 pyproject 均標示 Apache-2.0。 | 相對適合商業 PoC / 自架整合,但仍要看 NOTICE 與依賴授權。 |
| PyPI | cognee 目前版本 1.4.0;需要 Python 3.10–3.14;說明為 semantic layer for better understanding and reasoning。 | 可用 Python/uv 做 PoC;不是純概念 repo。 |
| 官方網站 | cognee.ai 把它定位為 open-source agent memory platform,主打 vector、graph、relational storage、自架、Claude Code/Cursor/LangGraph/n8n/CrewAI/MCP integrations。 | 定位接近「Agent memory substrate」,不是單一聊天 app。 |
| 研究論文 | arXiv 2505.24478〈Optimizing the Interface Between Knowledge Graphs and LLMs for Complex Reasoning〉以 Cognee 作為 KG construction/retrieval 框架研究多跳 QA 調參。 | 有研究脈絡,但論文也提醒:效果依資料集與評估指標而異,不宜視為萬能。 |
它在解什麼問題
一般 Agent 的上下文是短期的:今天教它公司規則、專案背景、使用者偏好,換 session 後常要重講。Cognee 的切入點是把資料 ingest 後建立 self-hosted knowledge graph,並用向量搜尋+圖關係推理讓 Agent 能 recall、connect、act with context。
核心操作與使用形狀
- remember:把文件或事實寫入長期圖譜,或寫入 session memory 後再同步。
- recall:查詢時自動路由到合適的搜尋策略,必要時先查 session memory 再 fallback 到 graph。
- forget:刪除 dataset / 記憶,這對隱私與錯誤記憶修正很重要。
- improve:README 表示 remember 會跑 add + cognify + improve,代表它不是單純 append text。
uv pip install cognee
# 設定 LLM_API_KEY 後:
await cognee.remember("Cognee turns documents into AI memory.")
results = await cognee.recall("What does Cognee do?")
await cognee.forget(dataset="main_dataset")