Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
6ee3b96
refactor(service-knowledge): split KnowledgeService into concern face…
claude Nov 30, 2026
525fb38
refactor(service-knowledge): register KnowledgeService in the facade …
claude Nov 30, 2026
4c4a984
refactor(service-knowledge): facets as host-typed functions the censu…
claude Nov 30, 2026
bac87c0
chore(service-knowledge): ceiling row measured on the split head
claude Nov 30, 2026
5fffac6
Merge origin/main into claude/project-thread-e6npb2
claude Nov 30, 2026
1b7a98c
docs(service-knowledge): name the facet modules in the host and top-l…
claude Nov 30, 2026
6829ee1
docs(service-knowledge): a private member with no docblock is named s…
claude Nov 30, 2026
ad4f458
chore(spec): the knowledge_source liveness ledger cites the moved bod…
claude Nov 30, 2026
1ff5857
feat(spec): source.retrieval.mode, AdapterCapabilities.retrieval and …
claude Nov 30, 2026
8dc9af7
chore(spec): regenerate the generated artifacts for source.retrieval
claude Nov 30, 2026
e582d5e
chore(changeset): source.retrieval.mode and the adapter's retrieval r…
claude Nov 30, 2026
9e57639
test(service-knowledge): the vector-mode contract case reads the vect…
claude Nov 30, 2026
0250e69
Merge remote-tracking branch 'origin/claude/project-thread-vj79kz' in…
claude Nov 30, 2026
9c31e44
feat(service-knowledge): read a source's retrieval mode, and refuse a…
claude Nov 30, 2026
e805371
test(spec): pin KnowledgeRetrievalModeSchema as isomorphic (ADR-0122)
claude Nov 30, 2026
b78a7de
Merge branch 'claude/project-thread-vj79kz' of https://github.com/obj…
claude Nov 30, 2026
14b8b7a
docs(knowledge): the adapter contract carries the retrieval mode; nam…
claude Nov 30, 2026
d22f211
Merge branch 'claude/project-thread-vj79kz' of https://github.com/obj…
claude Nov 30, 2026
dc69544
feat(service-knowledge): index_status names the store a source that n…
claude Nov 30, 2026
0d18717
Merge remote-tracking branch 'origin/main' into claude/project-thread…
claude Nov 30, 2026
8145e66
docs(knowledge): search_knowledge says what a score means; the AI ski…
claude Nov 30, 2026
dd4cf3e
Merge remote-tracking branch 'origin/main' into claude/project-thread…
claude Nov 30, 2026
08788c6
fix(platform-objects): name the retrieval-mode choices in every local…
claude Nov 30, 2026
662a70c
test(service-knowledge): keep the tracker id out of the contract suit…
claude Nov 30, 2026
6ea2c54
Merge remote-tracking branch 'origin/claude/project-thread-vj79kz' in…
claude Nov 30, 2026
2badd10
Merge branch 'claude/project-thread-vj79kz-service' into claude/proje…
claude Nov 30, 2026
7436d4f
test(platform-objects): count the retrieval-mode rows in the translat…
claude Nov 30, 2026
77c17a5
Merge remote-tracking branch 'origin/claude/project-thread-vj79kz' in…
claude Nov 30, 2026
76a8a7c
Merge branch 'claude/project-thread-vj79kz-service' into claude/proje…
claude Nov 30, 2026
43497e0
Merge remote-tracking branch 'origin/main' into claude/project-thread…
claude Nov 30, 2026
b15ac8d
docs(spec): cite the ADR-0161 note of 2026-11-30 under K8 by its plac…
claude Nov 30, 2026
a76dc2e
chore(changeset): the platform-objects translations of the retrieval-…
claude Nov 30, 2026
75d7437
fix(spec): the retrieval key warns until the service reads it; the co…
claude Nov 30, 2026
fdba258
Merge remote-tracking branch 'origin/main' into claude/project-thread…
claude Nov 30, 2026
099d019
Merge PR1 head into the service branch
claude Nov 30, 2026
4a93136
Merge branch 'claude/project-thread-vj79kz-service' into claude/proje…
claude Nov 30, 2026
21e5bf2
Cite the retrieval-mode note by its date in the knowledge tools
claude Nov 30, 2026
1a7ba24
Take a published knowledge source whatever its mode; restore the pgve…
claude Nov 30, 2026
ec8e3ff
Merge branch 'claude/project-thread-vj79kz-service' into claude/proje…
claude Nov 30, 2026
b69e471
Merge branch 'main' of https://github.com/objectstack-ai/objectstack …
claude Nov 30, 2026
25a6dee
Name the spec package in the service changeset: its liveness row flip…
claude Nov 30, 2026
dca1c8c
Merge remote-tracking branch 'origin/claude/project-thread-vj79kz-ser…
claude Nov 30, 2026
ff557c4
Merge remote-tracking branch 'origin/main' into claude/project-thread…
claude Nov 30, 2026
de3d7e4
docs(knowledge): name where a shipped source's unsupported mode is re…
claude Nov 30, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .changeset/38692-search-knowledge-score-text.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
'@objectstack/service-knowledge': patch
'@objectstack/skills': patch
---

