Skip to content

GH-50: Warn when an edited file is named in unread memories - #54

Merged
bguidolim merged 3 commits into
mainfrom
bruno/GH-50-edit-linked-memories
Oct 31, 2026
Merged

bguidolim merged 3 commits into
mainfrom
bruno/GH-50-edit-linked-memories

Conversation

@bguidolim

@bguidolim bguidolim commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Why

A session can edit a file against a rule the KB already holds, because a search for the task doesn't surface rules about each file it touches along the way. Now, when a memory names the edited file — by its path, or by its file name when that has two or more words (HermesManager, user_service) — Claude is asked to search the KB for it, with a line saying what the edit changes and why, and to check the edit against the results. The note never blocks the edit; observe only logs it.

A KB search that includes the path or name silences the note for the rest of the session, until the conversation is compacted; reading a memory doesn't count, because one broad memory can name many files. At most three notes per turn.

Replayed on 300 recent commits of a large app repo, about 17% of changed files would trigger a note, usually from one memory. Running the requested search for 14 sampled triggers surfaced a memory about the file in the top 6 every time.

Closes #50.

Test plan

  • mcs sync, then edit a file whose type name appears in a memory → expect a note asking for a KB search on that name
  • Search the KB for that name, then edit the file again in a later turn → expect no note
  • Edit a file with a one-word name such as index.ts → expect no note unless a memory names its full path

- kb-gate scans memories for the edited file's project-relative path and names unread ones as context; it never blocks the edit
- get/multi_get are recorded synchronously so a memory read just before an edit counts
- Tests, contract fixture and docs cover the new warning
- A memory counts only when it names the full path, so a root file no longer matches nested paths ending in its name
- The note gives the count and asks for a KB search on the path instead of listing titles
… KB search

- A memory naming the file's path, or its name when that has two or more words, triggers a note asking for a lex+vec KB search
- Only a search for the path or name since session start or the last compaction silences it; reading a memory does not
- At most three notes per turn; a SessionStart "compact" registration marks where earlier searches stop counting
@bguidolim
bguidolim force-pushed the bruno/GH-50-edit-linked-memories branch from bae9229 to 501b38b Compare October 30, 2026 00:06
@bguidolim
bguidolim added this pull request to stack #57 October 31, 2026 23:24
@bguidolim
bguidolim merged commit f912d29 into main Oct 31, 2026
5 checks passed
@bguidolim
bguidolim deleted the bruno/GH-50-edit-linked-memories branch October 31, 2026 23:38
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.

No gate connects a file edit to the memories that mention that file

1 participant