Skip to content

Knowledge Graph Patterns

Engram’s knowledge graph connects memories with typed, directed edges. This guide covers patterns for building graphs that make recall more powerful.

RelationMeaningExample
relates_toGeneral associationAuth middleware ↔ JWT library choice
supersedesReplaces outdated knowledgeNew API design supersedes old one
contradictsConflicts withTwo conflicting approaches found
part_ofComponent of a larger conceptDetail memory is part of hub memory
derived_fromConclusion drawn from sourceSummary derived from debugging session
summarized_byCondensed versionCluster of memories summarized by one

For complex topics, create a brief hub memory first, then store details as children:

{"tool": "remember", "content": "Auth system architecture overview: JWT + refresh tokens, httpOnly cookies, 15-min expiry"}

Then add detail memories with parent_id to automatically create part_of edges:

{"tool": "remember", "content": "JWT signing uses RS256 with rotating keys stored in AWS KMS", "parent_id": 42}

When decisions evolve, create supersedes edges rather than deleting old memories:

{"tool": "connect", "from": 55, "to": 42, "relation": "supersedes"}

This preserves history — you can trace why decisions changed.

In team contexts, the hive mind consolidation process uses these patterns automatically:

  • Deduplication: When two engineers remember the same thing, memories are merged
  • Contradiction detection: Conflicting knowledge gets contradicts edges, flagging it for resolution
  • Cross-team synthesis: Insights spanning domains are connected with relates_to edges

Set depth: 1 (up to 3) when recalling to follow edges and surface connected knowledge:

{"tool": "recall", "query": "authentication", "depth": 1}

This returns not just matching memories, but their graph neighbors — surfacing related context that flat search would miss.