2 Commits
Author SHA1 Message Date
shadowdaoandClaude Opus 5.5 ea1805c2a7 fix: centre search excerpts on rare query terms, match simple inflections
Searching "WHP founding partner pricing" excerpted the "business
partners ... (1) WHP commercial launch" sentence instead of the Founding
Partner passage. Every query term counted the same, so a common term
("WHP", four times) plus a coincidental hit ("partners") tied the real
passage on two terms and won by coming first. "pricing" matched nothing:
the memory says "price".

- Weight each term by rarity within the memory (1 / occurrences), so a
  word that appears once outweighs one sprinkled throughout.
- Strip one common suffix (-ing/-ed/-es/-s/-e, keeping 4+ chars) and
  match as a prefix, so "pricing" and "price" both become "pric".

Postgres ts_headline, suggested as the alternative, was tested on the
same text and picked the same wrong passage with an OR query (it also
weighs words equally); with plainto_tsquery's AND it found no cover and
fell back to a different, also wrong, passage.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 11:12:41 -08:00
shadowdaoandClaude Opus 5.5 a1cdfae0bd feat: return excerpts from memory.list / memory.search, full text via memory.get
Both tools returned every memory's full body, so one search across a few
dozen long memories could pour thousands of words into the caller's
context. The memory.get description already promised that list/search
"return summaries"; this makes it true.

Each list/search item now carries, instead of `content`:
- `excerpt`: ~200 chars, whitespace collapsed, cut on word boundaries.
  For search it is the window matching the most distinct query terms
  (stopwords ignored); for list, or a meaning-only hit with no term in
  the text, it is the memory's opening.
- `contentLength` and `truncated`, so the caller can tell a short note
  (excerpt is the whole thing) from a long document worth a memory.get.

`full: true` on either tool restores the whole `content`. Ids, tags,
scope, project, version, timestamps and search ranks are unchanged.
memory.get is unchanged. The web UI calls searchMemories directly and is
unaffected. Named `excerpt`, not `snippet`, to avoid confusion with the
snippet.* tools.

Tool descriptions now point callers at memory.get for full bodies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 11:03:33 -08:00