Skip to main content

Entity registry

How to make an ARC model linkable from Brain.

Add a descriptor​

  1. Open server/src/modules/brain/registry/ and either extend the domain file or add a new one.
  2. Call registerEntity({ ... }) with at least entityType, domain, slugPrefix, title, url, fields.
  3. If the model has no userId, set resolveUserId (e.g. Day via week).
  4. Optional: derivedLinks(row) to project FKs into Link rows with kind = DERIVED.
  5. Run pnpm brain:reindex --type=YourModel and confirm GET /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.