Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Principle:23blocks OS Ai maestro Entity Graph

From Leeroopedia
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.

Related Pages

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment