Cognee – Open-Source AI Memory for Agents
Cognee gives AI agents persistent long-term memory using a knowledge graph. Self-hosted, Apache-2.0, and works with Python 3.10+.
TL;DR
TL;DR: Cognee is an open-source AI memory platform that lets agents retain context across sessions by building a self-hosted knowledge graph from any data source.
Source and Accuracy Notes
⚠️ This section is MANDATORY. All links must be verified from actual source, not guessed.
- Project page: cognee.ai
- Source repository: github.com/topoteretes/cognee
- License: Apache-2.0 (verified via GitHub API
license.spdx_id) - Documentation: docs.cognee.ai
- PyPI package: pypi.org/project/cognee
- HN launch thread: news.ycombinator.com/item?id=42069173 (Show HN: Cognee – Open-Source AI Memory Layer That Remembers Context)
- Source last checked: 2026-07-18 (commit
v1.4.0)
What Is Cognee?
Large language models forget everything after each conversation ends. Cognee solves this by giving agents persistent, queryable memory built from your own data.
Cognee is an open-source AI memory platform that:
- Ingests data in any format (PDFs, plain text, structured data)
- Builds a self-hosted knowledge graph that captures relationships
- Provides semantic search across the graph using vector embeddings
- Runs entirely on your infrastructure — no vendor lock-in
At 27,982 GitHub stars and used as a plugin for Claude Code and OpenClaw, it is one of the most actively maintained open-source memory solutions for AI agents.
Setup Workflow
Prerequisites
- Python 3.10 – 3.14
- pip, poetry, or uv for package management
- Docker Desktop (optional, for the MCP server UI)
- 4GB RAM minimum
Step 1: Install Cognee
pip install cognee
Or with uv:
uv pip install cognee
Or with poetry:
poetry add cognee
Step 2: Configure the Pipeline
Cognee uses a pipeline-based architecture. After installation, configure your data sources and preferred graph store:
import cognee
cognee.config.set_data_directory("./data")
cognee.config.set_vector_store("pgvector")
cognee.config.set_graph_store("neo4j")
The docs cover environment configuration in detail.
Step 3: Ingest Data and Query
from cognee import Pipeline
pipeline = Pipeline()
# Add documents to the memory store
await pipeline.ingest("path/to/your/documents/")
# Query across sessions
results = await pipeline.search("what did we discuss about the API design?")
Step 4: Run the MCP Server (Optional)
For Claude Code or OpenClaw integration, Cognee ships an MCP server:
cognee-cli -ui
This launches a Docker container serving the MCP server on http://localhost:8001.
Run with Docker Compose
# Full stack: API + UI + Postgres/PGVector + Neo4j
docker compose up
# API + frontend
docker compose --profile ui up
# API + MCP server
docker compose --profile mcp up
Prebuilt images are published to Docker Hub: cognee/cognee and cognee/cognee-mcp.
Deeper Analysis
Architecture
Cognee combines three layers:
- Ingestion layer — accepts raw data in any format, chunks and structures it
- Graph layer — Neo4j or equivalent stores entities and relationships as a knowledge graph
- Vector layer — PGVector stores semantic embeddings for similarity search
This dual-layer approach (graph + vector) lets agents search by meaning (vector) and by relationship (graph) — more powerful than vector-only RAG.
Integrations
- Claude Code plugin — github.com/topoteretes/cognee-integrations
- OpenClaw plugin —
cognee-openclawon npm - Rust client — cognee-rs
- TypeScript client —
@cognee/cognee-tson npm
Research Backing
Cognee’s approach is grounded in published research: Optimizing the Interface Between Knowledge Graphs and LLMs for Complex Reasoning (Markovic et al., 2025).
Practical Evaluation Checklist
- [ ] Installs via pip without dependency conflicts on Python 3.12
- [ ] Successfully ingests a PDF or text corpus
- [ ] Query returns context from previously ingested documents
- [ ] MCP server starts inside Docker (if used)
- [ ] Neo4j and PGVector stores initialize correctly (if used)
- [ ] Claude Code or OpenClaw plugin connects to the MCP server
Security Notes
- All data stays on your infrastructure — no third-party data exfiltration
- Docker isolation for the MCP server prevents host access
- Supports self-hosted deployment on private networks
- Review the security policy on GitHub
FAQ
Q: Does Cognee require Neo4j or PGVector? A: Yes, it uses a graph store (Neo4j recommended) and a vector store (PGVector recommended). Both can be spin up via Docker Compose alongside Cognee.
Q: What Python versions are supported? A: Python 3.10 through 3.14. Tested on 3.10, 3.11, 3.12, 3.13, and 3.14.
Q: Can I use Cognee without Docker? A: Yes — the core library installs via pip and runs standalone. Docker is only required for the MCP server UI or if you want the full compose stack with Neo4j and PGVector.
Q: How does this compare to just using a vector database? A: Vector databases search by semantic similarity. Cognee’s knowledge graph additionally captures entity relationships, enabling queries like “what depends on X?” or “who owns this component?” that pure vector search cannot answer.
Q: Is there a managed cloud version? A: No — Cognee is fully self-hosted. There is no cloud offering or managed service at this time.
Conclusion
Cognee fills the long-term memory gap in LLM-based agents. Its dual graph-plus-vector architecture gives agents both semantic recall and relationship reasoning — something pure RAG pipelines cannot match. With v1.4.0 released July 2026 and active integrations for Claude Code and OpenClaw, it is the most production-ready open-source option for adding persistent memory to your AI agents.
Install it with pip install cognee and have a knowledge graph up in minutes.
Related Posts
dev-tools
Automotive Skills Suite for AI Engineering
Evaluate Automotive Skills Suite for APQP, ASPICE, HARA, safety-plan, and DIA workflows with setup notes, governance risks, and SME review guidance.
5/28/2026
dev-tools
awesome-agentic-ai-zh Roadmap Guide
Explore awesome-agentic-ai-zh as a Chinese agentic AI learning roadmap, with setup notes, track selection, study workflow, and evaluation guidance.
5/28/2026
dev-tools
Baguette iOS Simulator Automation Guide
Set up Baguette for iOS Simulator automation, web dashboards, device farms, gesture input, streaming, and camera testing with Xcode caveats.
5/28/2026