package main import "github.com/kami/maven/internal/memory" // bestRecall is the read side of the long-term memory store: the top hit when // it clears the confidence gate. The index holds BOTH notes and facts, and // either can win — the caller looks at the returned hit's meta["type"] to see // which. Facts aren't in the notes table, so this is the only path that can // answer "when did I last …?" from a captured fact. // // The whole hit is returned, not just its text, because "which memory answered" // decides how the answer is said: a note gets phrased in Maven's voice, a fact // is read back as stored. // // ok=false when the hit fails the confidence gate (see memory.Confident: an // absolute floor plus a margin over the runner-up) or carries no text. func bestRecall(results []memory.Result, minScore, minMargin float64) (memory.Result, bool) { if !memory.Confident(results, minScore, minMargin) { return memory.Result{}, false } if results[0].Meta["text"] == "" { return memory.Result{}, false } return results[0], true }