Entity Registry
The entity registry gives the people, organizations, projects, places, and concepts your memories mention a single canonical record each. Suppose “Alice Chen”, “Alice”, and “achen” show up across hundreds of memories. The registry resolves all three to one entity. That entity keeps its aliases and the list of memories that mention it, and recall, perspective, and the knowledge base can use it.
The registry is part of core MemoryLayer (0.2.0+). It is off by default.
export MEMORYLAYER_ENTITY_REGISTRY_ENABLED=truememorylayer serveWhile the flag is off, the /v1/entities endpoints that read or modify the registry return 501. The SDKs surface that 501 as EnterpriseRequiredError, even though the registry is a core feature. Turn on the flag to use it.
How Entities Are Built
With the registry enabled, every stored memory goes through accretion:
- Entity names are extracted from the content. Core MemoryLayer uses a deterministic extractor: dialogue speakers plus proper-noun spans. MemoryLayer Enterprise can use typed named-entity recognition (GLiNER2) instead.
- Each name is resolved: it is normalized, then matched exactly against canonical names, then against aliases. A new entity is created only when nothing matches.
- The memory is attached to each entity as a member. The role is
selfwhen the entity is the memory’s speaker orobserver_id, andmentionotherwise. A memory’sobserver_idandsubject_idfields always accrete as people, so email and documents get perspective anchors even without dialogue prefixes.
Names that the extractor could not type become concept and are promoted to person when the evidence says so. The same normalized name maps to one canonical entity per workspace.
Entity Types
The core types are person, org, project, place, event, and concept (the catch-all). The ontology also defines artifact, work_item, decision, and topic. Add domain types with MEMORYLAYER_ENTITY_TYPES, a comma-separated list of type or type:ner_label entries:
export MEMORYLAYER_ENTITY_TYPES="equipment,chemical:chemical compound,standard"The Entity Record
| Field | Description |
|---|---|
id | Entity ID |
entity_type | One of the types above (a string, so domain types round-trip) |
canonical_name / normalized_name | Display name and match key |
aliases | Other surface forms that resolve to this entity |
confidence | Resolution confidence (default 1.0) |
provenance | How the entity came to exist |
representative_memory_id | A memory that best represents the entity |
status | active or merged |
merged_into | The surviving entity when status is merged |
API
All endpoints are under /v1/entities and accept an optional workspace_id query parameter.
| Method & Path | Description |
|---|---|
GET /v1/entities | List entities (status = active or merged, limit default 100, max 1000) |
GET /v1/entities/resolve?name=...&entity_type=person | Resolve a surface name to a canonical entity. Never creates one; returns 404 when nothing matches. The response gives matched_via (exact, alias, and so on) and a score. |
GET /v1/entities/{id} | Get one entity |
POST /v1/entities/merge | Merge source_id into target_id (body: source_id, target_id, reason) |
POST /v1/entities/dedupe | Batch deduplication (see below) |
GET /v1/entities/{id}/provenance | Provenance and lineage |
GET /v1/entities/{id}/related | Related entities by co-occurrence (limit 10, min_shared 1) |
POST /v1/entities/seed | Seed a catalog of canonical entities |
POST /v1/entities/backfill | Accrete entities from existing memories |
POST /v1/entities/enrich | Link entities to an external knowledge base |
POST /v1/entities/{id}/derive | Synthesize inference memories (insights) about an entity |
GET /v1/entities/{id}/card | An LLM-written entity card: reflection, insights, and source memories (cached 300 s) |
GET /v1/entities/{id}/insights | List derived insights, optionally filtered by observer_id |
The derive, card, and insights endpoints use the configured LLM.
SDK Support
The Python, TypeScript, and Go SDKs wrap list, get, resolve, and merge:
entities = await client.list_entities(limit=50)resolution = await client.resolve_entity("Alice Chen", entity_type="person")survivor = await client.merge_entities(dup_id, keep_id, reason="same person")const { entities } = await client.listEntities({ limit: 50 });const resolved = await client.resolveEntity("Alice Chen", { entityType: "person" });Use the REST API for the other endpoints.
Merge and Dedup
Merge moves the source entity’s members and aliases onto the target, carries the source’s names forward as aliases, and marks the source merged with merged_into set. Merges are idempotent: merging an entity into itself, or merging when either side is already merged, is a no-op that returns the surviving entity.
Dedup (POST /v1/entities/dedupe, with optional threshold and limit default 1000) finds near-duplicate entities by name-embedding similarity. It groups them with union-find clustering and merges each cluster into its best-established member: the one with the most members, then the most aliases, then the highest confidence. It returns {clusters, merged}.
Seeding and Backfill
Seed a catalog of known entities before ingestion, so resolution lands on your canonical names:
curl -X POST "$MEMORYLAYER_URL/v1/entities/seed" \ -H "Content-Type: application/json" \ -d '{ "entities": [ {"name": "Acme Corp", "entity_type": "org", "aliases": ["Acme", "ACME Inc."], "external_ids": {"wikidata": "Q123"}}, {"name": "Project Falcon", "entity_type": "project", "description": "Payments rewrite"} ] }'Seeding creates or updates entities. Entries with an entity type the ontology does not know are skipped and listed in skipped_invalid_type.
Backfill accretes entities from memories that were stored before the registry was enabled:
# Accrete from existing memories in batches of 200curl -X POST "$MEMORYLAYER_URL/v1/entities/backfill?batch_size=200"
# Wipe the workspace's registry first, then rebuildcurl -X POST "$MEMORYLAYER_URL/v1/entities/backfill?reset=true"The response reports cleared, scanned, and accreted. Backfill always re-runs extraction with the current extractor instead of reusing entity names cached on each memory. Add reset=true after switching extractors, so stale entities from the old extractor are removed first. max_memories caps a run.
Provenance
GET /v1/entities/{id}/provenance returns a PROV-O-flavoured lineage record:
| Field | Description |
|---|---|
origin | seeded, promoted, created, matched, or unknown |
activity, agent, description | What created the entity and who ran it |
external_links | External knowledge-base links (id, label, description, url, score) keyed by source |
source_memory_ids | Memories that evidence the entity |
generated_at | When the lineage was recorded |
Relatedness
GET /v1/entities/{id}/related ranks other entities by member co-occurrence: how many memories mention both. Each result carries shared_memories and a score. Raise min_shared to require stronger evidence.
External Linking (Wikidata)
POST /v1/entities/enrich (with types default org,person,place, limit default 500, and overwrite default false) links entities to an external knowledge base through the configured linker. The linker is selected with MEMORYLAYER_ENTITY_LINKER_PROVIDER. Core MemoryLayer ships only the default no-op linker. The wikidata linker is part of MemoryLayer Enterprise.
Registry-Backed Recall
Two recall channels use the registry. Both are off by default:
| Env var | Default | Effect |
|---|---|---|
MEMORYLAYER_ENTITY_REGISTRY_RECALL_ENABLED | false | Resolves the query’s entities and fuses their mention members into recall. This catches memories that name the entity by an alias. |
MEMORYLAYER_ENTITY_REGISTRY_RECALL_POOL | 200 | Candidate pool for that channel |
MEMORYLAYER_ENTITY_REGISTRY_RECALL_MIN_RELEVANCE | 0.0 | Query-relevance floor, which stops large entities from flooding results |
MEMORYLAYER_GRAPH_RECALL_ENABLED | false | The bounded graph-traversal channel over the entity neighbourhood |
Recall never creates entities from a query string.
Related Pages
- Perspective & User Memory: what one entity knows about another, built on the registry
- Knowledge Base: entity articles for the most-connected entities
- Knowledge Graph: typed associations between memories