Skip to content

1.5.0: recall --since, faster recall with a signature file, words in any script

Choose a tag to compare

@nrzz nrzz released this 28 Oct 09:25
· 6 commits to main since this release
0c450c3
  • recall.mjs --since narrows recall to recent work: a number of hours, days or weeks back (12h, 7d, 2w) or a date (YYYY-MM-DD, local midnight); a value that is neither is an error. The index keeps each remark's timestamp, and search() in memory-index.mjs takes the same filter as { since }. Thanks to @yoreva-01 in #5.
  • Recall matches words in any script. Words are runs of letters, marks and digits as Unicode defines them, so Tamil, Hindi, Chinese and accented European words are matched whole; before, the tokenizer knew only a-z, 0-9 and _, split "Größe" at the umlaut, and never recalled anything written in another script. Text that writes no spaces between words gives one word per run, which still matches a repeated phrase.
  • Automatic recall is about three times faster per prompt. sig.bin, next to index.jsonl, holds a 256-byte signature per remark (a Bloom filter of every word and every prefix of it from 3 to 12 characters). A query word is looked for in a remark's text only when its signature allows it, so most of the text searches are never made; a remark whose signature allows a word is still checked in the text, so what recall finds is unchanged (verified on 220 prompts against a 94,000-remark history: identical results on every ASCII prompt, the only differences being the accented words that now match). On the 12 MB window a prompt went from about 125 ms to about 45 ms. An existing index is signed a little on each call, inside the hook's time budget, and a signature file that does not agree with state.json is rebuilt from the index; sig.bin is safe to delete.
  • HANDOVER_CONTEXT_LIMIT, HANDOVER_STALE_MINUTES, HANDOVER_RECALL_WINDOW_MB and HANDOVER_RECALL_STRICTNESS that are not numbers count as unset, as HANDOVER_CONTEXT_WINDOW already did. Before, a typo gave NaN, every comparison was false, and the guard never warned or asked, silently. HANDOVER_STALE_MINUTES=0 still means "ask whenever a turn ends above the limit".
  • scripts/common.mjs holds what the scripts shared by copy: the config and transcripts folders, the price list (one table, dated, with a fallback to the newest price of a model's family for an id the list does not know), the summing of a request's token counts, and the text of a message. The usage and cache reports name the date of the price list in their first heading.
  • SECURITY.md says that text pasted into an earlier session can come back as a recall line, and how to remove it.
  • Tests for each of these: settings that are not numbers, recall in Tamil and German, the signature file (same results with and without it, rebuilt when it does not match, kept in step with new remarks), the copy of the scripts still needing nothing outside its folder, and --since with the signature file (a remark that stays is checked against its own signature, not the one at its new place in the filtered list).
  • The signature file, the words in any script, the settings that fall back and scripts/common.mjs are from @elavarasan-sr in #6, who also brought --since on top of the signature file.

See the README to set it up, and CHANGELOG.md for every version.