Repository navigation
Description
maintainer · os-project-manager · session_01FEkQ5oW6SeQkzCccNxEc83
Filing gate: ② a decision only the maintainer can make (topic child; a new authorable key needs a ruling and an ADR-0161 note before any code). Source: topic #38346. Key words (maintainer, 2026-11-29, this session): 「检索按提问人单位加权,每种知识的要求不同吧,你的评估不能只考虑当前的规章制度,要考虑客户可能开发的各种元数据应用」「相关任务都加入知识专题」.
Grading: area:ai · Feature · p3 (dispatched in the topic's order after the ruling, not by grade) · reach: every app whose right answer depends on who asks or on how fresh the record is · evidence: measured in one evaluation with the asker simulated in the prompt (below); the rest read from the code on main 3511432.
Blocked-by: #38363
维护者速读
- 问题:同一个问题,不同的人问,应该排在前面的内容不一样(本单位的制度先于集团的;自己的客户纪要先于别人的;本产品线的工单知识先于其它线),而且每种知识的规则不同。现在检索对所有人按同一个顺序排,模型只能反问「你是哪个单位的」。
- 选项:A 在知识源上加一段声明式的「检索排序」配置,写明哪个字段和提问人的哪种身份相关、怎么用(加权、只留相关的、就近优先)、按哪个日期字段衰减、命中后带出哪些相邻或关联内容;不写就完全不加权。B 不加平台能力,把提问人身份告诉模型,由各应用在技能说明里教模型自己加过滤条件。
- 推荐:待决策线程按四轴写(本卡给证据、形状和四类应用的适配表)。
- 不定会怎样:每个应用各自在提示词里写一套「按单位找」的规则,效果随模型波动,换一种知识就要重写。
The question
May a knowledge_source declare, per source, how its hits are ordered for the person asking, and what a hit brings with it? If yes, in which shape, and as ranking only.
Evidence
- In a policy Q&A evaluation (1,923 documents / 67,379 passages, libSQL store, 132 questions; a small model answering over MCP, a separate model grading blind; one run), putting the asker's unit chain in front of the model moved the whole set from 86.7% to 92.4%, the questions whose answer depends on the asker's unit from 59.4% to 93.8%, and the turns that ended in a clarifying question from 41 to 2. That measures "the model knows who asks" (mcp: tell the model who is signed in — the asker's user and business-unit chain reach the ask route (cloud#5099) but not an MCP client #38363), with the model then doing the narrowing itself. It is the upper-bound signal for this card, not a measurement of platform-side ranking.
- What the platform has today:
search_knowledgeacceptsquery,sourceIds,topK,scope,granularity,groupBy(packages/services/service-knowledge/src/knowledge-tools.ts:321). The service contract already has a metadata-equalityfilter(packages/spec/src/contracts/knowledge-service.ts:62-63, run in both legs by both stores) that the tool does not expose. The search already over-reads and refills after the permission re-check (SEARCH_REFILL_FACTOR = 20,knowledge-service.ts:4402). The adapter contract carries "no rerank toggles" (packages/spec/src/contracts/knowledge-adapter.ts:18-19, ADR-0161 K8 rule 4), so ordering by declared fields belongs to the service, over the indexedmetadataFieldsvalues, not to adapters. - Identity vocabulary that already exists for predicates:
current_user.positions, the pre-resolved membership sets (rlsMembership,packages/spec/src/kernel/execution-context.zod.ts:569-585), and the declarative membership keys of Spec design: declarative membership keys for RLS (current_user.<key> from a lookup on records whose user field is the current user) #25234 (ruled, closed).
Proposed shape (option A; for the decision thread to confirm or reshape)
retrieval: {
affinity: [{ field, asker, mode, weight }],
recency: { field, halfLifeDays },
expand: { siblingsBy, window, follow },
}affinity[].field: one of the source'smetadataFields(refused at publish otherwise).affinity[].asker: a CLOSED vocabulary resolved by the platform from the caller's execution context, the same way row-level predicates readcurrent_user.*:userId|positions|businessUnitChain|teams|organization. ⛔ Never a value the client or the model supplies.affinity[].mode:boost(matching hits rank higher byweight),filter(only matching hits; the service passes it as the existingfilter/ scope),nearest(for a hierarchy: the asker's own unit first, then each ancestor in order, then the rest).recency: an exponential decay on a declared date field of the source'smetadataFields.expand: what a hit brings with it, each part re-checked as the caller:siblingsBy+window: the neighbouring passages of the same document or heading path (this is row 2-3 of Topic: knowledge splitting and retrieval for any content, phases 0–2 (no lost text, one passage per unit, passages that carry their context, hits a model can use) #38346, absorbed here if the ruling takes option A; otherwise it stays a row).follow: a declared lookup or master-detail field of the indexed object, ONE hop: the related record's display fields, read at query time under the caller's row- and field-level permissions and never stored in the index, and optionally that record's own best passages when it is indexed by a source the caller may search. This covers "supersedes", "references", "forwarded from", contract ↔ amendment, and the parent of a child-record passage (the residue of search_knowledge: hits do not return the source's metadataFields, so a child-record passage needs an extra read to find its parent #38291: a hit'smetadatacarries the parent's id, not its name). The object model is already a typed, permissioned graph; no separate graph store or graph extraction is proposed.
- Omitted block: today's behaviour, byte for byte. A public FAQ source declares nothing.
- Ranking only. It runs over the candidates that survived the permission re-check, inside the existing refill cap; it never widens what a caller may read, and
filtercan only narrow. The count of hits removed stays unreported, as today. - Each key lands with its reader in the same PR (ADR-0049);
affinitywaits for mcp: tell the model who is signed in — the asker's user and business-unit chain reach the ask route (cloud#5099) but not an MCP client #38363's identity resolution,recencyandexpand.siblingsBydo not.
The same four keys across unrelated apps
| App | affinity |
recency |
expand |
|---|---|---|---|
| CRM visit notes | owner ↔ userId, boost; territory ↔ teams, filter |
activity_date, 90 days |
follow: account |
| Support knowledge base | product_line ↔ teams, boost; the public FAQ source declares nothing |
reviewed_at, 365 days |
siblingsBy: heading |
| Contracts | signing_entity ↔ businessUnitChain, filter |
effective_date |
follow: amends (contract ↔ amendment) |
| Policies | owning_unit ↔ businessUnitChain, nearest (own unit before the group) |
none | follow: supersedes, siblingsBy: heading |
No row needs code in the app, and no key names a policy concept.
Options
- A: the declarative block above, in slices: (1)
recencyandexpand.siblingsBy, no identity needed; (2)affinity, after mcp: tell the model who is signed in — the asker's user and business-unit chain reach the ask route (cloud#5099) but not an MCP client #38363; (3)expand.follow. One ADR-0161 dated note first. - B: no platform ranking. mcp: tell the model who is signed in — the asker's user and business-unit chain reach the ask route (cloud#5099) but not an MCP client #38363 tells the model who asks;
search_knowledgeexposes the existingfilterovermetadataFields; each app's skill text teaches the model to narrow. Cheaper; depends on the model following instructions, and has no "nearest in the hierarchy" or decay. - C: A's
expandonly (it is hit shape, already on the topic as row 2-3), with ranking left to B until a second app asks.
Decision owed
Analysis (four axes, facets block, prior-rulings line, workload precedents) is owed by a decision thread. Not dispatched before a ruling is recorded here. Open points for that thread: whether filter mode is allowed at all given that sharing already decides visibility (a source-declared filter is a relevance narrowing, and must not be read as access control); the combination rule when several affinity entries match; how granularity: 'record' and groupBy interact with a re-rank; whether the tool gains an explicit opt-out for a caller who wants the unweighted order.
Reader
The decision thread, then repo:objectstack#5 (the seat holding #38346).
Related, not children: #38291 (hit metadataFields, landed as PR #38353), #25234 (declarative membership keys for row-level security, the precedent for a platform-resolved asker vocabulary), #37001 (ADR-0161, the knowledge platform boundary), #37000 (knowledge platform topic), objectstack-ai/brightrule#88 (the evaluation tooling).
Dedupe (open and closed): knowledge rerank 3 (none on declared ranking) · knowledge_source retrieval ranking asker 0 · knowledge recency boost 0 · search_knowledge neighbour passages 2 (#38346 row 2-3 only) · search_knowledge filter metadata argument 13 (all closed; none exposes filter on the tool) · knowledge graph 68 (none on knowledge retrieval; no graph card is filed, by the reasoning under follow).
Activity
objectstack-fleet commentedon Nov 29, 2026
triage#1 · sunhaolin · session_017xRBcSxvUE3fDrox79CL9t
Triage: lands in
packages/spec/src/ai/knowledge-source.zod.ts(a new authorableretrievalblock), the readers inservice-knowledge(knowledge-service.ts,knowledge-tools.ts) and an ADR-0161 dated note · area:ai · domain:spec (provisional; the readers are domain:server) · Feature · p3 · needs-user-decision (as filed) · size L. Rationale: a new authorable key with no precedent. That is a contract shape, and itsfiltermode sits beside the permission boundary, so it is on the human floor. The topic pre-authorises building, not the shape. A child of #38346, never folded or moved.Blocked-by: #38363applies only to option A slice 2. ⛔ The decision thread owes the four-facet block, thePrior rulings read:line and the recommendation before it is presented.Recorded 2026-11-29T00:50Z.