Vector search finds text with a similar meaning. Keyword search finds exact terms such as a function name or an error code. Agent memory benefits from both.
rusty-brain runs a cosine top-k search and an FTS5 search, then merges them with reciprocal rank fusion (RRF).
Why ranks instead of scores
A cosine similarity and a BM25 score are not on the same scale, so adding them needs calibration. RRF ignores raw scores. Each result earns 1 / (k + rank) from every list it appears in, and the sum decides the order:
score(doc) = sum over lists of 1 / (k + rank_in_list)A memory that ranks well in both lists rises. One that appears in a single list can still surface. rusty-brain returns results in a deterministic order, with provenance.