For the complete documentation index, see llms.txt. Every page is also served as Markdown at its URL followed by .md.

standards
Schema ownershipData model

Schema ownership

Understand who owns each object on a workspace, what a sync may change, and how a bundle lives and dies over the API.


A bundle is the slice of a workspace's schema that one codebase owns. You declare objects and views with the builders, give the set a name, and sync it with bundles.sync. The workspace applies it as system definitions. Users keep working on top: their attributes and views survive every sync.

import { bundle, createStandards, object, text } from "@standards/client";

const service = object("services", "Service")
  .labelExpression("{{ name }}")
  .attribute(text("name", "Name").required());

export const status = bundle("status-page", "Status page").add(service);

const standards = createStandards({
  baseUrl: "https://api.standards.new/v1",
  apiKey: process.env.STANDARDS_API_KEY!,
  bundles: [status],
});

const result = await standards.bundles.sync(status);
// { applied: true, hash, objects: { created, updated, deleted }, views: { created, updated, adopted, released } }

Three tiers

Every object on a workspace belongs to one of three tiers: native, system or runtime.

  • Native objects ship with the platform: skill, memory, drives, artifact, meeting. Their names are reserved. Declaring one in code fails at build time with ReservedObjectNameError, and the API refuses them too.
  • System objects and attributes are declared in code and synced by bundles.sync. They carry system: true and are immutable in the app.
  • Runtime objects and attributes are created by users in the app, or over POST /schema/objects and its attribute routes under architect:create. They carry system: false.
SystemRuntime
Who createsYour code, through bundles.sync.Users in the app, or an API call under architect:create.
Who changesYour code, on the next sync. Users cannot edit, retype or delete it.Users in the app.
Who deletesYour code. An attribute removed from the bundle is dropped with its values and the view contents sourced on it; an object removed from the bundle is demoted, not deleted.Users in the app.
What sync doesOwns the definition and rewrites it to match the code.Keeps it. Promotes it to system when the code declares the same name; refuses with a 400 when the types clash.

A runtime attribute added on a system object is merged back attribute by attribute: it stays where the user put it, and it becomes a system attribute only if your code later declares a compatible attribute with that name.

Removing an attribute reaches its views

Whoever removes an attribute, your code on the next sync or a user in the app, the views that name it follow:

  • A view content sourced on it is dropped from its view: a collection whose query reads related(attribute) or relatedFrom(attribute) through it, and a content.richtext(attribute) editing it. A content a bundle declared is hidden rather than deleted.
  • Any other content loses its mentions of the attribute: columns, card fields, form fields, filter rules and sorts.
  • The removal is refused with 409 SCHEMA_ATTRIBUTE_IN_USE, naming the view and the content, when a kanban is grouped by the attribute or when a view would lose its last main content. Regroup the board or give the view another main content first. A sync judges the views your code declares in that same sync, not the ones the previous sync left: re-sourcing a content on the attribute that replaces the removed one, or declaring another main content, in the same push keeps the view valid. A bundles.sync that removes such an attribute is refused as a whole with a 400 (BundleValidationError) carrying the same sentence, and nothing is applied.

Removing a runtime object, in the app, over DELETE /schema/objects/:id or in an Architect draft, does the same for each of its attributes on the views of the objects that remain: another object's collection listing its records through one of its relations is dropped, and a column naming one is stripped. Its own views leave with it and are not checked. It is refused the same way, with 409 SCHEMA_ATTRIBUTE_IN_USE, when a surviving kanban is grouped by one of its attributes or a surviving view would lose its last main content. The message names the attribute, not the object.

documents.relations and the emailAttributes of emails and meetings are not rewritten: repair them yourself.

Renames and retypes carry a resolution

Renaming a system attribute in code reads as one attribute gone and another of the same type appearing, and changing its type would leave the stored values unconverted. The sync refuses both before writing anything and answers 400 SCHEMA_AMBIGUOUS_CHANGE, naming the object, the attributes and the resolution that resolves them. Switching between text and richtext is the exception: both store a string, so it is applied in place. To keep the data, send that resolution with the next push — bundles.sync(bundle, { resolutions }) renames an attribute and keeps its values, or converts text → phone and number → currency; relations and any other retype still take a SQL migration. To drop the data, ship the removal and the addition in separate syncs. See Data model / Objects.

