From dfb036938a7e205f028ede669a608a05a5d70c97 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 26 Nov 2026 01:35:21 +0000 Subject: [PATCH 1/3] docs(skills): objectstack-ai teaches the context pack (ai_context), and both doors that mount the record-context service The published skills taught only the aiContexts key name and the record-context token row. A new reference, objectstack-ai references/context-packs.md, teaches authoring a pack: its keys and bounds, a related list's where / orderBy / limit, the body and its anchors, how a pack is named (package and name, the face), what the caller is not shown, and what os validate reports. Both SKILL.md files carry a pointer paid for by deleting restatement in the same file. The aiContexts description, the service-record-context README and the RecordContextServicePlugin docblock now name both mounts: the record-context token and a plugins[] mount. Claude-Session: https://claude.ai/code/session_01Utp6CaWzgwG1QYaiBidBCK Co-authored-by: Claude --- .changeset/record-context-two-mounts-prose.md | 9 ++ .../services/service-record-context/README.md | 18 ++- .../service-record-context/src/plugin.ts | 18 ++- packages/spec/src/stack.zod.ts | 8 +- scripts/check-skills-token-ratchet.mjs | 10 ++ skills/objectstack-ai/SKILL.md | 30 ++--- .../evals/skills-tools-knowledge.json | 10 ++ .../references/context-packs.md | 111 ++++++++++++++++++ skills/objectstack-platform/SKILL.md | 11 +- 9 files changed, 196 insertions(+), 29 deletions(-) create mode 100644 .changeset/record-context-two-mounts-prose.md create mode 100644 skills/objectstack-ai/references/context-packs.md diff --git a/.changeset/record-context-two-mounts-prose.md b/.changeset/record-context-two-mounts-prose.md new file mode 100644 index 00000000000..f3082bc0aa6 --- /dev/null +++ b/.changeset/record-context-two-mounts-prose.md @@ -0,0 +1,9 @@ +--- +'@objectstack/spec': patch +'@objectstack/service-record-context': patch +--- + +Clause-②: no +Metadata-protocol: none + +Documentation text only. The `aiContexts` description on the stack, the `@objectstack/service-record-context` README and the `RecordContextServicePlugin` docblock now name both ways a host mounts the record-context service that serves `get_record_context`: the stack declares `requires: ['record-context']`, which the CLI expands to the plugin, or a host that composes its own kernel lists `RecordContextServicePlugin` in `plugins`. Before, the stack description read the token as the only serving condition, and the README and docblock taught only the `plugins` mount. No schema, key or runtime behaviour changes. diff --git a/packages/services/service-record-context/README.md b/packages/services/service-record-context/README.md index b355687a7a0..94274e1c003 100644 --- a/packages/services/service-record-context/README.md +++ b/packages/services/service-record-context/README.md @@ -10,9 +10,8 @@ field, a list or a row the caller cannot read is never carried, and the answer says when something was withheld or cut. ```ts -import { RecordContextServicePlugin } from '@objectstack/service-record-context'; - export default defineStack({ + requires: ['record-context'], aiContexts: [{ name: 'policy_document', label: 'Policy document', @@ -21,12 +20,21 @@ export default defineStack({ related: [{ object: 'policy_revision', fields: ['version', 'published_at'] }], body: { field: 'content' }, }], - plugins: [new RecordContextServicePlugin()], }); ``` -A host that mounts the plugin serves `get_record_context` on its MCP doors -(`data:read`, read-only). A host without it serves no such tool. +Two doors mount the service, and either is enough: + +- `requires: ['record-context']` on the stack. The CLI expands the token to + `RecordContextServicePlugin` (`CAPABILITY_PROVIDERS` in `@objectstack/core`), + so an app that ships only metadata gets the tool with no host code. +- `plugins: [new RecordContextServicePlugin()]`, for a host that composes its + own kernel. A host that lists the plugin keeps its own instance when the + token is declared too. + +A host that mounts the service serves `get_record_context` on its MCP doors +(`data:read`, read-only). A host that does neither serves no such tool, +whatever packs it holds. The answer is `{ data, notes, framing }`: `data` is the record material, `notes` are the executor's statements about it, and `framing` says that `data` diff --git a/packages/services/service-record-context/src/plugin.ts b/packages/services/service-record-context/src/plugin.ts index 0e078c800d0..352a27ccaa0 100644 --- a/packages/services/service-record-context/src/plugin.ts +++ b/packages/services/service-record-context/src/plugin.ts @@ -21,11 +21,25 @@ export interface RecordContextService { * A host that mounts it serves `get_record_context` on its MCP doors (both * resolve the service by structure, as they resolve the dataset and knowledge * executors); a host without it registers no `get_record_context`, and - * nothing else changes (ADR-0160 D5). Composition is explicit: mount it in - * `plugins[]`. + * nothing else changes (ADR-0160 D5). Composition is explicit, by either of + * two doors: a stack declares `requires: ['record-context']`, which the CLI + * expands to this plugin (`CAPABILITY_PROVIDERS` in `@objectstack/core`), or a + * host that composes its own kernel mounts it in `plugins[]` and keeps that + * instance when the token is declared too. * * @example * ```ts + * // An app that ships only metadata: the token mounts the plugin. + * export default defineStack({ + * // … + * requires: ['record-context'], + * aiContexts: [policyDocumentPack], + * }); + * ``` + * + * @example + * ```ts + * // A host that composes its own kernel. * import { RecordContextServicePlugin } from '@objectstack/service-record-context'; * * export default defineStack({ diff --git a/packages/spec/src/stack.zod.ts b/packages/spec/src/stack.zod.ts index 717d193aae1..ecf365c797c 100644 --- a/packages/spec/src/stack.zod.ts +++ b/packages/spec/src/stack.zod.ts @@ -1223,9 +1223,13 @@ const STACK_DEFINITION_COLLECTIONS_SHAPE = { /** * [ADR-0160 D1] Context packs: which of one record's fields, related lists * and body text are handed to a model, read as the caller by - * `get_record_context` (`@objectstack/service-record-context`). + * `get_record_context` (`@objectstack/service-record-context`). The tool + * exists on a host that mounts that service, by either door: the CLI mounts + * it where `requires` includes `record-context`, and a host that composes + * its own kernel lists `RecordContextServicePlugin` in `plugins`. A host + * that does neither serves no such tool, whatever packs it holds. */ - aiContexts: z.array(AiContextSchema).optional().describe('AI context packs — the material of one record handed to a model, read as the caller by get_record_context (ADR-0160), which is served where `requires` includes `record-context`'), + aiContexts: z.array(AiContextSchema).optional().describe('AI context packs — the material of one record handed to a model, read as the caller by get_record_context (ADR-0160). A host serves that tool only when it mounts the record-context service: the CLI mounts it where `requires` includes `record-context`, and a host that composes its own kernel lists `RecordContextServicePlugin` in `plugins`'), /** * ObjectQL: Data Extensions diff --git a/scripts/check-skills-token-ratchet.mjs b/scripts/check-skills-token-ratchet.mjs index 58e34b3d88c..01a2ca8cae3 100644 --- a/scripts/check-skills-token-ratchet.mjs +++ b/scripts/check-skills-token-ratchet.mjs @@ -1997,6 +1997,16 @@ export const CEILINGS = new Map([ ['skills/objectstack-platform/references/operations.md', 3394], ['skills/objectstack-platform/references/plugin-development.md', 3137], ['skills/objectstack-upgrade/references/examples-upgrade.md', 1197], + // NEW FILE, pinned AT the measurement: the context pack (`ai_context`, ADR-0160) + // is a metadata kind no published skill taught beyond its key name. Card #37177 + // (the `Skills-docs: follow-up` of the PR that admitted the kind) asks for the + // teaching "in references where the ceiling binds", and both SKILL.md rows were + // at 14 and 0 tokens of headroom, so the keys, bounds, body outline, pack names + // and `os validate` rules live here and each SKILL.md carries a pointer paid by + // deleting restatement in the same file (neither SKILL.md row moves). The row is + // the seat's claim amendment 7179788843 on that card: one new row for this file. + // 5814 bytes -> ceil(5814 / 4) = 1454; zero headroom. + ['skills/objectstack-ai/references/context-packs.md', 1454], // ── 2026-10-26 the objectui bundle joins the catalog — decision C, #25832 ── // The maintainer ruled (decision C, 2026-10-25, recorded as item 17d of the diff --git a/skills/objectstack-ai/SKILL.md b/skills/objectstack-ai/SKILL.md index e28810338ac..4a4df799bee 100644 --- a/skills/objectstack-ai/SKILL.md +++ b/skills/objectstack-ai/SKILL.md @@ -3,8 +3,9 @@ name: objectstack-ai description: > Design ObjectStack AI skills, tools, knowledge sources, and the open-edition MCP server surface. Use when the user is adding `*.skill.ts` / `*.tool.ts`, - configuring an LLM provider, wiring the tools a skill grants, or indexing - ObjectStack data as a knowledge source for RAG. Agents themselves are + configuring an LLM provider, wiring the tools a skill grants, indexing + ObjectStack data as a knowledge source for RAG, or writing a context pack + (`aiContexts`). Agents themselves are platform-internal (`ask` / `build`) — third parties extend them via skills, not by authoring `*.agent.ts`. Do not use for general LLM prompting questions unrelated to ObjectStack metadata. @@ -14,7 +15,7 @@ metadata: author: objectstack-ai version: "18.6.0" domain: ai - tags: agent, tool, skill, knowledge, llm, embedding, mcp + tags: agent, tool, skill, knowledge, context-pack, llm, embedding, mcp --- # AI Agent Design — ObjectStack AI Protocol @@ -28,14 +29,6 @@ metadata: > expose the app to your own AI over **MCP** (below), and author metadata in > **source mode** with an AI coding agent (Claude Code, Cursor). -``` -Agent → Skill → Tool - │ │ │ - │ │ └─ Atomic operation (query, action, flow, API call) - │ └─ Capability bundle with instructions & trigger conditions - └─ Autonomous actor with role, instructions, and guardrails -``` - --- ## Skill Configuration @@ -137,7 +130,7 @@ still run under the caller's own permissions. ## Actions as AI Tools — the default path ☁️ -You usually **don't author tool definitions by hand** for action invocation. An +An `Action` attached to an object via `defineObject({ actions: [...] })` becomes a tool named `action_` **only when it opts in** — `ai.exposed: true` (default `false`) plus an `ai.description` of ≥ 40 chars, refused by the parse @@ -234,6 +227,7 @@ permissions and row-level security: |:--|:--| | `list_objects`, `describe_object` | schema introspection (system objects filtered out by default) | | `query_records`, `get_record` | reads — filter, field selection, sorting, pagination | +| `get_record_context` | one record through its context pack (**Context packs** below) | | `aggregate_records` | GROUP BY totals; registered only when the data bridge implements `aggregate` | | `validate_expression` | build-accurate CEL check before a formula is authored into metadata | | `create_record`, `update_record`, `delete_record` | writes; `delete_record` is refused with `ACTION_CONFIRMATION_REQUIRED` (428) unless it sends `confirm: true`. A request in which the human names the record to delete, with exactly one record matching, is their approval: send `confirm: true` on that call without asking again. When the name matches more than one record, or the request does not identify one, list the candidates, ask which one, and send `confirm: true` only after the answer | @@ -250,6 +244,15 @@ these tools, a client advertising form-mode `elicitation` is asked instead: --- +## Context packs — one record's material + +A context pack (`aiContexts`, `*.ai-context.ts`) lists the fields, related +lists and body of one record that `get_record_context` hands a model, read as +the caller; `requires: ['record-context']` serves the tool. Keys, bounds, pack +names, `os validate` rules: [references/context-packs.md](./references/context-packs.md). + +--- + ## Knowledge Sources (RAG) The RAG primitive is the **KnowledgeSource** (`KnowledgeSourceSchema` in @@ -289,7 +292,7 @@ import { KnowledgeSourceSchema, type KnowledgeSource } from '@objectstack/spec/a export const supportKb: KnowledgeSource = KnowledgeSourceSchema.parse({ id: 'support_kb', label: 'Support Knowledge Base', - adapter: 'ragflow', // or 'memory' for dev/test + adapter: 'ragflow', source: { kind: 'object', object: 'kb_article', @@ -467,7 +470,6 @@ author-time gate before reporting done: ```bash os validate # Zod schema + CEL predicate validation + bindings (no artifact) -# or: os build # the same gates, plus emits dist/ ``` This domain has no CEL site — a model-registry `promptTemplate.system` / `.user` is diff --git a/skills/objectstack-ai/evals/skills-tools-knowledge.json b/skills/objectstack-ai/evals/skills-tools-knowledge.json index 1559a2efba3..b89e3c0f64b 100644 --- a/skills/objectstack-ai/evals/skills-tools-knowledge.json +++ b/skills/objectstack-ai/evals/skills-tools-knowledge.json @@ -100,6 +100,16 @@ "must_contain": ["ask_ai", "record_header", "locations"], "must_not_contain": ["target:"] } + }, + { + "id": 11, + "prompt": "Give the AI a customer's open opportunities and notes when a user asks about that customer. Customers are `account` records with a long-text `notes` field; an `opportunity` has an `account` lookup and a `stage` whose closed values are `closed_won` and `closed_lost`. Write the metadata.", + "expected_output": "Emits a context pack (an `aiContexts` entry or a `*.ai-context.ts` file) with `name`, `label`, `object: 'account'`, a `related` entry on `opportunity` (`field: 'account'`, a few `fields`) whose `where` keeps the open rows on the child's own `stage` field with an admitted operator (`{ stage: { $nin: ['closed_won', 'closed_lost'] } }`), optionally `orderBy: [{ field, order }]` and a `limit` of at most 20, and `body: { field: 'notes' }`. Declares `requires: ['record-context']` (or mounts `RecordContextServicePlugin`) so `get_record_context` is served, and says the pack reads as the caller and grants nothing. No `description` or top-level `filter` key on the pack, no `direction` in `orderBy`, and no `aiReadable` on the object.", + "files": [], + "assertions": { + "must_contain": ["opportunity", "related", "where", "stage", "body", "notes", "record-context"], + "must_not_contain": ["filter:", "direction:", "aiReadable"] + } } ] } diff --git a/skills/objectstack-ai/references/context-packs.md b/skills/objectstack-ai/references/context-packs.md new file mode 100644 index 00000000000..a6e19f4cb5b --- /dev/null +++ b/skills/objectstack-ai/references/context-packs.md @@ -0,0 +1,111 @@ +# Context packs (`ai_context`) + +A context pack says which material of **one record** a model is handed: fields +of the root object, child lists that point at the record, and one long-text +field read as its body. Its only reader is the `get_record_context` tool, which +reads every part **as the caller**. A pack is no permission: it grants nothing +and hides nothing. Several packs may root on one object. + +Author it under `aiContexts` on the stack, or as a `*.ai-context.ts` / +`*.ai-context.yml` file. + + +```typescript +import type { AiContext } from '@objectstack/spec/ai'; + +export const AccountBrief: AiContext = { + name: 'account_brief', + label: 'Account brief for sales', + object: 'account', + fields: ['name', 'industry', 'owner', 'annual_revenue'], + related: [{ + object: 'opportunity', + field: 'account', + fields: ['name', 'stage', 'amount', 'close_date'], + where: { stage: { $nin: ['closed_won', 'closed_lost'] } }, + orderBy: [{ field: 'close_date', order: 'asc' }], + limit: 10, + }], + body: { field: 'notes' }, +}; +``` + +## Keys + +Strict: an unknown key, or a pack over a bound, is refused at parse, so nothing +is cut silently at call time. `name`, `label` and `object` are required. + +| Key | Contract | +|:--|:--| +| `name` | snake_case; what the tool's `context` argument names | +| `label` | The answer's header, and how the pack is listed when its object has several. Say the audience here: there is no `description` key | +| `object` | The root object. A call reads one record of it | +| `fields` | Up to 30 root fields, in order, none twice: the record's own facts. A lookup is answered with the name of the record it points at | +| `related` | Up to 3 child lists, one level deep: rows of another object that hang on the record | +| `body` | `{ field }`: the one long text the record is about, a `textarea`, `markdown`, `html` or `richtext` field of the root | + +A `related` entry: + +| Key | Contract | +|:--|:--| +| `object` | A child object with a reference field (lookup, master-detail, user, tree) that points at the root | +| `field` | That reference field. Required when the child has several | +| `fields` | Up to 10 columns per row. Omitted: the row's name only | +| `where` | Which rows: a filter on the child's **own** fields. A bare value is `$eq`; the operators are `$eq` `$ne` `$in` `$nin` `$gt` `$gte` `$lt` `$lte` `$null` `$exists`, joined by `$and` / `$or`. Comparands are literals: a dotted path, `{ $field }`, `$now` and a `{…}` placeholder are refused at parse | +| `orderBy` | `[{ field, order }]` on the child's own fields; `order` is `asc` (default) or `desc`. Omitted: the data engine's order | +| `limit` | 1 to 20 rows; 20 is the default and the cap. A cut list says so in the answer | + +Give a list its `where`, `orderBy` and `limit`, so the model gets the rows that +matter (the open ones, soonest first) and not the first 20. + +**The body.** Up to 8,000 characters it is carried whole. A longer body comes +back as an outline of its headings, each with an `anchor`, and the model reads +one section by calling again with that `anchor`. Headings are Markdown `#` +lines in `textarea` / `markdown`, `

` to `

` in `html` / `richtext`. A +long body with no headings is cut at the bound and marked `truncated`, so give +a long body headings. + +## Serving and calling it + +`get_record_context` exists only on a host that mounts +`@objectstack/service-record-context`: declare `requires: ['record-context']` +on the stack (the CLI mounts it), or list `new RecordContextServicePlugin()` in +`plugins` in a host that composes its own kernel. With neither, no such tool is +served, whatever packs the stack holds. Over MCP it sits under `data:read`. + +The call is `{ objectName, recordId, context?, anchor? }`; the answer is +`{ data, notes, framing }`. `data` is record material, never instructions; +`notes` say what was withheld or cut. + +- **`context` omitted** reads the object's one pack. No pack is refused `404` + (read the record with `get_record`); several are refused `400`, each listed + by its face and `label`. +- **A pack is identified by its package and its name**, as a skill is. A + namespace holds one pack per name: a second holder is refused at install + (`422 NAMESPACE_CONFLICT`) and by `os validate`. +- **`context` takes a pack's face**: `NAMESPACE-NAME` for a pack a package + ships, the bare name for the environment's own. A bare name also resolves + when one package holds it; held by two, it is refused + `409 RESOURCE_CONFLICT`, naming each face. +- `GET /api/v1/meta/ai_context/NAME` for a name two packages hold needs + `?package=`; without it the read is refused `409`. + +## What the caller is not shown, and what `os validate` reports + +Read as the caller: a field the caller cannot read carries no value, and a +related list is left out when the caller cannot read its link field or cannot +query on a field its `where` / `orderBy` names. `notes` then state that some +material is not visible. A `related` object the caller cannot read at all +refuses the whole call (`403 PERMISSION_DENIED`), so list only child objects +the pack's audience can read. + +An author's mistake is silent at the tool, so a caller never learns it. +`os validate` reports it as a warning: + +| Rule | The pack names | +|:--|:--| +| `ai-context-object-unknown` | a root or `related` object the stack does not define | +| `ai-context-field-unknown` | a field its object lacks. In a `where` or `orderBy`, the whole list is left out of every answer | +| `ai-context-related-link-unknown` | no reference field to the root, or several and no `field` | +| `ai-context-body-not-long-text` | a `body.field` that is not long text: the answer carries no body | +| `ai-context-sort-field-unsortable` | an `orderBy` field that is a formula or declares `sortable: false`: the list is left out | diff --git a/skills/objectstack-platform/SKILL.md b/skills/objectstack-platform/SKILL.md index e2c0cc2be43..ca68e5d16ed 100644 --- a/skills/objectstack-platform/SKILL.md +++ b/skills/objectstack-platform/SKILL.md @@ -44,8 +44,7 @@ are `manifest`, `packages`, `objects`, `objectExtensions`, `picklists`, There is **no** top-level `workflows` or `approvals` collection: an approval is a flow with Approval nodes, and record state machines are a `state_machine` validation rule on each object. -A phantom key (`roles:`, `policies:`) is no silent no-op: -the top level refuses it and the stack fails to load. +A phantom key (`roles:`, `policies:`) is refused (below). `queues` declares ownership queues (`defineQueue`, `@objectstack/spec/security`; objectstack-data): named sets of people a new record of an `ownership: 'user'` @@ -122,7 +121,7 @@ to a new protocol major — never to silence a mismatch. **`manifest.namespace` (ADR-0048):** Optional, but **enforced once set**. When a package declares `manifest.namespace: 'crm'`, every `object.name` must start with `crm_` or `defineStack` errors (`validateNamespacePrefix` in `@objectstack/spec`); the legacy `__` double-underscore form is rejected, and `sys_`-prefixed names are platform-reserved and exempt. The namespace is also a package-ownership key — installing two packages that both claim `crm` fails with `NamespaceConflictError` (downgrade to a warning with `OS_METADATA_COLLISION=warn`). Never `actions`, `connectors`, `global`, `hooks`, `oauth`, `runs`, `trigger` (route literals; `os validate` and build refuse). -**Which names carry the namespace (ADR-0150):** object and doc names, capabilities (`crm.export_data`) and positions (one slot per environment). Every other name stays short (`send_email`): flows, actions, hooks, apps, pages, dashboards, reports, datasets, permission sets, tools, skills, agents are identified by package and name. A prefixed name stays valid; no name starts with `_`, which the router reserves. `os lint`'s `naming/namespace-prefix` warns on a bare capability or position name, and when one package declares an app, page, dashboard, flow, report or dataset name twice, or an action name twice on one object. +**Which names carry the namespace (ADR-0150):** object and doc names, capabilities (`crm.export_data`) and positions (one slot per environment). Every other name stays short (`send_email`): flows, actions, hooks, apps, pages, dashboards, reports, datasets, permission sets, tools, skills, agents, context packs are identified by package and name. A prefixed name stays valid; no name starts with `_`, which the router reserves. `os lint`'s `naming/namespace-prefix` warns on a bare capability or position name, and when one package declares an app, page, dashboard, flow, report or dataset name twice, or an action name twice on one object. **Customizing an installed package (ADR-0146):** Customize an installed base `hotcrm` in its paired writable `hotcrm.custom`, which depends on it: a same-named item there with `overrides: { package: 'hotcrm', basedOn: '3.2.0' }` (its `manifest.id`/`manifest.version`) replaces the base's document whole. Reads honour it only from the pair (the row's `package_id`), for a view, dashboard, report, email_template, translation, flow, action, page, app, dataset, doc, book or mapping, never judging `basedOn`. An email template is one item per (name, locale): an override names a locale the base ships; one it does not ship is added without `overrides`. Then no `?package`, `?package=hotcrm`, the layered read and both lists serve it, and removing the pair's item (`DELETE …?package=hotcrm.custom`) serves the base's again; the env-wide list holds one item per name one code package ships (a dependent's stays under its own `?package=`); a pre-D11 unbound Setup row wins over the base's until `os migrate packageless-overlays` moves it, and once movable as a declared override, its package-less save, publish, reset and rollback are refused (D11); an email-template row at a locale the base does not ship moves as the pair's own member and keeps that write. The base's address serves the pair's added locale too (both lists, the layered read with `code` null and `effective` the pair's, the execution list, a send in that locale); one a dependent adds under the base's name is served only under its own `?package=`. An undeclared pair row or a dependent's row at a base-shipped locale is an orphan in the layered read's `overlay`, `effective` = the base's. An override may narrow a public form's anonymous intake, never re-open one any honoured body withdrew. `GET /packages/hotcrm.custom/export` carries it with `overrides`. @@ -179,10 +178,10 @@ The five retired remote templates (`todo`, `compliance`, `content`, `objectstack.config.ts` at the root is THE entry point (`defineStack()`), beside `package.json` and `tsconfig.json`. Metadata lives under `src//` — -`objects/` (one `task.object.ts` per object), then the optional `views/`, `apps/`, +`objects/`, then the optional `views/`, `apps/`, `flows/`, `actions/`, `dashboards/`, `reports/`, `datasets/`, `i18n/` and `handlers/` (runtime hook handlers) — each with a barrel `index.ts` -(`export * from './task.object'`) handed to the stack key of its name. +(`export * from './task.object'`). ### Naming Conventions @@ -301,7 +300,7 @@ token through the `CAPABILITY_PROVIDERS` registry in | Token | Provider package | |:--|:--| | `automation` | `@objectstack/service-automation` — flows, and any declarative `connectors:` entry | -| `analytics`° `cache`° `storage`° `queue`° `job`° `messaging`° `realtime` `settings`° `sms`° `push` `record-context` | `@objectstack/service-` + the token ([the `push` block](./references/operations.md#mobile-push)) | +| `analytics`° `cache`° `storage`° `queue`° `job`° `messaging`° `realtime` `settings`° `sms`° `push` `record-context` | `@objectstack/service-` + the token ([the `push` block](./references/operations.md#mobile-push)); `record-context` serves `get_record_context`, [context packs](../objectstack-ai/references/context-packs.md) | | `mailbox` | `@objectstack/service-mailbox` — inbound mail | | `marketplace` `package-registry`° | `@objectstack/service-package` | | `audit` `email`° `sharing`° `approvals` `webhooks` | `@objectstack/plugin-` + the token | From f3cbf52abd9ad1416576417391893470b0c6fb85 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 26 Nov 2026 01:44:30 +0000 Subject: [PATCH 2/3] docs(skills): regenerate the skills reference and the stack reference page; the pack example names declared fields only Claude-Session: https://claude.ai/code/session_01Utp6CaWzgwG1QYaiBidBCK Co-authored-by: Claude --- content/docs/ai/skills-reference.mdx | 4 ++-- content/docs/references/api/package-api-assembled.mdx | 4 ++-- scripts/check-skills-token-ratchet.mjs | 2 +- skills/objectstack-ai/references/context-packs.md | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/content/docs/ai/skills-reference.mdx b/content/docs/ai/skills-reference.mdx index 47d4ebd50f5..ff1c5cfa8d4 100644 --- a/content/docs/ai/skills-reference.mdx +++ b/content/docs/ai/skills-reference.mdx @@ -136,11 +136,11 @@ Use when the request is "when X happens, do Y" or you are editing `*.flow.ts`. N Design ObjectStack AI skills, tools, knowledge sources, and the open-edition MCP server surface. -Use when the user is adding `*.skill.ts` / `*.tool.ts`, configuring an LLM provider, wiring the tools a skill grants, or indexing ObjectStack data as a knowledge source for RAG. Agents themselves are platform-internal (`ask` / `build`) — third parties extend them via skills, not by authoring `*.agent.ts`. +Use when the user is adding `*.skill.ts` / `*.tool.ts`, configuring an LLM provider, wiring the tools a skill grants, indexing ObjectStack data as a knowledge source for RAG, or writing a context pack (`aiContexts`). Agents themselves are platform-internal (`ask` / `build`) — third parties extend them via skills, not by authoring `*.agent.ts`. Do not use for general LLM prompting questions unrelated to ObjectStack metadata. -**Tags:** `agent`, `tool`, `skill`, `knowledge`, `llm`, `embedding`, `mcp` +**Tags:** `agent`, `tool`, `skill`, `knowledge`, `context-pack`, `llm`, `embedding`, `mcp` --- diff --git a/content/docs/references/api/package-api-assembled.mdx b/content/docs/references/api/package-api-assembled.mdx index ae24a5dd680..617f7f01e5e 100644 --- a/content/docs/references/api/package-api-assembled.mdx +++ b/content/docs/references/api/package-api-assembled.mdx @@ -137,7 +137,7 @@ Installed package row whose manifest is the assembled package body | **agents** | `{ name: string; label: string; avatar?: string; role: string; … }[]` | optional | AI Agents — platform-internal (ADR-0063 §2): the kernel ships exactly two (ask/build); third parties extend via skills, not agents | | **tools** | `{ name: string; label: string; description: string; parameters: Record; … }[]` | optional | AI Tool metadata records — optional refinement layer, never required: the default path is skills referencing platform tools or materialised action_`` tools (ADR-0109) | | **skills** | `{ name: string; label: string; description?: string; surface?: Enum<'ask' \| 'build' \| 'both'>; … }[]` | optional | AI Skills (reusable capability bundles — the third-party AI extension primitive, ADR-0063) | -| **aiContexts** | `{ name: string; label: string; object: string; fields?: string[]; … }[]` | optional | AI context packs — the material of one record handed to a model, read as the caller by get_record_context (ADR-0160), which is served where `requires` includes `record-context` | +| **aiContexts** | `{ name: string; label: string; object: string; fields?: string[]; … }[]` | optional | AI context packs — the material of one record handed to a model, read as the caller by get_record_context (ADR-0160). A host serves that tool only when it mounts the record-context service: the CLI mounts it where `requires` includes `record-context`, and a host that composes its own kernel lists `RecordContextServicePlugin` in `plugins` | | **hooks** | `{ name: string; label?: string; object: string \| string[]; events: Enum<'beforeFind' \| 'afterFind' \| 'beforeInsert' \| 'afterInsert' \| 'beforeUpdate' \| …>[]; … }[]` | optional | Object Lifecycle Hooks, as a JSON document carries them | | **mappings** | `{ name: string; label?: string; sourceFormat?: Enum<'csv' \| 'json' \| 'xml' \| 'sql'>; targetObject: string; … }[]` | optional | Data Import/Export Mappings | | **analyticsCubes** | `{ name: string; title?: string; description?: string; sql: string; … }[]` | optional | Analytics Semantic Layer Cubes | @@ -388,7 +388,7 @@ This schema accepts one of the following structures: | **agents** | `{ name: string; label: string; avatar?: string; role: string; … }[]` | optional | AI Agents — platform-internal (ADR-0063 §2): the kernel ships exactly two (ask/build); third parties extend via skills, not agents | | **tools** | `{ name: string; label: string; description: string; parameters: Record; … }[]` | optional | AI Tool metadata records — optional refinement layer, never required: the default path is skills referencing platform tools or materialised action_`` tools (ADR-0109) | | **skills** | `{ name: string; label: string; description?: string; surface?: Enum<'ask' \| 'build' \| 'both'>; … }[]` | optional | AI Skills (reusable capability bundles — the third-party AI extension primitive, ADR-0063) | -| **aiContexts** | `{ name: string; label: string; object: string; fields?: string[]; … }[]` | optional | AI context packs — the material of one record handed to a model, read as the caller by get_record_context (ADR-0160), which is served where `requires` includes `record-context` | +| **aiContexts** | `{ name: string; label: string; object: string; fields?: string[]; … }[]` | optional | AI context packs — the material of one record handed to a model, read as the caller by get_record_context (ADR-0160). A host serves that tool only when it mounts the record-context service: the CLI mounts it where `requires` includes `record-context`, and a host that composes its own kernel lists `RecordContextServicePlugin` in `plugins` | | **hooks** | `{ name: string; label?: string; object: string \| string[]; events: Enum<'beforeFind' \| 'afterFind' \| 'beforeInsert' \| 'afterInsert' \| 'beforeUpdate' \| …>[]; … }[]` | optional | Object Lifecycle Hooks, as a JSON document carries them | | **mappings** | `{ name: string; label?: string; sourceFormat?: Enum<'csv' \| 'json' \| 'xml' \| 'sql'>; targetObject: string; … }[]` | optional | Data Import/Export Mappings | | **analyticsCubes** | `{ name: string; title?: string; description?: string; sql: string; … }[]` | optional | Analytics Semantic Layer Cubes | diff --git a/scripts/check-skills-token-ratchet.mjs b/scripts/check-skills-token-ratchet.mjs index 01a2ca8cae3..0d640548afa 100644 --- a/scripts/check-skills-token-ratchet.mjs +++ b/scripts/check-skills-token-ratchet.mjs @@ -2005,7 +2005,7 @@ export const CEILINGS = new Map([ // and `os validate` rules live here and each SKILL.md carries a pointer paid by // deleting restatement in the same file (neither SKILL.md row moves). The row is // the seat's claim amendment 7179788843 on that card: one new row for this file. - // 5814 bytes -> ceil(5814 / 4) = 1454; zero headroom. + // 5813 bytes -> ceil(5813 / 4) = 1454; zero headroom. ['skills/objectstack-ai/references/context-packs.md', 1454], // ── 2026-10-26 the objectui bundle joins the catalog — decision C, #25832 ── diff --git a/skills/objectstack-ai/references/context-packs.md b/skills/objectstack-ai/references/context-packs.md index a6e19f4cb5b..0e3c1d60858 100644 --- a/skills/objectstack-ai/references/context-packs.md +++ b/skills/objectstack-ai/references/context-packs.md @@ -17,7 +17,7 @@ export const AccountBrief: AiContext = { name: 'account_brief', label: 'Account brief for sales', object: 'account', - fields: ['name', 'industry', 'owner', 'annual_revenue'], + fields: ['name', 'industry', 'tier', 'annual_revenue'], related: [{ object: 'opportunity', field: 'account', From e9b2056f9dab8ebf46b5f1de19ab1a0ffe729a0c Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 26 Nov 2026 02:09:23 +0000 Subject: [PATCH 3/3] docs(skills): keep the platform skill's pinned phantom-key sentence; pay for the pointer with the prefix restatement instead Claude-Session: https://claude.ai/code/session_01Utp6CaWzgwG1QYaiBidBCK Co-authored-by: Claude --- skills/objectstack-platform/SKILL.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/skills/objectstack-platform/SKILL.md b/skills/objectstack-platform/SKILL.md index ca68e5d16ed..c5c67b52ef5 100644 --- a/skills/objectstack-platform/SKILL.md +++ b/skills/objectstack-platform/SKILL.md @@ -44,7 +44,8 @@ are `manifest`, `packages`, `objects`, `objectExtensions`, `picklists`, There is **no** top-level `workflows` or `approvals` collection: an approval is a flow with Approval nodes, and record state machines are a `state_machine` validation rule on each object. -A phantom key (`roles:`, `policies:`) is refused (below). +A phantom key (`roles:`, `policies:`) is no silent no-op: +the top level refuses it and the stack fails to load. `queues` declares ownership queues (`defineQueue`, `@objectstack/spec/security`; objectstack-data): named sets of people a new record of an `ownership: 'user'` @@ -117,7 +118,7 @@ checks it **before it loads anything** and refuses an out-of-range app at the boundary with the exact migration command. Change it when you deliberately move to a new protocol major — never to silence a mismatch. -**Object naming:** The object `name` is the canonical identifier and equals the physical table name. Embed any domain prefix directly in the name (e.g. `name: 'crm_account'`); the object-level `namespace` *field* is retired (ADR-0129 D3) and refused at load. Never set `tableName`, and never add a `sys_metadata` object to a runtime manifest. +**Object naming:** The object `name` is the canonical identifier and equals the physical table name. The object-level `namespace` *field* is retired (ADR-0129 D3) and refused at load. Never set `tableName`, and never add a `sys_metadata` object to a runtime manifest. **`manifest.namespace` (ADR-0048):** Optional, but **enforced once set**. When a package declares `manifest.namespace: 'crm'`, every `object.name` must start with `crm_` or `defineStack` errors (`validateNamespacePrefix` in `@objectstack/spec`); the legacy `__` double-underscore form is rejected, and `sys_`-prefixed names are platform-reserved and exempt. The namespace is also a package-ownership key — installing two packages that both claim `crm` fails with `NamespaceConflictError` (downgrade to a warning with `OS_METADATA_COLLISION=warn`). Never `actions`, `connectors`, `global`, `hooks`, `oauth`, `runs`, `trigger` (route literals; `os validate` and build refuse). @@ -300,7 +301,7 @@ token through the `CAPABILITY_PROVIDERS` registry in | Token | Provider package | |:--|:--| | `automation` | `@objectstack/service-automation` — flows, and any declarative `connectors:` entry | -| `analytics`° `cache`° `storage`° `queue`° `job`° `messaging`° `realtime` `settings`° `sms`° `push` `record-context` | `@objectstack/service-` + the token ([the `push` block](./references/operations.md#mobile-push)); `record-context` serves `get_record_context`, [context packs](../objectstack-ai/references/context-packs.md) | +| `analytics`° `cache`° `storage`° `queue`° `job`° `messaging`° `realtime` `settings`° `sms`° `push` `record-context` | `@objectstack/service-` + the token ([the `push` block](./references/operations.md#mobile-push)); `record-context` serves `get_record_context`, **objectstack-ai** [context packs](../objectstack-ai/references/context-packs.md) | | `mailbox` | `@objectstack/service-mailbox` — inbound mail | | `marketplace` `package-registry`° | `@objectstack/service-package` | | `audit` `email`° `sharing`° `approvals` `webhooks` | `@objectstack/plugin-` + the token |