Repository navigation
Description
repo:objectstack#5 · os-project-manager · session_01FEkQ5mzSTSPADAvwapnhxr
Filing gate: ① ruled. Ruling-ref: 7251603512 on #38412 (maintainer 「A 精简:排序加带出」, option A-lean; analysis 7251063339). Built to the ADR-0161 dated note of 2026-11-29 (PR #38511, merged; card #38502), K1 "What follows from the two lists". Body rewritten by the seat after the note landed (the first body said "both stores" and predates the note's shape).
Grading: area:ai · Feature · p3, dispatched in the topic's order · reach: every app with a knowledge source · contract-tier review (a new authorable key, built to the note).
Part of #38346.
维护者速读
- 做什么:知识源可以声明
expand.window(一个正整数):命中一段内容时,把同一文档里前后各几段一起带出来,答案不再被截在半句。 - 为什么:[Decision] knowledge_source: a declarative
retrievalblock — rank hits by the asker's relation to a declared field, by recency, and expand a hit along declared structure #38412 裁定 A 精简的第一片,按 docs(adr): ADR-0161 dated note, a knowledge source declares how its hits are ordered for the caller and what a hit brings #38511 落地的注记做;不依赖「是谁在问」,可以最先做。 - 影响:只在知识源声明了这个键时生效;没声明的源回答和今天逐字节相同。不重建索引。
- 要你做的:无。
What
Build source.expand.window exactly as the note fixes it (the note's bullets "◆ expand.window", "◆ Neighbouring passages are cut again from the record", "When a hit brings no neighbours", "◆ How an expansion rides", "Refused when it is written", "No index is rebuilt"):
- The key, on the object arm, with its first reader (K4, K10 rule 1). Set the upper bound of
windowand state it on the key (the note fixes no number). - Neighbours are cut again from the hit's record (
splitDocument) under the expected fingerprint when the record's hash equals the hit'sdocHash; no adapter member is added. Only adapters declaringcapabilities.chunks. - They ride as
neighbours{ offset, snippet, headingPath? }beside the hits on the report the tool already reads;KnowledgeHitgains no key,IKnowledgeService.searchkeeps its signature, the tool gains no argument. - Not counted in
topK, not ordered, no passage answered twice in one answer; under record granularity, the neighbours of the passage standing for the record or group. - The no-neighbour cases answer the hit as today with nothing saying why, and the stale-hash case repairs the document as the freshness check does.
- Refusals at write time:
windowon awholesplit; not a positive integer; over the bound. - Carry nit N4 of the note's review: one log line when a whole batch's re-cut comparison fails.
Acceptance
- A source declaring
windowreturns each hit with its neighbours, attached only for a row that passed the caller's re-check in this search; a source not declaring it answers byte-for-byte as before. - Each no-neighbour case of the note is pinned (no
chunkscapability, nodocHashor record id, hash behind the record, no passage with the hit'schunkIdor asnippetmismatch, a failed read). - The refill bound and the no-count rule (K9 rule 6, K10 rule 4) hold; tests pin both.
- The docs sentences this code makes untrue are rewritten in the same PR, never ahead of it (K2).
Not in scope: affinity (#38503); expand.follow (#38505); the heading-bounded mode (siblingsBy, not taken by the note); filter mode; date decay; any opt-out argument on the tool.
Dedupe: expand neighbouring passages knowledge_source 0 open.
Activity
objectstack-fleet commentedon Nov 29, 2026
triage#1 · sunhaolin · session_017xRBcSxvUE3fDrox79CL9t
Triage: lands in
packages/spec/src/ai/knowledge-source.zod.ts(theexpandneighbouring-content key) andpackages/services/service-knowledge(knowledge-tools.tshit shape, re-cutting neighbours from the live record), with pins · area:ai · domain:server (+ domain:spec for the key) · Feature · p3 · pm:blocked (Blocked-by: #38502, in the body) · size M. Rationale: theexpandsiblings slice named by the maintainer's #38412 ruling (record 7251603512), so pre-authorised execution. Its key and reading are fixed by the Tier H note #38502 (draft PR #38511). The card carried no pm state, a half state this touch resolves. Once the note merges, the seat rewords "both stores": the note re-cuts neighbours from the live record and changes no store.Recorded 2026-11-29T06:54Z.
docs(adr): ADR-0161 dated note, a knowledge source declares how its h…
feat(knowledge): a knowledge source orders its hits for the person as…