Sealed objects

An object marked .sealed() turns every undeclared runtime attribute into a standards schema diff failure unless .tolerate() names it; neither flag deletes user data. See Data model / Objects.

Demotion keeps records

Remove an object from the bundle, or remove the whole bundle, and the object is demoted to runtime: system: false, records untouched, attributes untouched. Users can then edit or delete it in the app. A sync demotes an object; it never deletes one.

Views are adopted and released

A view declared by a bundle is owned by it. When the bundle declares a view whose object and name already exist as a runtime view, the row is adopted: it becomes bundle-owned and workspace overlays on it are preserved. When a view leaves the bundle, the row is released back to runtime with its overlays. The sync never overwrites a user's view with a copy of its own. The one thing a sync carries into a tab the workspace customized is a column new to the bundle: it is appended, visible, after the workspace's columns. Columns the workspace removed stay removed, and its order stays its own.

An object your bundle declares without views gets the workspace's default views, a table and a record page, just like an object created in the app. Each is created once, when the object has no view of that kind, as an ordinary workspace view: users change them, and later syncs leave them alone. Declare a list view for the object and only the record page is created; declare both and neither is.

Lifecycle over the API

bundles.sync is a thin client over four routes.

RoutePermissionAnswer
GET /bundlesarchitect:read{ installed: [{ name, mode, origin, hash, installedAt, installedBy }] }, plus the bundles available for adding.
GET /bundles/:namearchitect:readOne summary. 404 with code SCHEMA_BUNDLE_NOT_FOUND when the workspace never received the bundle.
PUT /bundles/:namearchitect:update{ applied, hash, objects?, views? }
DELETE /bundles/:namearchitect:delete204. Owned objects are demoted, owned views released.

The sync works like this:

  1. The client builds the bundle (SHA-256 over the canonical JSON of its pieces) and reads GET /bundles/:name.
  2. Same hash, label and description: nothing is applied and the client answers { applied: false }.
  3. Otherwise PUT /bundles/:name with the built artifact and, when passed, resolutions. The server recomputes the hash and answers 400 when it differs. It then checks ownership, applies the resolutions (outside the hash), validates every object and view with the builders' own rules, and applies the bundle under a per-workspace lock before persisting it. Resolutions and bundle are one transaction: a refusal anywhere leaves both unapplied.

Scope. A sync, like a DELETE, writes only the bundle's own objects and the inverse rows of the bilateral relations it declares; the objects of core and of other bundles are read, never written, and cannot refuse it.

The routes are exempt from rate limiting: a CI push carries the whole schema in one call.

Conflicts. An object or view already owned by core or by another bundle is a 409 (DuplicateError), with a message like Object "services" is owned by bundle:legacy-site. The owner is always the other party; the client throws BundleConflictError with objectName and owner. A declared view that would be a second default for the same object and context is a 409 as well, before anything is written; objectName and owner are then empty.

What the workspace refuses. Over HTTP, core, a bundle a host declares in code and an added copy cannot be synced or removed, and a bundle cannot be removed while another installed bundle uses it. See Bundles.

Limits. A bundle synced over HTTP declares at most 50 objects and 200 views, and only views for its own objects. Agents and pages are not accepted over HTTP yet.

From a terminal

standards bundles sync                     # discover standards/bundles/*.ts and sync each one
standards bundles list                     # name, mode, origin, hash, installedAt
standards bundles remove status-page --yes # demote its objects, keep the records
standards schema pull                      # read the deployed schema against the shared runtime
standards schema diff                      # exit 0 when equal, 1 on differences, 2 on error

standards schema pull and standards schema diff compare what is deployed with what users changed at runtime. They never modify files or the workspace. See CLI / Schema and bundles.

Next steps