Schema objects reference
Inventory of the constraints, regular indexes, text indexes, vector indexes, and point indexes that the bolt backend attempts to create on connection. NAMS manages its schema on the service; client.schema is not supported there.
Use this page to answer "what schema changes will this library make to
my Neo4j database?" before deploying.
Schema creation is performed by neo4j_agent_memory.graph.schema.SchemaManager.setup_all(), which
runs as part of MemoryClient.connect(). Existing constraints/indexes
with the same name are skipped; the operation is idempotent.
setup_all() also runs a one-time data backfill that copies the legacy relation_type property of RELATED_TO relationships into type, the canonical relationship-name property since 0.7. It runs once per database: completion is recorded on a (:SchemaMigration {name: "relation_type_backfill"}) node, and later connects skip it. A failure is logged rather than raised, and the backfill is retried on the next connect. Set schema_config.backfill_relation_types=False to skip it and run the equivalent query yourself in batches on a very large graph.
A second one-time backfill, recorded as (:SchemaMigration {name: "entity_keys_backfill"}) and gated by the same setting, fills the entity lookup keys that entity resolution reads: name_key (the lower-cased name) and surface_keys (every surface form — name, canonical name and aliases — lower-cased between | delimiters). Every library write keeps both up to date. An entity written by your own Cypher has neither until you set them, and resolution’s exact-name and name-prefix lookups cannot find it.
The authoritative source is
src/neo4j_agent_memory/graph/schema.py. This page is a human-readable
reference to the schema objects the library creates, but consult that
file for the complete current inventory used in deployments.
Unique constraints
| Name | Label | Property | Purpose |
|---|---|---|---|
|
|
|
Unique conversation identifier. |
|
|
|
Unique message identifier. |
|
|
|
Unique entity identifier across all subtypes. |
|
|
|
Unique preference identifier. |
|
|
|
Unique fact identifier. |
|
|
|
Unique reasoning-trace identifier. |
|
|
|
Unique reasoning-step identifier. |
|
|
|
One |
|
|
|
Unique tool-call identifier. |
|
|
|
Unique user identifier (multi-tenancy). |
|
|
|
Unique consolidation-job run identifier. |
|
|
|
Unique memory-read audit event identifier. |
|
|
|
Unique stored-ontology identifier (bolt |
|
|
|
Unique ontology-version identifier. |
|
|
|
Backs the single lock node that serializes concurrent ontology activations. |
Regular indexes
Lookup indexes for common filter / equality queries.
| Name | Label | Property | Purpose |
|---|---|---|---|
|
|
|
Look up conversations by session. |
|
|
|
Filter active vs. archived conversations. |
|
|
|
Order messages chronologically. |
|
|
|
Filter messages by role ( |
|
|
|
Filter entities by POLE+O (or custom) type. |
|
|
|
Look up entities by display name. |
|
|
|
Look up entities by deduplicated canonical name. |
|
|
|
Entity resolution: names starting with a mention’s first token. |
|
|
|
Filter preferences by category. |
|
|
|
Reasoning traces for a session. |
|
|
|
Successful vs. failed traces. |
|
|
|
Filter failed traces by error classification. |
|
|
|
Filter consolidation runs by kind. |
|
|
|
Filter memory-read audit events by kind. |
|
|
|
Filter tool calls by status. |
|
|
|
Look up stored ontologies by name. |
Text indexes
Back the CONTAINS and ENDS WITH lookups of entity resolution, which runs on every ingested message.
| Name | Label | Property | Purpose |
|---|---|---|---|
|
|
|
Entity resolution: exact match on any surface form (name, canonical name, alias). |
|
|
|
Entity resolution: names ending with a mention’s last token. |
Vector indexes
Created with the embedding dimensions configured at construction time
(SchemaManager(client, vector_dimensions=…)). Default is 1536.
Vector-index creation exceptions are currently suppressed, including failures unrelated to server version. A successful connection therefore does not prove every index exists or is online. Point-index creation also suppresses errors. Inspect SHOW INDEXES when validating deployment permissions and semantic/geospatial query behavior.
After setup, MemoryClient validates the dimensions of existing managed vector indexes against the configured embedder. Mismatches raise EmbeddingDimensionMismatchError; unrelated index names are not checked. Changing a model requires the migration workflow, not just changing this setting.
| Name | Label | Property | Purpose |
|---|---|---|---|
|
|
|
Semantic search over message content. |
|
|
|
Semantic search over entity descriptions. |
|
|
|
Semantic search over preferences. |
|
|
|
Semantic search over facts. |
|
|
|
Search past reasoning traces by task similarity. |
|
|
|
Semantic search over individual reasoning steps (used by |
Point indexes
Created for geospatial queries on Location entities.
| Name | Label | Property | Purpose |
|---|---|---|---|
|
|
|
Geospatial proximity queries ( |
Removing the schema
SchemaManager.drop_all() removes every constraint and index whose name
starts with one of conversation_, message_, entity_,
preference_, fact_, reasoning_, trace_, tool_, task_,
step_, user_, consolidation_, memory_read_, or ontology_. It does not delete data, but its prefix matching can also remove application-owned schema objects using those prefixes. Inspect the current inventory before deliberately calling it.
async with MemoryClient(settings) as client:
await client.schema.drop_all()
See also
-
Configuration reference — provider dimensions and other configuration options.
-
Migrate embedding models — recreate indexes and re-embed stored data.
-
Graph memory architecture — the relationships these constraints/indexes support.