Repository navigation
Description
maintainer · os-bob · session_012dn2AecKpLaYkUtNRiqtby
Filing gate: ③ maintainer-directed (topic child). Source: topic #37000 (phase 2 row 10); maintainer 2026-11-24 「用fable评审,并分拆第二阶段的任务」. Reviewed by an independent Fable pass before filing.
Grading: area:ai · Feature · p2 (topic) · reach: apps that mount service-knowledge · evidence: read.
维护者速读
- 做什么:检索可以按记录返回。同一份制度命中多个片段时合成一条,取最高分;也可以按某个字段分组(比如按制度),返回「哪几份制度」。
- 记录在建索引之后改过内容的,不返回旧片段。
- 谁受益:制度问询先找到「哪几份制度」,再把全文交给模型;BrightRule 可以删掉自己写的去重。
- 需要你做的:无。
What
KnowledgeSearchOptions(packages/spec/src/contracts/knowledge-service.ts):granularity?: 'chunk' | 'record'(defaultchunk, today's behaviour) andgroupBy?: string. Return type staysKnowledgeHit[].knowledge-service.tssearch(): in record mode keep the best hit per group;topKcounts groups; builds on service-knowledge: search returns a short page after the permission filter instead of refilling #36993's refill after the permission filter, with a stated refill cap.groupBymust be one of the source'smetadataFields; a source without it answers no hits for that search (never ungrouped); the group value is returned in the hit'smetadata. File and http sources group bydocumentId.- The permission re-read stays
id+ the display field (resolveDisplayField, shared with service-knowledge: a knowledge hit's title is read from a hard-codedtitlefield #36994), as the asking user, in the same query. - Freshness, a separate query only for the hits that would be returned (at most topK records): one system-context read per object of the source's content and metadata fields with
{ $and: [where, { id: { $in } }] }. A record that no longer matcheswhere, or whose recomputed docHash differs from the hit's, is dropped. Repair is in process, not awaited, in system context, single-flight per (source, record) through service-knowledge: record-change sync ignores the sourcewhere, and a restored record never re-enters the index #36991's path, at most once per record per process lifetime until its hash matches; it never throws into the search. It moves to the queue with row 15. The hit carries the stored hash (KnowledgeHit.docHash?, per ADR: knowledge platform boundary — the platform owns document assembly, sync and reconcile, structural split and record-level return;knowledge_sourcebecomes a governed type #37001). - When a chunk has
headingPath(service-knowledge: one service-layer splitter (whole / recursive / markdown, Chinese-aware), the chunk channel and the split key #37098), the hit carries it (KnowledgeHit.headingPath?, per ADR: knowledge platform boundary — the platform owns document assembly, sync and reconcile, structural split and record-level return;knowledge_sourcebecomes a governed type #37001).
Acceptance
- One record with 3 matching chunks → 1 hit, the highest score.
topK: 5→ 5 records when that many exist within the refill cap (cap stated); fewer otherwise, logged.- A record deleted, unreadable, or out of
whereafter indexing → absent; content changed → no stale snippet, one repair. groupBy: 'policy'; agroupByfield missing from one source; system identity; several sources mixed; a file source.- Container run per AGENTS.md.
Out of scope
- New
search_knowledgetool arguments over MCP / in-app (epic row 12). - Grouping inside the adapter (in ADR: knowledge platform boundary — the platform owns document assembly, sync and reconcile, structural split and record-level return;
knowledge_sourcebecomes a governed type #37001's list). - The scope filter (row 11).
Blocked-by: #37001, #36993 (same function; record mode builds on its refill), #37098, #37096 (docHash). Coordinates with #36994: both use resolveDisplayField; #36994 sets the title at index time, this card reads it live in the permission re-read.
Parent: #37000. Reader: domain:server lane (spec edits per spec.md).
Dedupe: granularity 227 (open: none on knowledge besides #37000) · groupBy knowledge 25 (open 3: #37000, unrelated skills and seat posts).
Activity
objectstack-fleet commentedon Nov 24, 2026
triage#1 · os-warren · session_01JQwxbZKP5YM48rWMWTS7wE
Triage: first touch 2026-11-24T20:37Z
pm:blockedanddomain:serveradded. The card has no state yet, and itsBlocked-by:cards (ADR: knowledge platform boundary — the platform owns document assembly, sync and reconcile, structural split and record-level return;knowledge_sourcebecomes a governed type #37001, service-knowledge: search returns a short page after the permission filter instead of refilling #36993, service-knowledge: one service-layer splitter (whole / recursive / markdown, Chinese-aware), the chunk channel and the split key #37098, service-knowledge: adapters list their documents; a complete reindex skips unchanged documents and purges the ones its source no longer has; one contract test suite #37096) are still open.knowledge_sourcebecomes a governed type #37001). Triage's unlock scan moves the card when every blocker closes.