Memory

hm_forget

Delete a node with its relationships, or a single edge

hm_forget removes something from memory. Pass a key to delete a node and every relationship attached to it, or an edge_id to delete just one edge or hyperedge and keep the nodes.

Parameters

ParameterTypeDescription
keystringThe node to delete, together with all of its edges.
edge_idstringThe id of one binary edge or hyperedge to delete. The connected nodes are kept. Mutually exclusive with key.
edge_versionintegerOptional write_version for optimistic concurrency when deleting an edge.

Deleting a heavily connected node

Most nodes are deleted in one transaction and the result has status: "deleted".

A node with more connected edges than one transaction removes (25 by default) is hidden from every read immediately and removed in the background. Over REST this answers 202 Accepted.

  • The result has accepted: true, status: "deleting", deleted: false and relationships_remaining.
  • Call hm_forget again with the same key to see progress. deleted becomes true only when the node is gone.
  • Until then the key can’t be stored again (node_deleting) and new relationships to it are refused.

Response

FieldDescription
deletedtrue once the node or edge is gone.
status"deleted", "deleting" or "not_found".
acceptedtrue when a background deletion was started.
key / edge_idWhat was targeted.
kindFor an edge: binary or hyperedge.
relationships_total, relationships_remainingProgress of a background deletion.
deletion_id, operation_idIdentifiers of the deletion.
replayedtrue when this deletion had already been applied.

Examples

{ "key": "fact_old_pricing" }
{ "edge_id": "9b3e41d7-2c58-5f06-a1b4-7d20e6c93f85" }

Deletion is permanent. To correct a memory, prefer hm_update — it keeps the node’s relationships and history.

Equivalents

curl -X POST https://api.hypermemory.io/api/v1/memory/forget \
  -H "Authorization: Bearer $HYPERMEMORY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"key":"fact_old_pricing"}'