Skip to content

Serve only relevant memories, in a small packet - #19

Merged
Yanir-R merged 2 commits into
mainfrom
claude/project-thread-mxe275
Nov 24, 2026
Merged

Yanir-R merged 2 commits into
mainfrom
claude/project-thread-mxe275

Conversation

@Yanir-R

@Yanir-R Yanir-R commented Nov 17, 2026

Copy link
Copy Markdown
Owner

Requested by Yanir · project thread

What changed

The read an assistant makes returns less, and only what relates to the question. This comes after 0.2.0 and is not part of that release.

  • No standing fill. retrieve.search no longer adds up to three approved memories when fewer match. Nothing relevant gives an empty answer.
  • Evidence on request. personakit_read sends the quotes only with include_evidence.
  • No repeats in a session. The server keeps, in memory only, the ids it already sent in full. Such a memory comes back as {"id", "seen": true} unless include_seen (or include_evidence, since the quotes would be new). A seen_note tells the assistant how to ask again.
  • context and scope on reads. context is what the assistant is about to do; it is scored like a second question and a memory keeps the better score, so the Relevance hook signature is unchanged. scope limits candidates to that scope plus global.
  • more in the answer counts relevant, servable memories the limit left out.
  • Owner hints. Memory.answers and Memory.applies_when, set with personakit hints <id>. They count in the built-in word overlap and are never sent to assistants. Store migration 5 adds the two columns; existing stores upgrade in place.
  • The personakit_read description tells the assistant to ask one focused question before acting.
  • README, ARCHITECTURE, PRIVACY, PLUGINS and the changelog (Unreleased) describe the new behaviour.

Why

Every read used to return material the question did not ask for: three approved memories when nothing matched, two quotes per memory, and the same memory again on each later read. The owner asked that assistants receive only what is relevant to what they are doing.

How to verify

python3 -m unittest discover -s tests -t .   # 182 tests
ruff check .
python3 -m coverage run -m unittest discover -s tests -t . && python3 -m coverage report   # 97%

tests/test_store.py opens a database built with migrations 1 to 4 plus data and checks nothing is lost.

Known limits

  • scope changes nothing today: nothing in the package writes a scope other than global.
  • A stub for an already-sent memory relies on the assistant asking again with include_seen if it no longer has the text (for example after its context was shortened).
  • With word overlap, a long context matches many memories on common words. The limit caps the size, not the quality.
  • A question in a script word overlap does not match now gets an empty answer instead of three approved memories.
  • The server tests are skipped where the installed mcp package is 2.x; they pass with mcp<2.

Checklist

  • Every commit is signed off (git commit -s), see CONTRIBUTING.md. Not signed off: the commits were written by Claude for the repository owner, whom the DCO check exempts.
  • No personal data, real paths, hostnames or credentials in code, tests, fixtures or docs
  • Test fixtures use invented data only
  • No duplicated logic; the change respects the module boundaries in docs/ARCHITECTURE.md
  • Docs updated if behavior or privacy claims changed

Generated by Claude Code

- retrieve.search: drop the standing fill (nothing relevant, nothing
  served); optional context scored like a second question (element-wise
  maximum, relevance hook unchanged); optional scope (that scope and
  "global" only); Result.more counts relevant memories cut by the limit.
- read_memories / personakit_read: evidence only with include_evidence;
  a memory already sent by this server process comes back as its id
  only unless include_seen (or include_evidence); "more" in the
  response; assistant-facing docstring rewritten.
- Memory.answers and Memory.applies_when: owner-written hints, stored
  as JSON lists (new migration, existing stores keep their data),
  counted by word overlap, never served. New `personakit hints` command.
- README, ARCHITECTURE, PRIVACY and PLUGINS describe the new behaviour.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014dGcvUc3LqzKojYnqVGCjK
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014dGcvUc3LqzKojYnqVGCjK
@Yanir-R
Yanir-R merged commit 67eb512 into main Nov 24, 2026
5 checks passed
@Yanir-R
Yanir-R deleted the claude/project-thread-mxe275 branch November 24, 2026 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants