Skip to content

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

Backlog
6 of 14 issues completed

Description

@objectstack-fleet

repo:objectstack#8 · sunhaolin · session_017xRBcSSm1UGomShRsemA1N

Filing gate: ③ maintainer-directed (topic parent). Source: maintainer. Key words (maintainer, 2026-11-28, this session): 「使用 pm-dispatch 技能,立一个专题卡 包括 阶段 0 1 2」「然后使用 本账户下的 objectstack #8 座位开一个分区,专题派发此卡」; earlier in the same session, on scope: 「我们不能只考虑规章制度」「AI 整理我只是举例,不是必须的」「以上所有问题汇总用 fable 深度分析」. The phases below come from an independent Fable review of the session's analysis, which corrected it in three places (noted inline).
Grading: area:ai · topic parent (no type) · p2 · reach: every app that indexes long text through knowledge_source (policies, contracts, manuals, wiki pages, long ticket text) · evidence: measured on main 600197a against a 4,224-document real corpus (BrightRule), and read from the code.

维护者速读

  • 做什么:知识检索的切分与命中改造,面向任何长文本(制度、合同、手册、知识库、工单长文本),不只制度库。三件事:切分不丢内容、不挂错章节;一个单元(条、节、问答)恰好一段;每段带上它属于哪份文档、哪个单位;命中后模型能拿到相邻内容而不必读全文。
  • 谁受益:用知识检索作答的终端用户和 AI 助手;写知识源的应用作者(BrightRule 可去掉自写的「制度条款」派生对象和钩子)。
  • 分三阶段:阶段 0 修正确性(现在就派);阶段 1 零配置改进 + 文档 + 消融评测;阶段 2 段头配置、命中扩展、字段类型感知,顺序看阶段 1 评测结果再拆卡。
  • 要你做的:裁决子卡上的决策(第一张:「放得下的章节整节一段」做成 markdown 默认行为,还是只写进文档)。

Why (evidence, measured)

  • Today, on the real corpus, 4.9% of numbered articles land in exactly one passage under recursive (default); 71% share a passage with other articles. Re-measured by the Fable pass with a line-attribution metric; the session's first figure (16.6%) was biased upward.
  • The markdown strategy loses heading text: 918 heading lines in 65 documents appear in no passage and in no headingPath, including whole one-line articles; body-less sections are also filed under the next chapter's path. Read at splitter.ts:521-531, reproduced on synthetic samples.
  • With each unit written as a heading and split: { strategy: 'markdown', minChars: 800 } (equal to maxChars), today's code already gives 97.2% one passage per unit and 0% mixed passages; the app's own clause hook gives 95.5%. Correction to the session's analysis: issue service-knowledge: no split that keeps one passage per article; short articles are merged and tables lose the note after them #38290's option 2 is viable, with minChars = maxChars, not minChars: 0.
  • Embedding sees only the passage text (turso-adapter.ts:510); the document's title and owning unit are not in it. In the app's evaluation, passages that named their unit answered unit-scoped questions better (8/15 → 11/15 with the asker's unit in the prompt) while passages that did not got worse (10/15 → 7/15). 15 questions, one run: enough to start a card, not to rank it.
  • The 84% → 94% long-document gain quoted in service-knowledge: no split that keeps one passage per article; short articles are merged and tables lose the note after them #38290 changed at least six variables at once (unit, passage prefix, merged sources, dedupe, skill rules, removed examples), one run against three, with a 4–5 point run-to-run range. It is not evidence for splitting alone; phase 1's ablation is.

Phase 0: correctness (dispatch now)

Child Scope Blocked-by
#38350 — markdown drops body-less headings A body-less section's heading is kept with its whole parent path; a carried heading never crosses a parent section; the end-of-document carry is not dropped (an unclosed code fence keeps its CommonMark meaning). Acceptance: 0 heading lines lost on the measured corpus; property test "every non-blank source line is in some passage's text or path". #38349
#38349 — split version per strategy The split algorithm version is read per strategy, so a change to one strategy rebuilds only that strategy's sources (knowledge-index-fingerprint.ts). none

Phase 1: zero-config improvement, docs, evaluation

Child Scope Blocked-by
#38351 — a fitting leaf section is one passage (decision owed) markdown: a leaf section that fits maxChars is one passage, in the same version bump as 0-1 when the ruling lands first. Acceptance on the measured corpus after units are headings: ≤0.5% of units under maxChars split; 0 mixed; fitted table + note together ≥95%. #38349
#38290 (adopted) Docs: the one-passage-per-unit recipe (one heading per unit; a derived field on the same record carries the index text; an optional synthetic top heading names the document and its unit); minChars is a merge threshold; the settings page's chunk_target label and help text agree. Then answer #38290. #38350, #38351
1-3 (row) Ablation in the app's evaluation repo: unit (heading / article) × passage header (on / off) × after the hit (passage only / whole section / whole record), vector search, ≥3 runs per cell, mixed-version blind grading, 30 new questions that tuned nothing. Its result orders phase 2. Reader: the maintainer's evaluation session (not a fleet card). none

Phase 2: context and hits (rows; split into cards after 1-3 reports)

Row Scope
2-1 source.header: string[] beside content: the listed fields form one line that leads every passage of the record and is embedded with it; a lookup reads its display value, a select its label; same egress and withheld-field rules as content; a fingerprint change. No cross-object paths in the first version.
2-2 Hits return the source's declared metadataFields: landed (#38291, PR #38353); related, not a child. What is left, the parent record's display values (a hit carries the parent's id, not its name), is part of #38412's expand.follow.
2-3 Hit expansion: fetch the neighbouring passages, or every passage under the same heading path, by documentId. Carried by #38412 (expand), which also proposes following one declared lookup from the hit (the related record's display fields or passages, re-checked as the caller; no separate graph store); it stays a row here if that ruling declines the block.
2-4 Content field types: html / richtext fields become structured text before splitting; separate content fields are never merged into one passage; optionally the field name leads the path.
#38411 — keyword leg for unspaced CJK questions A Chinese, Japanese or Korean question written without spaces is one keyword term today, so the keyword leg ranks nothing; split CJK runs into overlapping 2- and 3-character pieces in both stores. Query-side only, no rebuild. Not ordered by 1-3: a defect, dispatchable now.
#38412 — declared retrieval block (decision owed) Per source: affinity (a declared field against a platform-resolved fact about the asker: boost, filter or nearest in a hierarchy), recency (decay on a declared date field), expand (row 2-3 plus one declared lookup hop). Omitted means today's order; ranking only, after the permission re-check. Blocked-by: #38363 for affinity.
#38363 (adopted) — an MCP client's model is told who is signed in The asker's user, organization, unit chain, teams and positions reach the model (an initialize paragraph, a read-only tool as fallback); lands in packages/mcp, outside this topic's file territory. Prerequisite of #38412's affinity.

Out of this topic (file only when a second consumer asks): a numbered-outline preset (auto-selected level families, guarded against fake headings, no user regex); copying a table's note onto each cut piece; passage-level dedupe; AI structure annotation or AI passage context. Normalising an app's Markdown (deterministic or AI) stays with the app; the platform keeps markdown correct on normalised input.

Rules every child keeps

  • A key lands with its first reader in the same PR (ADR-0049); no key ships without its enforcer.
  • Embedding is egress: whatever enters a passage (content or header) is listed explicitly; credential-class and internal fields never enter.
  • A passage stays a slice of the source text plus the declared header and path; nothing the platform generates is mixed into quoted text.
  • Changes that change passages for the same input bump the strategy's algorithm version once per release train, not once per card.

Done when

On the measured corpus with units written as headings: no source text is lost; ≥97% of units are one passage under the documented recipe; each passage carries its document and unit when the source declares a header; and the ablation reports the effect of splitting, header and hit expansion with intervals.

Exception note (pm:epic on a server line): opened by the maintainer's words above; territory = packages/services/service-knowledge/src/split/**, packages/services/service-knowledge/src/knowledge-index-fingerprint.ts, content/docs/ai/knowledge-rag.mdx; phase 2 adds packages/spec/src/ai/knowledge-source.zod.ts, packages/services/service-knowledge/src/knowledge-service.ts (recordToDocument), packages/services/service-knowledge/src/knowledge-tools.ts and packages/plugins/knowledge-* when its cards are split.
Reader: repo:objectstack#5 (handed over 2026-11-28 by the maintainer's word 「知识切分专题也交给5号座位」; earlier repo:objectstack#8, zone knowledge-split, area session session_017xRBcSSm1UGomShRsemA1N, released).
Related, not children: #37000 (knowledge platform topic), #37098 (the splitter, closed), #37001 (platform boundary ADR, closed), #38291 (hit metadata, in flight elsewhere).
Dedupe (open and closed): splitter markdown heading 3 (#38290 open, #37098 closed) · knowledge split 278 (no open card on the split behaviour but #38290) · minChars 5 (#38290, #37292, #37098, #37001 closed; #37309 Studio form, unrelated) · knowledge header passage 18 (#38291 the only open match) · search_knowledge neighbour passages 0 cards · knowledge html richtext 0 cards · SPLIT_ALGORITHM_VERSION 0.

Sub-issues

Sub-issues

6 of 14 Issues completed
Loading 14 sub-issues

Activity

  1. added
    priority:p2
    pm:epic
    area:ai
    on Nov 28, 2026
  2. objectstack-fleet commented on Nov 28, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#8 · sunhaolin · session_017xRBcSSm1UGomShRsemA1N

    维护者速读

    Handover

    Maintainer's words (2026-11-28, this session, in order): 「除了收尾了任务,剩下的任务都挂到知识专题下,交接给5号座位继续处理」「知识切分专题也交给5号座位」.

    From repo:objectstack#8, zone knowledge-split, area session session_017xRBcSSm1UGomShRsemA1N → to repo:objectstack#5. The topic's Reader: line now names seat 5. Seat 8's zone is released: no lease, no claim, no open PR is left behind.

    Done (closed, no action)

    Card / PR What landed
    #38349 · PR #38375 (ba33ea2) Split algorithm version per strategy (SPLIT_ALGORITHM_VERSION_BY_STRATEGY); no index rebuilt.
    #38350 · PR #38380 (9b783ee) markdown keeps every heading: on the 4,224-document corpus, heading lines lost 918 → 0. markdown: 2.
    PR #38383 (no card) Heading and table-separator reading made linear; 16,896 runs, 0 output differences; version not bumped.

    Handed over (open, children of this topic, none claimed, no open PR)

    Card State Next step
    #38351 needs-user-decision Await the ruling (below).
    #38290 needs-user-decision Answered by #38351's ruling; docs follow it.
    #38377 pm:queue, p3 Close-out of PR #38375: retire SPLIT_ALGORITHM_VERSION (narrowing) and add the ADR-0161 K7 revisions row.
    #38368 pm:queue, p2 ADR-0161 dated note: mounted ≠ enabled. Governed (docs/adr/**): the maintainer approves the merge. The three ◆ choices are already ruled 「以上都同意」.
    #38369 pm:blocked (Blocked-by: #38368) Implementation of the note; a narrowing (ADR-0087 entry, BREAKING changeset).
    #38371 pm:queue, p2 · time-sensitive Starter namespace starter → biz.
    #38372 pm:queue, p2 · time-sensitive Help-article object, view and seed in the Starter and the blank template. Same files as #38371: run them in sequence, not in parallel.
    #38373 pm:queue, repo:cloud Cloud carrier: confirm the biz_ rename reaches new workspaces. Follows #38371.
    #38374 pm:blocked Knowledge source over the help articles. Waits on #38369 and #38372.

    Related, not a child: #38352 (needs-user-decision, parent #37000). Triage noted that #38368 settles option A's premise.

    Pending rulings (carry them to the maintainer)

    1. service-knowledge: a markdown section that fits maxChars is still cut into several passages #38351. Fable recommends option A. If A is ruled, change the acceptance line to "a table and its note inside a fitting section are always one passage". service-knowledge: no split that keeps one passage per article; short articles are merged and tables lose the note after them #38290's docs follow from the same ruling.
    2. [Decision] Search the package manuals (doc metadata) through the knowledge service: which of three shapes #38352: A vs E. E is a pause with Restart-when: closed #38368. The maintainer said 「38352 手册搜索暂停」 and also asked for an analysis; the analysis was given in this session. Get the final letter recorded on the card.

    Watch out for

  3. objectstack-fleet commented on Nov 28, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · sunhaolin · session_017xRBcSxvUE3fDrox79CL9t

    Maintainer ruling recorded · 2026-11-28T23:16Z · topic #38346 is handed over to seat repo:objectstack#5.

  4. os-project-manager commented on Nov 29, 2026

    @os-project-manager
    Collaborator

    maintainer · os-project-manager · session_01FEkQ5oW6SeQkzCccNxEc83

    Cards added to this topic on the maintainer's words (2026-11-29, this session): 「相关任务都加入知识专题」. They come from a policy Q&A evaluation over MCP on 19.0.0-next.2 (tooling: objectstack-ai/brightrule#88); each is written as a platform capability for any metadata app, per 「你的评估不能只考虑当前的规章制度,要考虑客户可能开发的各种元数据应用」.

    Body edit: the phase 2 table only. Rows 2-2 and 2-3 were updated (2-2 landed as PR #38353; 2-3 is carried by #38412's expand), and three rows were added. Nothing else in the body changed.

    Children added:

    Related, not children:

    Not filed: per-connection MCP tool subsets. The evaluation used 3 of the 21 tools served, but its token cost per question is most likely accumulated retrieval output, not the tool list; that is an unmeasured performance observation, so it gets no card until someone measures the tool list's share.


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:aipm:epicpriority:p2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions