Concepts

Edges & hyperedges

How memories are connected, and how to write good relationships

Edges

An edge connects two nodes in one direction and says, in plain language, how they relate and why.

{
  "from_key": "component_checkout",
  "to_key": "tech_redis",
  "relationship": "checkout service uses Redis for session caching and rate limiting"
}
FieldDescription
relationshipThe wording of the connection. Be specific about why it holds — “uses Redis for session caching”, not just “uses”.
relationship_typeAn ontology relationship type. Defaults to related_to.
descriptionAn optional longer explanation.
dataOptional structured facts about the connection: since when, how strong, which version.

An edge is identified by its type and its two endpoints, so asserting it again updates the wording instead of adding a duplicate.

Hyperedges

A hyperedge is one fact over 2 to 256 nodes, with an optional role for each:

{
  "participant_keys": ["release_2_4", "fix_checkout_timeout", "deploy_2026_10_14", "person_alice"],
  "roles": ["release", "change", "deploy", "release manager"],
  "relationship": "Release 2.4 shipped the checkout timeout fix in the 14 October deploy, managed by Alice"
}

A hyperedge is identified by its wording and its set of participants (in any order). Asserting the same fact again returns the existing hyperedge.

When to use which

SituationUse
A simple fact between two thingsEdge
A meeting, decision or event with several participantsHyperedge
Five or more nodes that make up one piece of work — a feature, release, incident or investigationHyperedge naming what they jointly are

If removing one participant wouldn’t change the meaning, you probably don’t need that participant — or a hyperedge at all.

How relationships get written

WayWhen
With the node — relationships on hm_storeThe usual way. Up to 99 relationships, written in the same transaction as the node.
Afterwards — hm_add_relationshipsTo connect existing nodes or orphans. Up to 25 per call.
By enrichmentHyperMemory’s background workers detect entities in descriptions, discover relationships and add hyperedges.
From documentsUploaded files are linked to everything extracted from them.

Editing and deleting

  • Change an edge’s wording or data with hm_update and its edge_id. Pass edge_version to avoid overwriting someone else’s change.
  • Change its endpoints or type, or change a hyperedge: delete it with hm_forget and edge_id, then add it again.
  • Deleting an edge never deletes the nodes it connects. Deleting a node deletes its edges.

Edge ids and versions come back from hm_get_nodes.

Session hyperedges

HyperMemory groups the nodes one conversation touched under a session hyperedge (keys starting with chat_). These are reserved for the server; you read them with hm_get_chat_context.

Querying relationships

  • hm_recall returns each hit with its strongest relationships in expansion_context.
  • hm_find_related walks outward from a node.
  • hm_get_nodes returns a node’s edges and hyperedges in full.
  • GET /api/v1/memory/relationships/{key} lists one node’s relationships over REST.