Skip to content

Commit 776af34

Browse files
docs(skills): objectstack-ai teaches knowledge_source as metadata (shipped vs run-time mount, package-scoped identity) (#38053)
repo:objectstack#1 · os-elon-musk · session_016WV4cwPhGV4g9p1BGQaZbP Part of #37310 Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户能看到什么变化:用 AI(技能文档或 MCP 搭建)写知识源的作者,现在看到的是新写法:知识源是一份元数据,用 `name`、逐个列出要索引的字段、可以不写存储;MCP 新建知识源暂不提供起始模板(模板里的占位对象和字段会被当成真实值存进去),等设置页表单从作者输入构建 `source` 后再加。 - 为什么做:知识库检索专题(按调用者权限过滤的知识检索)第三阶段的教学一行,替照着技能写知识源的 AI 解决"照文档写出来却被拒绝"的问题。 - 出错会怎样:最坏是技能里某句教法不准,AI 写出的知识源在保存时被明确拒绝并给出修法;不会悄悄索引错的字段;改动可直接撤回。 - 要你做什么:合并(技能文档是受治理面,由你亲手落地);本 PR 只完成卡片的一部分:发布校验的五条规则名要等对应的校验改动(#37971)合并后再补,新建模板要等设置页表单,所以卡片保持打开。 ## What changes **`skills/objectstack-ai/SKILL.md`, § Knowledge Sources (RAG)** (ADR-0161 K4, K5, K6 item 6; rows 3a and 3b as merged): - A source is a `knowledge_source` item: shipped in a package (`knowledgeSources`, `*.knowledge-source.ts` / `.yml`) or authored in Studio or over MCP. `KnowledgeServicePlugin({ sources })` and `registerSource` are a second door for the same schema, and a code registration and an environment item of one name are one slot, the second refused. A source's identity is its package and `name`: `search_knowledge` lists a package's source as `NAMESPACE-NAME` (bare for a source no package holds). A shipped item (a `knowledgeSources` entry) mounts the knowledge service and its store with no `requires: ['knowledge']` (#37306, PR #38026); an app that ships no source and authors its sources at run time needs `requires: ['knowledge']`, or its items are never indexed (as main's `knowledge-rag.mdx` § Turning it on says). - The key table is the v1 keys of K4: `name`, `label` / `description`, `adapter` (optional; omitted ⇒ the deployment's store, else the only one registered, refused naming them when several and none is the deployment's), `source.kind`, `source.object`, `source.content` (an explicit non-empty list; why `'*'` is refused: embedding is egress, K5), `source.metadataFields`, `source.where`, `source.split`, `refresh.onRecordChange`, `aiExposed`. The old Hygiene column's advice (meaningful text only, never ids or system fields; `where` keeps drafts out) now lives in the `content` and `where` rows, and says `content`. - Egress and cost (K4): the first build sends every listed field of every matching record to the embedding provider; a run-time save needs `manage_knowledge_sources` beside `manage_metadata` and passes save-time admission. - The retired keys by name, each with its fix, as the tombstones read: `id` → `name`, `contentFields` → `content`, `embedding`, `vectorStore`, `adapterConfig`, `refresh.cron`, and the `file` / `http` arms with their four keys; `os migrate meta --from 18` for a stack, by hand for a registration in code. - The checked example drops `adapter: 'pgvector'` (the deployment's store) and its comments; it is otherwise row 3a's block. - `split`: `strategy` is required once `split` is written (`recursive` only when `split` is omitted); the adapter-list aside is gone. - The closing note: `topK` is a `search_knowledge` argument; rerank and hybrid weighting are no source key, and no shipped store has a setting for either (`knowledge-pgvector` and `knowledge-turso` fuse their legs by RRF with a fixed `RRF_K = 60`, `pgvector-adapter.ts:124`, `turso-adapter.ts:95`; no store plugin's options interface has a rerank, weight or fusion key). - The routing line in `skills/objectstack-mcp-build/SKILL.md` ("An agent skill, tool or knowledge source | objectstack-ai") stays true: the section name is unchanged, so it is not edited. **Not in this PR, on purpose (amendments 7221575164 and 7224082428):** the five `os validate` / publish rule ids of PR #37971 (`knowledge-source-object-unknown`, `knowledge-source-field-unknown`, `knowledge-source-object-not-searchable`, `knowledge-source-system-object-not-ai-readable`, `knowledge-source-field-never-indexed`). #37971 is still open, so this PR is `Part of #37310`: that part follows on this branch after #37971 lands (the keyword then returns to `Fixes`), or on a later PR if this one lands first. The create seed is also left open: it waits for the Studio form (#37309, row 5). **`skills/objectstack-ai/evals/skills-tools-knowledge.json`.** Case 3 (kb_article on PostgreSQL) and case 9 (policy_doc, `markdown` split) now expect `name` and `content`, and forbid a written `contentFields:` key; case 3 also forbids a written wildcard (`['*'],`, `['*'] }`), `embedding:` and `vectorStore:`, and its `topK` token becomes `topK:` (the key written) because the skill now names `topK` as a search argument. Case 9 also requires `name:` and forbids an `id:` spelling; case 13 forbids the double-quoted wildcard forms. New case 14 asks for an app that ships no source and authors one at run time, and requires the `requires: ['knowledge']` line (either quote style), with no `contentFields:`. New case 13 asks for a source that indexes "every text field" and expects an explicit list, the wildcard declined because embedding is egress, and no written `contentFields:` or wildcard. **`packages/spec/src/kernel/metadata-create-seeds.ts`: unchanged (byte-identical to `main`).** A `knowledge_source` create seed was tried and withdrawn at `4c965f4a5e` (comment 7229668414). Its object binding and content list sit inside `source`, and the Studio create flow (`buildCreateModeBody` / `seedPlaceholderKeys` in app-shell's `createBody.ts`) clears placeholder identity at the top level only, so it would have saved `example_object` / `example_field` into a new source: the objectui#12810 defect. No schema-valid seed avoids this, because `source.object` and a non-empty `content` (K5) are required and nested. `knowledge_source` stays on `KNOWN_UNSEEDED`, whose comment now gives the reason: a seed waits until the Studio form (#37309, row 5) builds `source` from the author's input. The card allows this ("or the type stays on `KNOWN_UNSEEDED` with the reason"). **`packages/runtime/src/domains/mcp-authoring.test.ts`.** One case beside the flow contract case, over the real protocol and the boot type registry: `list_metadata_items` with `contract: true` for `knowledge_source` serves no `createSeed`; `contractPath` `/properties/source/properties/content` serves the content rule (`minItems: 1`, `minLength: 1`, a pattern that refuses `*` and admits `body`); the served schema carries no `id` or `contentFields` tombstone; a hand-written source with one object and one field saves as a draft; the same item with `content: ['*']`, with an `id`, or with `contentFields` is refused `422 INVALID_METADATA`, the last two naming their tombstone's prescription ("use `name`", "use `content`"); nothing else is written. **Platform catalog (review round, `6f2e756f58`).** The generator's Boot cell (`packages/spec/scripts/lib/platform-catalog.ts`) reads ``on `requires`, or a shipped `knowledgeSources` item`` for a provider that declares `mountedBy`; `packages/spec/scripts/platform-catalog.test.ts` pins that cell, with `record-context` as the control that still reads ``on `requires` ``. `skills/objectstack-project/references/platform-catalog.md` is regenerated. **Token ratchet.** The standing ruling, verbatim and untranslated: 「A:先削重复,余额按实测提高」 (ruling record 6513306068, letter B). Paid down first, in the same file: the wiring paragraph's package list, the old `source.kind` Hygiene column (folded into two rows), the example's four comments restating table rows and its `refresh: { onRecordChange: true }` line restating the default, and the split passage's adapter aside. The row moves 6609 → 6639, the measured remainder, pinned at the measurement. Review round (`6f2e756f58`): after paying down the intro's restating clause, its separate `search_knowledge` sentence, the "one name is one source" clause and the longer closing note, the row moves 6639 → 6695 (+56, the measured remainder) under the same ruling. Reproduction: `ceil(($(wc -c < skills/objectstack-ai/SKILL.md) - 27) / 4)` = ceil(26779 / 4) = 6695. ## Tests **Review round at `6f2e756f58`** (merges `main` at `58be6770ab`; note 7230668192): unlocked, 35 commands, each exit 0, including `check-skills-token-ratchet` (row 6695), `check:nul-bytes`, `check-empty-changeset`, `check-adr-0087-registration`, `check-changeset-no-major`, `check:issue-citations`, `check:doc-authoring`, `check:skill-links`, `check:skill-identifier-liveness`, `check:skill-frame-sync`, `check:published-files`; `gen:skill-refs` exit 0. NOT MEASURED locally (verify lock never acquired in six tries): `check:skill-docs`, `check:skill-refs`, `check:yaml-examples`, the platform-catalog test, `metadata-create-seeds.test.ts`, the MCP contract case, eval case 14. CI on this head is the reading for them. overlap-check: `VERDICT overlap exit 1`, the same #36158-against-main conflict in the ratchet file; `origin/main`, #38032 and #38013 merge cleanly. The lock was saturated: about 70 minutes of queueing, two dogfood runs ahead. One locked round ran at `3407f7fe6e`; the second round was not reached. What was not measured locally is marked below, and CI runs it. <details><summary>Locked round at 3407f7f (VERDICT command-exit 0, held 365s)</summary> - `pnpm turbo run build --filter='@objectstack/runtime^...' --concurrency=2`: exit 0, `Tasks: 41 successful, 41 total`. - `metadata-create-seeds.test.ts` (spec): the seed pin run here (`Tests 20 passed (20)`) belonged to the withdrawn seed; the file is back to `main`'s, so CI `Test Core` is the reading. **Patch round at `4c965f4a5e`:** the app-shell `createBody.seedPlaceholders-12810.test.ts` (red at `19f3e118f2`, 2 failures, unedited), the spec create-seeds test and the rewritten MCP case are NOT MEASURED locally (verify lock saturated); their inputs equal `main`'s, so CI `Test UI` and `Test Core` on this head are the evidence. Unlocked gates at `4c965f4a5e`, exit 0 each: `check-skills-token-ratchet` (6639/6639), `check-empty-changeset`, `check-adr-0087-registration`, `check-changeset-no-major`, `check:nul-bytes`, `check:issue-citations`, `check:doc-authoring`. The changeset no longer lists `@objectstack/spec`. - `pnpm --filter @objectstack/runtime exec vitest run --maxWorkers=2 src/domains/mcp-authoring.test.ts`: exit 1, `Tests 1 failed | 73 passed (74)`. The failing assertion is the new case's tombstone half: it expected the served schema to carry `/properties/id`, and the served schema drops tombstones (see Acceptance notes). Its content-rule and seed assertions, which run before it, passed. The tombstone half is rewritten in `01cf7515c2` to assert absence plus the save refusal. **NOT MEASURED locally after that rewrite** (the second locked round never acquired); CI `Test Core` runs it. - `pnpm --filter @objectstack/spec run check:yaml-examples`: exit 0, `19 tagged YAML example(s) across 1 file(s) validate`. - `pnpm --filter @objectstack/spec run check:skill-docs`: exit 0, `Skill docs in sync`. - `pnpm --filter @objectstack/spec run check:skill-refs`: exit 0, `10 generated files in sync with packages/spec`. The generated skill references needed no regeneration: the section rewrite changes no reference input. - `pnpm --filter @objectstack/spec typecheck`: exit 0. - `pnpm --filter @objectstack/runtime typecheck`: exit 1. `tsc --noEmit` is clean. `check:test-typecheck` names 3 files this diff does not touch (`boolean-written-spelling-row-scope.test.ts`, `meta-object-publish-column-changes.test.ts`, `organization-ownership-boot-guard.turso-remote.kernel.test.ts`). `mcp-authoring.test.ts` is not among them. They are read here as the closure build's gaps (only `runtime^...` was built) and not as this diff's; CI `TypeScript Type Check` decides. - `pnpm --filter @objectstack/spec run check:skill-examples`: exit 3, PREREQUISITE NOT MET (the `@objectstack/client-react` dist is outside the built closure). **NOT MEASURED**; CI runs it. </details> <details><summary>Unlocked gates (35 derived families, each exit 0, at 3407f7f; the ratchet and nul-bytes re-run at 19f3e11)</summary> - `node scripts/check-skills-token-ratchet.mjs`: exit 0, `skills/objectstack-ai/SKILL.md is 6639 tokens (ceiling 6639; headroom 0)`; with `--self-test` exit 0. - Exit 0 each: `check-adr-0087-registration` (both forms), `check-changeset-no-major`, `check-closing-keyword-parity` (both), `check-declaration-mirrors` (both), `check-empty-changeset` (both), `check-issue-citations`, `check-self-test-wired` (both), `docs-audit/check-affected-docs`, `docs-audit/check-drift-comment`, and `pnpm check:` `agent-test-spelling`, `changeset-gate-self-tests`, `closed-ceremony-text`, `corpus-claim-drift`, `cross-package-test-inputs`, `doc-authoring`, `issue-citations`, `keyed-text-bounds`, `nul-bytes`, `pm-skill-id-lint`, `published-files`, `ratchet-remedy-authority`, `role-word`, `skill-compatibility`, `skill-frame-sync`, `skill-identifier-liveness`, `skill-links`, `test-source-alias`, `tier-file-adoption`. - `dispatch-gates --ran`: `116 derived, 38 run, 0 NOT-MEASURED, 78 UNRUN`. That is a declared narrowing: the lock was saturated, and CI runs the 78. - Local-only: `check-skill-frame-freshness` exit 0. `check-dev-prereqs` exit 1 ("69 of 110 workspace packages … not on disk"), which is the closure-only build and not a finding. </details> <details><summary>Eval runner and the ablation (`skill-evals`, claude-code-cli 2.1.332, oauth login, served claude-opus-5-5)</summary> Cases 3, 9 and 13 of `objectstack-ai/skills-tools-knowledge`, both arms, one repeat each: | skill text | #3 with-skill | #9 with-skill | #13 with-skill | no-skill (all three) | |:--|:--|:--|:--|:--| | this PR | pass | pass | pass | fail | | `main`'s `SKILL.md` (`8d34c4404f`, hash `88a20cb583`), new cases (ablation) | fail: `contentFields:` written; `name:`, `content:` missing | fail: `contentFields:` written; `content:` missing | fail: `contentFields:`, `['*'],` and `id: 'faq` written; no egress reason | fail | The ablation restored `main`'s `SKILL.md` into the working tree only (`git restore --source=8d34c4404f`, `git hash-object` = `88a20cb583`). The run ran, and then `HEAD`'s file came back (`fc845724ac` both on disk and at `HEAD`). An earlier run of case 13 on this text failed with-skill only on the token `['*']`, which a correct answer quoted while explaining the refusal. The forbidden token is now the written wildcard (`['*'],` / `['*'] }`), and the table above is after that change. </details> ## Acceptance notes - The acceptance grep (`git grep -n -E "contentFields|'\*'|adapter: 'ragflow'" skills/objectstack-ai`) returns eight lines. In `SKILL.md`, three: the `content` row ("`'*'` is refused") and two lines of the retired-keys paragraph. In the eval file, five: the reference answers of cases 3 and 13, which name both as retired, and the `must_not_contain` lists of cases 3, 9 and 13, which forbid a written `contentFields:` and a written wildcard (`['*'],`, `['*'] }`). The card itself asks the eval to fail on `contentFields` or `'*'`, which puts the forbidden token on the assertion line. The reviewer decides whether those lines count as "naming a retired key as retired". - `adapter: 'ragflow'` has no hit: #37004 already removed it. - The new MCP pin is an `it` inside the existing real-protocol `describe` of `mcp-authoring.test.ts`, beside the flow contract case, because that describe holds the real-protocol harness (`realProtocol`, `STUDIO_BASE`). It is in the shared harness file, not a new file. - **Premise correction (card item 3).** The card asks the served contract to carry "the tombstones' prescriptions as the describes read". It does not, by design: the served JSON Schema drops every `retiredKey()` tombstone (`{ not: {} }`; see the note in `packages/metadata-protocol/src/protocol-meta-type-schema.ts`: the served schema publishes what an author MAY write). The prescription reaches an MCP author through the save refusal instead. The pin asserts both halves: the tombstone is absent from the served schema, and a save that writes the retired key is refused naming its replacement. - The save half of the MCP pin covers row 3a's parse. Row 4's checks (#37971) are not on main, so a hand-written draft is not yet judged by them here. Today the save passes with no knowledge service mounted ("no knowledge service judges nothing"). - overlap-check before the PR: `VERDICT overlap exit 1`. `origin/main`, #38032 and #38013 merge cleanly. #36158 (a draft last updated 2026-11-25) conflicts in `scripts/check-skills-token-ratchet.mjs`. That conflict is #36158's own against `origin/main`: `git merge-tree origin/main` with #36158's head conflicts in the same file, and every conflict hunk is at line 798 or later, away from this branch's hunk near line 453. Reported here, not resolved. ## Verification Files to read first, by risk: 1. `skills/objectstack-ai/SKILL.md` § Knowledge Sources (RAG): the `adapter` and `content` rows and the retired-keys paragraph. 2. `packages/spec/src/kernel/metadata-create-seeds.test.ts`: the `KNOWN_UNSEEDED` reason for `knowledge_source` (no seed; `metadata-create-seeds.ts` is byte-identical to `main`). 3. `packages/runtime/src/domains/mcp-authoring.test.ts`: the new contract case. Two-minute check: `node scripts/check-skills-token-ratchet.mjs`. Expect `skills/objectstack-ai/SKILL.md is 6695 tokens (ceiling 6695; headroom 0)`. Readings: `skills/objectstack-ai/SKILL.md` 464 → 469 lines, 26462 → 26806 bytes (6609 → 6695 priced tokens, in two moves). Every published `SKILL.md` summed: 4936 → 4941 lines, 261366 → 261485 bytes (65342 → 65372 tokens). The eval file is 125 → 137 lines and 13611 → 15185 bytes; eval fixtures are measured, not ratcheted. --- _Generated by [Claude Code](https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 0e90d2f commit 776af34

9 files changed

Lines changed: 197 additions & 56 deletions

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
'@objectstack/skills': patch
3+
---
4+
5+
docs(skills): `objectstack-ai` teaches `knowledge_source` as a metadata item
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
`skills/objectstack-ai` § Knowledge Sources (RAG) now teaches the shape the 19 spec accepts. A source is a `knowledge_source` item shipped in a package (`knowledgeSources`, `*.knowledge-source.ts` / `.yml`) or authored in Studio or over MCP, with registration in code as a second door for the same schema. The key table lists `name`, `label`, `description`, the optional `adapter` (omitted, the source binds to the deployment's store), `source.object`, `source.content` (an explicit, non-empty list: `'*'` is refused because embedding is egress), `source.metadataFields`, `source.where`, `source.split`, `refresh.onRecordChange` and `aiExposed`. A source the app ships in `knowledgeSources` mounts the knowledge service and its store; an app that ships none and authors its sources at run time needs `requires: ['knowledge']`, or its items are never indexed. A source is identified by its package and `name`: `search_knowledge` lists a package's source as `NAMESPACE-NAME`, and a code registration and an environment item of one name are one slot. The closing note says that `topK` is a `search_knowledge` argument and that no shipped store has a rerank or hybrid-weight setting. The section says that a source's first build sends every listed field of every matching record to the embedding provider, and that a run-time save needs `manage_knowledge_sources` and passes save-time admission. It names each key retired in 19 with its fix: `id` → `name`, `contentFields` → `content`, `embedding`, `vectorStore`, `adapterConfig`, `refresh.cron`, and the `file` and `http` arms. `split.strategy` is required once `split` is written. The eval cases for knowledge sources move to the same shape, a new case asks for a wildcard source, and another for a source an app authors at run time.
11+

‎packages/runtime/src/domains/mcp-authoring.test.ts‎

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1404,6 +1404,58 @@ describe('done when: an OAuth author saves an app-crm flow draft with no routabl
14041404
expect(missing.body.contract).toBeUndefined();
14051405
});
14061406

1407+
it('[ADR-0161 K4, K5] the knowledge_source contract serves the content rule and no create seed; a source with one object and one content field saves, a wildcard or a retired key is refused', async () => {
1408+
const metadata = new MetadataManager({} as never);
1409+
metadata.setTypeRegistry(DEFAULT_METADATA_TYPE_REGISTRY);
1410+
const protocol = await realProtocol(new Map([['metadata', metadata]]));
1411+
const { authoring } = await authorThroughDomain({ protocol, systemPermissions: ['manage_metadata', 'manage_knowledge_sources'] });
1412+
const entry = (await protocol.getMetaTypes!()).entries!.find((e) => e.type === 'knowledge_source') as any;
1413+
1414+
const { contract } = (await call(authoring, 'list_metadata_items', { type: 'knowledge_source', contract: true })).body;
1415+
expect(contract.form).toBe('lean');
1416+
// No seed is served: the type stays unseeded until the Studio form builds `source` (metadata-create-seeds.test.ts).
1417+
expect(getMetadataCreateSeed('knowledge_source')).toBeUndefined();
1418+
expect(contract).not.toHaveProperty('createSeed');
1419+
expect(Object.keys(contract.schema.properties)).toEqual(Object.keys(entry.schema.properties));
1420+
1421+
// The content rule, as the served schema states it: a non-empty list, no empty name, no `'*'` member.
1422+
const contentPath = '/properties/source/properties/content';
1423+
const content = (await call(authoring, 'list_metadata_items', { type: 'knowledge_source', contract: true, contractPath: contentPath })).body.contract;
1424+
expect(content).toMatchObject({ form: 'full', path: contentPath });
1425+
expect(content.schema).toEqual(entry.schema.properties.source.properties.content);
1426+
expect(content.schema.minItems).toBe(1);
1427+
expect(content.schema.items).toMatchObject({ minLength: 1 });
1428+
expect(new RegExp(content.schema.items.pattern).test('*')).toBe(false);
1429+
expect(new RegExp(content.schema.items.pattern).test('body')).toBe(true);
1430+
1431+
// A tombstone is not served: the served schema publishes what an author MAY write (`{ not: {} }` is
1432+
// dropped). Its prescription reaches the author through the save, below.
1433+
expect(entry.schema.properties.id).toBeUndefined();
1434+
expect(entry.schema.properties.source.properties.contentFields).toBeUndefined();
1435+
1436+
// A source with one object and one content field saves as a draft; with a wildcard it is refused and nothing is written.
1437+
const item = { name: 'crm_opportunity_notes', label: 'Opportunity notes', source: { kind: 'object', object: 'crm_opportunity', content: ['name'] } };
1438+
const saved = await call(authoring, 'save_metadata_draft', { type: 'knowledge_source', name: item.name, item, package: STUDIO_BASE });
1439+
expect(saved.isError, JSON.stringify(saved.body)).toBe(false);
1440+
expect(saved.body.saved).toMatchObject({ type: 'knowledge_source', name: 'crm_opportunity_notes', package: STUDIO_BASE, state: 'draft' });
1441+
1442+
const wildcard = { ...item, name: 'crm_opportunity_all', source: { ...item.source, content: ['*'] } };
1443+
const refused = await call(authoring, 'save_metadata_draft', { type: 'knowledge_source', name: wildcard.name, item: wildcard, package: STUDIO_BASE });
1444+
expect(refused.body.error).toMatchObject({ code: 'INVALID_METADATA', status: 422 });
1445+
expect(JSON.stringify(refused.body.error.issues)).toContain('content');
1446+
1447+
// A retired key is refused with its tombstone's prescription, as the describe reads.
1448+
for (const [retired, replacement] of [
1449+
[{ ...item, name: 'crm_opportunity_id', id: 'crm_opportunity_id' }, '`name`'],
1450+
[{ ...item, name: 'crm_opportunity_cf', source: { ...item.source, contentFields: ['name'] } }, '`content`'],
1451+
] as const) {
1452+
const tomb = await call(authoring, 'save_metadata_draft', { type: 'knowledge_source', name: retired.name, item: retired, package: STUDIO_BASE });
1453+
expect(tomb.body.error, replacement).toMatchObject({ code: 'INVALID_METADATA', status: 422 });
1454+
expect(JSON.stringify(tomb.body.error.issues), replacement).toContain(`use ${replacement}`);
1455+
}
1456+
expect((await call(authoring, 'list_drafts', { package: STUDIO_BASE })).body.drafts.map((d: any) => d.name)).toEqual(['crm_opportunity_notes']);
1457+
});
1458+
14071459
it('an inherited member\'s name as `type`, which the fold keeps as sent, is refused and writes nothing', async () => {
14081460
const protocol = await realProtocol();
14091461
const { authoring } = await authorThroughDomain({ protocol });

‎packages/spec/scripts/lib/platform-catalog.ts‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,13 @@ export function renderPlatformCatalog(): string {
418418
);
419419
for (const token of PLATFORM_CAPABILITY_TOKENS) {
420420
const provider = PLATFORM_CAPABILITY_PROVIDERS[token];
421-
const boot = PLATFORM_ALWAYS_ON_CAPABILITIES.includes(token) ? 'every boot' : 'on `requires`';
421+
// A provider an item also mounts (`mountedBy`, read by `stackItemCapabilities`)
422+
// says so: only a SHIPPED item of that collection does, never one saved at run time.
423+
const boot = PLATFORM_ALWAYS_ON_CAPABILITIES.includes(token)
424+
? 'every boot'
425+
: provider?.mountedBy
426+
? `on \`requires\`, or a shipped \`${provider.mountedBy.collection}\` item`
427+
: 'on `requires`';
422428
lines.push(`| \`${token}\` | ${CAPABILITY_ROWS[token]} | ${provider?.edition ?? 'unknown'} | ${boot} |`);
423429
}
424430
lines.push('');

‎packages/spec/scripts/platform-catalog.test.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ describe('the live catalog — every name is one the contract package declares',
7474
}
7575
});
7676

77+
it('a token a shipped item also mounts says so in its Boot cell; the others read on `requires`', () => {
78+
const page = renderPlatformCatalog();
79+
expect(page).toMatch(/^\| `knowledge` \|.*\| on `requires`, or a shipped `knowledgeSources` item \|$/m);
80+
expect(page).toMatch(/^\| `record-context` \|.*\| on `requires` \|$/m);
81+
});
82+
7783
it('covers every value domain exactly', () => {
7884
expect(Object.keys(VALUE_DOMAIN_ROWS).sort()).toEqual([...ValueDomainSchema.options].sort());
7985
});

‎packages/spec/src/kernel/metadata-create-seeds.test.ts‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,15 @@ describe('metadata create seeds validate against their spec schemas', () => {
9696
// from `view` until card ③ (#37087), which brings the designer and its
9797
// seed. Deferred work, named here so it is not a silent gap.
9898
'form',
99-
// [ADR-0161 K4] `knowledge_source` is runtime-creatable, and its create
100-
// seed is deferred work with a name: it lands with the Studio form and
101-
// the MCP create seed (rows 5 and 5b of #37000), which are what would
102-
// serve one. Until then a source is created by a `/meta` save or shipped
103-
// in a package, never from a blank form.
99+
// [ADR-0161 K4, K5] `knowledge_source` is runtime-creatable, and its
100+
// create seed is deferred work with a name: it lands with the Studio
101+
// form (row 5 of #37000). The type's object binding and its content list
102+
// sit inside `source`, and K5 makes `content` non-empty, so a seed that
103+
// passes the schema carries a placeholder object AND a placeholder field
104+
// there. The Studio create flow takes placeholder identity out only at
105+
// the top level (objectui#12810), so it would save both into a new
106+
// source. Until the form builds `source` from the author's input, a
107+
// source is created by a `/meta` or MCP save, or shipped in a package.
104108
'knowledge_source',
105109
]);
106110
const seeded = new Set(listMetadataCreateSeedTypes());

‎scripts/check-skills-token-ratchet.mjs‎

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,40 @@ export const CEILINGS = new Map([
450450
// 6791 -> 6609: the section that taught an authored AI button on a record
451451
// page is replaced by one sentence (ADR-0160 D6, "Entry point": the shell's
452452
// entry is the only one); the row follows the measurement down.
453-
['skills/objectstack-ai/SKILL.md', 6609], // -18 (was 6824), then -5 A2′ (was 6806)
453+
// 6609 -> 6639 (2026-11-27, the ADR-0161 K6 item 6 skills follow-up): § Knowledge
454+
// Sources teaches the `knowledge_source` item (`name`, an explicit `content`
455+
// list with `'*'` refused, the optional `adapter`), egress and cost with the
456+
// save-time permission and admission, the retired keys with their fixes, and
457+
// `split.strategy` as required. Raise path the standing ruling
458+
// 「A:先削重复,余额按实测提高」 (ruling record 6513306068,
459+
// letter B). PAID DOWN FIRST: the wiring paragraph's package list, the old key
460+
// table's `source.kind` Hygiene column (folded into the `content` and `where`
461+
// rows), the example's four comments restating those rows and its
462+
// `refresh: { onRecordChange: true }` line restating the default, and the
463+
// split passage's adapter-list aside. Arithmetic in priced bytes (stamp line
464+
// excluded), against `main`'s 26435 (headroom 0): the file is 26462 -> 26581
465+
// bytes, so the LANDED priced text is 26554 -> ceil(26554 / 4) = 6639; the row
466+
// moves +30, the measured remainder only. Pinned AT the measurement.
467+
// ceil(($(wc -c < skills/objectstack-ai/SKILL.md) - 27) / 4) == ceil(26554 / 4)
468+
// 6639 -> 6695 (2026-11-27, the same follow-up's review round): the section
469+
// says which items mount the service (a SHIPPED `knowledgeSources` item does;
470+
// an app that ships none and authors sources at run time needs
471+
// `requires: ['knowledge']`), that a source is identified by its package and
472+
// `name` (`search_knowledge` lists a package's source as `NAMESPACE-NAME`; a
473+
// code registration and an environment item of one name are one slot), that
474+
// the display field is kept as each title, and that no shipped store has a
475+
// rerank or hybrid-weight setting. Raise path the standing ruling
476+
// 「A:先削重复,余额按实测提高」 (ruling record 6513306068, letter B). PAID DOWN
477+
// FIRST: the intro's "which records of one object are indexed, and which of
478+
// their fields" (the `source.object` and `source.content` rows say it), its
479+
// separate `search_knowledge` sentence (folded into the identity sentence),
480+
// the "one name is one source" clause it replaces, and a shorter closing
481+
// note. Arithmetic in priced bytes (stamp line excluded), against the row's
482+
// 26554: the file is 26581 -> 26806 bytes, so the LANDED priced text is
483+
// 26779 -> ceil(26779 / 4) = 6695; the row moves +56, the measured remainder
484+
// only. Pinned AT the measurement.
485+
// ceil(($(wc -c < skills/objectstack-ai/SKILL.md) - 27) / 4) == ceil(26779 / 4)
486+
['skills/objectstack-ai/SKILL.md', 6695], // -18 (was 6824), then -5 A2′ (was 6806)
454487
// -12 (was 6331): the `http.server` decision-table row dropped a trailing
455488
// clause that taught `contributes.routes` as a key that "parses but serves
456489
// nothing". The key is retired — an authored entry is now REFUSED, carrying

0 commit comments

Comments
 (0)