fix(hooks): sync auto-remember/recall classifier with MemWal#706 - #5
Conversation
Mirror the UserPromptSubmit and signal updates from MystenLabs/MemWal#706 so this marketplace plugin does not keep the old heuristic. Recall questions such as "what do you remember about how I like to work" now inject memwal_recall. Explicit save requests such as "Can you remember that I always use pnpm?" stay remember. Bump plugin to 0.0.8. Note in the setup skill that MEMORY.md writes mean the plugin hooks are not loaded.
Drop keyword classification. Inject the full decision rubric once per session, then a one-line nudge. Quiet gate is 8 chars. Setup skill wraps the CLAUDE.md routing block in memwal start/end markers and requires user go-ahead before writing the global file.
|
Synced with the latest MemWal#706 hook review: decision rubric once per session then a one-line nudge, 8-char quiet gate, CLAUDE.md start/end markers. Tests 11/11. |
harrymove-ctrl
left a comment
There was a problem hiding this comment.
Approving. I ran the suite at d6f54d0 locally: 11/11 pass, including the new session-scoped rubric-then-nudge tests and the terse Vietnamese case.
This is a good adaptation rather than a blind port. Three things I checked and liked:
firstTime("rubric", sessionId)plusDECISION_RUBRIC_NUDGEkeeps the full rubric once per session and drops to one line afterwards, so the per-turn context cost stays small.- The 8-char threshold with the reasoning in the comment is the right call. "Tui thích pnpm" gets through and "ok" / "yes" stay quiet.
- The
<!-- memwal:start -->/<!-- memwal:end -->markers inskills/setup/SKILL.md, plus "show this block, get the user's go-ahead", make the~/.claude/CLAUDE.mdmerge idempotent and consenting. Exactly right for an edit to a global user file.
Non-blocking notes, none of which need to hold this PR:
1. detectRecall / detectRemember are now dead code. on_user_prompt.mjs dropped the import, and on_post_tool.mjs only uses detectError, so no hook calls either function any more. This PR widens RECALL_INTENT with what do you remember, what's my, and friends, and adds a "canary remember prompt still fires remember" test, all for code nothing invokes. The green test gives false confidence that the canary path is covered. Either delete both detectors with their tests, or say in the comment that they are kept as a fallback for a future hook.
2. Drift against MemWal#706. That PR deleted the detectors outright, kept a 20-char threshold, and injects the full rubric every turn with no nudge. This repo keeps the detectors, uses 8 chars, and adds the nudge. This version is the better one, so it is worth pushing the threshold and nudge back into packages/mcp/plugin/ rather than letting the installed plugin and the in-repo copy diverge. Long term one of the two should be the source of truth.
3. Tiny. "ok thanks" is 9 characters, so it now clears the 8-char gate and gets the nudge. Harmless given how short the nudge is, just noting the tests only cover "ok" and "yes".
Not merging, leaving that to you.
Summary
Sync the Claude Code lifecycle hooks with MystenLabs/MemWal#706.
The marketplace plugin still had the old UserPromptSubmit heuristic:
This copy now matches the monorepo plugin:
memwal_recallonlymemwal_rememberAlso notes in the setup skill that
MEMORY.mdwrites mean hooks are not loaded, and bumps the plugin to 0.0.8.Cold-start tool descriptions stay in
@mysten-incubation/memwal-mcp. This repo onlynpxs that package.Test plan
node --test test/*.test.mjs— 12/12node --checkon hook scriptsEOF