# Cognee

> Open-source AI memory that turns your data into a queryable knowledge graph for agents

- Category: Agents & Automation / Agent Memory
- Language: Python
- Repository: https://github.com/topoteretes/cognee
- Website: https://www.cognee.ai
- Canonical page: https://ai-tldr.dev/tools/cognee/

## In short

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 sits in the Agent Memory category of the Agents & Automation tools and is open-source, written in Python.

## 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.

1. Install Cognee

   Install with pip, poetry, uv, or your preferred Python package manager.

```bash
uv pip install cognee
```

2. Configure the LLM

   Set your LLM API key as an environment variable, or create a .env file from the project's template.

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

3. Store and recall memory

   Use remember to store data in the knowledge graph and recall to query it. Both calls are async.

```python
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())
```

4. Use the CLI (optional)

   The cognee-cli command mirrors the API, and -ui opens a local web interface.

```bash
cognee-cli remember "Cognee turns documents into AI memory."
cognee-cli recall "What does Cognee do?"
cognee-cli -ui
```

## 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
