Skip to content

knowledge-turso: approximate (libsql_vector_idx) search for large sources, chosen by size, never on a multi-organization store #37975

Description

@objectstack-fleet

repo:objectstack#1 · os-elon-musk · session_016WV4cwPhGV4g9p1BGQaZbP

Filing gate: ③ maintainer-directed (topic child of #37000) · Source: maintainer (hotlong, cloud #5 project thread, 2026-11-27 13:41Z): 「但是我们作为元数据开发平台,不能只考虑制度库」 · Spec: objectstack#37000 comment 7220000671 · relayed by seat repo:objectstack#1 (mailbox #37561 comment 7220012379)
Grading: area:ai · Feature · p3 (topic) · reach: a hosted organization whose source holds more than about 20k passages (ticket history, visit notes, emails); at 1,536-dim float32 one exact search reads ~150 MB at 20k passages and ~1.5 GB at 200k · evidence: read on main 0b539b6.
Dedupe: is:issue knowledge vector index approximate → 2 (open: #37000 parent, #12708 seat post) · is:issue libsql_vector_idx → 3 (open: #37000 parent only).
Reader: area o1-C of seat repo:objectstack#1 claims it after triage's first touch.

维护者速读

  • 问题:现在每次检索都逐条扫完整张段落表,段落多了(工单、拜访记录、邮件动辄几十万条)会很慢。
  • 做什么:单个知识源段落超过阈值(默认约 2 万条,可配)时,建 libSQL 的近似向量索引走快速检索,再按组织、元数据过滤并逐条复核权限;可见记录少的调用者仍走精确的索引路径。存储里有多个组织时绝不走这条路。
  • 谁受益:托管版上知识量大的客户,检索速度。
  • 需要你做的:无。

What

Premise re-read on main 0b539b6: the store creates no DiskANN index because vector_top_k ranks before the organization filter (packages/plugins/knowledge-turso/README.md:49, turso-adapter.ts:189). On hosted, one organization per database (cloud ADR-0114), so that filter is moot there.

Acceptance

  • At 200k passages, p95 search latency is under a stated bound (measure it and put the number in the PR).
  • recall@10 against the exact scan is ≥ 0.95 on a sample.
  • A store holding more than one organization never takes the ANN path (pinned).

Activity

  1. added
    pm:queue
    area:ai
    on Nov 27, 2026
  2. objectstack-fleet commented on Nov 27, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Triage: lands in area:ai · domain:server · Feature · p3 · pm:queue · size M; rationale: maintainer-directed knowledge-topic child (#37000): approximate vector search for large Turso sources, chosen by size and never on a multi-organization store. A scale feature, so p3 as filed. Recorded 2026-11-27T14:16Z.

  3. added
    domain:server
    on Nov 27, 2026
  4. objectstack-fleet commented on Nov 27, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#1 · os-elon-musk · session_016WV4cwPhGV4g9p1BGQaZbP

    Claim: PM loop round 9 · area o1-C (epic #37000; area concurrency 8 by the maintainer 2026-11-27T11:26Z) · 2026-11-27T19:52Z
    Session: session_016WV4cwPhGV4g9p1BGQaZbP
    Account: os-elon-musk
    Branch: claude/area-o1C-37975
    Worktree: objectstack-issue-37975
    Domain: domain:server
    Area: o1-C
    Seat: repo:objectstack#1
    File surface: packages/plugins/knowledge-turso/src/turso-adapter.ts + sql.ts (a per-source passage-count threshold option, a libsql_vector_idx built above it, the vector leg via vector_top_k(k × factor) then the in-scope WHERE and the per-hit re-check; the keyword leg and RRF merge unchanged), knowledge-turso tests (threshold switch, multi-organization store never ANN, recall@10 sample against the exact scan, a latency measurement), packages/plugins/knowledge-turso/README.md (the Search paragraph), content/docs/ai/knowledge-rag.mdx if it names the exact scan, a changeset.
    Container & model: M, mode:subagent, model: default tier (dispatch-gates --tier: "no path-derived mandate"), effort: high (reason: M; an index whose ranking precedes the filter, so the organization rule and the over-fetch factor carry correctness, plus a measured latency and recall)
    Clause-②: no
    Metadata-protocol: none
    Responsibility: objectstack's own code, packages/plugins/knowledge-turso/src/turso-adapter.ts | a search over a source with hundreds of thousands of passages reads every vector on each call | a hosted organization with a large knowledge source
    Thread-read: 7220587871
    Premise: holds, read on origin/main c151c49 (after #38037) — README.md:49 and turso-adapter.ts:189 / :205 / :217: the vector leg is an exact cosine scan and the store creates no DiskANN index because vector_top_k ranks before the organization filter.
    Serial constraints cleared: probe overlap-check (turso-adapter.ts, sql.ts, README.md) against origin/main and every open PR: VERDICT clean exit 0, no PR shares a file. #38037 (hybrid, same search SQL) merged at c151c49, so this card's wait is over. F3 #37957 (visible-ids cap) is not started; the card's "callers whose visible ids fit the F3 cap keep the exact path" lands with whichever of the two lands second, and the PR says so.
    Pre-claim lane: packages/plugins/knowledge-*/** ⇒ domain:server.
    Pre-claim deps: none open; triage 7220587871 sized it M.
    Prior rulings read: card thread 0 rulings (triage 7220587871).
    Fold-or-serial: not folded with #37957 (different surface: search options in the service; serial by the rule above).

  5. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:aidomain:serverpm:dispatchedpriority:p3

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions