Lore

Improve recall quality

Fix memory shape first, then tune thresholds and weights with real prompts.

Most recall problems come from how memories are written, not from the settings. Fix the memory first, check the result with real prompts, and change a setting only when the memory is right and the result is still wrong.

Fix the memory shape first

Work through these steps in order:

  1. Make the memory about one topic. See What belongs in Lore.
  2. Give it a specific path, named for the concept, with no date. See Paths and domains.
  3. Write a concrete disclosure: one future situation. See Disclosure and glossary.
  4. Add glossary terms for the words people actually type, including the other language.
  5. Set the priority honestly. See Priority.
  6. Check that the embedding model is configured. Recall needs it. See Embeddings must be configured.
  7. Test with real prompts, and read the results before you change any setting.

Symptom and first fix

SymptomFirst thing to check
The right memory never appearsIts disclosure and glossary. Test with a prompt written in the words your team uses.
A memory appears in unrelated promptsWhether it is too broad. Split it, look for OR wording in its disclosure, and lower its priority if it is background.
Too many weak memories appearWhether the memories are sharp. If they are, raise recall.display.min_display_score. See the settings below.
Chinese prompts match poorlyWhether PostgreSQL has pg_jieba or zhparser. See Chinese recall. Add Chinese glossary terms either way.
Semantic matches are missingWhether the embedding model is configured. Changing it rebuilds views.
Recall never returns anythingWhether the embedding model is configured. Without it, recall fails. Check lore_status for backend health.
Recall is often skippedWhether the server is slow. A timeout skips recall and adds a notice.
A long prompt loses its pointOnly the first 200 characters are used for recall. Lead with the topic.
A useful memory ranks too lowIts disclosure and glossary. Priority adds only a small bonus.

Settings to tune

Change settings only after the memory shape is right. Change one value at a time, then run the same prompts again.

SettingDefaultWhat it doesChange it when
recall.display.min_display_score0.60Candidates scoring below this value are withheldRaise it when Shown is high and Used is low. Lower it only when a memory you know is correct keeps being withheld just below the cutoff.
recall.display.max_display_items3Most memories shown per recallLower it for quieter prompts. Raise it only when relevant memories keep being cut by the limit.
recall.safety.max_query_chars200Characters of a long prompt used for recallRaise it when long prompts lose key terms. Keep the topic near the start of the prompt.
recall.safety.timeout_ms2000Time after which recall is skippedRaise it only when your server is consistently slow. A timeout means no recall at all for that prompt.
recall.weights.w_exact0.30Weight of exact matchesLeave it alone. Fix the glossary first.
recall.weights.w_glossary_semantic0.25Weight of glossary semantic matchesConsider raising it when meaning-based matches on glossary terms are weak.
recall.weights.w_dense0.30Weight of view (semantic) matchesConsider raising it when memories are found by meaning but ranked too low.
recall.weights.w_lexical0.03Weight of full-text matchesLeave it alone unless Chinese full-text search is set up. See Chinese recall.
recall.bonus.priority_base and recall.bonus.priority_step0.05 and 0.01Priority bonusLeave them alone. Set priority honestly instead.
recall.recency.enabledtrueTurns the recency bonus on or offTurn it off when old, stable rules should rank the same as recent notes.
recall.recency.half_life_days180Days until the recency bonus halvesLower it, for example to 30, to favor recent work. Keep 180 for a gentler effect.
recall.recency.max_bonus0.04Largest recency bonusLeave it alone.
recall.recency.priority_exempt1Priority at or below this value never decaysLeave it alone.

On a self-hosted server, change settings at /settings, or through the API. Send the Authorization header only when the server sets API_TOKEN:

curl -X PUT http://127.0.0.1:18901/api/settings \
  -H "Authorization: Bearer lm_your_token" \
  -H "Content-Type: application/json" \
  -d '{"patch": {"recall.display.min_display_score": 0.65}}'

On Loremem Cloud, the recall behavior settings are in Settings → Preferences.

Chinese recall

Chinese text has no spaces between words, so lexical matching depends on a Chinese tokenizer in PostgreSQL. Lore uses pg_jieba when it is available, and zhparser otherwise.

  • If neither extension is installed, PostgreSQL falls back to its simple text search. Chinese matching is then weaker.
  • The Lore Postgres image, fffattiger/pgvector-zhparser:pg16, includes both extensions and preloads pg_jieba.
  • If you run your own PostgreSQL, see Use your own PostgreSQL.
  • Whatever the database, add Chinese terms to the glossary, such as 退款回调. People type these words directly.

Embeddings must be configured

Recall uses an embedding model for semantic matching. Without one, recall cannot run. The call fails, and the plugin continues without a recall block.

  • Loremem Cloud: models are preconfigured. Choose an embedding profile in Settings → Models. Changing it rebuilds views and recall indexes, and it uses model quota.
  • Self-hosted: set the embedding endpoint at /setup, or later at /settings. It must be an OpenAI-compatible /v1/embeddings endpoint, with a base URL, an API key, and a model name.

The View LLM is needed for the richest gist and question views. Without one, Lore builds simpler views from the content, the disclosure, and the glossary. See Generated views.

Test with real prompts

Test with prompts written the way you would type them while working. A keyword test you invent does not show what an agent will actually send.

  1. Open the Recall page: on Loremem Cloud, the Recall page in the console. On a self-hosted server, /recall.
  2. Enter a real prompt and run recall.
  3. Read the candidates, their order, and their scores.
  4. Find out where the right memory stops. If it is missing from every stage, fix the memory. If it is found but withheld, look at the display threshold and the item limit. See Recall analytics for what each stage shows.
  5. Fix the memory, then run the same prompt again. Change a setting only when the memory itself is right.

A short regular check

  1. After each important decision, write or update the memory. See Writing good memories.
  2. Once a week, run a few real prompts for each active project, and check which memories appear.
  3. Review the recall analytics for noisy or unused memories.
  4. Fix one memory for each problem you find. Do not change several settings at once.
  5. Back up before a large cleanup. See Backups and restore.

Tip

Record the prompt, what you expected, and what came back. Running the same prompts after each change shows whether the change helped.