# Open-source evidence retrieval baselines

This runner compares SQLite FTS5 and MiniSearch with Business Brain's published
evidence-session retrieval run. It scores the same 500 LongMemEval-S questions and
1,986 LoCoMo questions against the same labelled session IDs. It does not measure
generated answers or whole memory products.

## Inputs

- [LongMemEval-S cleaned JSON](https://huggingface.co/datasets/xiaowu0162/longmemeval-cleaned/tree/main), SHA-256 `d6f21ea9d60a0d56f34a05b609c79c88a451d2ae03597821ea3d5a9678c3a442`
- [LoCoMo 10-conversation JSON](https://github.com/snap-research/locomo/blob/main/data/locomo10.json), SHA-256 `79fa87e90f04081343b8c8debecb80a9a6842b76a7aa537dc9fdf651ea698ff4`

Use Node.js 26 with FTS5 available in `node:sqlite`. From this directory:

```sh
npm ci
node benchmark.mjs --benchmark longmemeval-s --dataset /path/to/longmemeval_s_cleaned.json --output /private/path/longmemeval-open-source.json
node benchmark.mjs --benchmark locomo --dataset /path/to/locomo10.json --output /private/path/locomo-open-source.json
node summarize.mjs /private/path/longmemeval-open-source.json /private/path/locomo-open-source.json /private/path/open-source-summary.json
```

The runner refuses different corpus checksums or incomplete question counts.
LongMemEval-S indexes each supplied haystack separately. LoCoMo indexes all 272
sessions once. Both tools index session date/title and the first 32,000 characters
of dialogue. Repeated source IDs use their last instance, as in the Brain run.
Both receive the question text; LongMemEval-S also includes the supplied
`question_date` as query text because Brain received it as a separate parameter.

R@K counts a question when any labelled evidence session appears in the first K
source IDs. SQLite FTS5 uses `unicode61` and `bm25()`. MiniSearch uses its
default scoring with OR terms, no prefix expansion, and no fuzzy matching.
The records include each question's labels and top ten source IDs but no
conversation text. Search timings are included for audit only: these in-process
tools do not have the same latency boundary as Brain's database-backed run.
