feat(7833): each moment declares which kinds of record its search may consider, editable in Settings > Moments
CI & Build / Python lint (push) Successful in 3s
CI & Build / Plugin hooks (push) Successful in 15s
CI & Build / TypeScript typecheck (push) Successful in 34s
CI & Build / Python tests (push) Failing after 1m35s
CI & Build / integration (push) Successful in 1m58s
CI & Build / Build & push image (push) Skipped
CI & Build / Python lint (push) Successful in 3s
CI & Build / Plugin hooks (push) Successful in 15s
CI & Build / TypeScript typecheck (push) Successful in 34s
CI & Build / Python tests (push) Failing after 1m35s
CI & Build / integration (push) Successful in 1m58s
CI & Build / Build & push image (push) Skipped
The kind x moment table (services/record_kinds.py): - every record search fires at a door: the operator message, or a catalog moment (work.change for the write path); - each door considers a set of kinds (snippet, note, lesson, process, task:issue/work/spike/plan); a kind left out is never searched there; - the shipped defaults are today's behaviour; a user's change is stored per door, and putting a door back removes it. Both note arms read it, replacing their fixed kind lists, and a reserved slot whose kind is turned off is not reserved. The review re-run searches the same kinds. Settings > Moments shows and edits the table, with each cell's lines shown and opens from the record ledger. list_moments returns it as record_kinds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -917,9 +917,14 @@ async def semantic_search_notes(
|
||||
demote_superseded: bool = True,
|
||||
system_id: int | None = None,
|
||||
report: dict | None = None,
|
||||
record_kinds: Sequence[str] | None = None,
|
||||
) -> list[tuple[float, Note]]:
|
||||
"""Return up to *limit* (score, note) pairs most relevant to *query*.
|
||||
|
||||
`record_kinds` narrows to the kinds of the kind×moment table
|
||||
(`record_kinds`: `snippet`, `task:issue`, …), the vocabulary the
|
||||
injected arms filter by. It composes with every other filter.
|
||||
|
||||
Scores are cosine similarities in [-1, 1]; only notes at or above
|
||||
*threshold* are returned, sorted highest-first.
|
||||
|
||||
@@ -1086,6 +1091,9 @@ async def semantic_search_notes(
|
||||
stmt = stmt.where(
|
||||
or_(Note.status.is_(None), Note.task_kind.in_(tkinds))
|
||||
)
|
||||
if record_kinds is not None:
|
||||
from grimoire.services.record_kinds import kinds_clause
|
||||
stmt = stmt.where(kinds_clause(record_kinds))
|
||||
if exclude_ids:
|
||||
stmt = stmt.where(NoteEmbedding.note_id.notin_(exclude_ids))
|
||||
# OVER-FETCH when a re-rank follows, so the demotion can actually
|
||||
|
||||
Reference in New Issue
Block a user