Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .changeset/37310-skill-knowledge-source-validate-rules.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
'@objectstack/skills': patch
---

docs(skills): `objectstack-ai` names the `os validate` rules for a `knowledge_source`

Clause-②: no
Metadata-protocol: none

`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.
19 changes: 18 additions & 1 deletion scripts/check-skills-token-ratchet.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,24 @@ export const CEILINGS = new Map([
// 26779 -> ceil(26779 / 4) = 6695; the row moves +56, the measured remainder
// only. Pinned AT the measurement.
// ceil(($(wc -c < skills/objectstack-ai/SKILL.md) - 27) / 4) == ceil(26779 / 4)
['skills/objectstack-ai/SKILL.md', 6695], // -18 (was 6824), then -5 A2′ (was 6806)
// 6695 -> 6893 (2026-11-28, the same follow-up's second half, after the
// `os validate` rules for `knowledge_source` landed): the section names the
// five rules `os validate` and publish report for a source
// (`knowledge-source-object-unknown`, `-field-unknown`,
// `-object-not-searchable`, `-system-object-not-ai-readable`, and the
// `-field-never-indexed` warning), each with its fix. Raise path the
// standing ruling 「A:先削重复,余额按实测提高」 (ruling record 6513306068,
// letter B). PAID DOWN FIRST: the `content` row's "credential-class and
// `internal` fields are never indexed" (the `-field-never-indexed` line
// says it), its "embedding is egress" (the egress paragraph says it), the
// `name` row's "with the package, its identity" (the intro says it), and
// the example's "no adapter: the deployment's store" comment (the `adapter`
// row says it). Arithmetic in priced bytes (stamp line excluded), against
// the row's 26779: the file is 26806 -> 27596 bytes, so the LANDED priced
// text is 27569 -> ceil(27569 / 4) = 6893; the row moves +198, the
// measured remainder only. Pinned AT the measurement.
// ceil(($(wc -c < skills/objectstack-ai/SKILL.md) - 27) / 4) == ceil(27569 / 4)
['skills/objectstack-ai/SKILL.md', 6893], // -18 (was 6824), then -5 A2′ (was 6806)
// -12 (was 6331): the `http.server` decision-table row dropped a trailing
// clause that taught `contributes.routes` as a key that "parses but serves
// nothing". The key is retired — an authored entry is now REFUSED, carrying
Expand Down
22 changes: 19 additions & 3 deletions skills/objectstack-ai/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,12 +252,12 @@ object or field, when you may not search that object or query a field it reads.

| Key | Purpose |
|:----|:--------|
| `name` | Snake_case source name; with the package, its identity |
| `name` | Snake_case source name |
| `label` / `description` | Display metadata |
| `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 |
| `source.kind` | `'object'`, the one kind |
| `source.object` | The object whose records are indexed |
| `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 |
| `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 |
| `source.metadataFields` | Fields kept for search-time filtering (`status`, `owner_id`, `tags`) |
| `source.where` | ObjectQL `where`: keeps drafts and archived rows out |
| `source.split` | How documents are cut into passages (below) |
Expand All @@ -272,14 +272,30 @@ deployment configures one embedder), `vectorStore` (the store is `adapter`),
`prefix`, `mimeTypes`, `urls`, `userAgent` (no form in 19). `os migrate meta
--from 18` lists a stack's edits; edit a registration in code by hand.

`os validate` and publish check each source; an error refuses the publish:

- `knowledge-source-object-unknown`: `source.object` is no object of the stack
or its packages (on the CLI a warning while the manifest declares a
dependency `packages[]` lacks). Name one, or declare and install its package.
- `knowledge-source-field-unknown`: a `content` / `metadataFields` member is no
field of it (`id` and the injected system columns resolve). Fix the
spelling, or remove it.
- `knowledge-source-object-not-searchable`: the API does not serve the object
for `search`. 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`. Index a business object.
- `knowledge-source-field-never-indexed` (warning): a credential-class or
`internal: true` member, which the index never carries. Remove it.

<!-- os:check -->
```typescript
import { KnowledgeSourceSchema, type KnowledgeSource } from '@objectstack/spec/ai';

export const supportKb: KnowledgeSource = KnowledgeSourceSchema.parse({
name: 'support_kb',
label: 'Support Knowledge Base',
source: { // no adapter: the deployment's store
source: {
kind: 'object',
object: 'kb_article',
content: ['title', 'body'],
Expand Down
Loading