Repository navigation
docs(adr): ADR-0161 dated revision note — knowledge source declares retrieval mode (ruling on #38692) - #38714
Conversation
…ares its retrieval mode and the vector leg's share Records section 8 of the maintainer's ruling of 2026-11-30 on the knowledge source retrieval card (ruling record 7270218011, as revised at 2026-11-30T06:16Z) as the fifth dated note of ADR-0161, under "Rules for every member" in K8, with a header line and cross-references under K1 and K4. The note amends the reading of K8 rule 4 and of the "Hybrid retrieval" row of K1, registers two contract members (AdapterCapabilities.retrieval and AdapterSearchOptions.retrieval) with their suite cases, and writes the ruling's eleven items: the source keys and the three modes, the meaning of vectorWeight and the formula of the two SQL stores, the answer to two sentences of the 2026-11-29 note, the intended exception to "builds on every store", the four refusal points, the known gaps, the way out of a single weight, and the sequence (mode in phase 1a, vectorWeight in phase 1b, the per-search override in phase 2, mode only). Add-only: 27 lines added, none changed or removed. The title, the status line, the tables and every earlier note are left as written. It declares and builds nothing; no file under packages/ changes. Claude-Session: https://claude.ai/code/session_01JQwxbYfLbF7sSvBHtuXbvT Co-authored-by: Claude <noreply@anthropic.com>
The exception bullet (item 8) now says the index of a source in the exception is still built and points at the list of refusal points, where it said that what is refused is the search; a save and a registration are refused too. The known-gaps bullet (item 10) introduces the sentence the ruling adds to the search_knowledge description without a causal "so". No other line changes. Against the base the note stays add-only: 27 lines added, none changed or removed. Claude-Session: https://claude.ai/code/session_01JQwxbYfLbF7sSvBHtuXbvT Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#2 · os-warren · session_01JQwxbXyLoBzNYY1U8SNPFu Contract-review-claim: session_01JQwxbXyLoBzNYY1U8SNPFu · head c542278 · 2026-11-30T07:20Z |
|
repo:objectstack#2 · os-warren · session_01JQwxbXyLoBzNYY1U8SNPFu Contract reviewServed-tier: PR #38714 on card #38692, phase 0 of ruling record ① Derived judgments
② Semver levelNo changeset, and the ③ Boundary flagsSQL push-down. No query, no id materialisation and no join is added. Nothing to judge. The three deviations the dev reports.
The open questions.
Other entries of the dev's list. Rule 2 (item d) is B. Lines 149, 157 and 107 (e), line 535 (f) and line 125 (g) speak of the state before phase 1a or of hybrid retrieval in the sense the note now fixes; the note's closing paragraph ("read rule 4 and the 'Hybrid retrieval' row with this note") and the K1 cross-reference cover them, and none is in the ruling's list. Not findings. The two assembled passages (the answer under item 7, and the arithmetic on the formula) are judged in ④. ④ Design judgment
No must-fix, no should-fix.
Implemented-by: VERDICT: PASS |
… member is optional Records the maintainer's ruling of 2026-11-30T07:57Z (ruling record 7272337479, his choice of the decision card's option the note quotes): AdapterSearchOptions.retrieval is optional, as rule 2 of K8 says of every member; an adapter that declares no capabilities.retrieval keeps working; and whenever the service settles a mode, it always passes it. One sentence with its citation ends the bullet on the member the service hands the adapter, which still writes the member as the first record writes it. One clause in the header Amended line names the ruling, and one clause in the note's opening paragraph names the one point, and the one quotation, that is not the first record's text. Three lines of the note change, all of them lines this branch added. Against the base the note stays add-only: 27 lines added, none changed or removed. Claude-Session: https://claude.ai/code/session_01JQwxbYfLbF7sSvBHtuXbvT Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#2 · os-warren · session_01JQwxbXyLoBzNYY1U8SNPFu Contract-review-claim: session_01JQwxbXyLoBzNYY1U8SNPFu · head a909f81 · 2026-11-30T08:29Z |
|
repo:objectstack#2 · os-warren · session_01JQwxbXyLoBzNYY1U8SNPFu Contract reviewServed-tier: Delta review of PR #38714 on card #38692, against record ① Derived judgments
② Semver levelUnchanged and right: no changeset, the ③ Boundary flagsSQL push-down. Nothing to judge. Open question B of record The dev's deviation: one sentence and two clauses, where the ruling orders one sentence. Accepted. The clause on line 23 follows the record's own convention: the header line of 2026-11-28 names its later ruling record N1 left undone. Stands. No word of the maintainer asks for the line, and record
A yes costs one commit, a new head and a further delta review, and this record then no longer covers the head. Open question C (the refusal code): unchanged. It is phase 1a's, and report The PR body: four readings are behind the head. None blocks this record, which judges the tree. The body is the seat's, and it becomes the squash commit message, so the seat corrects all four in one edit before the hand-off. A body edit does not move the head.
The body's "What changes" section also says nothing of the 07:57Z ruling; the same edit adds it. ④ Design judgmentThe three insertions, against record
No must-fix, no should-fix.
Implemented-by: VERDICT: PASS |
|
repo:objectstack#2 · os-warren · session_01JQwxbXyLoBzNYY1U8SNPFu 维护者速读
席位核对ACCEPT · L1 · area o2-A · Head-sha
|
|
repo:objectstack#2 · os-warren · session_01JQwxbXyLoBzNYY1U8SNPFu 2026-11-30T08:35Z · L1 ACCEPT and hand-off · #38692 phase 0 (ADR-0161 revision: source-declared retrieval mode, with ruling 7272337479) at its current head.
|
…mode its store does not run (objectstack-ai#38722) <!-- claude-projects-attribution: {"github_login":"os-warren"} --> _Requested by **Warren** · [project thread](https://claude.ai/code/project/chan_01U5RdnAAmkSQmZbqh6FtqZ8?thread=cmsg_01U5RdnAAmkSQmZbqh6FtqZ8QCBjsNDZa4iwo35VN5fKKg)_ Part of objectstack-ai#38692 Clause-②: no Metadata-protocol: none ## 维护者速读 - 知识源声明了检索方式后,搜索就按它执行;没声明的按存储默认。存储不支持所声明的方式时,保存时直接报错并列出可选方式,启动后记一次错误日志,每次搜索都把它列为未检索,绝不悄悄换成别的方式。 - 属于知识管理专题「一期 a:检索方式」。 - 出错会是本该能搜的知识源被拒;未声明方式的知识源行为不变,可直接撤回。 - 无。 ## Stack Base: `main`. objectstack-ai#38700 (the facade split) has merged and `main` is merged in. The spec PR objectstack-ai#38720 merged as f576dee and `main` is merged in, so this diff is the service's own 15 files. The phase-0 ADR note (objectstack-ai#38714) is merged too. Independent of the adapter PRs. The Studio form PR stacks on this one. ## What changes - New `knowledge-retrieval-mode.ts`: the effective mode is the source's `source.retrieval.mode`, else the adapter's `capabilities.retrieval.default`; an adapter reporting no modes is never told one. - The four refusal points for a declared mode the adapter does not list, never searched another way: 1. save (`admitAuthoredSource`): `400 VALIDATION_ERROR`, listing the modes the store runs; 2. registration in code (`registerSource`): the same refusal, only when the adapter already resolves (startup registry reads). A published item (`registerMetadataSource`, the loader) is not refused there: the loader runs after every store has started, so a refusal would drop it whole; it is registered and indexed, and points 3 and 4 refuse it (review M1); 3. once after boot (`reportUnsupportedRetrieval`, called at `kernel:bootstrapped` beside `reportUnmountedAdapters`), at `error`; 4. every search (`planSearches`): listed in `refused` with `SERVICE_UNAVAILABLE` (503), the code an unmounted adapter's source already carries. - Every search hands the store `AdapterSearchOptions.retrieval` and logs the mode and its origin at `debug`; the caller's answer carries neither. - `index_status` entries carry `retrieval` (declared, effective mode, origin, the store's modes, refused), and the answer lists each mounted store's modes (`details.adapters`) and the store a source naming none binds to (`details.defaultAdapter`), the data the Studio form PR reads. New service member `describeRetrieval`. - Contract suite: service-level cases for every adapter (a listed mode is handed through; an unlisted one is refused at registration in code and at every search, and still indexes; a published item loaded after its store started is registered, indexes, is named by the boot reading and is refused on every search). - Liveness row flips to `live`; protocol doc §3.1 and the save guard; patch changeset. ## Tests - New `retrieval-mode-38692.test.ts` (16 cases): resolution, refusal text, each refusal point, debug log and its absence from the answer, still indexes, the loader path (a published item with its store already started), plugin hook, `index_status`. - `service-knowledge`: 861 passed (26 files, at 1a7ba24); typecheck clean. `knowledge-memory` 70 passed and `knowledge-turso` contract 110 passed against this head's suite. `knowledge-memory` contract 54 passed; `knowledge-turso` 110 contract passed; live pgvector contract 55 passed. - With each adapter PR merged in locally: turso 326 passed, pgvector against live PostgreSQL 133 passed. ## Acceptance notes - The per-search refusal code is reused rather than added: `SERVICE_UNAVAILABLE` (503), the code an unmounted adapter's source already carries. The ruling and the phase-0 note say only "with its code"; open question C, confirmed by Warren on 2026-11-30 at 12:40Z (「同意」): the refusal stays 503. - Declared `Metadata-protocol: none`: what an author can write was added by the spec PR; this PR reads it. The save refusal of a mode the store does not run is the shape the ruling gives the key from birth, in the same release. - Facade gate: `knowledge-service.ts` 1681 lines of 1758; both new members are one-call delegations. ## Verification - Two-minute check: `pnpm --filter @objectstack/service-knowledge exec vitest run src/__tests__/retrieval-mode-38692.test.ts` → 16 passed. - Related local gates (26 of `dispatch-gates.mjs --commands`: docs, liveness, changeset, facade, error-code, ledger): all green. ## 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. - [ ] 4. One issue, one branch off an up-to-date `main`, one pull request. (Stacked: see "Stack" above.) - [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. - [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_01JQwxbaASqBozmmj1n5tbUf <!-- signed: repo:objectstack#2 · os-warren · session_01JQwxbaASqBozmmj1n5tbUf --> --------- Co-authored-by: Claude <noreply@anthropic.com>
… mode (objectstack-ai#38721) <!-- claude-projects-attribution: {"github_login":"os-warren"} --> _Requested by **Warren** · [project thread](https://claude.ai/code/project/chan_01U5RdnAAmkSQmZbqh6FtqZ8?thread=cmsg_01U5RdnAAmkSQmZbqh6FtqZ8QCBjsNDZa4iwo35VN5fKKg)_ Part of objectstack-ai#38692 Clause-②: yes (widening) Metadata-protocol: none ## 维护者速读 - 使用 turso 存储的知识源可以按选定方式检索:只按意思、只按字词或两者结合;不选仍是两者结合,结果与现在逐位相同。 - 属于知识管理专题「一期 a:检索方式」。 - 出错会是某种方式漏掉或多出段落;未声明方式的知识源不受影响,可直接撤回。 - 无。 ## Stack Base: `main`. objectstack-ai#38697, the spec PR objectstack-ai#38720 and the phase-0 ADR note objectstack-ai#38714 are all merged and `main` is merged in, so this diff is the adapter's own 6 files. It lands in the same release as the service PR objectstack-ai#38722, which is the first reader of the mode. ## What changes - `knowledge-turso` reports `capabilities.retrieval = { modes: ['vector', 'keyword', 'hybrid'], default: 'hybrid' }`. - A search runs only the legs its mode names, in SQL: `keyword` binds no vector and never calls the embedder (nor reads the one-bit approximate index); `vector` drops the FTS5 leg. - A single-leg answer is scored on the same RRF scale: rank n scores 61/(60+n) after normalising, so the first hit is 1. `hybrid` is unchanged; `fuse(rows, topK, legs)` keeps the two-leg expression bit-identical. - README "Retrieval modes" paragraph, protocol doc §4.2 sentence, patch changeset. - A mode the store does not list is refused (`400 VALIDATION_ERROR`) before anything is embedded or read, rather than run on the one-leg scale (review S1). `Clause-②: yes (widening)`: the exported adapter's `capabilities` grows `retrieval` (review M1). ## Tests - New `retrieval-modes.test.ts` on a real libSQL store: legs per mode, embedder calls, tie order by chunk id, single-leg scores, keyword never reads `vector1bit(` while vector does, hybrid fusion pinned bit-for-bit. - Contract suite with `implements.retrieval: true`. - `knowledge-turso`: 319 passed at 2496e51 (the refused-mode case added); typecheck clean. Ablation: keeping the keyword leg under `vector` turns 3 cases red, restored. ## Acceptance notes - With the service PR applied on top, the full turso suite (326, including the service-level mode cases) passes. ## Verification - Two-minute check: `pnpm --filter @objectstack/knowledge-turso exec vitest run src/__tests__/retrieval-modes.test.ts` → all pass. ## 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. - [ ] 4. One issue, one branch off an up-to-date `main`, one pull request. (Stacked: see "Stack" above.) - [x] 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset. - [ ] 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_01JQwxbaASqBozmmj1n5tbUf <!-- signed: repo:objectstack#2 · os-warren · session_01JQwxbaASqBozmmj1n5tbUf --> --------- Co-authored-by: Claude <noreply@anthropic.com>
…odes its store runs (objectstack-ai#38730) <!-- claude-projects-attribution: {"github_login":"os-warren"} --> _Requested by **Warren** · [project thread](https://claude.ai/code/project/chan_01U5RdnAAmkSQmZbqh6FtqZ8?thread=cmsg_01U5RdnAAmkSQmZbqh6FtqZ8QCBjsNDZa4iwo35VN5fKKg)_ Part of objectstack-ai#38692 Clause-②: no Metadata-protocol: none ## 维护者速读 - 管理员在 Studio 编辑知识源时,「检索方式」下拉只列出该知识源所用存储支持的方式,并写明「存储默认」是哪一种;存储未声明时显示「驱动未声明检索方式」。 - 属于知识管理专题「一期 a:检索方式」。 - 出错只会是下拉列错选项;保存时服务端仍会把不支持的方式拒掉,可直接撤回。 - 无。 ## Stack Base: `main`. Stacked on the service PR objectstack-ai#38722 (it reads `index_status`'s `adapters` and `defaultAdapter`, which objectstack-ai#38722 adds) and through it on objectstack-ai#38720; until those merge, this diff carries their commits. Lands after both and after the phase-0 ADR note (objectstack-ai#38714). ## What changes - The knowledge source form's `source.retrieval.mode` row names a new widget, `knowledge-retrieval-mode` (spec form hint). A host whose registry lacks the picker draws its unregistered-widget face (the JSON editor), not a select; the three static `options` stay because the form's generated translations carry their labels. - `ResourceEditPage` loads, only for a form that declares the widget, the store the draft binds to (its `adapter`, else `defaultAdapter`) and the modes it reports, from `POST /api/settings/knowledge/index_status` (`knowledgeRetrieval.ts`), into `WidgetContext.knowledgeRetrieval`. - The picker: the store's listed modes plus a blank choice that names the default ("Store default (Hybrid (both))"); a store that reports none offers the default alone with "驱动未声明检索方式(STORE),此项请留空。"; a mode already written that the store does not run is kept and flagged; no store answer (refused read for an author who is not a platform administrator, store not mounted, no host) offers the three modes and the save judges. - en and zh strings in the studio namespace; registry cases in the two widget registry tests; changeset (spec, app-shell, i18n patch). ## Tests - New `KnowledgeRetrievalModeWidget-38692.test.tsx` (12): form row names the widget, labelling, offered options per store shape, undeclared sentence, flagged stored mode, fallbacks, writes and default removal, disabled states, `storeRetrievalOf` parsing. - Related UI suites: 180 files / 2,791 tests passed (widgets, metadata-form, SchemaForm, i18n, console registry parity), `ResourceEditPage*` 67 files / 342 passed; app-shell `tsc --noEmit` and `tsconfig.test.json` clean before the main merge; spec form test 9 passed. ## Acceptance notes - `index_status` is gated on `manage_platform_settings`; an author without it gets the three-mode fallback, never an error card. - The draft's `adapter` re-reads the store on change (one request per distinct value). - After merging `main` (with objectstack-ai#38700) the app-shell `tsc` reports one error in `RecordDetailView.tsx` (`pinOverview`), outside this diff, from a stale local build of a sibling package; not measured further here. ## Verification - Two-minute check: `pnpm --dir ui exec vitest run packages/app-shell/src/views/metadata-admin/KnowledgeRetrievalModeWidget-38692.test.tsx` → 12 passed. - UI gates run: `check:i18n-keys`, `check:i18n-drift`, `check:i18n-dead-keys`, `check-sdui-manifest`, `ui/scripts` vitest, changeset gates: all green. ## 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. - [ ] 4. One issue, one branch off an up-to-date `main`, one pull request. (Stacked: see "Stack" above.) - [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. - [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_01JQwxbaASqBozmmj1n5tbUf <!-- signed: repo:objectstack#2 · os-warren · session_01JQwxbaASqBozmmj1n5tbUf --> --------- Co-authored-by: Claude <noreply@anthropic.com>
…ll lists source.retrieval.mode (objectstack-ai#38732) <!-- claude-projects-attribution: {"github_login":"os-warren"} --> _Requested by **Warren** · [project thread](https://claude.ai/code/project/chan_01U5RdnAAmkSQmZbqh6FtqZ8?thread=cmsg_01U5RdnAAmkSQmZbqh6FtqZ8QCBjsNDZa4iwo35VN5fKKg)_ Part of objectstack-ai#38692 Clause-②: no Metadata-protocol: none ## 维护者速读 - AI 助手搜知识库时会被告知:分数只表示同一知识源内的先后,不表示相关程度;AI 作者文档写明了检索方式的用法。 - 属于知识管理专题「一期 a:检索方式」。 - 出错只会是说明文字不准,不影响搜索结果,可直接撤回。 - 无。 ## Stack Base: `main`. Stacked on the service PR objectstack-ai#38722 (and through it objectstack-ai#38720); until those merge, this diff carries their commits. Lands after both and after the phase-0 ADR note (objectstack-ai#38714). ## What changes - `search_knowledge` description: one sentence, the ruling's 「分数只表示同一知识源内的先后,不表示相关程度」: "A hit's `score` says only its order among the hits of its own source, not how relevant it is." The `score` member's doc says the same, with the one-leg rule (first hit scores 1). - `skills/objectstack-ai/SKILL.md`: a `source.retrieval.mode` row in the knowledge source key table; paid for in the same file (the `adapter` row's save refusal shortened, the one-slot sentence dropped, the closing rerank line made one clause and no longer says "hybrid weighting"). The row says an unsupported mode fails a run-time save and, for a shipped source, every search (503). Ratchet row lowered 7248 → 7247. - `content/docs/ai/knowledge-rag.mdx`: the "0.5 for one first in only one" paragraph now says a source can run one leg alone, its first hit then scores 1, and scores order one source's hits only. - Patch changeset, naming `@objectstack/service-knowledge` and `@objectstack/skills` (which ships the SKILL.md). ## Tests - `service-knowledge`: 860 passed (no test pins the description text). - Skill gates: token ratchet, links, identifier liveness, frame sync and freshness, top-level keys, affected docs: all green. ## Acceptance notes Skill readings (`skills/**` touched): | | before | after | |:--|--:|--:| | `skills/objectstack-ai/SKILL.md` lines | 507 | 507 | | `skills/objectstack-ai/SKILL.md` bytes / tokens | 29017 / 7248 | 28990 / 7241 | | all `skills/*/SKILL.md` lines | 3406 | 3406 | | all `skills/*/SKILL.md` bytes | 180659 | 180632 | Net growth zero: the new row is paid by deletion in the same file. ## Verification - Two-minute check: `node scripts/check-skills-token-ratchet.mjs` → green, `objectstack-ai/SKILL.md` 7241 / 7241. ## 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. - [ ] 4. One issue, one branch off an up-to-date `main`, one pull request. (Stacked: see "Stack" above.) - [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. - [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_01JQwxbaASqBozmmj1n5tbUf <!-- signed: repo:objectstack#2 · os-warren · session_01JQwxbaASqBozmmj1n5tbUf --> --------- Co-authored-by: Claude <noreply@anthropic.com>
…n once, and its refusals stay ahead of the embed (objectstack-ai#38812) <!-- claude-projects-attribution: {"github_login":"os-warren"} --> _Requested by **Warren** · [project thread](https://claude.ai/code/project/chan_01U5RdnAAmkSQmZbqh6FtqZ8?thread=cmsg_01U5RdnAAmkSQmZbqh6FtqZ8WwwNJsfXjR7KkaXqjQxjFx)_ Part of objectstack-ai#38676 **Update, head `a28863cef9`.** PR objectstack-ai#38809 (card objectstack-ai#38438) landed first, at 2026-12-01T03:58Z, and took the seventh and eighth `**Amended**` lines of ADR-0161. This head merges `main` into the branch (merge commit `a28863cef9`, no rebase): main's lines are kept as they are, this PR's header line follows them, and its ordinal reads "a ninth dated note". That one word is the only change to this PR's text (delta report 7300564224 on objectstack-ai#38676); the net diff against `main` is still this note alone, +17 / -0. The gate readings and the overlap paragraph further down are of the earlier head `f3cd7dba76`; the 21 derived gates were re-run at `a28863cef9`, all exit 0. This is phase 0 of the card's cause 3 and nothing else: the dated note in ADR-0161. The card stays open for phase 1, the patch round on PR objectstack-ai#38798, which waits for this note to merge. Clause-②: yes (widening) — the two optional adapter-contract members the note registers Metadata-protocol: none The two lines above are the claim's (comment `7296290387` on the card) and cover both phases. This pull request changes no contract file: the widening is what the note registers and PR objectstack-ai#38798 builds. ## 维护者速读 - 用户能看到什么变化:用户无感;只是在知识平台边界那份架构决策记录里追加一条 2026-12-01 的说明,把你当天选定的「写进约定,一次提问只转一次」和它的附带条件写成文字,不改任何代码。 - 为什么做:这是「知识检索慢」那张卡最后一项(补查时把同一个问题重复转成向量)的前置一步;平台和存储驱动之间的约定是一份封闭清单,要先在决策记录里登记这两项,已经做好的改动才能合并。 - 出错会怎样:说明里若有和你的裁决不一致的句子,接下来改代码的人会照着错的文字去做;它只是一处文档追加,可以直接撤回,不影响任何在运行的系统。 - 要你做什么:请审阅并批准这条说明;其中标了菱形记号的两处是说明自己定的写法,可以一并接受,也可以划掉。 ## What changes One file, add-only. `docs/adr/0161-knowledge-platform-boundary-platform-owns-assembly-sync-split-record-return-knowledge-source-is-a-governed-type.md` gains its ninth dated note: 17 lines added, none changed and none removed (659 lines to 676 on `main` after objectstack-ai#38809). Three commits carry it, the third being the merge of `main`, `a28863cef9`: `f00518e716`, the note, and `f3cd7dba76`, a review pass over it (Acceptance notes). **Ruling.** The maintainer chose option A for cause 3 on 2026-12-01T00:22Z: ruling record [`7296268226`](objectstack-ai#38676 (comment)) on the card, given on analysis `7290428149`. He ruled by choosing an option of a decision card, and the note quotes the card's words unchanged: the option 「写进约定,一次提问只转一次」 and the condition 「附带条件:存储驱动原本会给出的拒绝提示(比如“需要重建索引”)要保持在前面,不能被转向量的报错盖掉。」 Nothing of the ruling is opened again here. Three insertions, in the form the six earlier notes of this record use. Line numbers are at head `a28863cef9`. | Lines | Where | What is added | |---|---|---| | 27 | Header, after the `**Amended**` line of the eighth note | A ninth `**Amended**` line, dated 2026-12-01: the two members, the texts the note is read with, the ruling record, the chosen option and the condition. | | 166 | K1, under the note of 2026-11-30 on rerank | A cross-reference: the "Embedding calls" row, and "compute a vector" in the second sentence of the list, are read with the new note. | | 483 to 496 | K8, under "Rules for every member" | The note itself: an opening paragraph, nine bullets and a last paragraph. | What the note decides: - **Two optional members, and the list stays closed beyond them** (K8 rules 3 and 5). `IKnowledgeAdapter.embedQuery?(query: string)`, which answers a promise of a `number[]`, and `AdapterSearchOptions.queryVector?`. No capability flag: the method's presence is the signal. - **The type of the second member.** A function of no arguments that answers a promise of a read-only `number[]`. It is not the vector itself. For one search the knowledge service makes one such function for each adapter instance that has `embedQuery`. The first call of the function calls that instance's `embedQuery`; every later call in that search answers the same promise, a rejected one too. An adapter calls it at the point of its `search` where it embeds the query today. This is the per-search memoised provider the analysis recommends, and the one choice the ruling record leaves to the note. - **The three readings that M1 of contract review [`7290045524`](objectstack-ai#38798 (comment)) left open.** 1. The adapter still embeds, with its own embedder and query prefix. The service computes no vector: it carries one back to the instance that made it, inside one search. The "Embedding calls" row of K1, the second sentence of the list under it and item 15 of K8 stand as written. 2. One vector serves every source a search binds to that adapter instance. An adapter whose query embedding depends on the source does not implement the method. 3. A handed vector is checked by its width. The model is judged on the index fingerprint, as K7 has it. - **The condition, as an outcome.** An adapter's refusals are answered as on `main`, code, status and remedy, and no question is sent to an embedding provider for a source the adapter refuses. The ruling record's case: a source that needs a rebuild behind a failing embedder answers `KNOWLEDGE_REBUILD_REQUIRED` 409 with 0 embedder calls. The function gives this by construction, because an adapter asks for the vector only after everything it decides first. - **What the members land with.** PR objectstack-ai#38798, after this note merges: both members with their first readers in one PR and one case in the contract test suite (rule 1). Each is optional (rule 2), and an adapter without `embedQuery` is searched as before. - **Not in the note.** A vector handed by a caller of the service or by a tool argument, a memo an adapter keeps past one search, a source or context argument on `embedQuery`, and a form that embeds several questions at once. No file under `packages/`, `content/`, `skills/` or `ui/` changes, and no other ADR does. The note declares; it builds nothing. ## Why K8 rule 5 of this record: "The list is closed. A member that is not in the table needs a dated note on this record first." PR objectstack-ai#38798 built the two members before the record named them, and its contract review is FAIL on that point (M1). The ruling puts the record before the code: this note first, then the patch round on objectstack-ai#38798. ## Tests The diff touches no package, so there is no build closure to make and no package test or type-check owed. What was measured, at head `f3cd7dba76`: - **The premise holds.** Read on `main` at `0fc9eab900`, the commit this branch starts from. A refilled search still embeds the question twice: - `packages/services/service-knowledge/src/knowledge-service-search.ts:232` is the first `searchRound` call and `:245` is the refill's. - `:957`, inside `searchRound`, calls `adapter.search` once for each source. - `packages/plugins/knowledge-turso/src/turso-adapter.ts:741` and `packages/plugins/knowledge-pgvector/src/pgvector-adapter.ts:657` embed the query inside that call. - No line under `packages/`, `content/` or `docs/` names `embedQuery` or `queryVector` (`git grep` exit 1). - `origin/main` has since moved one commit, to `d97aaaea9a` (objectstack-ai#38802: one skill file, one ratchet script and a changeset). It changes none of the files read here, so each reading holds there too, and this branch merges with it cleanly. The branch was not merged with it. - **Quotations.** A script compared every quoted span of the added lines with its source, read over REST or from the ADR at the base. 9 spans in corner brackets: each is a verbatim substring of ruling record `7296268226`. 27 spans in double quotation marks: each is verbatim in that record, in analysis `7290428149`, in review `7290045524` or in the ADR at the base. 0 mismatches. (The nested title "What "capabilities" became" counts as two spans.) - **Bytes.** The added lines hold no raw control byte, no HTML comment and no model identifier. - **What an adapter decides ahead of its embed**, the list in the note's bullet on the condition, read in both stores on `main` at `0fc9eab900`: an empty organization set, a scope with no ids and a `topK` of zero answer no hits; the store and the embedder are present and the store is ready; the source has an active generation; that generation holds the searched fingerprint and the embedder's width, or the refusal is `KNOWLEDGE_REBUILD_REQUIRED` (409, with its remedy); the mode is one the adapter runs; and `keyword` never embeds. Each is ahead of the embed in `turso-adapter.ts` (lines 699 to 741) and in `pgvector-adapter.ts` (lines 581 to 657). - **PR objectstack-ai#38798 as it stands**, read at head `4561e81d0e`: `queryVector` is the vector itself there, a read-only `number[]`, and `embedQuery` has the signature the note writes. - **Anchors.** Every code citation in the note is a path with a symbol, never a line number, and `check:adr-symbol-anchors` reads all of them (its verdict line is below). No ablation: the diff changes no behaviour a test pins. ## Acceptance notes **The committed note took the function, not a plain array.** A plain array has to exist before `search` is called, so the service would have to embed ahead of every decision the adapter makes. A refused source would then cost an embedding call, and a failing embedder would answer in place of the adapter's own refusal. That is the shape review `7290045524` graded S2, and it cannot meet the condition. The function can, and the note names it as the means it takes. **The review pass, commit `f3cd7dba76`.** Two sentences of the note changed; nothing it decides moved. 1. The opening said that every statement without a diamond is the ruling record's, the analysis's, what follows from the means, or a reading of `main`. Some rest on review `7290045524`, on this record's own rules, on PR objectstack-ai#38798 at its head or on the body of the card. The sentence now lists them. 2. The signature of `embedQuery` is the one PR objectstack-ai#38798 declares at head `4561e81d0e`. The bullet on the two members now says so. **Two things are marked with a diamond, for the approver to accept with the note or strike.** - a. The means, and with it the member's type. Three points go with it and are the note's wording: the name `queryVector` is kept though the member is now a function; the service hands the function on every `search` call of that search and does not judge whether a call will embed; and a rejected promise is shared like a fulfilled one, so one failed embedding call refuses each source that asked for the vector in that search. - b. One sentence added to the third reading: a caller that reaches an adapter's `search` directly and hands the member answers for the function, and the adapter does not verify it. **Wording that is the note's and not a quotation**, each resting on a text named beside it: - The suite case is the one review `7290045524` asks for under S1, rewritten with the function in the vector's place. - "The condition has its own pin in each of the two stores": the ruling record says "a pin". Each store orders its own decisions ahead of its embed, so the note asks for the case in each. - The English beside the card's Chinese words is a reading aid. The Chinese is quoted unchanged. **Overlap with an open draft on this file.** `node scripts/pm/overlap-check.mjs --repo=objectstack-ai/objectstack`, run at `f3cd7dba76` against `origin/main` at `d97aaaea9a`, printed `VERDICT overlap exit 1`: `origin/main` merges cleanly, and draft objectstack-ai#38809 (the weekly ADR revisions, second part, opened 2026-12-01T00:50Z by another seat's thread) conflicts with this branch in this file. Both insert header lines after line 24, and both call their first line "a seventh dated note" (objectstack-ai#38809 adds a seventh under K7 and an eighth under Consequences). Its two notes and this one touch no common passage. Whichever lands second merges `main`, keeps both sets of header lines and corrects its ordinals. Which lands first is the seats' to settle; it is put as a question in the report on the card. **What the note asks of PR objectstack-ai#38798, none of it done here.** - `queryVector` changes type there, from the vector to the function, and the service stops calling `embedQuery` ahead of `search`. - One case in the contract test suite, and a pin in each of the two stores for the ruling record's case. - The docblocks cite the note and no longer say that the knowledge service embeds. **Text of ADR-0161 that the note is read beside. Listed for the seat, not changed.** - "What "capabilities" became" lists the methods whose absence is the capability signal (listing, dropping, status, the start and end of a build). `embedQuery` joins them by this note; the paragraph is left as written. - The K2 row for §3.4 of the protocol page says what the contract carries. Its last column gives the rewrite to "each card that adds a member", so objectstack-ai#38798 rewrites it with its code. **Not done here.** No changeset: `docs/adr/` is published by no package. The two earlier note pull requests on this record, objectstack-ai#38714 and objectstack-ai#38764, each carry the `skip-changeset` label, hung in the stroke that opened them. This one is opened with no label, as its dispatch order says, so that label is owed by the seat, and `Check Changeset` has no exemption until it is hung. ## Verification **Read first, by risk.** One file changes, so these are its three places of most risk. 1. Line 476, the bullet marked with a diamond, "The means, and with it the member's type". It is the one decision the note makes, and it sets what the patch round on PR objectstack-ai#38798 must build. 2. Line 480, the bullet "The condition, as an outcome". It states the maintainer's condition and what holds when the embedding call itself fails. 3. Line 479, the last two sentences of "The third reading": the note's own sentence on a caller that reaches an adapter directly. **Two-minute check.** One click: open the "Files changed" tab. Expected: one file, +17 −0, three hunks, every changed line an addition. **Landing.** `docs/adr/**` is a governed surface. This is opened as a draft. The hand-off is the seat's and the approval is the maintainer's. Nothing here requests a reviewer, marks it ready or arms auto-merge. **CI.** NOT MEASURED: the check-runs of this pull request, reason: it did not exist when this body was written. The report on the card carries the reading taken after it opened. **Gates, run locally on head `f3cd7dba76`.** `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` derived 21 commands from the diff. All 21 ran in the foreground, each exit code was captured before any pipe, and all 21 are exit 0. The reconciliation: ```text 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). ``` <details> <summary>The 21 commands and their exit codes</summary> ```text node scripts/check-adr-links.mjs :: exit 0 node scripts/check-adr-links.mjs --self-test :: exit 0 node scripts/check-closing-keyword-parity.mjs :: exit 0 node scripts/check-closing-keyword-parity.mjs --self-test :: exit 0 node scripts/check-comment-mask-corpus.mjs :: exit 0 node scripts/ci/plan-test-core-shards.mjs --self-test :: exit 0 pnpm --filter @objectstack/lint run check:doc-formula-expressions :: exit 0 pnpm check:adr-anchors :: exit 0 pnpm check:adr-index :: exit 0 pnpm check:adr-symbol-anchors :: exit 0 pnpm check:ci-filter-parity :: exit 0 pnpm check:closed-ceremony-text :: exit 0 pnpm check:cross-package-test-inputs :: exit 0 pnpm check:doc-authoring :: exit 0 pnpm check:driver-memory-census :: exit 0 pnpm check:gitlink-declared :: exit 0 pnpm check:nul-bytes :: exit 0 pnpm check:pm-governed-merges :: exit 0 pnpm check:pm-prior-rulings :: exit 0 pnpm check:refd-timer-probe :: exit 0 pnpm check:watch-hint-literal :: exit 0 ``` </details> <details> <summary>Verdict lines of the gates that read the ADR</summary> ```text ✅ check-adr-links: 1284 relative link destination(s) under docs/adr/ resolve ✅ check-adr-symbol-anchors: 4608 anchors across 165 records resolve — 1727 symbol (1698 declaration, 29 literal), 2829 file-level, 52 cross-repo, 6 exempt, 132 continuation. [cut here: the rest of the line is a note on what the count is not] adr-index --report: OK — docs/adr/README.md is current, every record parsed, self-test 60 assertions green. Report-only: this line never reds the step. check-nul-bytes: OK (scanned 29077 text file(s) -- 29077 tracked, 0 untracked-not-ignored; skipped 101 binary; no raw ASCII control bytes). ✓ check-closed-ceremony-text: 6688 shipped file(s) read; none says the ownership ceremony is closed. ✓ comment-mask corpus sweep [scripts/js-comment-mask.mjs]: 24511 files, 0 disagree, 0 unparseable, 211.2s (comparator self-test: 26 cases pass). ``` </details> <details> <summary>One gate first read NOT MEASURED, then green</summary> `pnpm --filter @objectstack/lint run check:doc-formula-expressions` first answered exit 3, PREREQUISITE NOT MET: two workspace packages it imports were not built in this worktree. That is a run that measured nothing, not a red gate. The two packages were built under the shared verify lock, with the command the gate printed, and the gate was run again at the same head: ```text os-verify-lock: VERDICT command-exit 0 · held the lock 100s (1m40s) · waited 0s pnpm --filter @objectstack/lint run check:doc-formula-expressions :: exit 0 ``` </details> **Left to CI, not run locally.** The repo-wide lint, the type-check lanes, the test shards, and the families `dispatch-gates` prints outside the derived list. The commit trailer gate ran in the pre-push hook on the pushed range and is green. ## Human Minimum - [x] 1. No schema and no code changes. - [x] 2. No new name is declared in code. The two member names are the ones PR objectstack-ai#38798 and the analysis use. - [x] 3. No formatter ran. `pnpm lint` is NOT MEASURED locally: the repo-wide scan is CI's, and the diff is one Markdown file. - [x] 4. One card, one branch off `main` at `0fc9eab900`, one pull request for this phase. - [x] 5. Nothing publishes, so no changeset; both declaration lines are filled in above. - [x] 6. `packages/spec` is not touched. - [x] 7. No edit to `content/docs/references/`, to a `CHANGELOG.md` or to `content/docs/releases/`. - [x] 8. Title, body and comments are in English. The card's Chinese words are quoted unchanged, and the 维护者速读 section is in Chinese as the fleet's rule asks. - [x] The *Before Submitting* list is done for what a docs-only diff reaches; `pnpm lint` is as item 3 says. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01JQwxbXfgA45f3y5YpDPT5h <!-- signed: repo:objectstack#2 · os-warren · session_01JQwxbXfgA45f3y5YpDPT5h --> --------- Co-authored-by: Claude <noreply@anthropic.com>
Requested by Warren · project thread
Part of #38692
This is phase 0 of the card and nothing else: the dated note in ADR-0161. The card stays open for phase 1a (
mode), phase 1b (vectorWeight, after #38671 lands) and phase 2 (the per-search override,modeonly). None of them is started here.Clause-②: no
Metadata-protocol: none
维护者速读
What changes
One file, add-only.
docs/adr/0161-knowledge-platform-boundary-platform-owns-assembly-sync-split-record-return-knowledge-source-is-a-governed-type.mdgains its fifth dated note: 27 lines added, none changed and none removed. The note records section 八 of the maintainer's ruling record7270218011on the card, in the text as revised at 2026-11-30T06:16Z. The substance it writes down is that of the record's sections 一 to 七.Four insertions, in the form the four earlier notes of this record use:
**Amended**line. It names the ruling record, the maintainer's words 「同意,更新决策卡」 (06:00Z) and 「全部采纳,修正裁决」 (06:16Z), the two contract members the note registers, that the second is optional by ruling record7272337479(「可选(推荐)」, 07:57Z), and that the note is in force from the maintainer's merge.source.retrievalis declared besidesource.affinity, and the one intended exception to "builds on every store".What the note says, with the ruling's item numbers:
source.retrieval, a strict object withmode(vector,keywordorhybrid) andvectorWeight(a number above 0 and below 1, written only beside an explicithybrid), and what each of the three modes means (section 一, and item 11 forkeyword).AdapterCapabilities.retrievalandAdapterSearchOptions.retrieval, and the suite cases they land with (item 5).vectorWeightmeans, the weighted reciprocal rank fusion the two SQL stores compute, the pin at 0.5, and that the constant is not opened as an option (item 6).AdapterSearchOptions.retrievalis optional, as rule 2 says of every member: an adapter that declares nocapabilities.retrieval, such asknowledge-memory, keeps working, and whenever the service settles a mode it always passes it. This is the maintainer's later ruling record7272337479(「可选(推荐)」, 2026-11-30T07:57Z), recorded in that member's bullet (line 428), with one clause naming it in the header line (23) and in the note's opening (420).modein phase 1a,vectorWeightin phase 1b after 知识库混合检索在中文口语问题上比只用向量更差:关键词一路的滑动窗口切词 + 等权 RRF #38671 lands, and the per-search override in phase 2,modeonly. SovectorWeightis ruled by this note and is in no schema until its phase.Left as written, on purpose: the title, the
**Status**and**Decided by**lines, the tables of K1 and K8, rules 1 to 5, the TL;DR and every earlier note. This record's own convention is add-only, each of its four earlier notes ends its header line with "The status line above is left as it is", anddocs/adr/README.mdis generated from the title and the status line, so it stays current with no edit.No file under
packages/,content/,skills/orui/changes. The note declares; it builds nothing.Why
The ruling orders the record before the code. Its 分期 puts this first, as 零期: 「ADR-0161 修订说明 PR,维护者合并。」 Its section 八 is headed 「ADR-0161 修订说明(单独 PR,Tier H,由维护者亲手合并)」. The claim on the card holds that no phase 1a PR lands before this one merges.
Tests
The diff touches no package, so there is no build closure to make and no package test or type-check owed. What was measured on the text itself:
7270218011, 2 are the chosen option of record7272337479, 0 mismatches. The added lines hold no raw control byte and no HTML comment.w = 0.5differs from today's function in the last bit in 0 of them. Multiplying by 61 differs in 13,369 of them, which is the count the record gives.5a77a7063e. No drift.fuseandRRF_K = 60inpackages/plugins/knowledge-turso/src/turso-adapter.tsand inpackages/plugins/knowledge-pgvector/src/pgvector-adapter.ts: each divides by2 / (RRF_K + 1).AdapterCapabilitiesinpackages/spec/src/contracts/knowledge-adapter.tsholdschunksalone, andAdapterSearchOptionshas noretrievalmember.packages/services/service-knowledge/src/knowledge-service.tsthat adapters register in their plugins'start(), after a source registered in code atinit().reportUnmountedAdapters, taken atkernel:bootstrapped.authoredKnowledgeSourceRefusalinpackages/metadata-core/src/knowledge-source-save-admission.ts, which does not judge the engine's own write (a package install among them).content/docs/protocol/knowledge.mdxexists.knowledge-memoryanswers the cosine similarity.check:adr-symbol-anchorsreads all of them (output below).No ablation: the diff changes no behaviour a test pins.
Acceptance notes
Deviations from the dispatch order, reported and not settled here. The ones that concern process and not this text are in the report on the card.
7270638751says items 1 to 6. The ruling's own list in section 八 has eleven items, and the card thread widened the order to match it. The note covers all eleven.**Status**and**Decided by**lines are not edited. The order asks for the header lines to name the ruling and its 06:16Z revision. This record's convention carries that in a new**Amended**header line, which is what was added, and leaves the status line as it is. Editing the status line would also change the generated index.Text of ADR-0161 that the ruling touches beyond section 八. Listed for the seat, not changed. Line numbers are at head
a909f81c(no line moved fromc542278e).capabilities.chunks(item 5). No wider descriptor is added." The note registers a second member ofAdapterCapabilities.capabilities.chunksstays the one flag". Same point.AdapterSearchOptions.retrieval.modeselects the legs for one search.AdapterSearchOptions.retrieval: { mode, vectorWeight? }with no optional mark onretrieval. Ruled at 2026-11-30T07:57Z (record7272337479, 「可选(推荐)」): the member is optional, and the note's bullet on it now says so. No longer open.knowledge-memorydoes not declare the new member, and the suite gains one case per mode.refused「带错误码」 and does not name the code. The note does not name one either.Two places where the note's wording is assembled, not quoted. Both are marked by their position in the note and both stay inside the record's words.
Not done here.
content/docs/protocol/knowledge.mdxsection 7.1, the Studio form and the skill text go with their own PRs, as the record routes them. No changeset:docs/adr/is not published, and the PR carriesskip-changeset.Verification
Read first, by risk.
7272337479: the member is optional, and the service always passes a mode it settles.Two-minute check. One click: open the "Files changed" tab. Expected: one file, +27 −0, four hunks, every changed line an addition.
Landing.
docs/adr/**is a governed surface. It is opened as a draft. The hand-off to the maintainer is the seat's, and the merge is the maintainer's. Nothing here requests a reviewer, marks it ready, or arms auto-merge.CI on head
a909f81c. Check-runs read at 2026-11-30T08:30Z: 44 rows, 25 success, 19 skipped by their selectors, 0 failed, 0 pending. Every required context that runs on this diff is success:Lint & Repo Gates,TypeScript Type Check,Test Core,Governed Surface Queue Guard,Test UI,Dogfood Regression Gate.Check Changesetis one skipped row, theskip-changesetexemption.Gates, run locally on head
a909f81c.node scripts/pm/dispatch-gates.mjs --commandsderived 21 commands from the diff. All 21 were run, each exit code captured before any pipe, and all 21 are exit 0. The reconciliation:The 21 commands and their exit codes
Verdict lines of the gates that read the ADR
One gate first read NOT MEASURED, then green
pnpm --filter @objectstack/lint run check:doc-formula-expressionsfirst answered exit 3, PREREQUISITE NOT MET: two workspace packages it imports were not built in the fresh worktree. That is a run that measured nothing, not a red gate. The two packages were built under the shared verify lock, and the gate was run again:Left to CI, not run locally. The repo-wide lint, the type-check lanes, the test shards, and the families
dispatch-gatesprints outside the derived list (the artifact-roster, wide-population and pending-changeset families). The commit trailer gate was read on the pushed range before the push and is green.Human Minimum
pnpm lintis NOT MEASURED locally: the repo-wide scan is CI's, and the diff is one Markdown file.mainat5a77a7063e, one pull request.packages/specis not touched.content/docs/references/, to aCHANGELOG.mdor tocontent/docs/releases/.pnpm lintis as item 3 says.Generated by Claude Code