feat: advertise search_memory when a project has no memories yet; bump to 0.1.7 - #125
Merged
Merged
Conversation
Dhravya
force-pushed
the
feat/recall-discovery-on-empty
branch
from
September 12, 2026 22:53
9a91b91 to
ed39afa
Compare
|
If claude-supermemory#124 lands, this discovery block's omit line inverts.
becomes wrong. After injection, omit = this project. Suggested replacement for the bullets: The ToolSearch / |
…p to 0.1.7 The recall hook can only inject what it finds. On a miss it returned silently, and silence reads to the model as "there is nothing to search" — so it never reached for the tool, and history living in another container stayed invisible for the whole session. The guidance that would have fixed this already existed, but only inside formatRecall(), which runs when recall already found something. It was delivered in the case where it was least needed and withheld in the case where it mattered most. Emit a discovery block on the first genuinely-empty recall of a session: name the tool, point at ToolSearch to resolve it (the tool ships under three names depending on install shape, and deferred loading means the model holds a bare name with no schema), interpolate the repo containerTag, and note that read-only calls are auto-approved. Gated to fire once per session, and only when the container is truly empty rather than all-repeats — misses are the common case in an empty project, so repeating it would tax every prompt and invite searches on turns where memory is irrelevant. The marker is a file in the session dir next to recalled.json; writeState would have meant widening the EVENT_NAMES allowlist and touching the statusline renderer. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011qEtmi9chBJMgirVCTpSLu
Dhravya
force-pushed
the
feat/recall-discovery-on-empty
branch
from
September 17, 2026 01:05
ed39afa to
54d6ca2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The problem
The recall hook can only inject what it finds. When a project has no stored memories,
main()returns silently:Silence reads to the model as "there is nothing to search". So it never reaches for
search_memory, and any history living in another container stays invisible for the whole session.The guidance that would have fixed this already exists —
formatRecall()ends with:But
formatRecall()only runs when recall already found something. The routing instruction was delivered in the case where it was least needed, and withheld in the case where it mattered most.Observed
A session in a repo whose container had 0 memories. Session start correctly reported the container was empty. The model then went looking on its own, got no guidance, followed the MCP tool description ("omit this field so the server uses the active space"), and landed in the account's shared space without realizing it — while the answer it wanted sat in a container it was never told to ask for.
The change
Emit a discovery block on the first genuinely-empty recall of a session:
Roughly 110 tokens. Design notes:
ToolSearch, not a hardcoded name. The tool ships under three names depending on install shape — seeTOOL_NAME_REinrecall-approve.js— and under deferred tool loading the model holds a bare name with no schema, so a direct call fails withInputValidationError. A lookup is correct for every install; one hardcoded string is wrong for two of three.recall-approve.jsalready auto-approves read-only supermemory tools. That was built but never surfaced to the model, and unknown permission cost is a reason not to bother.Gating
Fires only when all four hold:
fresh.length === 0— recall found nothing newresults.length === 0— container is genuinely empty, not all-repeats (if hits came back,formatRecallalready delivered the same guidance)sessionDirexistsMisses are the common case in an empty project, so an ungated block would tax every prompt. The marker is a file in the session dir next to
recalled.json;writeStatewould have meant widening theEVENT_NAMESallowlist and touching the statusline renderer.Every earlier return is untouched —
shouldSkip, missing API key, and therecallDirectiveoverride all still bail before this point.Testing
No automated coverage added; verified manually against the live API rather than stubs. From a repo with 0 memories the block renders with the real container tag interpolated; a second prompt in the same session is silent; a fresh session shows it again; a repo with memories takes the normal recall path unchanged. Existing suite unaffected at 24/24.
Release
Bumps
0.1.6->0.1.7acrosslatest.json,package.json, andplugin/.claude-plugin/plugin.json, matching the convention infde77a7andc8c3cd2.Not included
mcp-proxy.jsarg injection. The proxy is currently a pure pass-through that only addsAuthorization, but it already resolves cwd andgetContainerTagsits in the samelib/. DefaultingcontainerTagontools/callwould make repo scoping true by construction instead of dependent on the model cooperating. Higher-value follow-up than this PR.biome.jsonlints nothing. Itsincludesis["src/**", "scripts/**"], neither of which exists in this layout — leftover from the 0.0.9 structure.npm run lintsilently checks 0 files.🤖 Generated with Claude Code
https://claude.ai/code/session_011qEtmi9chBJMgirVCTpSLu