Expand description
Embedding-based Knowledge Retrieval for ctx_knowledge.
Wraps ProjectKnowledge with a vector index for semantic recall.
Facts are automatically embedded on remember and searched via
cosine similarity on recall, with hybrid exact + semantic ranking.
Structs§
Constants§
- SEMANTIC_
DUP_ THRESHOLD - Cosine threshold above which a freshly-remembered fact is treated as a
semantic near-duplicate of an existing one. Deliberately conservative — only
genuine paraphrases (“DB is Postgres” / “we persist to PostgreSQL”) clear it,
so the advisory stays signal, not noise. Non-destructive: it nudges the agent
to
judge, never auto-merges (distinct facts can be near in embedding space, e.g. “Postgres 14” vs “Postgres 15”).
Functions§
- compact_
against_ knowledge - embed_
and_ store - find_
semantic_ duplicates - Embedding-based near-duplicate detection for
remember. Mirrors the lexicalfind_cross_key_similarbut scores cosine similarity, so paraphrases that share few tokens are still caught. Read-only against the pre-upsert index, so the incoming fact never matches itself. Returns advisory hits for the agent to resolve viajudge— it never mutates or merges facts. - format_
scored_ facts - reset
- semantic_
recall - semantic_
recall_ semantic_ only