fix(mcp): anchor REMEMBER to the turn, log tool names, add a live handshake probe - #711
Merged
Merged
Conversation
Rebased onto dev after #706 landed. Two of the four things this branch originally carried are now solved there, better than I had them: - #706 split SIGNED_OUT_* from SIGNED_IN_* tool descriptions via buildToolDefinitions(proactive). My version pushed proactive wording into the one shared list, which would have told signed-out clients to save proactively with tools that cannot work. Dropped mine. - #706 set memwal_recall to readOnlyHint: true, destructiveHint: false, going further than the readOnlyHint: false I had. Dropped mine. memwal_analyze keeps dev's destructiveHint: true; it writes memories, so that value is defensible. What remains is what #706 did not cover. 1. REMEMBER had no turn anchor. Measured on dev with the #706-equivalent fixes live, T1-T3 from WALM-368, scored from the MCP log rather than the tool cards: T2 recall PASS memwal_recall fired unprompted and answered from it T1 remember FAIL no tools/call at all T3 control PASS Recall firing is new; both earlier dogfood passes recorded zero tools/call for a whole session. RECALL and REMEMBER ship in the same instructions block, to the same client, in the same session, so this is a controlled comparison rather than a guess. The difference is in our own text: RECALL is anchored to a turn event ("before answering anything that touches..."), REMEMBER said "without waiting to be asked", which asks the model to classify a statement and then self-start with nothing tying the call to a moment. In T1 it replied "Got it - <fact>. What do you need done with it?", treating a durable fact as task setup. REMEMBER now anchors with "in that same turn, before you finish replying", adds configuration values (hostname, port, region, id) since the failing case was one, and closes the observed behaviour: do not ask whether to save, and acknowledging a fact in the reply does not store it. #706's scoping ("skip one-off tasks, the current file or bug, and small talk") is preserved verbatim. Applied to all three copies; the two that must be byte-identical were verified so. 2. Tool calls were not scorable. The host logs `method="tools/call" id=N` with no tool name, so "remember never fired" and "remember fired and failed" are indistinguishable - the exact ambiguity under investigation. Logs bridge.tool_call with the tool NAME and never `arguments`, since memory text is the user's private data. 3. No live check of what a client is actually handed. test/handshake-contract.mjs drives the real built server against a chosen env and asserts the delivered contract: instructions present with both halves anchored, recall advertised read-only, and cold start agreeing with upstream field by field. Not named *.test.mjs on purpose - it needs a live relayer and credentials, and the npm test glob must not collect it. tool-definitions.test.mjs from #706 covers the static list; this covers the deployed path, which is where the earlier runs went wrong: metadata lives in services/server/scripts, so a published package alone changes nothing for a signed-in user, and testing before the relayer redeploys measures the old server. packages/mcp 28 pass, services/server/scripts 221 pass. Refs WALM-324, WALM-368
harrymove-ctrl
force-pushed
the
fix/mcp-proactive-descriptions
branch
from
August 20, 2026 07:17
2c93d22 to
bfd793d
Compare
ducnmm
approved these changes
Aug 20, 2026
…tools Running the new probe against dev caught drift #706 did not cover. It synced memwal_remember and memwal_recall, which were the contradictory ones, and left four others pointing at pre-rewrite copy: memwal_remember_bulk title "Remember Several Facts" -> "Remember Multiple Facts" memwal_health title "Check Relayer Health" -> "Check Walrus Memory Health" memwal_analyze description 150 chars -> 340 memwal_restore description 165 chars -> 427 Less severe than the remember/recall case, since these are thinner rather than contradictory: memwal_restore upstream explains when to reach for it ("recall returns nothing even though facts were saved before"), while the cold-start copy only described the mechanics. A client that caches its first tools/list keeps the thin version for the whole session. Values copied programmatically from a live upstream tools/list rather than retyped, so they cannot drift again through transcription. login-handoff pinned the two stale titles. Its own comment requires pre-login discovery to expose "the same safety metadata clients will receive after the bridge hands off", so the expectations were wrong, not the change. Also makes the probe's instruction assertions whitespace-tolerant. The payload is newline-wrapped, so a phrase match with literal spaces fails on correct output whenever the phrase straddles a wrap. That produced a false FAIL on "Do not ask whether / to save it" and would keep doing so on any future rewording. packages/mcp 28 pass, services/server/scripts 221 pass, handshake-contract --dev 13/13. Refs WALM-368
…aseline MEMWAL_MCP_SERVER overrides the server path, which defaults to this checkout's build. Without it the probe can only describe the branch it sits in, so it could not answer the question that actually matters before merging: what does dev ship today? Measured against the real shipping artifacts, published @mysten-incubation/memwal-mcp@dev 0.0.10-dev.4 talking to the dev relayer at e4bdcc9 (#706), signed in: 11/13 passed FAIL REMEMBER is anchored to a turn event FAIL cold-start and upstream lists agree (drift: remember_bulk, analyze, restore, health) Those are exactly the two defects this PR fixes, and they reproduce with no code of mine in the path: dev's own package, dev's own relayer. The same probe against this branch reports 13/13. Useful beyond this PR as the before/after harness for any change to the handshake contract, and as the pre-flight before a dogfood run: it distinguishes "the model chose not to call the tool" from "the client was never handed the contract", which is the ambiguity that made the earlier WALM-368 runs unreconcilable. packages/mcp 28 pass. Refs WALM-368
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.
Rebased onto
devafter #706 landed. This PR is now only what #706 did not cover.Dropped, because #706 solved it better
This branch originally carried two more fixes. Both are superseded, and I removed them rather than resolve the conflict in my favour:
buildToolDefinitions(proactive)with separateSIGNED_OUT_*/SIGNED_IN_*constants. My version pushed proactive wording into the one shared list, which would have told signed-out clients to save proactively using tools that cannot work without credentials. fix(mcp): make Claude Code auto-remember/recall actually fire #706's design is correct; mine was worse.memwal_recallannotations. fix(mcp): make Claude Code auto-remember/recall actually fire #706 setreadOnlyHint: true, destructiveHint: false, going further than thereadOnlyHint: falseI had, with the same reasoning.memwal_analyzekeepsdev'sdestructiveHint: true— it writes memories, so that value is defensible.1. REMEMBER had no turn anchor
With the #706-equivalent fixes live on dev, I ran T1-T3 from WALM-368, scored from the MCP log rather than the tool cards:
memwal_recallfired unprompted and answered from ittools/callat allRecall firing is new. Both earlier dogfood passes recorded zero
tools/callfor an entire session. Since RECALL and REMEMBER ship in the sameinstructionsblock, to the same client, in the same session, this is a controlled comparison rather than a guess — and the difference is in our own text:RECALLREMEMBERmemwal_rememberwithout waiting to be asked"REMEMBER asked the model to classify a statement and then self-start, with nothing tying the call to a moment in the turn. In T1 it replied "Got it —
<fact>. What do you need done with it?", treating a durable fact as task setup and moving on.REMEMBER now anchors with "in that same turn, before you finish replying", adds configuration values (hostname, port, region, id) since the failing case was a hostname and port, and closes the observed behaviour: do not ask whether to save, and acknowledging a fact in the reply does not store it.
#706's scoping is preserved verbatim ("skip one-off tasks, the current file or bug, and small talk"). Applied to all three copies that carry this contract; the two that must be byte-identical were verified so.
2. Tool calls were not scorable from the log
The host logs
method="tools/call" id=Nwith no tool name, so "remember never fired" and "remember fired and failed" are indistinguishable — the exact ambiguity under investigation, and why the earlier dogfood runs could not be reconciled.The bridge now logs
{"event":"bridge.tool_call","tool":"memwal_recall","id":7}— name only, neverarguments, since memory text is the user's private data.3.
packages/mcp/test/handshake-contract.mjsDrives the real built server against a chosen env and asserts what a client is actually handed:
instructionspresent with both halves anchored,memwal_recalladvertised read-only, and cold start agreeing with upstream field by field.tool-definitions.test.mjsfrom #706 covers the static list. This covers the deployed path, which is where the earlier runs went wrong:services/server/scripts, so a published npm package alone changes nothing for a signed-in user. Testing before the relayer redeploys measures the old server.Deliberately not named
*.test.mjs: it needs a live relayer and credentials, and thenpm testglob must not collect it. On failure it names the broken precondition; on success it prints the T1-T3 runbook, since those are model-behaviour cases a script cannot automate.4. Finishing the cold-start sync #706 started
The probe immediately earned its keep, catching drift on four tools #706 did not touch:
memwal_remember_bulkmemwal_healthmemwal_analyzememwal_restoreLess severe than the remember/recall case since these are thinner rather than contradictory —
memwal_restoreupstream explains when to reach for it ("recall returns nothing even though facts were saved before"), while the cold-start copy described only the mechanics. A client that caches its firsttools/listkeeps the thin version all session.Values were copied programmatically from a live upstream
tools/listrather than retyped, so they cannot drift again through transcription.Testing
login-handoff.test.mjspinned the two stale titles. Its own comment requires pre-login discovery to expose "the same safety metadata clients will receive after the bridge hands off," so the expectations were wrong, not the change. Correction, not relaxation.Honest scope
Items 2, 3 and 4 are tooling and correctness, and stand on their own. Item 1 is a hypothesis with a controlled comparison behind it, not a proven fix. It needs another T1 run on a real client to confirm. Nothing here should be read as "proactive memory is fixed" until that run happens — the probe exists precisely so that run is attributable.
Found in passing, NOT fixed here
The dev relayer crash-loops on redeploy, which produced the 502s during this work:
LEGACY_DB_URLandDATABASE_URLpoint at the same Neon database, so the legacy security-delete migration contends with the main migration runner; during a redeploy the draining container holds the lock and the new one panics. Two separate problems: a transient lock timeout should not be fatal atmain.rs:758, and the legacy path should not compete with the main runner on every boot. Both are in the Rust server, out of scope here, and worth their own ticket.Refs WALM-368, WALM-324
Measured against dev's shipping artifacts
Added
MEMWAL_MCP_SERVERso the probe can run a published package instead of this checkout's build. That lets it answer the question that matters before merging: what doesdevship today?Published
@mysten-incubation/memwal-mcp@dev(0.0.10-dev.4) against the dev relayer ate4bdcc97(#706), signed in:Both defects this PR fixes reproduce with none of my code in the path — dev's own package, dev's own relayer. The same probe against this branch reports 13/13.
Reproduce: