Entity registry
How to make an ARC model linkable from Brain.
Add a descriptor
- Open
server/src/modules/brain/registry/and either extend the domain file or add a new one. - Call
registerEntity({ ... })with at leastentityType,domain,slugPrefix,title,url,fields. - If the model has no
userId, setresolveUserId(e.g. Day via week). - Optional:
derivedLinks(row)to project FKs intoLinkrows withkind = DERIVED. - Run
pnpm brain:reindex --type=YourModeland confirmGET /api/v1/brain/entities/search?q=….
Template
registerEntity({
entityType: 'Person',
domain: 'social',
icon: 'User',
color: '#64748b',
linkable: true,
autoLink: true,
slugPrefix: 'person',
title: (row) => [row.firstName, row.lastName].filter(Boolean).join(' ') || row.name || 'Person',
subtitle: (row) => row.relationshipType ?? null,
aliases: (row) => [row.firstName, row.name].filter(Boolean) as string[],
url: (row) => `/people/${row.id}`,
fields: {
firstName: { label: 'First name', type: 'string', editable: true },
lastName: { label: 'Last name', type: 'string', editable: true },
},
});
Rules
- If it has an id and a user can open it, it is linkable.
- Indexing is async; a failed index never fails a domain write.
- Soft-delete in the index sets
isDeleted = true; rows are not removed so links do not dangle.