From d16dc4b0a4d2a156db0d6923787ff03c6da37d59 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 28 Nov 2026 10:40:36 +0000 Subject: [PATCH 1/3] docs(skills): objectstack-ai teaches knowledge sources over business objects Long free text only, one source per corpus with sourceIds, attachment text through a text field. One eval case; the token ratchet row follows the measurement. Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP Co-authored-by: Claude --- ...kill-knowledge-sources-beyond-documents.md | 16 ++++++++++++++ scripts/check-skills-token-ratchet.mjs | 19 +++++++++++++++- skills/objectstack-ai/SKILL.md | 22 ++++++++++++++++--- .../evals/skills-tools-knowledge.json | 11 ++++++++++ 4 files changed, 64 insertions(+), 4 deletions(-) create mode 100644 .changeset/37976-skill-knowledge-sources-beyond-documents.md diff --git a/.changeset/37976-skill-knowledge-sources-beyond-documents.md b/.changeset/37976-skill-knowledge-sources-beyond-documents.md new file mode 100644 index 00000000000..d72d7ef2b46 --- /dev/null +++ b/.changeset/37976-skill-knowledge-sources-beyond-documents.md @@ -0,0 +1,16 @@ +--- +'@objectstack/skills': patch +--- + +docs(skills): `objectstack-ai` teaches knowledge sources over business objects, not only a document library + +Clause-②: no +Metadata-protocol: none + +`skills/objectstack-ai` § Knowledge Sources (RAG) gains three rules, one example each: + +- **Long free text only.** `content` lists prose fields (an article body, a ticket's `description`, a note). Numbers, dates, statuses and short names stay out, and counts and filters go to the record tools. +- **One source per corpus.** A skill's `instructions` say which source to pass in `sourceIds`, the argument of `search_knowledge`; omitted, every exposed source is scanned. +- **Attachment text goes through a field.** No source reads a file, and a `file` field in `content` adds no file text: write the extracted text to a `textarea` field and list that field. + +No behaviour changes. diff --git a/scripts/check-skills-token-ratchet.mjs b/scripts/check-skills-token-ratchet.mjs index 6f9f08eb1e5..54b1559b2fc 100644 --- a/scripts/check-skills-token-ratchet.mjs +++ b/scripts/check-skills-token-ratchet.mjs @@ -513,7 +513,24 @@ export const CEILINGS = new Map([ // ceil(27623 / 4) = 6906; the row moves +13, the measured remainder only. // Pinned AT the measurement. // ceil(($(wc -c < skills/objectstack-ai/SKILL.md) - 27) / 4) == ceil(27623 / 4) - ['skills/objectstack-ai/SKILL.md', 6906], // -18 (was 6824), then -5 A2′ (was 6806) + // 6906 -> 7109 (2026-11-28, knowledge sources over business objects): the + // section taught a source for a document library only. It now says three + // things, one example each: `content` lists long free text only, and counts + // and filters go to the record tools; one source per corpus, a skill's + // `instructions` naming which to pass in `sourceIds`, the argument of + // `search_knowledge`; attachment text reaches an index through a text field, + // since no source reads a file. Raise path the standing ruling + // 「A:先削重复,余额按实测提高」 (ruling record 6513306068, letter B). PAID DOWN + // FIRST: the `content` row's "Meaningful text only, never ids or system + // fields" (the first rule says it), and the `agent.knowledge` pitfall row's + // "describe intended grounding in `instructions`" (the second rule says it); + // the retired-kinds line's "no form in 19" became a pointer to the third + // rule. Arithmetic in priced bytes (stamp line excluded), against `main`'s + // 27621 (the row's 6906, headroom 0): the file is 27648 -> 28461 bytes, so + // the LANDED priced text is 28434 -> ceil(28434 / 4) = 7109; the row moves + // +203, the measured remainder only. Pinned AT the measurement. + // ceil(($(wc -c < skills/objectstack-ai/SKILL.md) - 27) / 4) == ceil(28434 / 4) + ['skills/objectstack-ai/SKILL.md', 7109], // -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 diff --git a/skills/objectstack-ai/SKILL.md b/skills/objectstack-ai/SKILL.md index cd707145fac..c1e0f2e38c7 100644 --- a/skills/objectstack-ai/SKILL.md +++ b/skills/objectstack-ai/SKILL.md @@ -258,7 +258,7 @@ object or field, when you may not search that object or query a field it reads. | `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: it would also send fields added later. Meaningful text only, never ids or system fields | +| `source.content` | Non-empty list of the fields whose text is indexed, in order. `'*'` is refused: it would also send fields added later | | `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) | @@ -270,7 +270,7 @@ Retired in 19, each refused with its fix: `id` (use `name`), `contentFields` deployment configures one embedder), `vectorStore` (the store is `adapter`), `adapterConfig` (an adapter takes plugin options), `refresh.cron` (call `reindexSource` from a flow or job), and `source.kind: 'file'` / `'http'` with -`prefix`, `mimeTypes`, `urls`, `userAgent` (no form in 19). `os migrate meta +`prefix`, `mimeTypes`, `urls`, `userAgent` (attachment text: below). `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: @@ -306,6 +306,22 @@ export const supportKb: KnowledgeSource = KnowledgeSourceSchema.parse({ }); ``` +**Sources over business objects**, not only a document library: + +- **Long free text only.** `content` lists prose: an article body, a ticket's + `description`, a note. Numbers, dates, statuses and short names stay out; + counts and filters go to the record tools. "Which customers reported login + loops?" is `search_knowledge`; "how many tickets are open per priority?" is + `aggregate_records`. +- **One source per corpus**, and a skill's `instructions` say which to pass in + `sourceIds`: `search_knowledge({ query, sourceIds: ['ticket_bodies'] })` + searches the tickets and not `support_kb`. Omitted, every exposed source is + scanned. +- **Attachment text goes through a field.** No source reads a file, and a + `file` field in `content` adds no file text. Have the flow, hook or import + that extracts the text write it to a `textarea` field + (`contract.attachment_text`), and list that field. + **Splitting (`split`).** The knowledge service cuts each document into passages for a store declaring `capabilities.chunks`; any other store receives whole documents. `split: { strategy, maxChars?, minChars? }` — `strategy` is required @@ -461,7 +477,7 @@ https://objectstack.ai/docs/protocol-upgrade: | Retired key | Removed in 17, tombstone gone in 18 — why, and what replaces it | |:--|:--| | `agent.tools` | The inline slot resolved names against the *full* registry with no surface check. Not a rename: the strict schema refuses the key as unknown; re-declare each tool in a `defineSkill` under the stack's `skills` (ADR-0064) | -| `agent.knowledge` | Declaring sources/indexes on an agent never scoped retrieval — `search_knowledge` takes `sourceIds` from the model's tool-call arguments. Restrict on the knowledge source (`aiExposed`, `source.where`); describe intended grounding in `instructions` | +| `agent.knowledge` | Declaring sources/indexes on an agent never scoped retrieval — `search_knowledge` takes `sourceIds` from the model's tool-call arguments. Restrict on the knowledge source (`aiExposed`, `source.where`) | --- diff --git a/skills/objectstack-ai/evals/skills-tools-knowledge.json b/skills/objectstack-ai/evals/skills-tools-knowledge.json index 890e58dc649..249506addec 100644 --- a/skills/objectstack-ai/evals/skills-tools-knowledge.json +++ b/skills/objectstack-ai/evals/skills-tools-knowledge.json @@ -153,6 +153,17 @@ "must_contain_any": [["requires: ['knowledge']", "requires: [\"knowledge\"]"]], "must_not_contain": ["contentFields:"] } + }, + { + "id": 15, + "prompt": "Our support app has `kb_article` (`title`, `body`) and `support_ticket` (`subject`, `description` as a textarea, `priority`, `status`, `amount`, and a `contract_pdf` file field holding a signed PDF). The assistant should answer from article bodies, from ticket descriptions and from what the PDFs say, and also tell us how many open tickets there are per priority. Design the knowledge sources and say how a skill should search them. None of the project's files are in this directory: write the files in your answer.", + "expected_output": "Writes two `knowledge_source` items, one per corpus (articles, tickets), each `source: { kind: 'object', … }` with an explicit `content` list of long free-text fields only: `title` / `body` for articles, `subject` / `description` for tickets. `priority`, `status` and `amount` are not in `content` (at most `metadataFields`), and the count of open tickets per priority is answered by a record tool (`aggregate_records` / `query_records`), not by `search_knowledge`. The PDF is not indexed from the `contract_pdf` file field and no `kind: 'file'` or `'http'` source is written (both retired): the extracted text is first written to a text field on the record (a `textarea`, filled by a flow, hook or import) and that field is listed in `content`. The skill's `instructions` tell the model which source to search by passing `sourceIds` to `search_knowledge`, so a question does not scan every source; no second argument shape and no `knowledge` key on the skill is invented.", + "files": [], + "assertions": { + "must_contain": ["sourceIds", "content:", "textarea"], + "must_contain_any": [["aggregate_records", "query_records", "aggregate_data"]], + "must_not_contain": ["kind: 'file'", "kind: \"file\"", "kind: 'http'", "contentFields:", "'contract_pdf']", "'amount']", "'priority']"] + } } ] } From c71105cb5bf387236d6255abf91db0d03f324742 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 28 Nov 2026 11:45:36 +0000 Subject: [PATCH 2/3] docs(skills): narrow eval case 15 to wrong shapes; restore two clauses; re-measure the row Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP Co-authored-by: Claude --- scripts/check-skills-token-ratchet.mjs | 34 ++++++++++--------- skills/objectstack-ai/SKILL.md | 20 +++++------ .../evals/skills-tools-knowledge.json | 2 +- 3 files changed, 29 insertions(+), 27 deletions(-) diff --git a/scripts/check-skills-token-ratchet.mjs b/scripts/check-skills-token-ratchet.mjs index 54b1559b2fc..cc9de5425b2 100644 --- a/scripts/check-skills-token-ratchet.mjs +++ b/scripts/check-skills-token-ratchet.mjs @@ -513,24 +513,26 @@ export const CEILINGS = new Map([ // ceil(27623 / 4) = 6906; the row moves +13, the measured remainder only. // Pinned AT the measurement. // ceil(($(wc -c < skills/objectstack-ai/SKILL.md) - 27) / 4) == ceil(27623 / 4) - // 6906 -> 7109 (2026-11-28, knowledge sources over business objects): the + // 6906 -> 7148 (2026-11-28, knowledge sources over business objects): the // section taught a source for a document library only. It now says three - // things, one example each: `content` lists long free text only, and counts - // and filters go to the record tools; one source per corpus, a skill's - // `instructions` naming which to pass in `sourceIds`, the argument of - // `search_knowledge`; attachment text reaches an index through a text field, - // since no source reads a file. Raise path the standing ruling + // things, one example each: `content` lists long free text only (a title or + // subject line with it), and counts and filters go to the record tools, + // named by both spellings (`aggregate_records`, `aggregate_data` in `ask`); + // one source per corpus, a skill's `instructions` naming which to pass in + // `sourceIds`, the argument of `search_knowledge`; attachment text reaches + // an index through a text field. Raise path the standing ruling // 「A:先削重复,余额按实测提高」 (ruling record 6513306068, letter B). PAID DOWN - // FIRST: the `content` row's "Meaningful text only, never ids or system - // fields" (the first rule says it), and the `agent.knowledge` pitfall row's - // "describe intended grounding in `instructions`" (the second rule says it); - // the retired-kinds line's "no form in 19" became a pointer to the third - // rule. Arithmetic in priced bytes (stamp line excluded), against `main`'s - // 27621 (the row's 6906, headroom 0): the file is 27648 -> 28461 bytes, so - // the LANDED priced text is 28434 -> ceil(28434 / 4) = 7109; the row moves - // +203, the measured remainder only. Pinned AT the measurement. - // ceil(($(wc -c < skills/objectstack-ai/SKILL.md) - 27) / 4) == ceil(28434 / 4) - ['skills/objectstack-ai/SKILL.md', 7109], // -18 (was 6824), then -5 A2′ (was 6806) + // FIRST: the `content` row's "Meaningful text only" (the first rule says + // it; the row keeps "Never ids or system fields"), and the `agent.knowledge` + // pitfall row's "describe intended grounding in `instructions`", now a + // pointer to the second rule; the retired-kinds line's "no form in 19" + // became a pointer to the third rule. Arithmetic in priced bytes (stamp + // line excluded), against `main`'s 27621 (the row's 6906, headroom 0): the + // file is 27648 -> 28617 bytes, so the LANDED priced text is 28590 -> + // ceil(28590 / 4) = 7148; the row moves +242, the measured remainder only. + // Pinned AT the measurement. + // ceil(($(wc -c < skills/objectstack-ai/SKILL.md) - 27) / 4) == ceil(28590 / 4) + ['skills/objectstack-ai/SKILL.md', 7148], // -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 diff --git a/skills/objectstack-ai/SKILL.md b/skills/objectstack-ai/SKILL.md index c1e0f2e38c7..e924528665c 100644 --- a/skills/objectstack-ai/SKILL.md +++ b/skills/objectstack-ai/SKILL.md @@ -258,7 +258,7 @@ object or field, when you may not search that object or query a field it reads. | `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: it would also send fields added later | +| `source.content` | Non-empty list of the fields whose text is indexed, in order. `'*'` is refused: it would also send fields added later. 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) | @@ -309,18 +309,18 @@ export const supportKb: KnowledgeSource = KnowledgeSourceSchema.parse({ **Sources over business objects**, not only a document library: - **Long free text only.** `content` lists prose: an article body, a ticket's - `description`, a note. Numbers, dates, statuses and short names stay out; - counts and filters go to the record tools. "Which customers reported login - loops?" is `search_knowledge`; "how many tickets are open per priority?" is - `aggregate_records`. + `description`, a note, with its title or subject line. Numbers, dates, + statuses and the names of people or accounts stay out; counts and filters + go to the record tools. "Which customers reported login loops?" is + `search_knowledge`; "how many tickets are open per priority?" is + `aggregate_records` (in-app `ask`: `aggregate_data`). - **One source per corpus**, and a skill's `instructions` say which to pass in `sourceIds`: `search_knowledge({ query, sourceIds: ['ticket_bodies'] })` searches the tickets and not `support_kb`. Omitted, every exposed source is scanned. -- **Attachment text goes through a field.** No source reads a file, and a - `file` field in `content` adds no file text. Have the flow, hook or import - that extracts the text write it to a `textarea` field - (`contract.attachment_text`), and list that field. +- **Attachment text goes through a field.** A `file` field in `content` adds + no file text. Have the flow, hook or import that extracts the text write it + to a `textarea` field (`contract.attachment_text`), and list that field. **Splitting (`split`).** The knowledge service cuts each document into passages for a store declaring `capabilities.chunks`; any other store receives whole @@ -477,7 +477,7 @@ https://objectstack.ai/docs/protocol-upgrade: | Retired key | Removed in 17, tombstone gone in 18 — why, and what replaces it | |:--|:--| | `agent.tools` | The inline slot resolved names against the *full* registry with no surface check. Not a rename: the strict schema refuses the key as unknown; re-declare each tool in a `defineSkill` under the stack's `skills` (ADR-0064) | -| `agent.knowledge` | Declaring sources/indexes on an agent never scoped retrieval — `search_knowledge` takes `sourceIds` from the model's tool-call arguments. Restrict on the knowledge source (`aiExposed`, `source.where`) | +| `agent.knowledge` | Declaring sources/indexes on an agent never scoped retrieval — `search_knowledge` takes `sourceIds` from the model's tool-call arguments. Restrict on the knowledge source (`aiExposed`, `source.where`); name the `sourceIds` to pass in `instructions` (§ Knowledge Sources) | --- diff --git a/skills/objectstack-ai/evals/skills-tools-knowledge.json b/skills/objectstack-ai/evals/skills-tools-knowledge.json index 249506addec..f5cb72bd6ce 100644 --- a/skills/objectstack-ai/evals/skills-tools-knowledge.json +++ b/skills/objectstack-ai/evals/skills-tools-knowledge.json @@ -162,7 +162,7 @@ "assertions": { "must_contain": ["sourceIds", "content:", "textarea"], "must_contain_any": [["aggregate_records", "query_records", "aggregate_data"]], - "must_not_contain": ["kind: 'file'", "kind: \"file\"", "kind: 'http'", "contentFields:", "'contract_pdf']", "'amount']", "'priority']"] + "must_not_contain": ["kind: 'file',", "kind: \"file\",", "kind: 'http',", "kind: \"http\",", "contentFields:", "content: ['priority'", "content: ['status'", "content: ['amount'", "content: ['contract_pdf'", "'description', 'priority'", "'description', 'status'", "'description', 'amount'", "'description', 'contract_pdf'"] } } ] From 742647d8f0bdaf84df35bd2edfd8897b95adcb53 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 28 Nov 2026 12:25:40 +0000 Subject: [PATCH 3/3] docs(changeset): the note follows the reviewed skill text Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP Co-authored-by: Claude --- .changeset/37976-skill-knowledge-sources-beyond-documents.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.changeset/37976-skill-knowledge-sources-beyond-documents.md b/.changeset/37976-skill-knowledge-sources-beyond-documents.md index d72d7ef2b46..06050d544fd 100644 --- a/.changeset/37976-skill-knowledge-sources-beyond-documents.md +++ b/.changeset/37976-skill-knowledge-sources-beyond-documents.md @@ -9,8 +9,8 @@ Metadata-protocol: none `skills/objectstack-ai` § Knowledge Sources (RAG) gains three rules, one example each: -- **Long free text only.** `content` lists prose fields (an article body, a ticket's `description`, a note). Numbers, dates, statuses and short names stay out, and counts and filters go to the record tools. +- **Long free text only.** `content` lists prose fields (an article body, a ticket's `description`, a note) with their title or subject line. Numbers, dates, statuses and the names of people or accounts stay out, and counts and filters go to the record tools (`aggregate_records`, or `aggregate_data` in the in-app assistant). - **One source per corpus.** A skill's `instructions` say which source to pass in `sourceIds`, the argument of `search_knowledge`; omitted, every exposed source is scanned. -- **Attachment text goes through a field.** No source reads a file, and a `file` field in `content` adds no file text: write the extracted text to a `textarea` field and list that field. +- **Attachment text goes through a field.** A `file` field in `content` adds no file text: write the extracted text to a `textarea` field and list that field. No behaviour changes.