Skip to content

Commit 132dd13

Browse files
os-billclaude
andauthored
docs(spec): KnowledgeSource docblock says runtime registration, not governed metadata (#17653)
The docblock above `KnowledgeSourceSchema` claimed it is "Stored as metadata, versioned, and environment-scoped exactly like a view or a flow". Measured on this tree: `listMetadataTypeSchemaTypes()` returns 26 governed types with none knowledge-shaped (controls `view`, `flow`, `skill`, `agent`, `tool` all present), `ObjectStackDefinitionSchema` has 44 top-level keys with none knowledge-shaped, and `defineStack({ knowledgeSources: [...] })` is refused with the generic unrecognized-key message — identical to a `zzz_nonsense` dark control — while `defineStack({ skills: [a valid skill] })` is accepted as the lit control. No ADR says it ought to be a governed metadata type; the rest of the contract already says the opposite (`IKnowledgeService.registerSource`, `KnowledgeServicePlugin({ sources })`, the process-lifetime source Map, and the `agent.knowledge` liveness row). The prose was the outlier, so the prose is what moves: the replacement states the schema is the shape of a runtime registration, names both routes a source arrives by, and says retrieval is restricted per-source at the service level. Prose only — no schema, no registry, no key. `gen:schema` and `gen:docs` produced no artefact change. The card relation is declared in the pull request body, which is its only carrier. Claude-Session: https://claude.ai/code/session_01MkQhmuuJAVDjmeWNixwDDH Co-authored-by: Claude <noreply@anthropic.com>
1 parent 6465cc0 commit 132dd13

2 files changed

Lines changed: 69 additions & 2 deletions

File tree

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
'@objectstack/spec': patch
3+
---
4+
5+
`KnowledgeSourceSchema`'s docblock stops claiming it is stored as metadata "exactly like a view or a flow", and says where a knowledge source actually lives
6+
7+
The docblock above `KnowledgeSourceSchema` declared, verbatim:
8+
9+
> Canonical KnowledgeSource. Stored as metadata, versioned, and
10+
> environment-scoped exactly like a view or a flow.
11+
12+
None of the three is true, measured on the tree this changeset lands on:
13+
14+
- `listMetadataTypeSchemaTypes()` returns **26** governed metadata types and
15+
**none is knowledge-shaped**. Controls that fire: `view`, `flow`, `skill`,
16+
`agent` and `tool` are all present; a `zzz_nonsense` dark control is absent.
17+
- `ObjectStackDefinitionSchema` has **44** top-level keys, none knowledge-shaped
18+
(controls present: `skills`, `agents`, `tools`, `views`, `flows`).
19+
- `defineStack({ knowledgeSources: [...] })` is refused with the **generic**
20+
unrecognized-top-level-key message — byte-identical to the message for
21+
`zzz_nonsense`. Lit control: `defineStack({ skills: [<valid skill>] })` is
22+
accepted on the same base, so the probe does find an authoring route for a
23+
type that has one.
24+
25+
So an author who followed the sentence reached for a mounting that does not
26+
exist and got a rejection that pointed nowhere — the authoring trap, not a
27+
wrong example.
28+
29+
**The prose was the outlier, not the schema.** No ADR in this repo mentions
30+
`KnowledgeSource` at all, and the rest of the contract is already consistent:
31+
`IKnowledgeService` declares `registerSource` / `unregisterSource` /
32+
`listSources` / `getSource`, `KnowledgeServicePlugin` takes a `sources` option
33+
at kernel wiring and calls `registerSource` for each, and the implementation
34+
holds them in a process-lifetime `Map`. The `agent.knowledge` liveness row says
35+
the same thing from the other side — *"restrict retrieval at the
36+
knowledge-service/source level; describe grounding in `instructions`"*.
37+
38+
The replacement docblock states what the schema is (the shape of a runtime
39+
registration), names both routes a source actually arrives by, and says the
40+
retrieval restriction is per-source at the service level.
41+
42+
⛔ No behaviour, no key and no accept set changes: the diff is one docblock.
43+
Running `gen:schema` and `gen:docs` afterwards produced no artefact change —
44+
`content/docs/references/ai/knowledge-source.mdx` mirrors the file-level header
45+
docblock, not this per-schema one.
46+
47+
**Why this is not `skip-changeset`.** `@objectstack/spec`'s published `files[]`
48+
ships `dist` *and* `src/**/*.zod.ts`, so this text is published twice over: the
49+
old sentence was measured in the built `dist/knowledge-document.zod-*.d.ts` and
50+
`.d.mts` (1 occurrence each) before the edit, and the source file is shipped
51+
verbatim. Both move.

packages/spec/src/ai/knowledge-source.zod.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,24 @@ export const KnowledgeSourceKindSchema = lazySchema(() => z.discriminatedUnion('
102102
]));
103103

104104
/**
105-
* Canonical KnowledgeSource. Stored as metadata, versioned, and
106-
* environment-scoped exactly like a view or a flow.
105+
* Canonical KnowledgeSource — the shape of a **runtime registration**,
106+
* ⛔ not a governed metadata type.
107+
*
108+
* It is not stored as metadata, not versioned and not
109+
* environment-scoped: no knowledge-shaped entry exists in the governed
110+
* metadata-type registry (`listMetadataTypeSchemaTypes()`), and
111+
* `ObjectStackDefinitionSchema` carries no collection for it — so
112+
* `defineStack({ knowledgeSources: [...] })` is refused as an
113+
* unrecognized top-level key. `view`, `flow`, `skill`, `agent` and
114+
* `tool` are the types that do work that way; this one does not.
115+
*
116+
* A source reaches the runtime through code, for the life of the
117+
* process: `KnowledgeServicePlugin({ sources: [...] })` at kernel
118+
* wiring, or `IKnowledgeService.registerSource(source)` afterwards;
119+
* `listSources()` / `getSource()` read that in-memory registry back.
120+
* Retrieval is restricted at the knowledge-service/source level —
121+
* `search_knowledge` takes `sourceIds` — and an agent describes its
122+
* grounding in `instructions`.
107123
*/
108124
export const KnowledgeSourceSchema = lazySchema(() => z.object({
109125
/** Stable identifier. Snake_case. */

0 commit comments

Comments
 (0)