Repository navigation
Commit 1330750
docs(knowledge): the docs and the AI skill state the document unit (documentBy) and the held knowledge service (#38855)
<!-- claude-projects-attribution: {"github_login":"os-support-ai"} -->
_Requested by **Yibo Wang** · [project
thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwBG4YD4RMAt72Ga5PdYYZDAQ)_
Fixes #38538
Fixes #38475
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 用户能看到什么变化:用户无感。写给开发者和 AI
的知识库说明补了两段:一是应用自己把长文档拆成一条条子记录时该怎么配,搜索结果按上级文档去重和计数;二是知识库装上了但还没配好向量模型时,知识源只是挂着、搜不了,配好并重启后才生效。
-
为什么做:这两段都是已上线功能欠下的说明文字,分属知识库专题里的「按上级文档计数」和「装上不等于启用」两项;你已裁定它们不算新任务、现在补齐。
- 出错会怎样:只改说明文字,产品行为不变。最坏情况是 AI 照新说明把某个配置写错,保存时会被拒绝并告诉它怎么改;这次改动可以直接撤回。
- 要你做什么:技能说明的文字需要你审批后才能合并。
## What changes
Two cards, one commit each. Text only: no schema, no runtime code, no
generated page.
**Card 38538, the document unit (`de04044835`).** The two knowledge
pages and the AI skill did not name `source.documentBy`. They now state
the rule in one voice: an app that cuts its own passages writes each one
as a child record and indexes the child object with `split: { strategy:
'whole' }`; the index stays one record = one document; `documentBy` is
the unit a record-level search counts in `topK` and groups by when no
`groupBy` is sent.
- `content/docs/ai/knowledge-rag.mdx`: a paragraph under "Retrieving
knowledge"; the `topK` and `granularity` rows of the `search_knowledge`
argument table; a new subsection, "An app that cuts its own passages",
with the four rules (child records with `whole`, the index unchanged,
the counted and grouped unit, the single parent link and where it is
refused). The same-record recipe above it now points at the subsection
for an app that already keeps one row per unit.
- `content/docs/protocol/knowledge.mdx`: the key in section 3.1 (what it
is, what it leaves unchanged, what it must be and where it is refused);
the default grouping in "Records, not passages" (one hit per parent, a
record with no parent is its own hit, the group is keyed with the
source, `groupValue` on a tool hit, an explicit `groupBy` takes its
place); one pointer in section 3.5.
- `skills/objectstack-ai/SKILL.md`: the key's row in the source table,
and one rule beside the corpus rules.
**Card 38475, mounted is not enabled (`ac64b997eb`).** The skill said "A
shipped item mounts the knowledge service and its store", which read as
"shipped, so searchable". The sentence now reads "A shipped item mounts
the knowledge service, which does not enable it" ("and its store"
dropped after review, `ff79a0e739`) and says the service is held until
an embedder provider is saved, the deployment's store is mounted and the
server restarts; that held sources are listed and never built or
searched; that `search_knowledge` is not offered; that a search or a
run-time save answers `503 SERVICE_UNAVAILABLE` naming the missing half,
with nothing written; that `os knowledge status` prints the state and
why, and `os knowledge rebuild` exits 1 with it. The remedy for an app
that ships no source gains the embedder save and its restart. No example
is added.
The wording was read from the code on `main` at `13a0d3fedf`, not from
the cards: `heldSourcesText` and `heldSourceSaveText`
(`knowledge-service-top-level.ts`), `heldIndexReading`
(`knowledge-build.ts`), the `rebuild` and `index_status` actions
(`knowledge-build-actions.ts`), `describeEnablement` and the two CLI
commands (`packages/cli/src/commands/knowledge/`), and
`noKnowledgeServiceRefusal` (`knowledge-source-save-admission.ts`).
**Two files of the card's list do not change.** The `search_knowledge`
description (`knowledge-tools.ts`) and the TSDoc of
`KnowledgeSearchOptions.granularity` / `topK` (`knowledge-service.ts` in
the spec contracts) already say one hit per parent for a `documentBy`
source on `main`: that text landed with the key itself. The Studio form
row and its test are on `main` too.
### Skills budget
Standing ruling, quoted: 「A:先削重复,余额按实测提高」 (ruling record 6513306068,
letter B). Restating text of the same file is deleted first, and the
token row moves by the measured remainder, pinned at the measurement.
| Reading | Before (`13a0d3fedf`) | After (`ff79a0e739`) | Delta |
|:--|--:|--:|--:|
| `skills/objectstack-ai/SKILL.md`, lines | 507 | 518 | +11 |
| `skills/objectstack-ai/SKILL.md`, bytes | 29014 | 30020 | +1006 |
| `skills/objectstack-ai/SKILL.md`, tokens (stamp line excluded) | 7247
| 7499 | +252 |
| Every `SKILL.md` of the catalog, lines (14 files) | 2769 | 2780 | +11
|
| Authored bundle, tokens | 189821 | 190073 | +252 |
| Whole shipped tree, tokens | 295693 | 295945 | +252 |
Deleted first, all in the same file: the `maxChars` sentence's "the
longest passage" (the setting it overrides is named **Longest passage**
in the same sentence); the "(`KnowledgeSourceSchema` in
`@objectstack/spec/ai`)" aside (the section's example imports that
schema from that path); the second "`SERVICE_UNAVAILABLE`, nothing
written" (the held refusal beside it says both); "to the stack" and "the
server" of the remedy. The row in
`scripts/check-skills-token-ratchet.mjs` moves 7247 to 7401 in the first
commit 7401 to 7489 in the second, and 7489 to 7499 in the review fix
(`ff79a0e739`: the `documentBy` row now ends "Setting it rebuilds
nothing; newly listing the field rebuilds the source in place", and "and
its store" is the deletion shown), each with its arithmetic in the row's
history.
The dispatch's budget for the two cards together is at most +12 lines;
the file moves +11.
## Tests
No behaviour changes, so no test is added or changed and no ablation
applies. No test or script pins the edited sentences (searched: the
skill path, the two page paths and the removed phrases, across
`*.test.ts` and `scripts/`).
## Acceptance notes
- **File surface, one path outside the claim's list.**
`scripts/check-skills-token-ratchet.mjs` is edited: one row and its two
history notes. The gate reds a row that sits above or below its
measurement, so any change to the skill's bytes moves that row in the
same PR; the standing ruling the dispatch names is the path that moves
it. It is declared here so the seat can add the path to the claim.
- **"Counted" is stated as far as this repository delivers it.** The
pages and the skill say `topK` counts parents for a `documentBy` source.
Whether a hosted plan's document quota counts parents is the cloud
repository's half of the topic; it could not be read from this session,
so nothing here states it.
- **One snippet in the guide, none in the skill.** The new guide
subsection shows a six-line `source` block, in the style of the split
and ordering sections beside it. The "no new example" rule of card 38475
is about the skill, and the skill gains none.
- **The skill does not list the rule id**
`knowledge-source-document-by-not-parent-link`. The row says any other
field is refused, and the refusal names the fix; the two lines the
bullet would cost are outside the line budget. The guide and the
protocol page name the rule.
- **Noted, not changed (outside the file surface).** The TSDoc of
`documentBy` in `packages/spec/src/ai/knowledge-source.zod.ts` still
says a source registered in code or installed with a package "meets no
save, so that rule does not judge it yet"; since the lint rule above
landed, `os validate` and the publish gate judge it. Prose drift only:
the `.describe` string, and with it the generated reference page, is
accurate.
- **Noted, not changed.** The skill's Knowledge Sources section does not
mention `source.affinity` (the order for the asker). It is outside both
cards.
- **The other open PR on the protocol page** (the embed-once change,
section 3.4) shares `content/docs/protocol/knowledge.mdx`.
`overlap-check.mjs` before each push: merges cleanly, exit 0.
## Verification
Read first, by risk:
1. `skills/objectstack-ai/SKILL.md`, the first paragraph of "Knowledge
Sources (RAG)": the held-state wording, the Tier H text.
2. `scripts/check-skills-token-ratchet.mjs`, the
`skills/objectstack-ai/SKILL.md` row: 7247 to 7499, and the three
history notes above it.
3. `content/docs/ai/knowledge-rag.mdx`, "An app that cuts its own
passages": the new subsection.
Two-minute check: `node scripts/check-skills-token-ratchet.mjs` prints,
on its first line, `skills/objectstack-ai/SKILL.md is 7499 tokens
(ceiling 7499; headroom 0)` (at `ff79a0e739`).
<details>
<summary>Local gates at <code>ac64b997eb</code> (the review fix
<code>ff79a0e739</code> re-ran the skills gates: os-dev delta 7303030228
on #38538)</summary>
The list is `node scripts/pm/dispatch-gates.mjs --commands` on the final
head: 93 commands. Each exit code was recorded before any pipe, and the
record was reconciled with `--ran`:
`✓ dispatch-gates --ran: 93 derived famil(ies) accounted for — 92 run, 1
NOT-MEASURED (0 DERIVED from a recorded exit 3, 1 claimed).`
- 92 commands exit 0. Among them: `check-skills-token-ratchet.mjs` and
its `--self-test`, `check:skill-docs`, `check:skill-examples`,
`check:skill-identifier-liveness`, `check:skill-links`,
`check:skill-frame-sync`, `check:skill-compatibility`, `check:docs`,
`check:doc-anchors`, `check:doc-authoring`, `check:docs-single-h1`,
`check:docs-spec-enumerations`, `check:docs-transcript-drift`,
`check:doc-formula-expressions`, `check:doc-security-posture`,
`check:nul-bytes`, `check:pm-skill-id-lint`, `check:pm-dispatch-gates`,
`check-empty-changeset.mjs`, `check-changeset-no-major.mjs`,
`check-adr-0087-registration.mjs`.
- NOT MEASURED: `pnpm check:dual-build-cjs-loads`, exit 3, PREREQUISITE
NOT MET. It reads built output of every package and asks for a full
`pnpm build`; the whole-tree build is CI's, and this diff changes no
package source.
- Five of the 92 first answered exit 3 for a missing build
(`check:doc-formula-expressions`, `check:doc-security-posture`,
`check:skill-examples`, `check:docs-transcript-drift`,
`check:lean-entry-closure`) and were run again after `turbo run build`
of `@objectstack/formula`, `@objectstack/lint`,
`@objectstack/client-react` and `@objectstack/client`: exit 0 each.
- Outside the derived list: `pnpm --filter @objectstack/spec run
check:generated` exit 0 ("All 14 generated artifacts are up to date",
`check:skill-docs` and `check:skill-refs` among them, so no generated
file is regenerated); `check:skill-served-sections` exit 0.
- `node scripts/pm/overlap-check.mjs`: `VERDICT clean exit 0` against
`origin/main` `13a0d3fedf` and the two open PRs that share a file.
No package source changes, so no package build closure, test or
typecheck is owed by this diff; the full farm is CI's.
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01WGufzeatqKfTRUzTJVa9jQ)_
<!-- signed: repo:objectstack@os-support-ai · os-support-ai ·
session_01WGufzeatqKfTRUzTJVa9jQ -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 81aacd3 commit 1330750
5 files changed
Lines changed: 156 additions & 17 deletions
File tree
- .changeset
- content/docs
- ai
- protocol
- scripts
- skills/objectstack-ai
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
170 | 179 | | |
171 | 180 | | |
172 | 181 | | |
| |||
236 | 245 | | |
237 | 246 | | |
238 | 247 | | |
239 | | - | |
240 | | - | |
| 248 | + | |
| 249 | + | |
241 | 250 | | |
242 | 251 | | |
243 | 252 | | |
| |||
317 | 326 | | |
318 | 327 | | |
319 | 328 | | |
320 | | - | |
| 329 | + | |
321 | 330 | | |
322 | 331 | | |
323 | 332 | | |
| |||
340 | 349 | | |
341 | 350 | | |
342 | 351 | | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
343 | 372 | | |
344 | 373 | | |
345 | 374 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
212 | 235 | | |
213 | 236 | | |
214 | 237 | | |
| |||
406 | 429 | | |
407 | 430 | | |
408 | 431 | | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
409 | 442 | | |
410 | 443 | | |
411 | 444 | | |
412 | 445 | | |
413 | 446 | | |
414 | 447 | | |
415 | 448 | | |
416 | | - | |
| 449 | + | |
| 450 | + | |
417 | 451 | | |
418 | 452 | | |
419 | 453 | | |
| |||
692 | 726 | | |
693 | 727 | | |
694 | 728 | | |
695 | | - | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
696 | 733 | | |
697 | 734 | | |
698 | 735 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
570 | 570 | | |
571 | 571 | | |
572 | 572 | | |
573 | | - | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
574 | 624 | | |
575 | 625 | | |
576 | 626 | | |
| |||
0 commit comments