Skip to content

Commit 9726bd8

Browse files
docs(skills): objectstack-ai names the os validate rules for a knowledge_source, each with its fix (#38091)
repo:objectstack#1 · os-elon-musk · session_016WV4cwPhGV4g9p1BGQaZbP Part of #37310 Clause-②: no Metadata-protocol: none ## 维护者速读 - 读 AI 技能包的开发者和 AI 助手,在“知识源”一节里新看到一张清单:校验和发布时会拒收知识源的五条规则,每条都配了改法;之前这一节没有这张清单。 - 属于“AI 知识检索(RAG)元数据化”这一组工作:上一轮的规则检查已经合并,这次补上教学文字,让作者在校验报错前就知道怎么写对。 - 出错只影响文档:写错的话,作者会照着错误的改法去改,但平台照样拒收,不会有坏数据进去;改动只有文字和预算行,可以直接撤回。 - 无。 ## What changes `skills/objectstack-ai/SKILL.md` § Knowledge Sources (RAG) now lists what `os validate` and publish report for a `knowledge_source`, by rule id, with the fix for each. I took the wording from the rules' own messages and hints in `packages/lint/src/validate-knowledge-source.ts` on `main`, not from the card: - `knowledge-source-object-unknown`: `source.object` is no object of the stack or its packages. On the CLI it is a warning while the manifest declares a dependency that `packages[]` does not carry. Fix: name a defined object, or declare and install its package. - `knowledge-source-field-unknown`: a `content` / `metadataFields` member is no field of the object; `id` and the injected system columns resolve. Fix: correct the spelling, or remove the member. - `knowledge-source-object-not-searchable`: the API does not serve the object for `search`. Fix: leave `enable.apiEnabled` on; an `enable.apiMethods` list must grant `list`, with `enable.searchable` not false. - `knowledge-source-system-object-not-ai-readable`: a `sys_` object without `enable.aiReadable: true`. Fix: index a business object. - `knowledge-source-field-never-indexed` (warning): a credential-class or `internal: true` member, which the index never carries. Fix: remove it. The section says that an error refuses the publish. **Token ratchet.** Raise path: the standing maintainer ruling 2026-10-27 「A:先削重复,余额按实测提高」 (ruling record 6513306068, letter B). Paid down first: four restatements in the same section. - The `source.content` row's "credential-class and `internal` fields are never indexed". The `-field-never-indexed` line now says it. - Its "embedding is egress". The egress paragraph says it. - The `name` row's "with the package, its identity". The intro says it. - The example's `// no adapter: the deployment's store` comment. The `adapter` row says it. Then the row moves `6695 -> 6893` (+198), by the measured remainder only: - SKILL.md is 26806 -> 27596 bytes, and the priced text is 27569 bytes (the 27-byte stamp line is excluded). - ceil(27569 / 4) = 6893. Changeset: `.changeset/37310-skill-knowledge-source-validate-rules.md`, `'@objectstack/skills': patch`. **Skill size readings (`skills/**`).** - Changed file `skills/objectstack-ai/SKILL.md`: 471 -> 487 lines, 26806 -> 27596 bytes, 6695 -> 6893 tokens. - Whole bundle, the sum of all 14 SKILL.md files: 4936 -> 4952 lines, 261710 -> 262500 bytes. ## Tests All readings are at `36261634ad`. - `os validate` on the section's example: exit 0, `"valid": true`, zero knowledge-source findings. - The fixture is a throwaway stack of namespace `kb`, with object `kb_article` (`title`, `body`, `category`, `published`, `sharingModel: 'private'`) and the example's source verbatim. - It ran from an isolated directory under `examples/app-todo`, then the directory was deleted. - Positive control: the same stack with `enable: { apiEnabled: false }`, content `['title', 'bodyy', 'secret']` and a `Field.secret` member. Exit 1, with: - `knowledge-source-object-not-searchable` (error, `source.object`); - `knowledge-source-field-unknown` (error, `content[1]`); - `knowledge-source-field-never-indexed` (warning, `content[2]`). - Eval case 14 (`objectstack-ai/skills-tools-knowledge#14`, an app that ships no source and authors one at run time), 1 rep per arm: - with-skill **pass**: the answer leads with `requires: ['knowledge']`; - no-skill **fail**: the model said it had nothing to go on. ## Acceptance notes - The section names the five ids: `grep -o 'knowledge-source-[a-z-]*' skills/objectstack-ai/SKILL.md | sort | uniq -c` gives each of the five once. - The example passes `os validate` with zero knowledge-source findings (Tests). - `Part of #37310`, not `Fixes`: the card's create seed still waits for #37309, which is the Studio form that builds `source` from the author's input. `knowledge_source` stays on `KNOWN_UNSEEDED` with that reason. ## Verification <details><summary>Skill gates under the verify lock (VERDICT command-exit 0)</summary> - `pnpm turbo run build --filter='@objectstack/cli...' --concurrency=2`: exit 0 - `check:skill-docs`: exit 0, "Skill docs in sync" - `check:skill-refs`: exit 0, "10 generated files in sync with packages/spec" - `check:yaml-examples`: exit 0, "19 tagged YAML example(s) across 1 file(s) validate" - `node scripts/check-skills-token-ratchet.mjs`: exit 0, "61 authored bundle file(s) within their ceilings" </details> <details><summary>Local subset of the derived gate families (28, each exit 0)</summary> `dispatch-gates --commands --repo objectstack-ai/objectstack` derives 67 families at `36261634ad`. I ran 28 of them locally, each exit 0: the ratchet with its self-test, `check:nul-bytes`, `check-empty-changeset`, `check-adr-0087-registration`, `check-changeset-no-major`, `check:doc-authoring`, `check:skill-links`, `check:skill-identifier-liveness`, `check:skill-compatibility`, `check:skill-frame-sync`, `check:published-files` and the rest of that set. CI runs the full set. </details> **Read first.** 1. `skills/objectstack-ai/SKILL.md`, the new rule list just above the example. Risk: a fix that departs from the rule's hint. 2. `scripts/check-skills-token-ratchet.mjs`, the `6695 -> 6893` comment. Check its arithmetic. **Two-minute check.** Run `node scripts/check-skills-token-ratchet.mjs | grep objectstack-ai/SKILL`. Expect `6893 / 6893`. --- _Generated by [Claude Code](https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP)_ Co-authored-by: Claude <noreply@anthropic.com>
1 parent d7a6d74 commit 9726bd8

3 files changed

Lines changed: 47 additions & 4 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@objectstack/skills': patch
3+
---
4+
5+
docs(skills): `objectstack-ai` names the `os validate` rules for a `knowledge_source`
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
`skills/objectstack-ai` § Knowledge Sources (RAG) now lists what `os validate` and publish report for a knowledge source, by rule id, with the fix for each. `knowledge-source-object-unknown`: `source.object` is no object of the stack or its packages; on the CLI it is a warning while the manifest declares a dependency that `packages[]` does not carry. `knowledge-source-field-unknown`: a `content` or `metadataFields` member is no field of the object (`id` and the injected system columns resolve). `knowledge-source-object-not-searchable`: the API does not serve the object for `search`. `knowledge-source-system-object-not-ai-readable`: a `sys_` object without `enable.aiReadable: true`. `knowledge-source-field-never-indexed` is a warning for a credential-class or `internal: true` member, which the index never carries. An error refuses the publish. The section's example passes `os validate` with no knowledge-source finding.

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

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,24 @@ export const CEILINGS = new Map([
483483
// 26779 -> ceil(26779 / 4) = 6695; the row moves +56, the measured remainder
484484
// only. Pinned AT the measurement.
485485
// 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)
486+
// 6695 -> 6893 (2026-11-28, the same follow-up's second half, after the
487+
// `os validate` rules for `knowledge_source` landed): the section names the
488+
// five rules `os validate` and publish report for a source
489+
// (`knowledge-source-object-unknown`, `-field-unknown`,
490+
// `-object-not-searchable`, `-system-object-not-ai-readable`, and the
491+
// `-field-never-indexed` warning), each with its fix. Raise path the
492+
// standing ruling 「A:先削重复,余额按实测提高」 (ruling record 6513306068,
493+
// letter B). PAID DOWN FIRST: the `content` row's "credential-class and
494+
// `internal` fields are never indexed" (the `-field-never-indexed` line
495+
// says it), its "embedding is egress" (the egress paragraph says it), the
496+
// `name` row's "with the package, its identity" (the intro says it), and
497+
// the example's "no adapter: the deployment's store" comment (the `adapter`
498+
// row says it). Arithmetic in priced bytes (stamp line excluded), against
499+
// the row's 26779: the file is 26806 -> 27596 bytes, so the LANDED priced
500+
// text is 27569 -> ceil(27569 / 4) = 6893; the row moves +198, the
501+
// measured remainder only. Pinned AT the measurement.
502+
// ceil(($(wc -c < skills/objectstack-ai/SKILL.md) - 27) / 4) == ceil(27569 / 4)
503+
['skills/objectstack-ai/SKILL.md', 6893], // -18 (was 6824), then -5 A2′ (was 6806)
487504
// -12 (was 6331): the `http.server` decision-table row dropped a trailing
488505
// clause that taught `contributes.routes` as a key that "parses but serves
489506
// nothing". The key is retired — an authored entry is now REFUSED, carrying

‎skills/objectstack-ai/SKILL.md‎

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,12 +252,12 @@ object or field, when you may not search that object or query a field it reads.
252252

253253
| Key | Purpose |
254254
|:----|:--------|
255-
| `name` | Snake_case source name; with the package, its identity |
255+
| `name` | Snake_case source name |
256256
| `label` / `description` | Display metadata |
257257
| `adapter` | Optional store id (`pgvector`, `turso`, `memory`). Omitted: the deployment's store (`pgvector` on PostgreSQL, `turso` otherwise), else the only one registered; several and none the deployment's is refused, naming them |
258258
| `source.kind` | `'object'`, the one kind |
259259
| `source.object` | The object whose records are indexed |
260-
| `source.content` | Non-empty list of the fields whose text is indexed, in order. `'*'` is refused: embedding is egress, and a wildcard also sent fields added later. Meaningful text only, never ids or system fields; credential-class and `internal` fields are never indexed |
260+
| `source.content` | Non-empty list of the fields whose text is indexed, in order. `'*'` is refused: it would also send fields added later. Meaningful text only, never ids or system fields |
261261
| `source.metadataFields` | Fields kept for search-time filtering (`status`, `owner_id`, `tags`) |
262262
| `source.where` | ObjectQL `where`: keeps drafts and archived rows out |
263263
| `source.split` | How documents are cut into passages (below) |
@@ -272,14 +272,30 @@ deployment configures one embedder), `vectorStore` (the store is `adapter`),
272272
`prefix`, `mimeTypes`, `urls`, `userAgent` (no form in 19). `os migrate meta
273273
--from 18` lists a stack's edits; edit a registration in code by hand.
274274

275+
`os validate` and publish check each source; an error refuses the publish:
276+
277+
- `knowledge-source-object-unknown`: `source.object` is no object of the stack
278+
or its packages (on the CLI a warning while the manifest declares a
279+
dependency `packages[]` lacks). Name one, or declare and install its package.
280+
- `knowledge-source-field-unknown`: a `content` / `metadataFields` member is no
281+
field of it (`id` and the injected system columns resolve). Fix the
282+
spelling, or remove it.
283+
- `knowledge-source-object-not-searchable`: the API does not serve the object
284+
for `search`. Leave `enable.apiEnabled` on; an `enable.apiMethods` list
285+
must grant `list`, with `enable.searchable` not false.
286+
- `knowledge-source-system-object-not-ai-readable`: a `sys_` object without
287+
`enable.aiReadable: true`. Index a business object.
288+
- `knowledge-source-field-never-indexed` (warning): a credential-class or
289+
`internal: true` member, which the index never carries. Remove it.
290+
275291
<!-- os:check -->
276292
```typescript
277293
import { KnowledgeSourceSchema, type KnowledgeSource } from '@objectstack/spec/ai';
278294

279295
export const supportKb: KnowledgeSource = KnowledgeSourceSchema.parse({
280296
name: 'support_kb',
281297
label: 'Support Knowledge Base',
282-
source: { // no adapter: the deployment's store
298+
source: {
283299
kind: 'object',
284300
object: 'kb_article',
285301
content: ['title', 'body'],

0 commit comments

Comments
 (0)