Overview
Cognee is an open-source AI memory platform for agents. You feed it data in many formats, and it builds a self-hosted knowledge graph that gives your agents long-term memory that lasts across sessions. It combines vector embeddings for meaning-based search with a graph layer that captures how facts relate to each other.
It is aimed at developers who are building agents, assistants, or RAG systems that need to remember context over time instead of starting fresh on every request. The Python API centers on four operations — remember, recall, forget, and improve — so you can store information, query it, and clean it up without managing the graph by hand.
As a memory framework, Cognee sits between your raw documents or conversations and the agent that uses them. It runs locally, supports multiple LLM providers, and also offers a CLI and integrations (including a Claude Code plugin) for capturing and recalling memory.
What it does
- Builds a self-hosted knowledge graph from documents and conversations, combining vector embeddings with graph reasoning
- Simple Python API with four core operations: remember, recall, forget, and improve
- Session memory (fast cache) plus a permanent graph store, with auto-routing that picks the best search strategy
- Command-line interface (cognee-cli) and a local web UI for storing and querying memory
- Works with multiple LLM providers and runs locally; ontology grounding for connecting facts
- Integrations for AI coding agents, including a Claude Code plugin that captures tool calls and syncs them to the graph
Getting started
Cognee needs Python 3.10 to 3.14. Install the package, point it at an LLM API key, then store and query memory in a few lines.
Install Cognee
Install with pip, poetry, uv, or your preferred Python package manager.
uv pip install cogneeConfigure the LLM
Set your LLM API key as an environment variable, or create a .env file from the project's template.
import os
os.environ["LLM_API_KEY"] = "YOUR OPENAI_API_KEY"Store and recall memory
Use remember to store data in the knowledge graph and recall to query it. Both calls are async.
import cognee
import asyncio
async def main():
# Store permanently in the knowledge graph
await cognee.remember("Cognee turns documents into AI memory.")
# Query with auto-routing
results = await cognee.recall("What does Cognee do?")
for result in results:
print(result)
if __name__ == '__main__':
asyncio.run(main())Use the CLI (optional)
The cognee-cli command mirrors the API, and -ui opens a local web interface.
cognee-cli remember "Cognee turns documents into AI memory."
cognee-cli recall "What does Cognee do?"
cognee-cli -uiCommands and code are distilled from the project's own documentation — always check the official repo for the latest.
When to use it
- Give an agent or chatbot persistent memory so it recalls user preferences and past context across sessions
- Turn a collection of internal documents into a queryable knowledge graph for retrieval-augmented agents
- Add long-term memory to a coding assistant via the Claude Code plugin, which captures tool calls and syncs them to the graph
- Build a shared 'company brain' that unifies data from several sources and serves it to multiple agents
How Cognee compares
Cognee alongside other open-source agent memory tools AI/TLDR tracks, ranked by GitHub stars.
| Tool | Stars | What it does |
|---|---|---|
| Claude-Mem | ★ 102k | Persistent memory layer for coding agents: it captures what an agent does during a session, compresses it into semantic summaries, and injects the relevant parts back into later sessions. |
| Mem0 | ★ 67.4k | A memory layer that you add to existing LLM agents to extract, store, and recall user facts and preferences across sessions using vector, graph, and key-value backends. |
| MemPalace | ★ 59.6k | Local-first agent memory that stores conversations verbatim instead of summarising them, with a structured palace index, pluggable vector backends and an MCP server. |
| Hindsight | ★ 51.1k | An agent memory server that stores facts and experiences, consolidates them into observations and mental models, and serves them back through retain, recall, and reflect operations. |
| OpenViking | ★ 40.2k | A context database that stores an agent's memories, resources, and skills as one browsable viking:// filesystem with three-tier (abstract/overview/details) on-demand loading. |
| Cognee | ★ 32.5k | Open-source AI memory that turns your data into a queryable knowledge graph for agents |
| Graphiti | ★ 32k | A library that builds a temporal knowledge graph from an agent's conversations and data so facts can be tracked and queried as they change over time. |
| Supermemory | ★ 31.3k | A memory and context engine that ingests information across tools and sessions and can run fully locally, acting as a second brain for AI applications. |
