Principle:23blocks OS Ai maestro Entity Graph
| Knowledge Sources | |
|---|---|
| Domains | Memory, Knowledge_Graph |
| Last Updated | 2026-10-26 10:00 GMT |
Overview
An entity relationship graph stored in CozoDB that links extracted entities via typed relations, queried by neighbourhood traversal with fading of stale memories.
Description
The memory system extracts entities from conversations and links them via typed relations (e.g., `created_by`, `depends_on`, `works_with`). The graph is stored in CozoDB tables (`entities`, `entity_relations`, `relation_statements`).
`entityNeighbourhood` queries all entities related to a given entity — both outgoing and incoming — strongest first, excluding faded memories. `aboutEntity` builds a complete memory card: finds the entity by name, queries its relations, and fetches the memories that mention it.
Memories have a tier system: short-term memories can be reinforced (reinforcement count incremented), promoted to long-term (sufficient reinforcement), or faded (past retention window). Faded memories are excluded from neighbourhood queries.
Usage
Use this principle when designing a knowledge graph where:
- Entities are extracted from text and linked by typed relations
- Relations have provenance (the memory that established them)
- Stale memories fade and are excluded from queries
Theoretical Basis
The graph is a directed typed graph with tiered memories:
entities(entity_id, name, type)
entity_relations(from_entity, predicate, to_entity, memory_id)
relation_statements(from_entity, predicate, to_entity, memory_id, said_at, holds)
memories(memory_id, category, content, tier, reinforcement_count)
The neighbourhood query traverses both directions:
?[direction, predicate, other, other_name, other_type, memory_id, sessions] :=
*entity_relations{from_entity: id, predicate, to_entity: other, memory_id},
*memories{memory_id, tier, reinforcement_count: sessions}, tier != 'faded',
direction = 'out'
// ... and the 'in' direction
The `sessions` column (reinforcement count) lets the UI show how many times a relation was observed, and the `holds` flag on statements marks ended relations.