Skip to content

feat: configurable similarity threshold for recall ("I don't know" behavior) #252

Closed

Description

@ajianaz

Summary

Add a minimum similarity score threshold to the recall operation. Results below threshold are excluded, returning empty rather than low-confidence matches. This enables "I don't know" behavior instead of confident wrong answers.

Problem

Current recall in operations.rs has no minimum score filter:

// Every candidate gets returned, regardless of score
for (memory_id, distance) in candidates {
    let score = euclidean_to_cosine(distance);
    results.push(SearchResult { memory, score: boosted_score });
    // No threshold check!
}

This means:

  • Query "quantum computing" with no relevant memories → returns 5 garbage results at score 0.1
  • Agent receives confident-looking but irrelevant context
  • Per Sibyl benchmark: all vector systems scored 0/50 on trap questions — they always return a nearest neighbor, even for fake entities

Implementation

1. Config (uteke.toml)

[recall]
min_score = 0.3          # Default: skip results below 0.3 cosine similarity
min_score_strict = 0.5   # For critical queries

2. Recall Logic

// In recall function, after computing score:
if score < self.recall_config.min_score {
    continue;  // Skip below-threshold results
}

3. CLI Usage

uteke recall "quantum computing"              # Uses default min_score from config
uteke recall "quantum computing" --min 0.5    # Override threshold
uteke recall "deploy staging" --strict         # Uses strict threshold

4. Response

When all results filtered:

{
  "results": [],
  "total": 0,
  "threshold": 0.3,
  "message": "No memories above similarity threshold"
}

Scope

  • Modify: config.rs — add RecallConfig section
  • Modify: operations.rs — add score filter in recall()
  • Modify: uteke-cli/src/commands/recall.rs — add --min / --strict flags
  • Modify: types.rs — update SearchResult if needed

Acceptance Criteria

  • Default min_score = 0.3 in config
  • recall filters out results below threshold
  • --min <score> CLI flag for per-query override
  • JSON output shows threshold info when results empty
  • Backward compatible: default threshold is low enough to not break existing behavior

Activity

  1. added
    enhancement
    scope:core
    v0.0.14
    and removed on Jun 9, 2026
  2. added 6 commits that reference this issue on Jun 10, 2026
  3. added
    priority:high
    and removed on Jun 11, 2026
  4. added this to the milestone on Jun 11, 2026
  5. added a commit that references this issue on Jun 11, 2026
  6. added a commit that references this issue on Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementpriority:highscope:corev0.0.14

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions