cognee: open-source AI memory platform for agents

cognee (Apache-2.0) is the leading self-hosted answer to a problem every team running AI agents at scale hits: the agent has no memory of what it learned last week, last month, or last release. As of 2026-06-30, the topoteretes/cognee repository sits at 25,747 stars, 2,371 forks, 8,426 commits on main, 207 open issues, 224 open pull requests, 121 releases, Apache-2.0 (GitHub REST API, 2026-06-30). The latest release, v1.2.2 “Truth Subspace & Retrieval Improvements” (2026-06-26), adds a new retrieval layer on top of the single-Postgres architecture that shipped in cognee 1.0.
What it does
The four-method API. Cognee exposes four async operations — remember, recall, forget, improve — for the entire memory lifecycle (README). remember ingests into the permanent knowledge graph or a fast session cache that syncs in the background. recall queries the graph and auto-routes to the best search strategy. forget(dataset=...) deletes a dataset. improve(...) runs the truth-subspace build after session distillation and before enrichment; v1.2.2 added the build_truth_subspace=True opt-in flag.
Single Postgres is the recommended default, but optionality remains. Per the README: “In cognee 1.0 you can run the entire memory layer on a single Postgres instance” (README). The traditional agent-memory stack needs four services — a graph database, a vector database, Redis, and a relational database. cognee 1.0 collapses that to one Postgres instance with pgvector for embeddings, a SQL session-cache backend, and the same Postgres for metadata. The README reports that “in our CI benchmarks, Postgres search ran ~10% faster than the separate graph-plus-vector setup.” Optional dedicated backends remain available: Neo4j and Neptune for graphs, Redis for sessions, pgvector and LanceDB for vectors, plus Qdrant, ChromaDB, Weaviate, and Milvus via community adapters.
The research grounding is real, with honest limits. Optimizing the Interface Between Knowledge Graphs and LLMs for Complex Reasoning (Markovic et al., 2025-05-30) studies hyperparameter optimization across three multi-hop QA benchmarks — HotPotQA, TwoWikiMultiHop, MuSiQue. The paper is explicit: “This is a preliminary version. A revised and expanded version is in preparation.” The BEAM benchmark is self-reported: cognee 0.79 at 100K tokens (>0.8 with per-question routing), 0.67 at 10M tokens, with an Obsidian / RAG baseline of ~0.33. The README’s own caveat: “These numbers are a directional signal rather than a definitive measure.”
The Claude Code plugin is the most direct builder hook. Cognee ships a Claude Code marketplace plugin — cognee-memory@cognee — that captures prompts, tool traces, and assistant responses into session memory, injects relevant context on every prompt, and syncs session memory into the permanent knowledge graph at session end (plugin source). The lifecycle hooks cover SessionStart, UserPromptSubmit, PostToolUse, Stop, PreCompact, SessionEnd. Install is three commands before the first claude launch:
claude plugin marketplace add topoteretes/cognee-integrations
claude plugin install cognee-memory@cognee
export LLM_API_KEY="sk-..." # local mode
claude
The MCP server attaches cognee to any agent that speaks MCP. Pre-built images are published as cognee/cognee (API server on port 8000) and cognee/cognee-mcp (MCP server on port 8001). Any MCP-speaking agent — Claude Code, Codex, Cursor, OpenCode, Cline, Windsurf, Continue, Kiro — can attach a persistent memory layer without custom glue code.
Other clients and add-ons. Official clients for Rust (cognee-rs, cargo add cognee) and TypeScript (@cognee/cognee-ts, npm install @cognee/cognee-ts); an OpenClaw plugin (@cognee/cognee-openclaw); and Cognee Cloud at www.cognee.ai. One-click deploys target Modal, Railway, Fly.io, Render, and Daytona.
v1.2.2 (2026-06-26) is the headline release: truth-subspace reranking, all opt-in. Five named items: a truth-subspace builder, centroid-slot truth weighting (MVP), truth-subspace reranking + feedback activation, a build_truth_subspace opt-in flag on /improve, and a DEFAULT_FEEDBACK_INFLUENCE env var (default 0.0). Two demos ship: truth_centroid_slots_demo.py and truth_subspace_reranking_demo.py. Truth signatures now use sha256 hashing. Breaking changes: none.
v1.2.0 (2026-06-21) is the security-and-distillation release. Smart session distillation, batched curator, per-lesson writers. Breaking changes: LLM_MAX_TOKENS → LLM_MAX_COMPLETION_TOKENS and EMBEDDING_MAX_TOKENS → EMBEDDING_MAX_COMPLETION_TOKENS. Public registration is disabled by default; ENABLE_BACKEND_ACCESS_CONTROL now implies API auth and per-user/dataset DB isolation.
Why it matters
- Agent memory is the unsolved infrastructure problem of agent tooling. cognee is the leading open-source answer — self-hosted, Apache-2.0, graph-backed, attachable via SDK, CLI, MCP, or marketplace plugin.
- The single-Postgres architecture is a real simplification. The traditional stack needs four deployed services before an agent remembers anything; cognee 1.0 collapses that to one Postgres instance, ~10% faster than the separate setup.
- The arXiv paper is real research grounding, with honest limits. HotPotQA, TwoWikiMultiHop, MuSiQue; the paper is a preliminary version; the BEAM numbers are directional.
- The Claude Code plugin is the lowest-friction entry point on the market. Three commands and the value is visible in the next session.
- v1.2.2’s truth-subspace reranking is a research-grade retrieval improvement, shipped behind a default-off flag.
DEFAULT_FEEDBACK_INFLUENCEdefault 0.0 means no behavior change unless the operator opts in.
Practical implications
- If you run Claude Code today, install the cognee plugin in three commands. The first launch bootstraps memory automatically.
- For any MCP-speaking agent, attach
cognee-mcpvia Docker. Configure the agent’s MCP client to point at the container onlocalhost:8000. - For first-time deploys, default to single Postgres.
pip install "cognee[postgres]", then set the four*_PROVIDER=postgresenv vars. - If upgrading to v1.2.0+, rename two env vars.
LLM_MAX_COMPLETION_TOKENSandEMBEDDING_MAX_COMPLETION_TOKENS. - If trying truth-subspace reranking, opt in per-call or per-deployment. Set
DEFAULT_FEEDBACK_INFLUENCEto a non-zero value (e.g.0.1), then callimprove(..., build_truth_subspace=True). - If building in Python, the SDK path is four lines of code.
import cognee; await cognee.remember(...); await cognee.recall(...); await cognee.forget(...).
Risks and caveats
- The BEAM numbers are self-reported and explicitly directional. “These numbers are a directional signal rather than a definitive measure.” No third-party reproduction is on the record as of 2026-06-30.
- The arXiv paper is a preliminary version, not peer-reviewed. “This is a preliminary version. A revised and expanded version is in preparation.”
- Truth-subspace reranking is opt-in. Default
DEFAULT_FEEDBACK_INFLUENCEis 0.0 — existing deployments that upgrade do not see a behavior change unless they opt in. - Single Postgres is the recommended default, but optionality remains. Neo4j, Neptune, Redis, pgvector, LanceDB, Qdrant, ChromaDB, Weaviate, Milvus all still supported.
- v1.2.0 introduced a breaking env var rename. Operators relying on
LLM_MAX_TOKENSorEMBEDDING_MAX_TOKENSmust update their.env. - No independent head-to-head against Zep, mem0, or Letta is on the record. Cognee Cloud pricing is also not on the public record.
What to watch
- Revised arXiv paper in preparation per the arXiv page.
- First independent BEAM benchmark reproduction.
- Cognee Cloud GA / pricing (www.cognee.ai) — pricing not on the public record as of 2026-06-30.
- v1.3 / v1.4 with truth-subspace as default.
- Adoption in non-Claude-Code agents via the MCP server.
Sources
- topoteretes/cognee — GitHub repository (2026-06-30)
- topoteretes/cognee — GitHub REST API metadata (2026-06-30)
- topoteretes/cognee — v1.2.2 “Truth Subspace & Retrieval Improvements” release notes (2026-06-26)
- topoteretes/cognee — v1.2.0 release notes (2026-06-21)
- arXiv:2505.24478 — Optimizing the Interface Between Knowledge Graphs and LLMs for Complex Reasoning (2025-05-30)
- cognee-integrations/claude-code — Claude Code marketplace plugin source (2026-06-30)
- cognee-mcp — Docker Hub prebuilt MCP server image (2026-06-30)
- cognee-rs — Rust client (2026-06-30)
- @cognee/cognee-ts — TypeScript client (2026-06-30)
- Cognee Cloud — managed hosting at www.cognee.ai (2026-06-30)
- AI Newsroom — codebase-memory-mcp article (2026-06-24)