Declaring a type
A record type is an ordinary page under a space’stemplates/ prefix whose frontmatter carries a metadataSchema.
Field types
string, text, number, boolean, date, select, multiselect, list, and url.
Fields take required, default, label, and description. Select and multiselect fields take options. Number fields take inclusive min and max bounds.
additionalKeys decides whether metadata keys the schema does not declare may be written. Set it to allow when agents should be free to add their own keys, or reject to keep the type closed.
Creating records
A record is created from its type, so it is born conforming rather than corrected later. The examples below createdemo/deals/acme: space demo, page path deals/acme.
400 with per-field issues and creates nothing, so a bad write never leaves a half-made page behind:
diligence, Diligence, and in diligence until no query is trustworthy.
Querying records
Every record carries atemplate stamp in its metadata, so querying one type is a metadata query with that filter already applied.
coco records types <space> and coco.records.types(space) list the space’s record types with their fields, which is how an agent meeting a deployment for the first time learns what it can ask.
Where record types fit
- Page metadata is the underlying store. A record type is a contract over it, not a different mechanism.
- Templates covers the rest of what templates do, including whole-space kits.
- Views is the human window onto the same queries.
- Export and import carries a type and its records between deployments as one bundle.