Relationships
Relationships connect memories in the knowledge graph. They are created automatically during retain and reflect operations.
Relationship Object
Section titled “Relationship Object”{ "id": "r1-uuid", "source_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "target_id": "b2c3d4e5-f6a7-8901-bcde-f12345678901", "type": "is_about", "strength": 0.85, "created_at": "2025-01-15T10:30:00Z"}| Field | Type | Description |
|---|---|---|
id | UUID | Relationship identifier |
source_id | UUID | Origin memory |
target_id | UUID | Target memory |
type | string | Relationship kind |
strength | float (0-1) | Connection strength |
created_at | ISO 8601 | When created |
Relationship Types
Section titled “Relationship Types”Types are flexible — the LLM infers appropriate types during retain and reflect. Common types:
| Type | Example |
|---|---|
is_about | A fact describes a person or topic |
related_to | Thematic connection |
part_of | Belongs to a broader concept |
contradicts | Conflicting information |
supports | Reinforcing evidence |
POST /api/v1/relationships/batch
Section titled “POST /api/v1/relationships/batch”Fetch relationships for multiple memories in a single request.
curl -X POST https://api.memlayer.dev/api/v1/relationships/batch \ -H "Content-Type: application/json" \ -d '["a1b2c3d4-e5f6-7890-abcd-ef1234567890", "b2c3d4e5-f6a7-8901-bcde-f12345678901"]'The request body is a JSON array of memory UUIDs. The response includes all relationships where any of the provided UUIDs appear as source_id or target_id.
Per-Memory Relationships
Section titled “Per-Memory Relationships”You can also fetch relationships for a single memory:
curl https://api.memlayer.dev/api/v1/memories/a1b2c3d4-e5f6-7890-abcd-ef1234567890/relationships