docs(knowledge): `search_knowledge` says what a hit's score means, and the AI skill documents `source.retrieval.mode`

Clause-②: no
Metadata-protocol: none

The `search_knowledge` description now says that a hit's `score` gives only its order among the hits of its own source, not how relevant it is, and the `score` member says the same: under a one-leg retrieval mode the first hit scores 1, and scores of sources searched in different modes are not comparable. The `objectstack-ai` skill lists `source.retrieval.mode` (vector, keyword or hybrid; omitted means the store's default; a mode the store does not run is refused at a run-time save, and a shipped source's every search answers 503), paid for by shortening two of its own sentences.
18 changes: 11 additions & 7 deletions content/docs/ai/knowledge-rag.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,17 @@ hit's `title` is the value of the object's display field (`nameField`, else the
derived title field).

The two open stores, [pgvector](#self-hosted-vector-store-postgresql--pgvector)
and [libSQL](#local-vector-store-a-libsql-file), search with two legs: the
vector leg ranks by meaning, and a keyword leg ranks the passages that hold the
query's terms as written — an order number, a model code like `X-200`, a
person's name, a short term like 「出差」 — which a vector alone can rank
below `topK`. The two rankings are merged by reciprocal rank fusion, so a hit's
`score` is 1 for a passage first in both and 0.5 for one first in only one, and
the merge happens before the permission re-check.
and [libSQL](#local-vector-store-a-libsql-file), search with two legs by
default: the vector leg ranks by meaning, and a keyword leg ranks the passages
that hold the query's terms as written — an order number, a model code like
`X-200`, a person's name, a short term like 「出差」 — which a vector alone can
rank below `topK`. The two rankings are merged by reciprocal rank fusion, so a
hit's `score` is 1 for a passage first in both and 0.5 for one first in only
one, and the merge happens before the permission re-check. A source can run one
leg alone with `source.retrieval.mode` (`'vector'`, or `'keyword'`, which calls
no embedder); its first hit then scores 1. A score orders the hits of one
source; it is not a measure of relevance, and scores of two sources are not
comparable.

```ts
const knowledge = ctx.getService('knowledge');
Expand Down
10 changes: 8 additions & 2 deletions packages/services/service-knowledge/src/knowledge-tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,12 @@ export interface SearchKnowledgeHit {
title?: string;
/** The passage that matched. */
snippet: string;
/** Relevance, higher is better. */
/**
* The hit's order among the hits of its own source in the store's ranking: not a
* measure of relevance, and not comparable across sources (ADR-0161, the
* dated note of 2026-11-30 under K8). Under a one-leg mode it reflects rank
* alone, and the first hit scores 1.
*/
score: number;
/** The record the passage was indexed from: read it with the record tools. */
record?: { object: string; id: string };
Expand Down Expand Up @@ -222,7 +227,8 @@ const SEARCH_KNOWLEDGE_DESCRIPTION =
'Search the knowledge sources this app indexes (policies, manuals, articles, records indexed for retrieval) by '
+ 'meaning, and answer with the most relevant passages, each naming its source and, for an indexed record, the '
+ 'record it came from. Use it before answering a question the app\'s own documents or knowledge base should '
+ 'answer, and cite the passages you used. Send `query` as a short natural-language statement of what you are '
+ 'answer, and cite the passages you used. A hit\'s `score` says only its order among the hits of its own '
+ 'source, not how relevant it is. Send `query` as a short natural-language statement of what you are '
+ 'looking for. Omit `sourceIds` to search every source; every answer lists the sources this tool may search, '
+ 'and `sourceIds` takes their ids. `topK` caps the passages (default '
+ `${SEARCH_KNOWLEDGE_DEFAULT_TOP_K}, at most ${SEARCH_KNOWLEDGE_MAX_TOP_K}). Only passages the caller may read `
Expand Down
8 changes: 7 additions & 1 deletion scripts/check-skills-token-ratchet.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,13 @@ export const CEILINGS = new Map([
// text is 28990 -> ceil(28990 / 4) = 7248; the row moves +48, the measured
// remainder only. Pinned AT the measurement.
// ceil(($(wc -c < skills/objectstack-ai/SKILL.md) - 27) / 4) == ceil(28990 / 4)
['skills/objectstack-ai/SKILL.md', 7248],
// -1 (was 7248): #38692 phase 1a added the `source.retrieval.mode` row and
// paid for it in the same file: the `adapter` row's save refusal names the
// mounted stores alone, the one-slot sentence of the source's identity went
// (the registry's 409 names both doors), and "Rerank and hybrid weighting"
// became one clause. Banked at the measurement.
// ceil(($(wc -c < skills/objectstack-ai/SKILL.md) - 27) / 4) == ceil(28987 / 4)
['skills/objectstack-ai/SKILL.md', 7247],
// -12 (was 6331): the `http.server` decision-table row dropped a trailing
// clause that taught `contributes.routes` as a key that "parses but serves
// nothing". The key is retired — an authored entry is now REFUSED, carrying
Expand Down
10 changes: 5 additions & 5 deletions skills/objectstack-ai/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,7 @@ in `@objectstack/spec/ai`). Ship it in a package (`knowledgeSources`,
`KnowledgeServicePlugin({ sources })` and `registerSource` are a second door for
the same schema. A source is identified by its package and `name`; the ☁️
`search_knowledge` tool lists a package's source to agents as `NAMESPACE-NAME`
(bare for one no package holds), and a code registration and an environment
item of one name are one slot, the second refused. A shipped item mounts the
(bare for one no package holds). A shipped item mounts the
knowledge service and its store; where an app ships none, a run-time save is
refused (`503 SERVICE_UNAVAILABLE`, nothing written) until you add
`requires: ['knowledge']` to the stack and restart the server.
Expand All @@ -255,13 +254,14 @@ object or field, when you may not search that object or query a field it reads.
|:----|:--------|
| `name` | Snake_case source name |
| `label` / `description` | Display metadata |
| `adapter` | Store id (`pgvector`, `turso`, `memory`). Omitted: the deployment's store (`pgvector` on PostgreSQL, `turso` otherwise), else the only one registered; several and none the deployment's is refused, naming them. A run-time save naming one the deployment does not mount is refused (`400 VALIDATION_ERROR`, nothing written), naming the source, the adapter and the mounted ones: name a mounted one, or mount the store and save again |
| `adapter` | Store id (`pgvector`, `turso`, `memory`). Omitted: the deployment's store (`pgvector` on PostgreSQL, `turso` otherwise), else the only one registered; several and none the deployment's is refused, naming them. A run-time save naming a store not mounted is refused (`400`), naming the mounted ones |
| `source.kind` | `'object'`, the one kind |
| `source.object` | The object whose records are indexed |
| `source.content` | Non-empty list of the fields whose text is indexed, in order. `'*'` is refused: it would also send fields added later. Never ids or system fields |
| `source.metadataFields` | Fields kept for search-time filtering (`status`, `owner_id`, `tags`) |
| `source.where` | ObjectQL `where`: keeps drafts and archived rows out |
| `source.split` | How documents are cut into passages (below) |
| `source.retrieval.mode` | `'vector'` (by meaning), `'keyword'` (by words: codes, clause numbers) or `'hybrid'`; omitted: the store's default (`hybrid` on `turso`, `pgvector`). A mode the store lacks fails a run-time save; shipped, every search (503). `memory` runs none |
| `refresh.onRecordChange` | Sync from record events (default `true`); `false` leaves the index to an external indexer |
| `aiExposed` | May `search_knowledge` expose it (default `true`) |

Expand Down Expand Up @@ -347,8 +347,8 @@ Retired: the `knowledge.chunk_overlap` setting (`400 UNKNOWN_KEY`;
passages never overlap) and `KnowledgeChunk.metadata` (parse error; a passage
takes its document's `metadata`).

`topK` is a `search_knowledge` argument. Rerank and hybrid weighting are no
source key, and no shipped store has a setting for either.
`topK` is a `search_knowledge` argument; rerank and leg weights are no source
key.

---

Expand Down
Loading