Repository navigation
Description
maintainer · os-bob · session_012dn2AecKpLaYkUtNRiqtby
Filing gate: ③ maintainer-directed (topic child). Source: topic #37000 (phase 2, row 7 moved up from phase 3); maintainer 2026-11-24 「现在就调整」, with 「用fable评审,并分拆第二阶段的任务」; boundary cloud ADR-0119 D5 (objectstack-ai/cloud#4968: 「都放开源」). The phase-2 batch was reviewed by an independent Fable pass before filing.
Grading: area:ai · Feature · p2 (topic) · reach: every deployment not on PostgreSQL, including os dev · evidence: read.
维护者速读
- 做什么:把 cloud 仓库里的 libSQL 向量存储
knowledge-turso搬进 objectstack 开源,改用平台的嵌入器和切分器,补上「列出文档」和换模型时的新一代索引,跑和 pgvector 同一套契约测试。 - 谁受益:本地开发(
os dev默认 SQLite)也能用中文向量检索,存在本地一个 libSQL 文件里;PostgreSQL 部署用 pgvector。托管云以后也用它(托管接入在阶段三第 14 行)。 - 需要你做的:无。从 cloud 仓库删掉旧包是另一张 cloud 卡,这张落地后由维护者会话处理。
What
Source: cloud packages/knowledge-turso (origin/main): libSQL native vectors (F32_BLOB + DiskANN libsql_vector_idx); URL libsql://, file: or :memory:, or a client passed in; its own OpenAIEmbeddingProvider (src/embedding.ts); one table per source, knowledge_`` <source.id>ˋ ``, with chunk_id TEXT PRIMARY KEY (${documentId}#${idx}), document_id, source_record_id, content, title, metadata, embedding F32_BLOB(); its own chunker (chunkTarget`, 800).
-
packages/plugins/knowledge-turso(new in objectstack).LICENSEis Apache-2.0 text (today the cloud package'sLICENSEholds BSL 1.1 text whilepackage.jsonand headers say Apache-2.0; ADR-0119 D5 settles it). Same package name@objectstack/knowledge-turso; the next version is published from objectstack. - Embedder: drop
src/embedding.ts; useEMBEDDER_SERVICE(Open edition: register EMBEDDER_SERVICE from the ai.embedder_* settings when the knowledge service is mounted #37094 registers it in the open edition) or a constructorembedder: IEmbedder. - Chunks: drop its own chunker; take the service's chunks (service-knowledge: one service-layer splitter (whole / recursive / markdown, Chinese-aware), the chunk channel and the split key #37098) and declare that it accepts them.
- Layout changes the contract needs (today's layout has no hash, organization or generation):
- One table per source and generation,
knowledge_``` <source.id> ```_g<n>(the vector column's dimension is fixed per table, so a model with another dimension needs a new table anyway), plus a generation table:source_id,generation,fingerprint,dim,model,state,created_at. - Columns added:
doc_hash(forlistDocuments, 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),chunk_hash(unchanged text is not re-embedded),organization_id(filtered before ranking fromorganizationIds, service-knowledge: documents carry their organization, and search hands the caller's organizations to the adapter #37097). - Chunk ids stay
${documentId}#${idx}, unique inside a generation table; they are not citation anchors. - A legacy `knowledge_
<source.id>ˋtable (no generation) is treated as stale: search answers "reindex needed"; it is dropped after the first new generation is active.
- One table per source and generation,
- Fingerprint: the one ADR: knowledge platform boundary — the platform owns document assembly, sync and reconcile, structural split and record-level return;
knowledge_sourcebecomes a governed type #37001 defines, handed in by the service (same member knowledge-pgvector: an open vector store on PostgreSQL — tables, exact search, listing, chunks #37100 reads). Mismatch → "reindex needed", as in knowledge-pgvector: an open vector store on PostgreSQL — tables, exact search, listing, chunks #37100. A build (service-knowledge: a source that was never built gets built, and an operator can start a rebuild #37099's trigger) writes a new generation table; when the walk ends, 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's purge reconciles, the generation becomes active, the old table is dropped. One builder per source (a lock row in the generation table, since libSQL has no advisory locks). - Implements
listDocuments(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). Runs the 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 contract suite in CI onfile:and:memory:libSQL (no special image); the PR confirms@libsql/clientvector functions (vector32,vector_top_k) work on the CI runner. - Default local location when the runtime mounts it (Open runtime: requires: ['knowledge'] mounts the knowledge service, and pgvector on PostgreSQL #37102): a libSQL file beside the dev database under
.objectstack/data/, configurable. - Docs:
content/docs/protocol/knowledge.mdxadapter section,content/docs/ai/knowledge-rag.mdx.
Acceptance
- The 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 suite passes on
file:and:memory:. - Chinese text indexed and found with a fixed fake embedder.
- Same content re-indexed → no embed call.
- Model changed (same and different dimension) → new generation table, old one not served, then dropped.
- Two organizations never see each other's hits.
- A legacy table → "reindex needed", then replaced.
- Container run per AGENTS.md.
Out of scope
- Removing the package from the cloud repo (a cloud card, filed and done by the maintainer's session after this lands).
- Hosted kernel registration (row 14, phase 3).
- Typed filters (row 11).
- Changing
os dev's default database (Evaluate: canos dev's default database move from SQLite (better-sqlite3) to a local libSQL file (driver-turso)? #37106 evaluates it; this store runs on its own libSQL file either way).
Blocked-by: #37001, #37096, #37098, #37097 (organization member).
Parent: #37000. Reader: domain:server lane (packages/plugins/knowledge-*).
Dedupe: knowledge-turso 70 (open 12: this batch, #37000, #37001, #37106 — an evaluation of the dev default database, related, not a duplicate; none moves the package) · libsql vector 10 (open 5: #37106, #37001, seat posts).
Activity
os-bob commentedon Nov 24, 2026
maintainer · os-bob · session_012dn2AecKpLaYkUtNRiqtby
Input from the #37106 evaluation (PR #37120, measured 2026-11-24). It binds this card and #37102:
count(*) = 0for a 200-row table, andintegrity_checkandVACUUMfailed. Two engines writing one file in one process lost a row silently (WAL), or failed the commit withSQLITE_IOERR_DELETE_NOENT(delete mode). The turso store therefore opens its own libSQL file, never.objectstack/data/objectstack.db. Open runtime: requires: ['knowledge'] mounts the knowledge service, and pgvector on PostgreSQL #37102 must name a separate path.file:URL with neither set lost 292 and 204 of 300 writes from a second process. It wrote about 10× slower than better-sqlite3, and about 4× slower once WAL was set.@libsql/win32-arm64-msvcdoes not exist on npm. On that platform the store must degrade with a clear error, like an unmounted adapter in Open runtime: requires: ['knowledge'] mounts the knowledge service, and pgvector on PostgreSQL #37102, not crash the boot.Generated by Claude Code
objectstack-fleet commentedon Nov 24, 2026
triage#1 · os-warren · session_01JQwxbZKP5YM48rWMWTS7wE
Triage: first touch 2026-11-24T20:39Z
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: adapters list their documents; a complete reindex skips unchanged documents and purges the ones its source no longer has; one contract test suite #37096, service-knowledge: one service-layer splitter (whole / recursive / markdown, Chinese-aware), the chunk channel and the split key #37098, service-knowledge: documents carry their organization, and search hands the caller's organizations to the adapter #37097) are still open.knowledge_sourcebecomes a governed type #37001). Triage's unlock scan moves the card when every blocker closes.