Cognee
An open-source memory that turns documents, code and chats into a knowledge graph your agents can search.
by Topoteretes (Cognee), Berlin · Built this? Edit this page on GitHub
In short
You give Cognee text, files, code or a conversation. It picks out the people, places and things, and how they connect, and keeps them as a map (a knowledge graph) alongside the original passages. When an agent asks a question, Cognee finds the matching passages and walks the map to their neighbours. After a session, an “improve” step folds the chat into the map, applies any ratings you gave answers, and boils what was learned into lasting lessons.
Who it’s for
Developers building agents or a shared “company brain” from documents, tickets, code and conversations. People also meet it through its plugins for Claude Code, Codex and OpenClaw, and its MCP server for Cursor and others.
What it remembers
Facts from your documents and code (entities, relationships, summaries), conversation turns and agent tool steps, lessons distilled from sessions, and, if you turn it on, each user's preferences.
- Memory lives
- Your machine, your server, or Cognee Cloud
- API keys
- None to store and search; an AI model key for written answers and lessons
- Works with
- Python SDK, Claude Code, Codex, Cursor (MCP), OpenClaw, REST API
- License
- Open sourceApache-2.0
- Price
- Free to self-host; Cloud free tier, then $1 per 1M tokens
Under the hood
- Who writes memories
- Whatever you or your app sends it. An AI (or a small local model) extracts the entities and links; after sessions, an AI curator writes the lessons.
- Where they're kept
- A graph database, a vector database and SQLite, all embedded by default (Ladybug, LanceDB), or Postgres, Neo4j and others on a server.
- How they're found
- By meaning and keywords over passages, then by walking the graph to connected facts. It picks the search type for you unless you choose.
- Extra AI calls
- Yes, with an AI key: extraction on every add, a call per written answer, and more in improve() and the optional contradiction check.
How it works
- 1RememberDocuments, code or chat go in; a session is kept short-term first.
- 2Build the mapEntities and links are extracted and stored with the passages.
- 3RecallSearch finds passages and walks the graph to connected facts.
- 4ImproveAfter a session: apply ratings, fold in the chat, distill lessons.
What stands out
- Runs entirely on your machine with no AI key: small local models build the graph, and an AI key only adds written answers.
- A real knowledge graph you can open and explore, so you can see why something was recalled, not just that it was.
- A self-improvement loop you can audit: each improve() run reports what every one of its nine stages did, and why any were skipped.
- Honest about conflicts: it can flag two facts that disagree instead of quietly overwriting one, and it can import memory from Mem0, Letta or Zep.
What it doesn’t do
- Nothing fades on its own by default. Memories stay until you forget them.
- Contradictions are flagged rather than settled: both facts stay current unless you declare a relationship single-valued or close the old fact yourself.
- Ratings and personal preferences only change ranking once you rate answers and switch those signals on.
- No reminders, no emotional weighting, and no sense of self: it's knowledge memory for agents and teams.
Measured against human memory
3 built (2 in depth), 6 partly, 2 not of the Field Guide’s 11 mechanisms, and 1 in development
Encoding
Salience
Decides what's worth keeping, and how much, as a memory is written.
You can mark something as more or less important when you save it; otherwise everything gets the same middle weight. source
Emotion
Gives memories written with feeling more weight.
No emotional weighting is documented.
Storage
Forgetting
Lets unused memories fade over time on its own.
Nothing fades unless you turn it on: an opt-in cleanup can delete documents nobody has searched for in a set time, and personal preference weights drift back to neutral. source
Interference
When a new memory closely matches an old one, notices and lets the newer one win.
An opt-in check flags new facts that contradict stored ones. Only for relationships you declare single-valued does the newest get marked current and the older one tagged as replaced. source
Retrieval
Retrieval
Remembering something makes that memory stronger.
Rating an answer strengthens or weakens the memories it used, but merely using a memory doesn't, and the weight is off in ranking by default. source
Association
Links memories, so recalling one brings its neighbours.
Everything lives in a graph, and search pulls in the facts directly connected to what it found. An optional pass links related things that weren't connected. source
Prospective
Brings a memory back at the right time without being asked.
It answers time-based questions when asked, but nothing comes back on its own at a set time. source
Transformation
Consolidation
Reworks memories between sessions: strengthening, merging, reorganising.
After a session, improve() runs in the background by default: it folds the chat into the graph, applies ratings and distills lessons. Merging duplicate entities is a separate opt-in pass. source
Reconsolidation
Corrects a memory when it's contradicted, and keeps what it used to say.
Outdated facts are kept rather than overwritten, closed with an end date or tagged as replaced, but only when your code closes them or you declared the relationship. source
Planned: search will take closed facts into account, so an outdated fact stops turning up in results.
Gist
Turns many specific moments into general knowledge.
An AI curator turns a session's guidance into lasting lessons, checked against what's already known, that later sessions recall. It needs an AI key. source
Schemas
Forms beliefs about people and projects, and weighs new facts against them.
Each user can get a preference record (off by default) that nudges what ranks first, but new facts aren't weighed against it. source
Not every system is trying to be a human memory, so a hollow dot isn’t a flaw. It just says what the system doesn’t do. What the mechanisms are.
Compare Cognee with the others, side by sideQuestions
- Who is Cognee for?
Developers building agents or a shared “company brain” from documents, tickets, code and conversations. People also meet it through its plugins for Claude Code, Codex and OpenClaw, and its MCP server for Cursor and others.
- Where does Cognee keep its memories?
Your machine, your server, or Cognee Cloud. A graph database, a vector database and SQLite, all embedded by default (Ladybug, LanceDB), or Postgres, Neo4j and others on a server.
- Does Cognee forget?
Forgetting: a little. Nothing fades unless you turn it on: an opt-in cleanup can delete documents nobody has searched for in a set time, and personal preference weights drift back to neutral. source
- Does Cognee correct a memory when it turns out to be wrong?
Reconsolidation: partly, more in development. Outdated facts are kept rather than overwritten, closed with an end date or tagged as replaced, but only when your code closes them or you declared the relationship. Planned: search will take closed facts into account, so an outdated fact stops turning up in results. source
- Is Cognee open source?
Yes, it's open source. License: Apache-2.0. Code: github.com/topoteretes/cognee, github.com/topoteretes/cognee-integrations.
- Does Cognee work with Claude Code?
Yes. Works with: Python SDK, Claude Code, Codex, Cursor (MCP), OpenClaw, REST API.
- Does Cognee need an API key?
API keys: None to store and search; an AI model key for written answers and lessons.
- How much does Cognee cost?
Price: Free to self-host; Cloud free tier, then $1 per 1M tokens.