Hypergraph relations
Beta in docs/STATUS.md. Mnemosyne is alpha, on the 3.6.x line, and the API
can still change within 3.x.
Why pairs are not enough
A relation joins two memories. Some knowledge joins more:
When a firmware release (A) fails its docking smoke test (B) and the rollback image (C) is out of date, the manual recovery runbook (D) applies.
Six pairwise edges can connect those four, but they lose the joint condition: any two of them look related on their own. A hyperedge keeps the four together.
The model
A hyperedge (MnemoHyperedge in packages/types/src/primitives.ts) has:
| Field | Meaning |
|---|---|
memberIds | The ids of the members, 3 to 50 |
label | A short name, optional |
description | A longer explanation, optional |
contextQuery | The situation in which the group matters, optional |
activationCount | How many times it was served with a hit |
worth | Its usefulness, starting at 0.5 |
validFrom, validTo | The same validity window that facts have |
Creating and reading
curl -X POST http://localhost:3939/hyperedges \
-H "Authorization: Bearer mns_live_..." \
-H "Content-Type: application/json" \
-d '{
"memberIds": ["FACT_A", "FACT_B", "FACT_C", "FACT_D"],
"label": "failed-release-recovery",
"description": "When a release fails docking and the rollback image is stale, use the manual runbook."
}'GET /hyperedges List; filter with memberId, label, includeClosed
GET /hyperedges/{id}
PATCH /hyperedges/{id} Change label, description or contextQuery
DELETE /hyperedges/{id} Close itFrom MCP, memory_hyperedge takes action (create, get, list, patch
or archive). An agent can also form one with memory_self_edit and the
link action.
How hyperedges form
- Explicitly, with the calls above.
- On session collapse. After the new facts are stored, the collapse asks the LLM for groups of three or more that belong together and stores each group as a hyperedge. A failure here does not fail the collapse.
Recalling facts together does not create a hyperedge. Co-recall strengthens the pairwise relation between the two facts.
In recall
Stage 3 of the cold tier looks up the hyperedges of the served hits and attaches them as context. Members of a hyperedge are not added to the result as hits. Serving a hit that belongs to a hyperedge raises that hyperedge’s activation count.