Repository navigation
feat(service-knowledge)!: one splitter (whole / recursive / markdown, Chinese-aware), the chunk channel and the split key; KnowledgeChunk.metadata and knowledge.chunk_overlap retired - #37287
Conversation
… embedding descriptor, reindex failures Claude-Session: https://claude.ai/code/session_01QSeKYoHKp8EUQtketT9S29 Co-authored-by: Claude <noreply@anthropic.com>
…lden files and the budget property Claude-Session: https://claude.ai/code/session_01QSeKYoHKp8EUQtketT9S29 Co-authored-by: Claude <noreply@anthropic.com>
…e chunks; whole over the budget is removed and reported Claude-Session: https://claude.ai/code/session_01QSeKYoHKp8EUQtketT9S29 Co-authored-by: Claude <noreply@anthropic.com>
…ns, chunk_overlap retired, contract suite chunk cases and stubs Claude-Session: https://claude.ai/code/session_01QSeKYoHKp8EUQtketT9S29 Co-authored-by: Claude <noreply@anthropic.com>
… read through the settings service Claude-Session: https://claude.ai/code/session_01QSeKYoHKp8EUQtketT9S29 Co-authored-by: Claude <noreply@anthropic.com>
…siness words, visibility pin moved Claude-Session: https://claude.ai/code/session_01QSeKYoHKp8EUQtketT9S29 Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QSeKYoHKp8EUQtketT9S29 Co-authored-by: Claude <noreply@anthropic.com>
…limit Claude-Session: https://claude.ai/code/session_01QSeKYoHKp8EUQtketT9S29 Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QSeKYoHKp8EUQtketT9S29 Co-authored-by: Claude <noreply@anthropic.com>
…e tenant-audit census can place its delete Claude-Session: https://claude.ai/code/session_01QSeKYoHKp8EUQtketT9S29 Co-authored-by: Claude <noreply@anthropic.com>
…eiver; the chunk-channel engine double holds the caller's bound Claude-Session: https://claude.ai/code/session_01QSeKYoHKp8EUQtketT9S29 Co-authored-by: Claude <noreply@anthropic.com>
…Strategy (ADR-0122) Claude-Session: https://claude.ai/code/session_01QSeKYoHKp8EUQtketT9S29 Co-authored-by: Claude <noreply@anthropic.com>
…em 5) — tombstone, retired-key and D3 semantic entries, step-18 rationale Claude-Session: https://claude.ai/code/session_01QSeKYoHKp8EUQtketT9S29 Co-authored-by: Claude <noreply@anthropic.com>
… declarations, the ADR-0087 marker Claude-Session: https://claude.ai/code/session_01QSeKYoHKp8EUQtketT9S29 Co-authored-by: Claude <noreply@anthropic.com>
…unk key Claude-Session: https://claude.ai/code/session_01QSeKYoHKp8EUQtketT9S29 Co-authored-by: Claude <noreply@anthropic.com>
…owledge-splitter # Conflicts: # content/docs/protocol/knowledge.mdx # packages/plugins/knowledge-memory/src/__tests__/contract.test.ts # packages/plugins/knowledge-memory/src/index.ts # packages/services/service-knowledge/src/knowledge-service-plugin.ts # packages/services/service-knowledge/src/knowledge-service.ts # packages/services/service-knowledge/src/testing.ts # packages/spec/src/ai/knowledge-document.zod.ts
…ment reference from the merged tree Claude-Session: https://claude.ai/code/session_01QSeKYoHKp8EUQtketT9S29 Co-authored-by: Claude <noreply@anthropic.com>
…d declare organizationIds, beside the merged organization cases Claude-Session: https://claude.ai/code/session_01QSeKYoHKp8EUQtketT9S29 Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 5 package(s): 7 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 3 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 178 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin a9947ebcda6f1ffccebcf1a22da3cc766dcab6e9 && git checkout a9947ebcda6f1ffccebcf1a22da3cc766dcab6e9
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 4ed453dc211f24114c36133cb016515f377d2d5c c84c242aa76ac788c77052c6a33335912f58ee17 && git checkout -B drift-repro 4ed453dc211f24114c36133cb016515f377d2d5c && git merge --no-ff c84c242aa76ac788c77052c6a33335912f58ee17
node scripts/docs-audit/affected-docs.mjs --json 4ed453dc211f24114c36133cb016515f377d2d5c
|
|
repo:objectstack#4 · os-justin · session_01QSeKYoHKp8EUQtketT9S29 {
"issue": 37098,
"status": "done",
"branch": "claude/issue-37098-knowledge-splitter",
"pr": "https://github.com/objectstack-ai/objectstack/pull/37287",
"session": "session_01QSeKYoHKp8EUQtketT9S29",
"premise_still_valid": true,
"summary": "Draft PR #37287 at head c84c242aa, under claim 7158315677 (Metadata-protocol: narrowed). It delivers the card's What 1–6: one service-layer splitter (whole / recursive / markdown, Chinese-aware sentence rule, tables and list items kept whole while they fit), the chunk channel and the capabilities.chunks flag (ADR-0161 K8 item 5), embedding.maxInputTokens on the adapter and IEmbedder.maxInputTokens? (K8 item 6; embedder-openai fills it), the split key (K8 item 10), whole-over-budget removed and reported (failed/failures; the event path logs at error; indexDocument throws), knowledge-memory taking the service's passages, chunk_target with a reader, and both docs pages. Per seat direction B (7158283273) and its ruling A, KnowledgeChunk.metadata is retired here with the kit under protocol major 18. knowledge.chunk_overlap is retired the Localization-format way. #37256 was merged in via os-regen-merge.sh, keeping both sides. docHash recipe unchanged.",
"tests": "On head c84c242aa: service-knowledge 253/253 (split.test.ts with 6 golden files and a 500-document seeded budget property; contract-stubs; chunk-channel; the merged organization cases); knowledge-memory 34/34 (contract suite with listDocuments, chunks and organizationIds); embedder-openai 30/30; service-settings 1523/1523 (pre-merge head; the merge did not touch it); spec 985 files / 29934 tests (pre-merge kit head 455310944, then check:generated green after the merge); step18-rationale-merge 9/9; packages/cli test/migrate-meta-engine-guidance.test.ts 3/3. Typecheck exit 0 for spec, service-knowledge, knowledge-memory, embedder-openai and service-settings, check:test-typecheck included, so the tsc-channel @ts-expect-error pin is live. No ablation: the behaviours are new, not changed.",
"gates": "Local, head c84c242aa: dispatch-gates --commands derived 122 families; all 122 ran, all exit 0; --ran: 122 derived, 122 run, 0 NOT-MEASURED, 0 UNRUN. The earlier four real findings stay fixed (tenant-audit census, logger receiver detach, objectql double limit, ADR-0122 parsed aliases). The two earlier NOT MEASURED (check:skill-examples, check:dual-build-cjs-loads) ran and passed once the closure was built. check-adr-0087-registration exit 0 (1 declared-breaking changeset, carrying its disposition); check-changeset-no-major exit 0; check-empty-changeset exit 0; spec check:generated: all 14 artifacts up to date. PR #37287 check-runs: 74/74 completed, none failed. Required contexts: Lint & Repo Gates success, TypeScript Type Check success, Test Core success, Build Core success, Governed Surface Queue Guard success, Type Check UI success, Test UI success, Build & E2E UI success, Live E2E UI success, Dogfood Regression Gate success, Lint UI skipped (no ui/ diff). Also success: Check Changeset, Spec property liveness, Check PR Size, PR-body guards.",
"dogfood_battery": "c84c242aa · os-verify-lock VERDICT command-exit 0 (48m43s) · Test Files 487 passed | 3 skipped (490) · Tests 4128 passed | 68 skipped (4196) · no failures",
"mcp_calls": "15 — mcp__github__issue_read x6, mcp__github__pull_request_read x2 (get_check_runs), mcp__claude-code-remote__send_message x7; no GitHub MCP write",
"api_writes": "5 — post-stamped report comments 7158152761, 7160020786, 7160082130 on #37098, the relay pr_create of #37287 (run 45610900972, read-back identical, assignee os-justin, no labels), and this comment",
"line_budget": "62 files; 2553 insertions + 233 deletions = 2786 changed lines against merge base f9fda2a4f, under 3000, so not Tier H by size",
"files_changed": "packages/services/service-knowledge (src/split/ new; knowledge-service.ts, knowledge-service-plugin.ts, testing.ts; tests split, contract-stubs, chunk-channel new; knowledge-service.test.ts; fixtures/split/*), packages/spec (ai/knowledge-document.zod.ts and its new test, ai/knowledge-source.zod.ts, contracts/knowledge-adapter.ts, embedder.ts, knowledge-service.ts with failed?/failures? only; migrations/entries/retired-keys/18.ai__KnowledgeChunk__metadata.ts, migrations/entries/semantic/18.knowledge-chunk-metadata-retired.ts, migrations/registry.ts.template with one STEP18_RATIONALE fragment; regenerated api-surface, export-origins, declaration-map, authorable-surface, references, strictness-ledger counts), packages/plugins/knowledge-memory, packages/plugins/embedder-openai, packages/services/service-settings (knowledge.manifest.ts and its test, 11 translations, settings-visibility-declaration.pin.test.ts), content/docs/protocol/knowledge.mdx, content/docs/ai/knowledge-rag.mdx, .changeset/37098-knowledge-splitter.md",
"deviations": [
"Earlier WIP pushes went out without overlap-check before each (noted by the PM); every push since has run it first.",
"No D2 MetadataConversion for KnowledgeChunk.metadata, although the relay asked for one. A chunk is a runtime contract shape, never stored in stack metadata, so a conversion has no source to walk. The kit routes such a key through the D3 semantic entry plus RETIRED_KEYS_BY_MAJOR only; precedent: ActionDescriptor.isAsync. retiredAfter is a conversion field (SemanticMigration has none), so it does not apply.",
"The retirement kit touches files outside the claim's literal file list, on the PM's order to follow the kit: the two migrations entries, registry.ts.template and packages/spec/src/ai/knowledge-document.test.ts. Two settings manifest pins (settings-visibility-declaration.pin.test.ts, knowledge.manifest.test.ts) moved with the ordered chunk_overlap retirement.",
"No minChars <= maxChars refinement: the published JSON Schema cannot carry it, and its baseline is outside the claim. A minChars above the effective maxChars reads as maxChars, documented on the key.",
"The worktree /home/user/objectstack-issue-37098 is kept rather than removed: #37265 still shares files, and its merge is the next expected round."
],
"open_questions": [],
"security_findings": "withheld",
"out_of_scope_findings": [
"carrier: skills/objectstack-ai/SKILL.md owner · noted, not filed — the skill does not name the new split key; skills/** is governed and outside this claim",
"carrier: #37100 · noted, not filed — docHash does not cover passages, so a changed split setting re-splits a document only when the document changes; the index fingerprint closes it, and the docs say so"
]
}Generated by Claude Code |
|
repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ Contract reviewServed-tier: Face: schema ( ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgment
Implemented-by: VERDICT: PASS |
|
repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ 席位核对 — REWORK · L1 · head
|
|
repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ 席位核对 — ACCEPT · L1 · head
|
|
repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ Contract reviewServed-tier: Same-head delta over the contract review 7163151592. The head is unchanged: the live PR reads S1, closed
Carried, by referenceEverything else in 7163151592 stands as written and was not re-read: ① both deviations hold (D3 only for the runtime-only One observation, no finding: N6's second half (速读 line 4 says nothing is asked of the maintainer) still reads the same in the live body; it stays a nit, and the seat's hand-off carries the ask. Implemented-by: VERDICT: PASS No must-fix, no should-fix. |
|
repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ 维护者速读
席位意见:通过。两处移除都没有读者,移除按 ADR-0161 K8 第 5 项和席位 7158283273 的方向做,退役登记齐全(协议 18)。开发者没有写数据迁移,是对的:片段只在运行时存在,不存进任何元数据。切分器的样例和上限属性我在评审中重跑过,全部通过。技能文档的跟进已立卡 #37292。剩 7 处小瑕疵,比如 Markdown 切法下,末尾没有正文的标题可能丢失,不影响合并。 Hand-off · 2026-11-25T13:07Z · @os-zhuang — PR #37287 (card #37098, epic #37000) needs your approval. It declares |
… hit's title is the object's display field (objectstack-ai#37301) <!-- claude-projects-attribution: {"github_login":"os-warren"} --> _Requested by **Warren** · [project thread](https://claude.ai/code/project/chan_01U5RdnAAmkSQmZbqh6FtqZ8?thread=cmsg_01U5RdnAAmkSQmZbqh6FtqZ8HtXJcvyDnGVcP1BL7DwnBY)_ Fixes objectstack-ai#36993 Fixes objectstack-ai#36994 Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户能看到什么变化:在挂了知识库的应用里,一个人能看的记录很少时,AI 检索不再返回空或只剩一两条,而是继续往后找,补满到要的条数;命中结果的标题改为取对象的名称字段(比如客户的「名称」、发票的编号),不再只认名为 title 的字段。 - 为什么做:知识检索平台化专题的第一、四阶段两张卡,同一个文件一起修;「按记录返回」那张卡要在这次的补齐逻辑上继续做。 - 出错会怎样:最坏是检索多读一轮、稍慢,或某条命中没有标题。权限检查只多不少:名称字段对某人不可查时,这个知识源对他不检索;旧索引里的标题还取自名为 title 的字段,所以在索引重建之前,title 字段对某人不可查时同样不检索。可以直接撤回。 - 要你做的:无。 ## What changes **Search refills after the permission filter (objectstack-ai#36993).** `KnowledgeService.search` re-checks every object-source hit as the caller *after* ranking, so a caller who may read few of the matching rows was answered from what was left of `topK` ranked hits. Now: - When the re-check can remove hits (a caller who is not the system identity, with a data engine bound), each `object` source is asked for `topK × SEARCH_FIRST_ROUND_FACTOR` (5). - When the survivors name fewer than `topK` records (several passages of one record count once: an object hit is its source and record id, any other hit its document), every `object` source that answered as many hits as it was asked (the only ones that may hold more) is asked once more, for `topK × SEARCH_REFILL_FACTOR` (20, the cap). That round's answer replaces the source's first-round hits; a source whose refill throws keeps its first-round survivors. At most two rounds; an adapter that caps `topK` answers fewer than asked and is never asked again. - A `file` / `http` source is asked for `topK` once (the re-check never removes its hits). The system identity gets one round of `topK`, no refill. No context: object sources stay unsearched, as before (fail closed). - The answer is still at most `topK` chunk-level hits, sorted by score; `search`'s return type is unchanged (`expectTypeOf` pin). The count the re-check removed is logged at `debug` only, never returned. - The adapter loop moved into a private `searchRound`, unchanged in behaviour (foreign-source hits dropped and warned, a throwing adapter logged and skipped). **A hit's title is the object's display field (objectstack-ai#36994).** `recordToDocument` read `record.title`. Per ADR-0161 K5 ("the title is the object's display field"), it now reads the field `documentTitleField(schema)` names: `resolveDisplayField` (ADR-0079: `nameField`, its deprecated alias, else the derivation), and with no object definition a field named `title`, as before. A withheld field (credential-class or `internal`), an empty value, a value that is not text or a finite number, a definition that resolves no display field, or a `nameField` the definition does not declare gives no title. `resolveRecordDisplayName` is not used: its `Record #id` floor is a UI label. The source admission's field gate (`servedFieldsOf`) asks about the same field through the same `documentTitleField`. So a source whose object's display field the caller may not query is not searched for that caller at all. It also keeps asking about a declared field named `title`, as before: documents indexed under the earlier rule carry that field's value as their title and stay in the index until a complete reindex writes them again, and nothing reindexes at boot. That arm is retired once the index is proven rebuilt under the display-field rule (the recipe hash that names the title rule, ADR-0161 K7, and the rebuild of a stale source, objectstack-ai#37099); the code comment says so. Docs: `content/docs/protocol/knowledge.mdx` states the refill and its cap, and the display-field title (three places that said "the record `title`"); `content/docs/ai/knowledge-rag.mdx` says the same in two sentences. `content/docs/permissions/system-context.mdx` row 46 keys `search` too (it now reads `isSystem`: the system identity skips the over-fetch and the refill), and its generated register is regenerated (`check:system-context-census --write`). ## Tests `packages/services/service-knowledge`: `pnpm test` 8 files / 219 tests passed at 4621738; `pnpm typecheck` exit 0 (incl. `check:test-typecheck`). New pins in `knowledge-service.test.ts` (two top-level describes) and `knowledge-source-admission.test.ts` (one): - 100 hits, the caller may read 5 spread across them → those 5, best first; asked `[s1, 25]` then `[s1, 100]`. - A readable row beyond the cap → fewer than `topK`, never a third round. Enough survivors → no refill. An adapter capping at 10 → asked once. Several sources → only the saturated one refilled. The refill decision counts records: topK 3, one source answers two passages of one readable record, another holds a readable record past its first round that outranks both → it is refilled and answers `[s1-c0, s1-c15, s2-a]`. A failed refill keeps round one. System identity → one round of `topK`, no re-check. No context → only the file source, asked `topK`. A file source beside an object source → asked `topK` once. - Removed count only in the `debug` log; answer and return type unchanged. - Title: explicit `nameField`; derived `name` over `title`; formula (text) and autonumber name fields (a number value → its text); withheld internal / secret name fields; empty, non-text, unresolvable and undeclared-`nameField` cases; no definition → `title`; the event sync and the reindex walk read the definition off the engine. - Field gate: hiding the display field refuses the source even with `title` visible; hiding a declared `title` that is not the display field refuses it too (the adapter returns a stored hit carrying an old-rule title, and the answer is empty); a caller who may query both gets the hit. <details><summary>Ablations: each committed first, mutated through scripts/ablation-replace.mjs, restored to HEAD with git diff HEAD empty</summary> - Refill disabled (`if (false && filtered && kept.length < topK)`): 6 refill tests red, 5 green (the ones that pin "no refill"). - Title back to `record.title`: 5 title tests red. - Field gate back to `title` only: both display-field gate tests red. - Refill decision back to counting hits (`kept.length`): the record-counting test red, 150 green. - The declared-`title` arm deleted from the gate: its refusal pin red, 24 green. </details> ## Acceptance notes - **objectstack-ai#36993 point 2 is applied to the refill decision only.** The answer stays at most `topK` chunk-level hits (`KnowledgeSearchOptions.topK` is "Max number of hits to return"; `search_knowledge` returns "at most `topK`" passages; the card: "what is returned stays chunk-level hits"). Counting records decides whether to refill, and with several sources that changes the answer: another source's refill can outrank a second passage of a record already counted (pinned above). - **The declared `title` arm of the field gate is temporary.** Retire it when the index is proven rebuilt under the display-field rule (ADR-0161 K7 recipe hash, objectstack-ai#37099). - **Title egress** (the question raised on objectstack-ai#36994): ADR-0161 K5 declares the title as the object's display field, so it is sent whether or not the source lists that field among its content fields. It is withheld when the field is credential-class or `internal`. The field-egress declaration of cloud ADR-0119 does not exist yet; when it does, `documentTitleField` is the one place assembly and the gate both read. - The title enters `docHash`, so the first complete reindex after this lands rewrites the documents whose title changed. - Seat 4's objectstack-ai#37287 edits the same file; `scripts/pm/overlap-check.mjs` merges this branch with its head cleanly (the search factors sit beside `LIST_DOCUMENTS_PAGE_SIZE` to stay clear of its new constant). ## Verification Files to read first: `packages/services/service-knowledge/src/knowledge-service.ts` (`search`, `searchRound`, `documentTitle`), `knowledge-source-admission.ts` (`documentTitleField`, `servedFieldsOf`). Two-minute check: `pnpm --filter @objectstack/service-knowledge exec vitest run src/__tests__/knowledge-service.test.ts -t refills` — 11 tests pass; the first shows a caller reading 5 of 100 hits getting all 5. <details><summary>Local gate families: the derived list (scripts/pm/dispatch-gates.mjs --commands, 98 commands, derived at ecb0842), run in order; CI runs the full farm</summary> - Rework round (4621738): package test 8 files / 219, typecheck 0, eslint on the four changed source and test files 0, check:doc-anchors 0, check:system-context-census 0, overlap-check clean against origin/main, objectstack-ai#37287 and objectstack-ai#37265. - 79 of 98 run: 76 exit 0; 3 PREREQUISITE NOT MET (not verdicts, NOT MEASURED locally, CI builds them): check-plugin-teardown-shape --self-test (shallow clone cannot reach its pinned fixture commit), spec check:skill-examples (client-react dist not built), check:dual-build-cjs-loads (hono / account dist not built). - The remaining 19 (the repo-wide eslint-backed ratchets onward) were still running when this was written: NOT MEASURED locally; their CI check-runs are the reading. - Also run: package typecheck (exit 0, incl. check:test-typecheck), eslint on the four changed source and test files (exit 0), check:doc-anchors (exit 0), check:system-context-census (exit 0 after row 46 below), scripts/pm/overlap-check.mjs (clean against origin/main, objectstack-ai#37287 and objectstack-ai#37265). </details> ## Human Minimum - [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic. - [x] 2. Every name I added uses the casing for its kind. - [x] 3. No formatter ran; `pnpm lint` passes. - [x] 4. One issue, one branch off an up-to-date `main`, one pull request. - [x] 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset. - [x] 6. `packages/spec` touched: its generated artifacts are regenerated and committed. (not touched) - [x] 7. No hand edits to `content/docs/references/`, `packages/*/CHANGELOG.md` or `content/docs/releases/`. - [x] 8. Title, body and comments are in English. - [x] The *Before Submitting* list in CONTRIBUTING.md is done. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01JQwxbWqwmAwx7eD4Xf3dv1 --- _Generated by [Claude Code](https://claude.ai/code/session_01JQwxbWqwmAwx7eD4Xf3dv1)_ <!-- signed: repo:cloud#1 · os-warren · session_01JQwxbWqwmAwx7eD4Xf3dv1 --> --------- Co-authored-by: Claude <noreply@anthropic.com>
…ped bucket beside skill and ai_context (objectstack-ai#37330) <!-- claude-projects-attribution: {"github_login":"os-warren"} --> _Requested by **Warren** · [project thread](https://claude.ai/code/project/chan_01U5RdnAAmkSQmZbqh6FtqZ8?thread=cmsg_01U5RdnAAmkSQmZbqh6FtqZ8ThLXnc2MYoAdJHGZxSsdaA)_ repo:cloud#1 · os-warren · session_01JQwxbZjKjZ947xtTvgJuHX Fixes objectstack-ai#37325 Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户能看到什么变化:用户无感(只改决定记录,不改代码);把你今天定的「按应用+名字区分,都保留」写进记录:两个应用各带的同名知识源都保留、各建各的索引,AI 用「应用前缀-名字」指明是哪一个。 - 为什么做:属于「知识检索平台化」专题;哪些类型按应用区分要先写进记录,后面的实现卡 objectstack-ai#37304(让知识源成为应用包里的一份配置)才能照着做。 - 出错会怎样:记录写偏的话,后面的实现会照着偏的做;这次只有文档,撤回这次合并即可。 - 要你做什么:合并这个 PR,合并就是这条裁定的记录;其中一处超出你的原话、只能由你定:同一个应用前缀下不允许两个应用包带同名知识源(前缀不同的同名知识源照样都保留),不同意就先划掉这一条再合并。 ## What changes Two files under `docs/adr/`: 58 lines added, 1 line changed. No schema, no code, no changeset. **ADR-0150** (Accepted) gains a dated addendum. No ruled sentence is rewritten. - The status line gains one **Amended** clause, dated 2026-11-25, after the `ai_context` one. This is the one changed line: the clause is appended, and nothing before it is edited. - The D1 table gains one row, marked with the date, after the `ai_context` row and before bucket 4. - A new section after the `ai_context` addendum and before D2, "Addendum (2026-11-25): `knowledge_source` joins bucket 3". It writes the maintainer's ruling of that day into the record: the knowledge source type of ADR-0161 K4 is identified by `(package, name)`, in bucket 3 beside `skill` and `ai_context`. The ruling is quoted with its record id in the status clause, at the head of the addendum and in the ADR-0161 note: seat record `7168239918` on the code card, decision card tapped **B 「按应用+名字区分,都保留」** at 2026-11-25T16:34:09Z, against the card's recommendation. The addendum says, in this order: 1. **The type**, and what D2, D3, D4, D5, D6 and D8 mean for it. A package's source is spelled `NS-NAME` where its name crosses the AI face, which is inside `search_knowledge`: the `sources` list of an answer and the `sourceIds` argument. 2. **The principle, read for this type.** The recommendation read a source's name under D1's storage half. The ruling did not, so the keys of a source's index are derived from its identity, as its face is. Three things that reading does not hide are listed. 3. **The tree today**, measured on `main` at `fbb62e1c`. The type is not registered and is in none of the four lists. A source reaches the service through code only. The keys of an index are the bare `id`. 4. **What changes with the bucket**: the service's copy, overlays, owner stamps, uninstall and the keys of an index. 5. **The readers that move.** It names five and moves none. 6. **The follow-up**, the code card objectstack-ai#37304, after this merge. 7. **Past the ruling's words**: seven points, none decided here. One is the maintainer's, two follow from text already ruled, and four are left open for the code card. **ADR-0161** gains one cross-reference note after point 3 of K4 and before K5. No sentence of it is changed. **Not in this PR**, by the card's contract: none of the four lists is edited, no reader is moved and no store is re-keyed. That is the code card's work, after this merge. ## Tests No package is touched, so no package build or test is owed. The checks that read these two files are the docs gates under Verification. ## Acceptance notes - **The chain.** This PR is the ruling's record and step 1 of its execution. The code card objectstack-ai#37304 comes after it and stays open: it takes the four lists, the readers and the store keying in memory, pgvector and turso. - **One decision is the maintainer's alone** (point 1 of "Past the ruling's words"). The ruling record counts "the `domain:server` four lists and readers (precedent PR objectstack-ai#37291)" and names none of them. In that PR the fourth list is `NAMESPACE_UNIQUE_TYPES`: one package holder of a name inside one namespace, refused at install and in `os validate`. So "Two packages shipping one source name both work" holds for two namespaces, and inside one namespace the second is refused. The list's header reserves a further type to the maintainer. The merge accepts this point. Struck, two co-owners of a namespace may ship one name, and the one face they derive is refused at the call. - **Two points follow from text already ruled** and are no new decision. A source name takes the name grammar of buckets 2 and 3, which refuses a `_`-led name that today's `id` pattern admits. And a `409` names only the sources the tool may search (ADR-0161 K9). - **Four points are left open for the code card.** Each is stated in the addendum and decided nowhere in it: what each shape carries (a hit's `sourceId` and `documentId`, a stored document's `sourceId`, the by-name members of the service contract); which coordinate a key carries, the package id or the namespace, and what removes an index left under the old key; which holder a source registered in code is; and an environment source under a name a package later ships. - **The acceptance line of the card**, "The addendum quotes the ruling comment id and the maintainer's words; earlier text of the record unchanged". The id and the words are in all three places named above. ADR-0150's diff has one changed line, the status line, and its old text is a strict prefix of the new text. Every other old line of both files survives, in order. - **The tree moved once during the work.** `main` gained the knowledge splitter (PR objectstack-ai#37287) under six of the files the addendum anchors. `main` is merged into the branch (a merge commit, no rebase and no force-push). Every "today" sentence and every anchor was read again at `fbb62e1c`, and all hold. The two dated readings name that commit. - **Overlap.** PR objectstack-ai#37329 adds a dated note under K8 of the same ADR-0161 file. `node scripts/pm/overlap-check.mjs --branch=claude/project-thread-4uapwf` answered `VERDICT clean exit 0` at this head, against `origin/main` and that PR's head. Whichever of the two lands second merges `main`. - **Line budget.** 58 added and 1 changed; the precedent PR objectstack-ai#37209 was 44 and 1. The difference is the "principle" paragraph, which the precedent did not need because its ruling followed the recommendation, and the seven-point list. - **Citation form.** `check:adr-symbol-anchors` refuses a line anchor under `docs/adr/`, so the record cites `path#Symbol`, and the line numbers are in the table under Verification. - **No changeset.** `docs/adr/` ships in no package, so this PR carries `skip-changeset`. - **Tier H.** This PR stays draft. The merge is the maintainer's, and it is the ruling's record. - **Shallow checkout.** No claim here is read from history dates. - **Attribution lines.** The dispatch asked for a commit trailer that names a model and for the harness's two-line block at the end of this body. The repository's rules ask for the model-free trailer pair and for one footer line under a rule, and those are what the commits and this body carry. - **Noted, not filed.** ADR-0161's status keyword still reads Proposed on `main`, and its own status line says the record is in force from the merge of the PR that carried it. This PR adds one note to that record and does not touch its status line. ## Verification **Read first**, by risk: 1. `docs/adr/0150-…-literal-prefix.md`, "Past the ruling's words" at the end of the addendum (lines 191 to 199). Point 1 is the one decision that is the maintainer's. 2. The same file, "The principle, read for this type" (line 160): how D1's storage half reads for a type the ruling placed against the recommendation. 3. The same file, the D1 table hunk (line 95) and the status line (line 3): one row inserted into a ruled table and one appended clause. Check that both read as additions and change no ruled text. **Two-minute check**: run `node scripts/check-adr-symbol-anchors.mjs`. Expect `4220 anchors across 163 records resolve` and exit 0. Twenty-one of them are this diff's `path#Symbol` anchors. <details> <summary>Measured anchors on main at fbb62e1 (file:line)</summary> | What the addendum says | Where it is read | |---|---| | The type is in no row of the registry; `skill` and `ai_context` open no environment overlay | `packages/spec/src/kernel/metadata-plugin.zod.ts:798` (`DEFAULT_METADATA_TYPE_REGISTRY`), `:1384`, `:1388` | | The service keeps one slot per (package, name) for listed types | `packages/spec/src/api/protocol.zod.ts:2753` (`PACKAGE_SLOTTED_METADATA_TYPES`; `skill` at `:2754`) | | Any other type is keyed by name alone | `packages/metadata/src/package-slotted-store.ts:797` (`storeWriteKey`), `:820` | | The one rule resolves only its listed types, and throws for a type outside the list | `packages/core/src/package-scoped-resolution.ts:245` (`PACKAGE_SCOPED_TYPES`; `skill` at `:270`), `:740`; `packages/objectql/src/package-scoped-resolver.ts:149` | | A by-name read consults (package, name) for listed types | `packages/objectql/src/package-scoped-read.ts:88` (`PACKAGE_SCOPED_READ_TYPES`; `skill` at `:96`) | | One package holder of a name inside a namespace; the list is reserved to the maintainer | `packages/objectql/src/namespace-co-owner-names.ts:96` (`NAMESPACE_UNIQUE_TYPES`), `:27` | | A source reaches the service through code only | `packages/services/service-knowledge/src/knowledge-service-plugin.ts:91` (`KnowledgeServicePlugin`), `:44`, `:220` | | One map by `id`; a second registration replaces the first with a warning | `packages/services/service-knowledge/src/knowledge-service.ts:121` (`KnowledgeService`), `:123`, `:166`, `:168` | | A document id is the source's `id`, a `:` and the record id | `packages/services/service-knowledge/src/knowledge-service.ts:1570` (`documentIdFor`), `:1571` | | An adapter is handed the whole source | `packages/spec/src/contracts/knowledge-adapter.ts:33` (`AdapterContext`), `:35` | | The one in-tree store keyed by the bare `id` | `packages/plugins/knowledge-memory/src/index.ts:44` (`KnowledgeMemoryAdapter`), `:48`, `:55` | | The push door that takes a document id from a caller | `packages/spec/src/contracts/knowledge-service.ts:107` (`IKnowledgeService`), `:127` | | The tool lists each source by its `id`; a hit shows `sourceId` and `documentId` | `packages/services/service-knowledge/src/knowledge-tools.ts:61` (`SearchKnowledgeSourceSummary`), `:70`, `:72`, `:222` | | An unknown `sourceIds` entry is refused `NOT_FOUND` | `packages/services/service-knowledge/src/knowledge-tools.ts:246` (`createKnowledgeTools`), `:257`, `:260` | | Today's `id` pattern admits a `_`-led name; the bucket's pattern does not | `packages/spec/src/ai/knowledge-source.zod.ts:174` (`KnowledgeSourceSchema`), `:176`; `packages/spec/src/kernel/address-grammar.ts:68` (`ROUTER_ADDRESSABLE_NAME_PATTERN`) | | The one face derivation | `packages/spec/src/ai/face-name.ts:86` (`deriveAiFaceName`) | | A skill prompt's name: a face, else a bare name by the one rule | `packages/mcp/src/skill-prompts.ts:373` (`lookupSkillPrompt`) | | The owner stamp's judge, and the collections it judges | `packages/spec/src/kernel/collection-item-owner-stamp.ts:129` (`judgeCollectionItemOwnerStamp`), `:100` | | The type's row is not among the served overrides | `packages/metadata-protocol/src/protocol-package-bindings.ts:388` (`SEALED_ROW_SERVED_OVERRIDE_TYPES`) | | Uninstall, the registry's half | `packages/objectql/src/registry.ts:5328` (`uninstallPackage`) | | Uninstall, the service's half | `packages/metadata/src/metadata-manager.ts:2880` (`unregisterPackage`) | Absence readings at the same commit, each with a positive control: - `knowledge_source` in the four list files, in `packages/metadata/src/package-slotted-store.ts` and in the registry's rows: 0 lines each. Control: `skill` is in the first three lists and in the registry, at the lines the table gives. - A stack collection: `knowledgeSources` in `packages/spec/src/stack.zod.ts`, 0 lines. Control: `aiContexts`, 3 lines. - `knowledge_source` under `packages/`, `examples/`, `ui/`, `skills/` and `content/`: 0 files. Control: `ai_context`, 60 files. - `KnowledgeServicePlugin` or `registerSource` under `examples/`: 0 files. Control: 25 files under `packages/`. - Tracked paths under `knowledge-pgvector` or `knowledge-turso`: 0. Control: `packages/plugins/knowledge-memory`, 10 files. - Before this diff, ADR-0161 named ADR-0150 on 0 lines (control: ADR-0088, 7 lines), and ADR-0150 held the word "knowledge" on 0 lines (control: `ai_context`, 6 lines). </details> <details> <summary>Local gates at head 05f35b6: 21 derived, 21 run, all exit 0</summary> Derived with `node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --commands`, and reconciled with `--ran`: ``` Run reconciliation — 21 derived, 21 run, 0 NOT-MEASURED, 0 UNRUN. ✓ dispatch-gates --ran: 21 derived famil(ies) accounted for — 21 run, 0 NOT-MEASURED (a DERIVED zero — all 21 recorded an exit code and none of them is 3). ``` Each exit code was captured before any pipe: ``` 0 node scripts/check-adr-links.mjs 1225 relative link destination(s) under docs/adr/ resolve 0 node scripts/check-adr-links.mjs --self-test 0 node scripts/check-closing-keyword-parity.mjs 3 parsers agree on all 9 keywords 0 node scripts/check-closing-keyword-parity.mjs --self-test 0 node scripts/check-comment-mask-corpus.mjs 23929 files, 0 disagree, 0 unparseable 0 node scripts/ci/plan-test-core-shards.mjs --self-test 0 pnpm --filter @objectstack/lint run check:doc-formula-expressions 0 pnpm check:adr-anchors 132 anchored file(s), every governing ADR still referenced 0 pnpm check:adr-index docs/adr/README.md is current, every record parsed 0 pnpm check:adr-symbol-anchors 4220 anchors across 163 records resolve 0 pnpm check:ci-filter-parity 0 pnpm check:closed-ceremony-text 0 pnpm check:cross-package-test-inputs 0 pnpm check:doc-authoring 0 pnpm check:driver-memory-census 0 pnpm check:gitlink-declared 0 pnpm check:nul-bytes no raw ASCII control bytes 0 pnpm check:pm-governed-merges 0 pnpm check:pm-prior-rulings 0 pnpm check:refd-timer-probe 0 pnpm check:watch-hint-literal ``` `check:doc-formula-expressions` reads the compiled output of `@objectstack/formula` and `@objectstack/lint`. Those two and their dependencies were built first on the merged tree, under the shared verify lock (`VERDICT command-exit 0`). `docs/adr/README.md` is generated from each record's status keyword. ADR-0150's keyword stays Accepted and ADR-0161's stays Proposed, so the index does not change and is not in this diff. Also at this head: `node scripts/check-commit-card-trailers.mjs --range origin/main..HEAD` exits 0 over the 3 commits of the branch. Not measured locally, and CI's to run: the type-check lanes, the `Plan Test Core shards` job and the governed-merges audit, which take values only a CI run has. </details> --- _Generated by [Claude Code](https://claude.ai/code/session_01JQwxbZjKjZ947xtTvgJuHX)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
…nd names the keys retired beside it (objectstack-ai#37334) <!-- claude-projects-attribution: {"github_login":"os-warren"} --> _Requested by **Warren** · [project thread](https://claude.ai/code/project/chan_01U5RdnAAmkSQmZbqh6FtqZ8?thread=cmsg_01U5RdnAAmkSQmZbqh6FtqZ8JhskFY4nvqZftyd6QBC3Sa)_ Fixes objectstack-ai#37292 Clause-②: no Metadata-protocol: none Skills-docs: this PR is the skills-docs half (`skills/objectstack-ai`); PR objectstack-ai#37287 shipped the `split` key and named this card ## 维护者速读 - 用户能看到什么变化:用 AI 搭建知识源时,AI 读到的技能说明现在会教「切片设置」怎么写:普通文字按段落和句子切,带标题的手册按章节切,短记录整篇一段;并说明「切片重叠」设置和单段附加信息已经下线、写了会被拒。只有文字变化。 - 为什么做:属于知识检索平台化专题,补上切片功能合并后欠下的技能说明,后面重写知识源一节的卡要在它之后做。 - 出错会怎样:最坏是说明写得不准,AI 写出的设置仍会被校验拦住;撤回即恢复旧文字。 - 要你做什么:受治理的技能文件,需要你批准后合并。 ## What changes `skills/objectstack-ai/SKILL.md`, *Knowledge Sources (RAG)*: - The `object` row of the source table gains `split?`, and a new passage replaces the closing note that said chunking is not platform metadata (PR objectstack-ai#37287 made that false). It teaches `split: { strategy, maxChars?, minChars? }` on object sources only: `recursive` (default) for prose, `markdown` for documents with headings (each passage embedded with its heading path), `whole` for short records only, because a document over the embedder's input budget is removed from the index and reported, never truncated. `maxChars` overrides the **Target chunk size** setting (`knowledge.chunk_target`, else 800), the embedder's input limit can lower it, and `whole` ignores it; `minChars` defaults to 200. Changing `split` re-splits a document only when it next changes. - The key applies to an adapter that declares `capabilities.chunks` (`memory`); `ragflow` does not, receives whole documents, and `split` has no effect on it. - Names the two keys retired beside it, both refused when written: the `knowledge.chunk_overlap` setting (`400 UNKNOWN_KEY`; passages never overlap) and `KnowledgeChunk.metadata` (parse error; a passage takes its document's `metadata`). - Top-K, score thresholds and rerankers: not source metadata; they belong to the adapter or application code. Paid for by deleting restatement in the same file; the token ceiling is unchanged (6801, the file measures 6800). Deleted: the pitfall "Indexing everything" (the `object` row's Hygiene column says it); the "Skills are your entry point" paragraph (the frontmatter, the `tools` row and *Platform agents* say it); the incident sentence after `ai-skill-tool-unresolved`; the sentence on what `os validate` confirms; the *App AI Blueprint* registration-row clause repeating three facts stated in their own sections; four clauses repeating the sentence beside them (*Tool metadata*, *Platform agents*, *Wiring*, *Actions as AI Tools*). `evals/skills-tools-knowledge.json`: - New case 9: a Markdown handbook source on the in-memory adapter, split by section at 600 characters, with a request for overlapping passages. Expected: `split: { strategy: 'markdown', maxChars: 600 }` and the overlap declined. Assertions: must contain `split`, `strategy`, `markdown`, `maxChars`; must not contain `chunkSize`, `chunkOverlap`, `overlap: 100`. - Case 3 (RAGFlow): `expected_output` no longer says chunking is adapter config; it writes no `split`, since that adapter receives whole documents. Changeset `.changeset/37292-skill-knowledge-split.md`: `@objectstack/skills` patch. Out of scope, left for their cards: the `contentFields` / `id` / `'*'` / `embedding` / `vectorStore` / `file` / `http` / `adapterConfig` teaching and the example block (objectstack-ai#37310, row 5b, after objectstack-ai#37306), and the `ragflow` mentions (objectstack-ai#37004). ## Why PR objectstack-ai#37287 (objectstack-ai#37098) added the source's `split` key and retired `KnowledgeChunk.metadata` and `knowledge.chunk_overlap`. The skill an AI reads to author a knowledge source did not mention any of them and still said chunking is not platform metadata, so an agent would never set `split` and could still write the overlap setting. ## Verification Every claim in the new passage rests on: `packages/spec/src/ai/knowledge-source.zod.ts` (`KnowledgeSplitSchema`, `ObjectKnowledgeSourceSchema.split`), `packages/spec/src/ai/knowledge-document.zod.ts` (the `KnowledgeChunk.metadata` tombstone), `content/docs/protocol/knowledge.mdx` §3.5 and the adapter-contract paragraph above it, `.changeset/37098-knowledge-splitter.md` (the `chunk_overlap` refusal), `packages/plugins/knowledge-memory/src/index.ts:46` (`capabilities = { chunks: true }`; `knowledge-ragflow` declares none). Skills size readings (`node scripts/check-skills-token-ratchet.mjs`, tokens = ceil(utf8 bytes / 4)): | | main | this PR | |---|---|---| | `skills/objectstack-ai/SKILL.md` lines | 467 | 474 | | `skills/objectstack-ai/SKILL.md` tokens (ceiling 6801) | 6801 | 6800 | | All `skills/*/SKILL.md` lines | 4941 | 4948 | | Bundle total tokens (whole shipped tree) | 297002 | 297305 | The bundle grows by 303 tokens, all in the unratcheted eval fixture (2140 to 2444); ratcheted authored text drops by 1. <details><summary>Local gates at 6fb18c1</summary> `node scripts/pm/dispatch-gates.mjs --commands` derived 49 commands. 41 ran locally, all exit 0, including `check-skills-token-ratchet` (gate and `--self-test`), `@objectstack/spec check:skill-docs`, `check:skill-links`, `check:skill-identifier-liveness`, `check:skill-compatibility`, `check:skill-frame-sync`, `check:doc-authoring`, `check:nul-bytes`, `check-empty-changeset`, `check-changeset-no-major`, `check-adr-0087-registration`, `check:pm-governed-merges`. NOT MEASURED locally, left to CI: `@objectstack/lint check:doc-formula-expressions` (exit 3, prerequisite: needs `@objectstack/formula` and `@objectstack/lint` built; nothing measured), and seven families that read built `dist/` output (`check:dts-closure`, `check:dual-build-cjs-loads`, `check:lean-entry-closure`, `check:published-files`, `check:sourcemap-no-sources-content`, `check:driver-memory-census`, `check:corpus-claim-drift`). The diff touches no package source. </details> No ablation: the change is docs and an eval fixture; no tested behaviour moved. Two-minute check: read *Knowledge Sources (RAG)* in `skills/objectstack-ai/SKILL.md` and compare the *Splitting* passage with `content/docs/protocol/knowledge.mdx` §3.5. ## Acceptance notes - Authored by a Fable subagent from a first draft in this session, per the claim's tier; the seat's L1 and the contract review read the final diff. - None filed. ## Human Minimum - [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic. - [x] 2. Every name I added uses the casing for its kind. - [x] 3. No formatter ran; `pnpm lint` passes. (repo-wide lint is CI's run; the diff touches only Markdown and JSON) - [x] 4. One issue, one branch off an up-to-date `main`, one pull request. - [x] 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset. - [x] 6. `packages/spec` touched: its generated artifacts are regenerated and committed. (not touched) - [x] 7. No hand edits to `content/docs/references/`, `packages/*/CHANGELOG.md` or `content/docs/releases/`. - [x] 8. Title, body and comments are in English. - [x] The *Before Submitting* list in CONTRIBUTING.md is done. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01JQwxbYY43RED8SphBLGpAy --- _Generated by [Claude Code](https://claude.ai/code/session_01JQwxbYY43RED8SphBLGpAy)_ Co-authored-by: Claude <noreply@anthropic.com>
…dshake reads '^19' (objectstack-ai#37314) repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ Fixes objectstack-ai#37229 Clause-②: yes (narrowing) Metadata-protocol: narrowed Skills-docs: follow-up objectstack-ai#37298 ## 维护者速读 - 协议版本从 18 升到 19:仓库里每个示例应用、连接器应用和文档示例都改为声明 19,新建项目模板在出预发布版时自动改成 19;只有装 19 预发布版的人会碰到。 - 属于「19.0.0 大版本」路线(你选的方案「A」第 2 项);它解开 19.0.0-next 的版本 PR:出版本的流水线不接受顺手改协议版本,所以由这一单先改好。 - 装了 19 预发布版、但应用仍声明 18 的人,启动时会被拒绝并提示改成 19(单一配置文件的应用有一条命令可自动改;多包组合的应用要逐个包手改);18.x 正式版用户不受影响;撤回即还原本单。 - 按你对冲突的裁决「A」,本单还改了一道检查:预发布模式下且 spec 已排定大版本时,下架提示写「19.0.0」不再被拦;五条下架提示因此写 19.0.0。 - 要你做的:「进入预发布模式」那一单已合并;本单是大版本变更,请你亲自把关合并。「Check Changeset」是有意的红:本单改了别人已合并的两条变更说明(各改一处事实)。另一单 objectstack-ai#37298 改三个技能文件,在本单合入之后合并。 ## What changes On the shape of the v18 move (objectstack-ai#22215, commit `4e9fe9f`), minus `skills/**`. - **`packages/spec/src/kernel/protocol-version.ts`:** `PROTOCOL_VERSION = '19.0.0'`. The docblock names protocol 19 as the pre-mode lockstep exception (ruling records 6049734955 and 7153441862), and says the blank template follows at the version pass and the published skills' examples in a change of their own. - **Handshakes:** 85 sites in 67 files move `engines.protocol` from `'^18'` to `'^19'`. Each is a manifest that stands for "an app on the current protocol", and none of them asserts on the range. | Directory | Files | Sites | |---|---|---| | `examples/` (crm, showcase, todo, starter, multi-package ×2) | 6 | 6 | | `packages/apps/connector-{docusign,github,stripe}` | 3 | 3 | | `packages/cli` (tests) | 40 | 56 | | `packages/qa` (7 dogfood tests, the sql-perf bench app, the scenarios exporter test) | 9 | 9 | | `packages/lint`, `packages/spec`, `packages/metadata` (tests) | 4 | 5 | | `packages/mcp/README.md` | 1 | 2 | | `content/docs` (cli, your-first-project, upgrading) | 3 | 3 | | `docs/qa/scenarios/builds/travel_expense.json` | 1 | 1 | `examples/app-starter` arrived from `main` (objectstack-ai#37399) declaring `'^18'` and moves with the merge. Its boot test, which installs the starter through `MarketplaceInstallLocalPlugin`, passes 5/5 at `'^19'`. At `'^18'` it reads 3 failed | 2 passed, refused `OS_PROTOCOL_INCOMPATIBLE`. - **`docs/qa/platform-checklist/areas/cli.json`:** one prose fact, "the stock showcase declares `'^18'`", now reads `'^19'`. - **`docs/qa/scenarios/builds/travel_expense.provenance.json`:** `sha256` is the build's hash as it now stands, and a second `amended` entry names the one edit (`engines.protocol` `'^18'` → `'^19'`) and the hash it replaced. `cardSha256` is unchanged. - **The protocol 19 migration step (ADR-0087).** `packages/spec/src/migrations/registry.ts.template` opens `step19`, with no conversions yet. Its first semantic entry, `entries/semantic/19.protocol-18-range-refused.ts`, is the refusal this PR causes, with the prescription: `--write` rewrites the range of a root `defineStack` manifest; for a manifest `composeStacks` composes, it writes nothing and lists the range for a hand edit in each package manifest. Its acceptance text claims only what the hop does: it edits or refuses the range. A key retired in this release that the metadata still carries is refused at parse by its own message, which names its own remedy. The text no longer says that `validate` passes or that every package installs. The upgrade guide now generates three hop sections (17, 18, 19). See "Why a step-19 entry" below. - **Removal prescriptions stamped after 18.6.0 name `@objectstack/spec 19.0.0`.** `retired-key-removal-version.pin.test.ts` derives the removing release's major from `PROTOCOL_MAJOR`, so at 19 the retirements not in the published 18.6.0 name 19.0.0, not 18.7.0, a release the v19 line never cuts: `object-grid` `singleClickEdit` (`component.zod.ts`), the boolean `field.inlineEdit` (`field.zod.ts`), `listView.columnState` and `view.columnState` (`view.zod.ts`), and `seed.mode` `'insert'` / `'replace'` (`seed.zod.ts`). Their text pins, the regenerated `content/docs/references/ui/{component,view}.mdx`, `content/docs/data-modeling/seed-data.mdx` and the metadata-protocol seed pin follow. - **`scripts/check-future-spec-major.mjs` reads the pre-mode window (ruling record 7176929521, option A).** On a stable `@objectstack/spec` label, with `.changeset/pre.json` at `"mode": "pre"` and a pending changeset declaring `"@objectstack/spec": major`, the next publish is label + 1, so the gate judges citations against 19 here. That is why the prescriptions above can name `@objectstack/spec 19.0.0`. The window is read through `check-changeset-no-major.mjs`'s `readProtocolLockstepInputs`, the reader the protocol lockstep already uses; there is no second parser. That file's docblock now names its three importers (`check-docs-image-tag.mjs`, `check-future-spec-major.mjs`, `pm/l1-face.mjs`); the change is a comment. Label + 2, pre mode without a pending spec major, a pending spec major outside pre mode and a prerelease label each open nothing; five new self-test rows pin those five cases (34 → 39 cases). An unreadable `.changeset/` opens nothing either, by the code; no row pins it. The stable-label condition is the same one `judgeProtocolLockstep` applies: on a `19.0.0-next.N` label the label's own major is already the carrier. Reverse verification: with the window condition ablated, the gate reads 14 problems, the 14 sites. - **Two fixtures pay a dynamic load at module top** (`validate-flow-region-shape.test.ts`, `plugin-artifact-packages-attribution.test.ts`). `check:test-source-alias` judges every test file a diff edits, and both edits here are the range literal. The gate prescribes exactly these imports. - **`.changeset/37229-protocol-19.md`:** `"@objectstack/spec": minor` and `"@objectstack/mcp": patch` (its shipped `README.md` changes), the two declaration lines, a BREAKING note with the FROM → TO and the command, and `registered protocol-18-range-refused`. - **DELIBERATE CORRECTION of two existing changesets.** `Check Changeset` stays red on both by design: each note is on the merge base, and each changes only the facts this PR makes false. - `.changeset/37223-v19-line-opens.md` (carried N1 of objectstack-ai#37230's L1, and N3 of this PR's L1), two sentences. "The first is `@object-ui/i18n`'s retirement …" now reads "The first change graded `major` is `@object-ui/i18n`'s retirement …", because this PR's protocol move is a breaking change graded `minor`. "`PROTOCOL_VERSION` follows `@objectstack/spec`'s major at version time." now reads "`PROTOCOL_VERSION` moves to 19 ahead of the version pass, in its own changeset." - `.changeset/37042-skills-inline-edit-boolean.md`, one clause: "The spec parse refuses `true` and `false` on a relationship field's `inlineEdit` since 18.7.0" now reads "… since 19.0.0", the release the retirement ships in. - **Carried from objectstack-ai#37230's L1, N3 — `ui/packages/i18n/scripts/released-keys-removed.mjs`** refuses an argument it does not know (exit 2, naming it), and prints the tag's commit: `^{commit}` peels the annotated tag. Measured: the tag `@object-ui/i18n@18.6.0` is a tag object `0dbef86ce3`, and the script now prints its commit `958ee03594`. The script is not in the package's `files[]`, so it publishes nothing and needs no changeset. ## Judgments: every `'^18'` left in place, with its reason | Site | Reason | |---|---| | `skills/**` (3 files) | Governed Tier H; the sibling PR objectstack-ai#37298. | | `packages/create-objectstack/src/templates/blank/objectstack.config.ts:38` | The version pass stamps it with the template's `@objectstack/*` versions, and `template-consistency.test.ts` holds it equal to the scaffolder major (create-objectstack is 18.6.0). Measured: moved to `'^19'` now, that test goes red; the version-pass rehearsal below stamps it `'^19'`. Same judgment as objectstack-ai#22215. | | `packages/cli/src/utils/protocol-version-gap.test.ts:82` | Paired with an explicit installed `'17.2.0'`: "a newer major is silent". The subject is the pairing, not the current protocol. | | `packages/metadata-core/src/artifact-forward-conversion*.test.ts`, `protocol-handshake.test.ts` | The subject is the artifact's floor against an injected runtime label (the v18 prerelease major-step window), or a range/major pair. No handshake against `PROTOCOL_VERSION` runs. | | `packages/metadata/src/plugin-artifact-forward-conversion-{major-step,package-body}.test.ts` | The same age subject at the metadata door, which runs no handshake. | | `docs/qa/platform-checklist/areas/platform-core.json`, item `platform-core.protocol-18-handshake-and-stored-replay` | Revised in place to protocol 19 (revision 6, with its history entry). The id keeps its protocol-18 slug because ids are immutable. Its `'^18'` now stands for the refused case: `'^18'` → 422 `OS_PROTOCOL_INCOMPATIBLE` naming `os migrate meta --from 18`, `'^19'` admitted, and the artifact step edits the copy's range to `'>=18.0.0'`, as the option-B fixture does. | | `content/docs/releases/**`, `docs/adr/**`, `**/CHANGELOG.md`, `.github/workflows/release.yml` (comment), script comments | Release-owned, governed or historical prose. | | `ui/**` tests, `packages/runtime/src/domains/packages-ensure-customization.test.ts`, `scripts/docs-audit/affected-docs.mjs` | Not a protocol handshake (`requiredRange` of a later refusal, a package-dependency range, a React peer range). | Moved to `'>=18.0.0'` (5 sites, commit `e05fdf6f`): `packages/runtime/src/standalone-stack-option-b-forward-conversion.test.ts`. It boots through the load seam, which refuses `'^18'` at protocol 19. Measured: `ProtocolIncompatibleError: package 'com.test.ob.core' targets protocol ^18 … Run: objectstack migrate meta --from 18`, 3 cases. Its subject is the conversion window, which opens on the floor. `'>=18.0.0'` keeps the floor (18.0.0, as `parseRangeFloor` reads `^18`) and admits 19. This is the same move as objectstack-ai#22215's two runtime fixtures (`>=17.1.0`). The fixture's docblock now says why, so a later sweep to `'^19'` does not close the window. ## Why a step-19 entry (the ADR-0087 disposition) `Metadata-protocol:` is judged from content. A 19 runtime refuses an authored value, `engines.protocol: '^18'`, that 18 admitted. That is `narrowed`, and the `Clause-②` arm is `narrowing`, as in objectstack-ai#22215. On a declared `narrowed`, `check:adr-0087-registration` refuses `not-required (no-migration-prescription)` outright and asks for a registered entry. Measured: "`not-required (no-migration-prescription)` is refused on a changeset that declares `Metadata-protocol: narrowed` … fix: register an entry under packages/spec/src/migrations/entries/semantic/". No entry at the merge base covers the refusal, so this PR opens step 19 with one entry, and the upgrade guide carries the prescription. ## Acceptance notes - **Docs versus npm `latest`.** The three docs pages show `'^19'`, as in objectstack-ai#22215. npm `latest` stays 18.6.0 until 19.0 GA, and an 18.x runtime refuses `'^19'`. The changeset says to move the range together with the `@objectstack/*` versions. - **Size.** 92 files, +440 / −161 against `main` (GitHub at `3811cd10f5a`), under the 3,000-line threshold. - **Out of this PR, found by the version-pass rehearsal.** On the post-version tree, `check:release-notes` is red: `@objectstack/spec` ships 19.x and there is no curated `content/docs/releases/v19` page. It is red on the control leg too (main + objectstack-ai#37230, without this PR), so objectstack-ai#37230's `major` causes it, not this PR. Release pages are release-owned, so this PR does not write one. Until one exists, the version-PR lane still refuses the 19.0.0-next refresh, on that gate alone. - **objectstack-ai#37287 and step 19.** objectstack-ai#37287 registered its retirement, `KnowledgeChunk.metadata`, under step 18; it reached this branch through the merge of `main`, and its refusal says "removed in @objectstack/spec 18" (`packages/spec/src/ai/knowledge-document.zod.ts:61`). Once protocol 19 is on `main`, `os migrate meta --from 18` replays only step 19, so a retirement that ships on the v19 line and is filed under step 18 is not listed to an 18 → 19 upgrader. objectstack-ai#37287 is one member of the family "step-18 entries registered on `main` after the 18.6.0 tag" (31 step-18 semantic entry files at this head that the 18.6.0 tag does not carry, and 34 on `main` at `5d21d431ec`, after objectstack-ai#37382, objectstack-ai#37392 and objectstack-ai#37395). That card is follow-up owed (seat). - **The dev's open questions, as built (seat reading at L1):** - The declaration is `yes (narrowing)` + `narrowed` with a step-19 entry, rather than `semantic`. - The blank template stays `'^18'`, and the version pass stamps it. - The metadata and metadata-core floor-subject sites are kept. The option-B runtime file moves to `'>=18.0.0'`. - The gate conflict between `check-future-spec-major` and the removal-version pin is resolved by ruling record 7176929521, option A (above). ## Verification Two-minute check: `node scripts/check-future-spec-major.mjs` prints `✓ check-future-spec-major: no @objectstack/spec citation names a major above 19` and `pre-mode window: label major 18, pre mode next, pending major for @objectstack/spec in .changeset/37223-v19-line-opens.md — the next publish carries 19`, and exits 0. `node scripts/check-changeset-no-major.mjs --base origin/main` prints `✓ Protocol lockstep: PROTOCOL_VERSION major 19, @objectstack/spec@18.6.0 — the one exception, evidenced: pre mode (tag next) and a pending major for @objectstack/spec (.changeset/37223-v19-line-opens.md).` and exits 0. Read first: 1. `.changeset/37229-protocol-19.md` and `packages/spec/src/migrations/entries/semantic/19.protocol-18-range-refused.ts`: what an upgrading author is told. 2. `packages/spec/src/migrations/registry.ts.template`, the new `step19`: the ledger's protocol 19 step opens here. 3. `scripts/check-future-spec-major.mjs`, `judgedMajor` and the five new self-test rows: the one gate this PR changes. 4. The Judgments table: every `'^18'` left in place. <details><summary>Readings at <code>3811cd10f5a</code> (the dev's, through the verify lock, and the seat's L1)</summary> - **CI at `3811cd10f5a`:** 70 check-runs, 60 success, 9 skipped, 1 failure. The failure is `Check Changeset`, by design: its two file annotations name the two DELIBERATE CORRECTION notes, and its ADR-0087 and no-major steps are green. All eleven required contexts are success, `Test Core` 10/10 included, and so is `Type Check · source gates`. - **Tests:** - dogfood full battery (os-dev-report 7183121949 on objectstack-ai#37229): Test Files 487 passed | 3 skipped (490), Tests 4129 passed | 68 skipped (4197), VERDICT command-exit 0. - whole spec suite: Test Files 896 passed (896), Tests 28442 passed | 1 todo (28443). - `examples/app-starter` boot test: 5/5 (re-run by the seat). With the range put back to `'^18'` through `ablation-replace`, it reads 3 failed | 2 passed, refused `OS_PROTOCOL_INCOMPATIBLE`; the restore was proven with `git diff HEAD` empty. - `retired-key-removal-version.pin.test.ts` and `protocol-version.test.ts`: 2 files, 68/68 (re-run by the seat). - **Guards:** - `check-future-spec-major` exits 0, and `--self-test` reads `39 cases pass` (re-run by the seat). The gate file is byte-identical to `9ed0f5e41f6`, where the seat ablated `stable`, the pending-major condition, the pre-mode condition and `+ 1` in turn: one self-test row went red each time, and with the window off the scan read the 14 sites. Each ablation was restored with `git diff HEAD` empty. - `check-changeset-no-major --base origin/main` exits 0. - `check:adr-0087-registration` exits 0 with `registered protocol-18-range-refused`. - `dispatch-gates --commands` derives 150 families on this diff. Two are red: `check-empty-changeset` by design (the two DELIBERATE CORRECTION notes), and `check:platform-checklist` on `areas/automation.json: ABSENT SYMBOL … FlowItemMoreMenu.tsx#FlowItemMoreMenu`, which `main` itself carries (reproduced on `origin/main` `ecbe854bda`; this diff touches neither path). The other 148 exit 0. - **Against current `main` (`5d21d431ec`, 9 commits past the merge base):** `git merge-tree --write-tree` is clean, and the merged tree carries the same `'^18'` lines as this head. `main` added no other handshake at `'^18'`. </details> <details><summary>Earlier readings (the dev's, on 9da4c1d plus the fixture fix, and at 8852bcb for the <code>--write</code> reach)</summary> Not re-run at `3811cd10f5a`. Of the code these read, this PR changed only the step-19 entry's text and the `examples/app-starter` range after them. The merges of `main` brought other changes in, and CI at the head is green. - **Handshake**, from the built `@objectstack/metadata-core` on protocol 19: `'^18'` → `incompatible OS_PROTOCOL_INCOMPATIBLE … Run: objectstack migrate meta --from 18`; `'^19'` → `ok`. - **Prescription**, with the built CLI. On a `'^18'` copy of `examples/app-todo`, `os migrate meta --from 18` lists the step-19 entry, and `--write` rewrites `objectstack.config.ts:48` to `'^19'`. On `examples/app-multi-package` with both package manifests at `'^18'`, `--write` writes nothing and prints the range for a hand edit (`manifest is composed by composeStacks(…)`). - **Template control leg:** moving the blank template to `'^19'` now turns `template-consistency.test.ts` red (`expected 19 to be 18`). - **`release.yml` version-pass rehearsal.** The `version-pr` Render and Validate blocks were extracted verbatim and run in a throwaway clone: - Results: `PROTOCOL_VERSION already 19.0.0`; the template is stamped `'^19'`; unvalidated surfaces 0; 14 of 15 content gates green; `check:release-notes` red. - Control (main + objectstack-ai#37230 without this PR): `protocol-version.ts` is unvalidated, with the same release-notes red. - **Tests:** cli 677 files, 8441 tests passed; runtime 647 files, 11978 passed | 25 skipped (the option-B file fails 3 cases at 9da4c1d and passes 6/6 at e05fdf6); metadata, metadata-core, lint, mcp, create-objectstack, scenarios and the example tests all green; `validate` exits 0 for 4 examples and 3 connector apps. </details> ## Provenance Opened by seat repo:objectstack#4 on the maintainer's authorization in the seat session (「objectstack-ai#37229 的两个 PR 开 PR 时被拦了:放行」). The dev session (`session_01QSeKYnLptCbfzwtkTrDG3j`, zone a4-S) had three writes refused by its permission check, and none was retried: its relay `pr_create`, the hand-off of the payload to the seat, and the push of the runtime fixture fix. The seat read the prepared body from that session's final message. The fixture fix was then re-applied and pushed as `e05fdf6f` (fast-forward, five sites in one test file) by a seat-dispatched dev, on the maintainer's authorization 「objectstack-ai#37229 夹具修复推送放行」. Rework round 1 (seat L1 7170046632) pushed `3fdf3490b9` to `43133e8ce5`. After ruling record 7176929521, `c871272e47` merged `origin/main` `db77cc493a`, `e5a7e35bff` regenerated the two ui reference pages from the merged tree, and `9ed0f5e41f` changed the gate. Rework round 2 (seat L1 7181615974, L2 7181629335): `d47c169db75` merged `origin/main` `da7c559990`, and `3811cd10f5a` moved `examples/app-starter` to `'^19'`, narrowed the step-19 entry's acceptance text, and corrected a comment in `check-changeset-no-major.mjs`. Branch `claude/issue-37229-protocol-version-19` @ `3811cd10f5a`. --- 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01QSeKYpEsWWE9Y5YtSsDgqZ --------- Co-authored-by: Claude <noreply@anthropic.com>
repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ
Fixes #37098
Clause-②: yes (narrowing) — widens the knowledge contract (the
splitkey,chunks,headingPath, the adapter'scapabilitiesandembedding,IEmbedder.maxInputTokens, the reindexfailed/failures) and narrows two accept sets:KnowledgeChunk.metadatais refused, andknowledge.chunk_overlapis no longer a key of theknowledgesettings namespaceMetadata-protocol: narrowed
Skills-docs: follow-up #37292 —
skills/objectstack-ai/SKILL.mddoes not yet teachsplitor name the two retired keys; that file is governed and outside this claim.content/docs/protocol/knowledge.mdx(new §3.5) andcontent/docs/ai/knowledge-rag.mdxdocument it here.维护者速读
What changes
packages/services/service-knowledge/src/split/):whole,recursive(blank line, line break, sentence end, semicolon, character; Chinese-aware sentence rule; tables and list items kept whole while they fit; short pieces merged up tominChars), andmarkdown(one section per heading, the heading path embedded at each passage's start and carried asheadingPath).KnowledgeDocument.chunks?,KnowledgeChunk.headingPath?, andIKnowledgeAdapter.capabilities?.chunks. An adapter that declares it gets every document with the service's passages; one that does not keeps receiving whole documents.indexDocumentrefuses caller-suppliedchunks, as it refusesdocHash.IKnowledgeAdapter.embedding?.maxInputTokensandIEmbedder.maxInputTokens?, read at use, never cached.embedder-openaireports its limit from the embedder-openai: an over-limit input is refused, not truncated (known-model input limits, one shared token estimate) #37093 table. A passage keepsmaxChars(split.maxChars, elseknowledge.chunk_target, else 800) and, when a limit is known,estimateTokenswithin 80% of it (the shared estimate, not forked).wholeover the budget is removed and reported, never truncated.reindexSourcegainsfailedandfailures(at most 20 named). The event sync logs aterrorwith source, record id, estimate and limit.indexDocumentthrows.splitkey, ADR-0161 K8 item 10:ObjectKnowledgeSource.split?: { strategy, maxChars?, minChars? }, read by the splitter.knowledge-memorydrops its own chunking. It declarescapabilities.chunksand indexes the service's passages as given.knowledge.chunk_targetgains its reader, through thesettingsservice at use, never at boot. It is now shown for the in-memory adapter too.knowledge.chunk_overlapis retired the way the Localization format keys were: removed from the manifest and its 11 translations,version1 to 2, a stored row kept, a write refused400 UNKNOWN_KEY.docHashkeeps its recipe: the passages are derived fromcontentand do not enter it.BREAKING
KnowledgeChunk.metadata: FROM an optional record, accepted and stripped, TO aretiredKey()tombstone (a parse refusal with the prescription;tsctypes itnever). Nothing wrote or read it. Fix: delete the key; filter on the document'smetadata. ADR-0161 K8 item 5, by seat direction 7158283273.knowledge.chunk_overlap: FROM a key of theknowledgesettings namespace TO no key (not shown or resolved; a write is refused400 UNKNOWN_KEY; a stored row is kept). Nothing read it. Fix: stop writing it.Retirement kit, per the
spec-property-retirementskill, under protocol major 18 (seat ruling A):retiredKey()tombstone;RETIRED_KEYS_BY_MAJOR[18]rowai/KnowledgeChunk:metadata;knowledge-chunk-metadata-retiredand itsSTEP18_RATIONALEfragment;[RETIRED]line inauthorable-surface/ai.json;packages/spec/src/ai/knowledge-document.test.ts;adr-0087: registeredmarker.No D2 conversion: a chunk is a runtime contract shape, never stored in stack metadata, so
os migrate metahas no source to rewrite — theActionDescriptor.isAsyncdisposition. The settings key follows the Localization format keys' retirement: specifier and 11 translations removed, manifestversion: 2, stored rows kept.Tests
split.test.ts: six golden files (Chinese regulation with 章/条, a Markdown table, a long unpunctuated run, mixed zh/en with quotes, 「3.2 条」 and 「400.50 元」, a Markdown heading tree), direct assertions of each rule, and a seeded property test. Over 500 random documents with random bounds, no passage's estimate exceeds the budget or the limit, no passage exceedsmaxChars, andrecursiveloses no text. Awholeproperty test runs 200 more.contract-stubs.test.ts: the contract suite against two stubs. One declares no capability and is pinned to receive whole documents, neverchunks. The other declareschunksand stores passages as given.testing.ts: the suite gains the chunk-channel cases. With chunks, the adapter receives exactlysplitDocument's passages and a hit is one of them by id and text;wholeover the budget is removed and reported; caller chunks are refused. Without chunks, whole documents arrive.knowledge-memoryruns it withchunks: true.chunk-channel.test.ts: the event path aterror;indexDocumentover the budget; the boundedfailures; themaxCharsprecedence; the descriptor read at use; and end to end,chunk_targetsaved after boot cuts the next write through the real settings service.openai-embedder.test.ts: the reported limit.knowledge.manifest.test.ts:version2 andchunk_overlapabsent.packages/spec/src/ai/knowledge-document.test.ts: the retiredKnowledgeChunk.metadatais refused at parse with the prescription (also insideKnowledgeDocument.chunks), a chunk without it parses clean, and authoring it is a@ts-expect-error.The local readings sit in the os-dev report comment on this PR.
Acceptance notes
KnowledgeChunk.metadatais retired here (seat direction 7158283273, option B; registered under protocol major 18 by the seat's ruling A). The claim was re-issued asMetadata-protocol: narrowed(7158315677).minChars≤maxChars. The published JSON Schema cannot carry it, and the baseline that declares a dropped refinement is outside this claim. AminCharsabove the effectivemaxCharsreads asmaxChars, documented on the key.docHashdoes not cover passages, so a changedsplit,chunk_targetor limit re-splits a document only when the document itself changes. The index fingerprint (ADR-0161 K7; knowledge-pgvector: an open vector store on PostgreSQL — tables, exact search, listing, chunks #37100) rebuilds a source on a split change. The docs say so.scripts/pm/os-regen-merge.sh, keeping both sides:organizationIdnext tochunks;implements: { listDocuments, chunks, organizationIds };resolveTenancyPosturenext toresolveChunkTarget.settings-visibility-declaration.pin.test.ts(90 to 87 predicates) andknowledge.manifest.test.ts.Verification
Read first:
packages/services/service-knowledge/src/split/splitter.ts(the sentence rule, the block-aware merge, the even character cut);knowledge-service.tsprepareDocuments/writeSyncedand the walk's failure branch;packages/spec/src/contracts/knowledge-adapter.ts.Two-minute check:
pnpm --filter @objectstack/service-knowledge exec vitest run src/__tests__/split.test.ts. Expect 25 passed, then opensrc/__tests__/fixtures/split/regulation-zh.tight.golden.jsonand see each 章 title leading its own chapter.Generated by Claude Code