What one recall hands to the next in a session (docs/spec.md §A.5).
focus = Reminisce.Focus.new()
{:ok, %{focus: focus}} = Reminisce.recall(store, owner, "the friday deploy", focus: focus)
{:ok, %{memories: ms}} = Reminisce.recall(store, owner, "what went wrong with it?", focus: focus)A focus is a value the caller holds: nothing is written and nothing is kept between calls, and two sessions are two values. It holds a bounded set of cues, each with a weight from 0 to 1,000:
{:term, t}— the analyser's terms of the queries;{:memory, key}— the keys of the memories recalled;{:source, ref}— the references those memories cite.
It also keeps the keys of the last 64 intentions it surfaced, which leave
due while it keeps them, and the owner and audience of its first recall:
a recall for another starts from an empty focus, and says so with
focus_reset: true.
Each recall with a focus is one turn. Every weight is multiplied by the
retention (thousandths, the remainder dropped), and a cue below 100 leaves;
the recall's query terms come in at 1,000, the memory at rank r and its
sources at max(1000 - 100 (r - 1), 300), and a cue already there keeps the
higher weight. Then only the size heaviest cues stay, ties broken by the
cue. It fades by turn, never by the clock; clear/1 is the remedy for a
pause.
How it weighs recall: a focus term the query does not contain scores
idf × weight div 2000, a memory's focus part is capped at half the smallest
idf of the query's scoring terms, and a memory in the focus that something
matches has its score multiplied by (4000 + weight) div 4000. So every
memory a query term scores ranks above every memory the focus alone brings
in. A memory nothing matches gains nothing.
Recall checks a focus it is given, so that one a host built by hand cannot
lift a memory past these bounds: at most size cues (1 to 256), each a
{:term | :memory | :source, string} weighing 0 to 1,000; a retention of 0
to 1,000; at most 64 distinct surfaced keys; a count of turns; and an
audience of nil or {owner, subject | nil}. Anything else answers
{:error, {:invalid, :focus}}.
A focus holds keys, references and the caller's own query terms. Its
Inspect shows only its sizes, and it is never in telemetry, a log or an
error.
Summary
Functions
The same focus, emptied: no cues, no surfaced keys, no audience, no turns.
Its cues with their weights, heaviest first, ties by the cue.
An empty focus.
The keys of the intentions it has surfaced and still keeps, the earliest first.
Types
@type t() :: %Reminisce.Focus{ bound: nil | {Reminisce.owner(), String.t() | nil}, cues: %{required(cue()) => 0..1000}, retention: 0..1000, size: 1..256, surfaced: [String.t()], turns: non_neg_integer() }
Functions
The same focus, emptied: no cues, no surfaced keys, no audience, no turns.
Its cues with their weights, heaviest first, ties by the cue.
An empty focus.
Options: :retention, in thousandths (0 to 1,000, default 700), and
:size, the most cues it holds (1 to 256, default 32). Anything else raises
ArgumentError.
The keys of the intentions it has surfaced and still keeps, the earliest first.