Skip to content

feat(core,cli,server,mcp): recall similarity field, strict on similarity (#1650) - #1659

Merged
ajianaz merged 4 commits into
developfrom
feat/recall-similarity-1650
Nov 4, 2026
Merged

ajianaz merged 4 commits into
developfrom
feat/recall-similarity-1650

Conversation

@ajianaz

@ajianaz ajianaz commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

What

  • Every memory result (CLI --json, POST /recall, MCP uteke_recall incl. explain/pack/unified) carries similarity: the unboosted cosine of the vector leg, null for a hit only full-text search found (and for documents). MCP text lines show it as sim.
  • strict / [recall] min_score_strict compare against similarity, and hits with null similarity are dropped. score, --min/min_score and the ranking are unchanged for every strategy. With --strict --min, --min still filters score and the strict floor filters similarity.
  • The filter runs before the limit, through a shared window-widening fetch (ResultFilter::fetch) used by run_recall (HTTP + MCP) and the CLI local path, so up to N rows come back when N qualify.
  • Benchmark note on the 0.5 floor with real EmbeddingGemma Q4: benchmarks/internal/STRICT_FLOOR.md plus the reproducible script.
  • Docs: CLI reference, configuration, MCP, skill copies, CHANGELOG, generated API reference.

Why

Under the default fusion strategy the score is at most about 0.25, so recall --strict (floor 0.5 on score) returned nothing. Closes #1650. Wire names agreed in uteke-cloud#459 (Amendment 3).

The floor: off-topic queries top out at cosine 0.37; relevant hits keep 38% (sentences) / 27% (paragraphs) at 0.5 while 95-98% of irrelevant hits are dropped. It is a precision floor; 0.4 is the recall-leaning alternative. Details and caveats in the note.

Testing

  • New core tests: fusion + strict returns the on-topic memory and drops off-topic ones; FTS-only hits excluded; scores identical with and without strict for vector/hybrid/fts5/fusion/graph; --min still on score; similarity null/number in JSON; unified and pack under strict; filter window logic.
  • New HTTP tests (POST /recall: similarity present, null for FTS-only, strict, pack) and an MCP test (sim, strict, FTS-only).
  • cargo fmt --check, cargo clippy --workspace --all-targets -D warnings, cargo test --workspace all pass locally; cargo run -p docgen output committed.
  • Mutation gate is a release-time step, not run here.

@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

Comment thread crates/uteke-core/src/graph.rs Outdated
let mut all_results: Vec<SearchResult> = results
.into_iter()
.map(|(_, (memory, score))| SearchResult { memory, score })
.map(|(_, (memory, score))| SearchResult::new(memory, score))
…ity (#1650)

Every memory result carries `similarity`, the unboosted cosine of the
vector leg (null for a hit only full-text search found). `strict` and
`[recall] min_score_strict` compare against it and drop null-similarity
hits, so `recall --strict` works under the default fusion strategy.
`score`, `--min` and the ranking are unchanged for every strategy.

The filter runs before the limit through a shared window-widening fetch
used by run_recall (HTTP, MCP) and the CLI local path. Pack and unified
results carry `similarity` too. Benchmark note on the 0.5 floor with
EmbeddingGemma: benchmarks/internal/STRICT_FLOOR.md.
The widened passes of the strict filter fetched discarded candidates and
counted them as recalled. They now run with the touch held, and the rows
finally returned are touched once.
@ajianaz
ajianaz force-pushed the feat/recall-similarity-1650 branch from 695b76f to 088d20b Compare November 4, 2026 03:12
@ajianaz
ajianaz merged commit 5227cf8 into develop Nov 4, 2026
15 checks passed
@ajianaz
ajianaz deleted the feat/recall-similarity-1650 branch November 4, 2026 06:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

recall: make --strict filter on vector similarity, add an additive similarity field

2 participants