cognee is a free, open source machine learning infrastructure project written in Python and released under Apache-2.0. It has 30,780 GitHub stars, 3,050 forks and 495 open issues, and was last pushed 5 hours ago. On this registry it ranks #9 of 57 tracked projects in Machine Learning Infrastructure, with 5 head-to-head comparisons available. It gained 76 stars over the last 3 tracked days.

What is cognee?

What it is

Cognee is an open-source AI memory platform for agents, released under the Apache-2.0 license and written in Python. It ingests data in any format and builds a self-hosted knowledge graph that agents query to recall, connect, and act with full context across sessions. The project lives in the Python ecosystem, installs through standard package managers, and sits in the AI and machine learning infrastructure category alongside graph databases and context engineering tooling. A companion research paper, "Optimizing the Interface Between Knowledge Graphs and LLMs for Complex Reasoning" by Markovic et al., 2025, documents the retrieval approach.

The concrete problem is that agents forget. Each new run starts blind, so project context, past decisions, fixes, and learned rules are lost between sessions, and teams cannot connect a decision to the discussion and implementation behind it. Cognee solves that by turning text into entities, relationships, and searchable chunks, and code into a graph of symbols and dependencies, then distilling accepted session lessons into durable memory. At query time, retrieval selects relevant graph, vector, or code context, and the application can inspect the retrieved evidence before answering.

Key capabilities

  • Persistent memory operations through remember, recall, and forget, with remember running add, cognify, and improve in one call.
  • Session memory keyed by session_id, stored in a fast cache that syncs to the graph in the background, with recall that falls through to the graph when the session lacks an answer.
  • Auto-routing recall that picks the best search strategy automatically instead of requiring a fixed retrieval mode, and returns retrieved evidence for inspection.
  • Code memory that builds a graph of symbols and dependencies rather than treating source as plain text.
  • Custom data models and ontologies so memory is structured around the entities and relationships an application needs.
  • Ingestion of data in any format, including documentation, conversations, tickets, and code.
  • Deployment flexibility spanning a bundled demo that needs no API key, infrastructure self-hosting, and the managed Cognee Cloud service.

Who uses it and how

  • Teams building a company brain, bringing documentation, conversations, tickets, code, and agent work into shared memory so decisions link back to their discussion and implementation.
  • Agent developers giving agents memory across runs, retaining project context, past decisions, fixes, and learned rules, then distilling session lessons into durable knowledge another session can retrieve.
  • Domain teams grounding agents in their own structure, using custom data models and ontologies to shape memory around application-specific entities and relationships.
  • Existing agents that need memory added through plugins and MCP integration rather than a rebuild.
  • Self-hosters running Cognee on their own infrastructure when a managed service is not acceptable.

Getting started

Cognee requires Python 3.10–3.14 and installs with pip, uv, or another Python package

project readme (upstream, from github) — read inline

Cognee - The Open-Source AI Memory Platform for Agents

Demo . Docs . Learn More · Join Discord · Join r/AIMemory . Community Plugins & Add-ons

GitHub forks GitHub stars GitHub commits GitHub tag Downloads License Contributors Sponsor

topoteretes%2Fcognee | Trendshift

Cognee 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

🌐 This README is also available in:

Deutsch | Español | Français | 日本語 | 한국어 | Português | Русский | 中文

📄 Read the research paper: Optimizing the Interface Between Knowledge Graphs and LLMs for Complex Reasoning — Markovic et al., 2025

When to use Cognee

  • Build a Company Brain. Bring documentation, conversations, tickets, code, and agent work into shared memory. Help your team and agents connect a decision to the discussion and implementation behind it. Explore Company Brain.
  • Give agents memory across runs. Retain project context, past decisions, fixes, and learned rules. Distill useful session lessons into durable knowledge that another session can retrieve. Connect your agent.
  • Ground agents in your domain. Structure memory around the entities and relationships your application needs, with custom data models and ontologies. Explore ontologies.

Choose your starting point

I want to… Start here
See a memory graph without an API key Bundled demo
Build with text, code, and session memory Python quickstart
Give an existing agent memory Plugins and MCP
Run Cognee on my infrastructure Deployment options
Use a managed service Cognee Cloud

Quickstart

Requires Python 3.10–3.14.

You can install Cognee with pip, uv, or your preferred Python package manager.

uv pip install cognee

Try it without an API key

cognee-cli demo

Step 2: Configure the LLM

import os
os.environ["LLM_API_KEY"] = "YOUR OPENAI_API_KEY"

Alternatively, create a .env file using our template.

The default uses OpenAI for language models and embeddings. Processing and generated answers make provider calls. See installation, other providers, or local Ollama models for other setups.

import cognee
import asyncio


async def main():
    # Store permanently in the knowledge graph (runs add + cognify + improve)
    await cognee.remember("Cognee turns documents into AI memory.")

    # Store in session memory (fast cache, syncs to graph in background)
    await cognee.remember("User prefers detailed explanations.", session_id="chat_1")

    # Query with auto-routing (picks best search strategy automatically)
    results = await cognee.recall("What does Cognee do?")
    for result in results:
        print(result)

    # Query session memory first, fall through to graph if needed
    results = await cognee.recall("What does the user prefer?", session_id="chat_1")
    for result in results:
        print(result)

    # Delete when done
    await cognee.forget(dataset="main_dataset")


if __name__ == '__main__':
    asyncio.run(main())

How Cognee works

Cognee builds connected memory from different sources. Text becomes entities, relationships, and searchable chunks; code becomes a graph of symbols and dependencies. Session distillation curates accepted lessons into permanent memory.

At query time, retrieval selects relevant graph, vector, or code context. Your application can inspect the retrieved evidence and use it to answer a question or continue an agent task.

Operation What it does Learn more
remember Store content or code in permanent memory, or in a session when a session ID is supplied. Store memory
recall Retrieve context and answers, using automatic routing or a chosen search strategy. Query memory
improve Enrich memory, apply feedback, and bridge session knowledge into the graph. Improve memory
forget Remove a specific item or dataset. Delete memory

Explore the architecture and session lifecycle.

Connect your agent

Install the Claude Code plugin:

claude plugin marketplace add topoteretes/cognee-integrations
claude plugin install cognee-memory@cognee

or Codex plugin

Make sure to enable hooks:

# ~/.codex/config.toml
[features]
hooks = true
codex plugin marketplace add topoteretes/cognee-integrations --ref main
codex plugin add cognee@cognee

Follow the plugin setup guide to configure local or remote memory.

Interface Start here
Claude Code memory plugin Install and configure the plugin
OpenClaw memory plugin Install @cognee/cognee-openclaw
Cursor, Cline, and other M

readme truncated — read the full docs on github

Frequently asked questions

Is cognee free to use?

cognee is open source under the Apache-2.0 licence. There is no licence fee and no seat count — you can self-host it or, where the project offers one, pay a vendor for a managed version instead.

What does cognee do?

Cognee is the open-source AI memory platform for agents. Give your AI agents persistent long-term memory across sessions with a self-hosted knowledge graph engi

What is cognee written in?

cognee is primarily written in Python. Its source is publicly available at https://github.com/topoteretes/cognee, and it has 30,780 GitHub stars.