cognee-custom-graph-models
Skill31k starsChanged 2 months agoApache-2.0View on GitHub
Use when defining the shape of cognee's knowledge graph with graph_model= — writing DataPoint node classes, choosing identity and index fields so nodes merge and are searchable, declaring typed Edge fields and FromIdentity references, building a model from a JSON schema, or debugging duplicated nodes, missing edges, or InvalidReferenceTypeError.
Trending
More talk lately.about the whole repository
Who's talking about topoteretes/cognee
- A Hacker News story“Show HN: Cognee – Open-Source AI Memory Layer That Remembers Context”Hacker News · Jun 3, 2025 · 9 points
- @github-trending.bsky.social“🚀 Skyrocketing! 🚀 (200+ new stars) 📦 topoteretes / cognee ⭐ 4,853 (+414) 🗒 Python Memory for AI Agents …”Bluesky · Jun 9, 2025 · 7 likes
- A Hacker News story“Show HN: Auto-optimizing deterministic LLM outputs using knowledge graphs”Hacker News · Apr 22, 2024 · 7 points
- A Hacker News story“Show HN: Cognee – Turn RAG and GraphRAG into custom dynamic semantic memory”Hacker News · Feb 13, 2025 · 6 points
- @github-trending.bsky.social“🚀 Skyrocketing! 🚀 (200+ new stars) 📦 topoteretes / cognee ⭐ 28,581 (+303) 🗒 Python Cognee is the …”Bluesky · Jul 20, 2026 · 5 likes
The biggest 5 of 70 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 70
Talked about on GitHub, Bluesky and Hacker News (70 times).
On GitHub · 50
- Apr 10, 2026[Add App]Cognee — beclab/apps2 reactions
- Nov 15, 2025[Request] Implement Long-term Cross-session Memory through Cognee Integration — lobehub/lobehub2 reactions · 6 comments
- Jun 28, 2026Epic: Cross-project knowledge storage — queryable KB over the board — joelfuller2016/KanbanFlow-v21 reaction · 4 comments
- Nov 20, 2026[spike] Cognee GitHub ingestion vs file memory, Phase 0 measurement only — anchapin/plan-coder0 reactions · 1 comment
- Nov 16, 2026مرشحون جدد للدليل (2026-11-16) — mgrd281/Skill-0 reactions
45 more on GitHub
- Nov 3, 2026feat(connector): add Gitee data-source connector (cognee#6364) — topoteretes/cognee-community0 reactions
- Nov 3, 2026feat(connector): add Atlassian Jira project issues and agile tracking data-source connector (cognee#6466) — topoteretes/cognee-community0 reactions
- Nov 3, 2026feat(connector): add Zendesk support tickets and conversations data-source connector (cognee#6465) — topoteretes/cognee-community0 reactions
- Nov 3, 2026feat(connector): add Trello boards, lists, and cards data-source connector (cognee#6471) — topoteretes/cognee-community0 reactions
- Nov 3, 2026feat(connector): add AtCoder competitive programming data-source connector (cognee#6406) — topoteretes/cognee-community0 reactions
- Nov 3, 2026chore(deps): bump cognee from 0.4.1 to 1.5.0 in /ai-memory-hackathon-2026-02-07 — topoteretes/cognee-hackathons0 reactions
- Oct 30, 2026Bump the pip group across 2 directories with 2 updates — MendyData/agents-towards-production0 reactions
- Oct 29, 2026memory-lab: Cognee — развернуть на PVE и проверить — TeaShaman-cyber/theseus-local-lab0 reactions · 38 comments
- Oct 28, 2026feat(connector): add Trivy security vulnerability and misconfiguration connector — topoteretes/cognee-community0 reactions
- Oct 28, 2026feat(connector): add Traefik reverse proxy routing and middleware topology connector — topoteretes/cognee-community0 reactions
- Oct 26, 2026chore(deps-dev): bump cognee from 1.1.2 to 1.6.5 — TSchonleber/brainctl0 reactions
- Oct 26, 2026feat(connector): add Habitica gamified habits and task management connector — topoteretes/cognee-community0 reactions
- Oct 25, 2026feat(connector): add lemlist outreach and campaigns REST connector — topoteretes/cognee-community0 reactions
- Oct 25, 2026feat(connector): add Jotform form builder and submissions REST connector — topoteretes/cognee-community0 reactions
- Oct 25, 2026feat(connector): add npm package registry public REST API connector — topoteretes/cognee-community0 reactions · 1 comment
- Oct 25, 2026feat(connector): add WooCommerce store catalog and orders connector — topoteretes/cognee-community0 reactions
- Oct 25, 2026feat(connector): add Hardcover books and reading journals GraphQL connector — topoteretes/cognee-community0 reactions
- Oct 25, 2026feat(connector): add Bitrix24 CRM inbound webhook connector — topoteretes/cognee-community0 reactions
- Oct 25, 2026feat(connector): add BigCommerce catalog and orders connector — topoteretes/cognee-community0 reactions
- Oct 23, 2026MEMSYNC — Umbrella: governed synchronization of persistent memories across Cogentia agents — JeanHuguesRobert/cogentia0 reactions
- Oct 22, 2026Memoria que el agente escribe durante la sesión — e2its/myrmion-graphrag0 reactions
- Oct 22, 2026Olvidar y borrar como herramienta — e2its/myrmion-graphrag0 reactions
- Oct 20, 2026fix(storage): explain embedding mismatch recovery — volcengine/OpenViking0 reactions
- Oct 15, 2026[P0][Comparator][Cognee] Execute first local-model external same-harness comparison — MythologIQ-Labs-LLC/agent-memory0 reactions · 3 comments
- Oct 14, 2026feat: add Read.ai connector with OAuth and scoped sync — topoteretes/cognee-community0 reactions
- Oct 13, 2026[Benchmark][Comparators] Expand real same-harness market cohort beyond Mem0, with per-profile peer coverage — MythologIQ-Labs-LLC/agent-memorysays it tested it0 reactions · 9 comments
- Oct 9, 2026feat(linear): implement linear integration - #4699 — topoteretes/cognee-community0 reactions
- Oct 9, 2026feat(connector): add Airtable data-source connector — topoteretes/cognee-community0 reactions
- Oct 8, 2026feat(connector): add Snowflake data-source connector — topoteretes/cognee-community0 reactions · 1 comment
- Oct 8, 2026feat(connector): add Databricks workspace data connector — topoteretes/cognee-community0 reactions · 1 comment
- Oct 8, 2026feat(connector): add Outline Knowledge Base data-source connector — topoteretes/cognee-community0 reactions · 1 comment
- Oct 8, 2026feat(connector): add Appwrite data-source connector — topoteretes/cognee-community0 reactions · 1 comment
- Oct 8, 2026feat(connector): add Ghost CMS data-source connector — topoteretes/cognee-community0 reactions · 1 comment
- Oct 5, 2026feat(connector): add tl;dv meeting data-source connector — topoteretes/cognee-community0 reactions · 1 comment
- Oct 5, 2026feat(connector): add LogRocket MCP data source — topoteretes/cognee-community0 reactions · 1 comment
- Oct 3, 2026Bump the pip group across 2 directories with 2 updates — herominutes/agents-towards-production0 reactions
- Sep 27, 2026[assessment] Competitor assessment 3×7: KIP, mem0, ruflo, MemPalace, [redacted vendor], cognee, agentmemory, [redacted vendor] Agent Memory, Haystack vs ai-memory release/v1.0.0 (level, value, licensing) — alphaonedev/ai-memory-mcp0 reactions · 11 comments
- Sep 24, 2026Reality probe: Cognee #5161 passes local prune tests but the end-to-end claim is contradicted — hippoley/CounterProof0 reactions
- Sep 20, 2026Freshness: cognee v1.5.4 -> v1.6.5 — thoroc/context-radar0 reactions
- Sep 17, 2026📈 AI 开源趋势日报 2026-09-17 — 96loveslife/big_model_radar0 reactions
- Sep 15, 2026[GHSA-fcch-9ph8-q3p4] Cognee thru v0.4.0 contains a critical remote code... — github/advisory-database0 reactions
- Sep 4, 2026Bump cognee from 1.0.9 to 1.5.0 in /testbed/dmas/memory — rustic-ai/dmas-memory0 reactions
- Sep 3, 2026chore(deps): bump cognee from 1.1.0 to 1.5.0 in /cognee-mcp — monk-io/cognee0 reactions
- Sep 3, 2026chore(deps): bump the pip group across 2 directories with 1 update — CorInfinitum/cognee0 reactions
- Sep 3, 2026chore(deps): bump cognee from 0.2.0 to 1.5.0 in /evals/src — AhindraD/cognee0 reactions
On Bluesky · 15
- Jun 9, 2025🚀 Skyrocketing! 🚀 (200+ new stars) 📦 topoteretes / cognee ⭐ 4,853 (+414) 🗒 Python Memory for AI Agents in 5 lines of code — @github-trending.bsky.social7 likes and reposts
- Jul 20, 2026🚀 Skyrocketing! 🚀 (200+ new stars) 📦 topoteretes / cognee ⭐ 28,581 (+303) 🗒 Python Cognee is the open-source AI memory platform for… — @github-trending.bsky.social5 likes and reposts · 1 reply
- Mar 15, 2026🔥 Hot Repo! 🔥 (100+ new stars) 📦 topoteretes / cognee ⭐ 13,644 (+168) 🗒 Python Knowledge Engine for AI Agent Memory in 6 lines of code — @github-trending.bsky.social5 likes and reposts
- Jun 3, 2025Explore the research: arxiv.org/abs/2505.24478 Our GitHub: github.com/topoteretes/... — @vasilijee.bsky.social3 likes and reposts
- Jan 17, 2025What will you build with cognee? Try it out: github.com/topoteretes/... — @vasilijee.bsky.social2 likes and reposts · 1 reply
10 more on Bluesky
- Jan 16, 2025Check it out and let us know what you’ll build 🛠️ github.com/topoteretes/... github.com/milvus-io/mi... @cognee.bsky.social… — @vasilijee.bsky.social2 likes and reposts
- Jul 20, 2026今日のGitHubトレンド topoteretes/cognee CogneeはAIエージェントにセッションをまたいだ永続的な長期記憶を提供するためのオープンソースAIメモリプラットフォームです。… — @dailygithubtrends.bsky.social1 likes and repost
- Jun 27, 2026🎉 Celebrating! 🎉 (500+ new stars) 📦 topoteretes / cognee ⭐ 23,567 (+729) 🗒 Python Cognee is the open-source AI memory platform for… — @github-trending.bsky.social1 likes and repost · 1 reply
- Jun 15, 2026Cognee transforma datos no estructurados en un grafo de conocimiento persistente. plugins para OpenClaw, Claude Code y Hermes Agent.… — @samuel-ferrero.bsky.social1 likes and repost
- Apr 16, 2026🔥 Hot Repo! 🔥 (100+ new stars) 📦 topoteretes / cognee ⭐ 15,589 (+156) 🗒 Python Knowledge Engine for AI Agent Memory in 6 lines of code — @github-trending.bsky.social1 likes and repost
- Jun 19, 2025cognee Memory for AI Agents in 5 lines of code. https://github.com/topoteretes/cognee — @pythonhub.dev1 likes and repost · 1 reply
- Jun 8, 2025今日のGitHubトレンド topoteretes/cognee このリポジトリは、AIエージェント向けの動的なメモリ機能を提供することを目的に作成されました。 従来のRAG(Retrieval Augmented… — @dailygithubtrends.bsky.social1 likes and repost
- Jun 6, 2025今日のGitHubトレンド topoteretes/cognee このリポジトリは、AIエージェントにメモリ機能を持たせるためのライブラリです。… — @dailygithubtrends.bsky.social1 likes and repost
- Jan 21, 2025and try @cognee.bsky.social with LanceDB in our repo: github.com/topoteretes/... — @vasilijee.bsky.social1 likes and repost
- Jun 21, 2026🚀 Skyrocketing! 🚀 (200+ new stars) 📦 topoteretes / cognee ⭐ 18,410 (+361) 🗒 Python Cognee is the open-source AI memory platform for… — @github-trending.bsky.social0 likes and reposts · 1 reply
On Hacker News · 5
- Jun 3, 2025Show HN: Cognee – Open-Source AI Memory Layer That Remembers Context9 points · 2 comments
- Apr 22, 2024Show HN: Auto-optimizing deterministic LLM outputs using knowledge graphs7 points
- Feb 13, 2025Show HN: Cognee – Turn RAG and GraphRAG into custom dynamic semantic memory6 points · 1 comment
- Jan 13, 2025Cognee: Reliable LLM Memory for AI Applications and AI Agents2 points
- Feb 6, 2026Memory for AI agents in 6 lines of code1 point
In this repository17 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- cognee-cliSkill
- cognee-communitySkill
- cognee-custom-pipelinesSkill
- cognee-dockerSkill
- cognee-forgetSkill
- cognee-improve-sessionsSkill
- cognee-ingestionSkill
- cognee-installSkill
- cognee-integrationsSkill
- cognee-migrationsSkill
- cognee-performanceSkill
- cognee-permissionsSkill
- cognee-recallSkill
- cognee-serverSkill
- cogneeSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 46
Every node type subclasses DataPoint (from cognee.low_level import DataPoint).
- Very specific: line 104
Instead of a nested object, the LLM answers the identity string of a node (is_a: "engineer"), and cognee links to that node.
- Very specific: line 164
Remote mode drops it: After cognee.serve(url), remember() and cognify() do not forward graph_model.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Custom graph models
By default cognee extracts a generic KnowledgeGraph of entities and
relationships. Pass your own model with graph_model= and the LLM fills
your node and edge types instead.
from typing import Annotated, Literal
import cognee
from cognee.low_level import DataPoint, Edge, FromIdentity
class Role(DataPoint):
name: str
metadata: dict = {"index_fields": ["name"], "identity_fields": ["name"]}
class Person(DataPoint):
name: str
is_a: Annotated[Role, FromIdentity()] | None = None # reference by name
reports_to: list[Edge["Person", "Person"]] = [] # edge owned by Person
metadata: dict = {"index_fields": ["name"], "identity_fields": ["name"]}
class PeopleGraph(DataPoint): # the root the LLM fills
people: list[Person]
friends_with: list[Edge[Person, Person]] = []
family: list[Edge[Person, Person, Literal["married_to", "sibling_of"]]] = []
metadata: dict = {"index_fields": [], "transparent": True}
await cognee.remember(text, graph_model=PeopleGraph, custom_prompt="Extract every person...")Full example: examples/guides/custom_graph_model.py.
Use it
Nodes: DataPoint classes
Every node type subclasses DataPoint (from cognee.low_level import
DataPoint). Its fields become:
- Node properties: scalars, strings, dicts, and anything that is not a DataPoint.
- Edges named after the field: a field holding a DataPoint or a list of
DataPoints.
members: list[Person]becomesmembersedges.
dict[str, Person], sets and plain tuples are stored as properties, not
edges.
Identity and search: metadata
| Key | What it does |
identity_fields | The node id is derived from these field values (normalized: lowercased, spaces to _, apostrophes removed). The same entity from two chunks or two runs becomes one node. |
index_fields | Each field gets a vector collection named <ClassName>_<field>, so recall can find the node. |
transparent | The node is not stored; its children take its place. Use it for a root container like PeopleGraph. |
Without identity_fields every node gets a random id, so the same person
is duplicated in every chunk and every run. Set it on every node type that
represents a real-world entity.
Write metadata explicitly, as in the examples above. There is also an
annotation shortcut (from cognee.infrastructure.engine import Dedup,
Embeddable; name: Annotated[str, Embeddable(), Dedup()]), but today only
half of it works:
Dedup()works: ids are derived from the marked fields.Embeddable()does not index. The markers update the class-level default, but each instance still carries{"index_fields": []}, and indexing reads the instance, so no vector collection is created and recall cannot find the node.
Markers are also ignored entirely when the class declares metadata
itself.
Typed edges: list[Edge[Source, Target, Name]]
The LLM answers edges as flat rows of identity strings (source, target),
and cognee resolves them to the extracted nodes. The third parameter
controls the relationship name:
| Declaration | Relationship name |
list[Edge[Person, Person]] | The field name (friends_with) |
list[Edge[Person, Person, Literal["a", "b"]]] | The LLM picks one value |
list[Edge[Person, Person, str]] | Free-form from the LLM, normalized |
- Where to declare: on the root model for relationships with no obvious
owner, or on the owning node. On the owner, endpoints of the owner's own
type must be strings (
Edge["Person", "Person"]), because the class is not defined yet inside its own body. - Always a list:
Edge[...]orEdge[...] | Noneon its own raises. - Both endpoint types need exactly one
identity_fieldsentry.
References: Annotated[Target, FromIdentity()]
Instead of a nested object, the LLM answers the identity string of a node
(is_a: "engineer"), and cognee links to that node. Supported spellings:
Target, Target | None, list[Target], list[Target] | None.
Anything else raises InvalidReferenceTypeError. The target needs exactly
one identity field, and its other required fields need defaults.
Edge values you build by hand
Edge(source=..., target=..., relationship_type=..., weight=...,
properties={...}). An omitted source falls back to the node declaring the
field; on a parametrized field that node must be the declared Source
type, or it raises. On a root container, always pass source=. The tuple
form (Edge(weight=0.8), target_node) attaches edge properties to a plain
DataPoint field (examples/guides/custom_data_models.py).
From JSON instead of Python
cognee.low_level.graph_model_from_spec(spec): a small entity/relation spec (names, fields,one/manyrelations) compiled to DataPoint classes, with identity and index onnameby default. Example:examples/guides/graph_model_from_json.py.cognee.low_level.graph_schema_to_graph_model(json_schema): a JSON Schema (needs a top-leveltitle; only internal#refs).- HTTP:
POST /api/v1/remembertakes agraph_modelform field (JSON schema string);POST /api/v1/cognifytakes agraphModelJSON object.POST /api/v1/llm/infer-schemaproposes a schema from sample text.
Neither JSON path can express typed Edge fields or FromIdentity; use
Python classes for those.
Pitfalls
- Duplicated nodes → missing
identity_fields. - Node never shows up in recall → no
index_fields, or the recalling process never imported the model class (graph completion searches the collections of DataPoint classes loaded in that process). - Edge rows silently missing → an unresolved row is dropped with a warning. Endpoints resolve by exact type against nodes extracted from the same chunk: a subclass instance does not match where its base is declared, and a node from another chunk or an earlier run is not a candidate.
InvalidReferenceTypeError, "declares Edge in a shape the LLM extraction cannot fill" → an unsupportedFromIdentityorEdgespelling. These are raised when the model is converted during extraction, not at class definition, so they appear mid-pipeline.- String endpoints resolve only to the owning model itself or a
module-level class. A string naming another class defined inside a
function raises
InvalidReferenceTypeError, so define models at module level. - Field names that collide with DataPoint's own fields (
id,type,version,metadata,created_at,belongs_to_set, …) are stripped from what the LLM sees. Rename them. - A subclass that overrides
metadatareplaces the parent's entirely. Droppingidentity_fieldsonly logs a warning. A subclass also hashes ids under its own class name. - Write a
custom_prompt. Without one the generic knowledge-graph prompt is used; your schema reaches the LLM only as structured output. - Not with GLiNER.
extractor="gliner_demo"(alias"gliner") raises with a customgraph_model, and so does the defaultGRAPH_EXTRACTOR=autowhen no LLM key is configured (it resolves togliner_demo). - Remote mode drops it. After
cognee.serve(url),remember()andcognify()do not forwardgraph_model; the server builds a generic graph. - A custom model skips the generic path's ontology resolution, per-graph
node dedup, and
functional_relationships. Summaries still run.
How it works
extract_content_graph converts a DataPoint model into a plain Pydantic
model for the LLM: infrastructure fields and metadata are stripped, typed
edge fields become row lists (FriendsWithEdge with source/target
strings), and FromIdentity fields become strings. The answer is converted
back into DataPoint instances with ids from identity_fields, edge rows are
resolved against the nodes in that answer, and the result is attached to the
chunk (chunk.contains) and stored by add_data_points. Ownership is
recorded per document, so forget(data_id=...) removes a custom-model
document's nodes while shared nodes survive.
- LLM boundary, both directions:
cognee/shared/llm_graph_model.py - DataPoint, metadata, ids:
cognee/infrastructure/engine/models/DataPoint.py - Markers:
cognee/infrastructure/engine/models/FieldAnnotations.py - Edge:
cognee/infrastructure/engine/models/Edge.py - Property vs edge decision:
cognee/modules/graph/utils/field_edges.py - Custom-model branch of extraction:
cognee/tasks/graph/extract_graph_from_data.py - JSON schema / spec paths:
cognee/shared/graph_model_utils.py,cognee/modules/graph_models/ - Vector collections:
cognee/tasks/storage/index_data_points.py
Extending it
- Tests for the LLM round trip:
cognee/tests/unit/modules/graph/test_content_graph_to_data_point.py. Edge typing:cognee/tests/unit/interfaces/graph/test_typed_edge_model.py,test_typed_edges_graph.py. Identity:cognee/tests/unit/infrastructure/engine/test_identity_fields.py. Property vs edge:cognee/tests/unit/modules/graph/test_field_edges.py. - Deletion of custom-model nodes:
cognee/tests/test_delete_custom_graph.py. - A new
EdgeorFromIdentityspelling must be handled in both directions inllm_graph_model.py, and rejected withInvalidReferenceTypeErrorwhen unsupported, never silently accepted.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

