Repository navigation
fix(openclaw): build the recall query from the current request - #41
Conversation
…hats only Two OpenClaw 2026.11 additions the plugin did not follow: - before_prompt_build now carries `currentUserMessage`, and the docs warn that `prompt` may contain reconstructed history on some runtimes (Codex is named). Recall built its query from `prompt`, so there the query could be the head of old history. Use `currentUserMessage` when present; an explicit "" means no textual request and recalls nothing rather than falling back to history, as the docs require. Older hosts keep using `prompt`. - hook ctx carries `memoryAudience`: `owner-private` for the owner's direct chat, `conversation` for another sender, a group, channel, or thread. Recall searched the owner's user track (profile, episodes) in every turn, so a group chat could be shown the owner's personal memory. In `conversation` audience only the agent track (cases, skills) is searched. Hosts without the field behave as before. Both fields typecheck against the real 2026.11.3 SDK. Version 3.0.4. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gloryfromca
left a comment
There was a problem hiding this comment.
Blocking: make the owner-memory audience gate work with the capability this plugin actually registers.
I reviewed the repository guidance (no AGENTS.md, CLAUDE.md, or CONTEXT*.md files are present), the full diff, affected recall/registration callers, relevant history, backward compatibility, test changes, and the OpenClaw v2026.11.3 host contract. The current-request half is compatible with older hosts, and no tests were weakened. The audience tests exercise a manually supplied context, but the production host path does not supply that context for this plugin; details are inline.
Validation: the initial locked install failed because this runner has unsupported Node 23.10.0 (the pinned OpenClaw package requires 22.22.3, 24.15+, or 25.9+). After npm ci --ignore-scripts, npm run ci completed successfully: lint, both typechecks, build, and 145 tests passed; 3 live EverOS smoke tests were skipped by their existing availability guard.
OpenClaw resolves `memoryAudience` only when the loaded memory provider is
native (registers a `providerRuntime`); resolveLoadedMemoryProviderKind
returns nothing for this plugin's `registerMemoryCapability({})`, so hook
ctx carries no audience and the gate never fired outside the tests, which
supplied it by hand. Keeping owner memory out of group turns needs a native
provider integration; that is a separate change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gloryfromca
left a comment
There was a problem hiding this comment.
No blockers; this can merge as far as I am concerned.
This revision removes the unsupported audience gate and narrows the change to building recall from OpenClaw's explicit currentUserMessage. I checked the full diff and delta from the prior revision, recall and registration callers, relevant history and the OpenClaw hook contract, backward compatibility when the new field is absent, test changes (no tests were weakened for the remaining behavior), and the plugin's empty-capability architecture. No repository-authored AGENTS.md, CLAUDE.md, or CONTEXT*.md guidance is present outside installed dependencies. The prior thread was replied to and resolved because its code and claim were removed.
Validation: npm run ci passed (lint, both typechecks, build, and tests): 143 passed, 3 existing live EverOS smoke tests skipped because no local EverOS service was running. The run used the existing --ignore-scripts installation under Node 23.10.0 because the pinned OpenClaw install script does not support Node 23.
before_prompt_buildgainedcurrentUserMessagein OpenClaw 2026.11. The docs sayprompt"may contain reconstructed history" (Codex runtime named), and that an explicit""means no textual request and must not fall back to history. Recall built its query from the head ofprompt, so on those runtimes the query could be old history.Now:
currentUserMessagewhen the host sends it;""recalls nothing; hosts without the field keep usingprompt. The host fills this field for everybefore_prompt_buildlistener (agent-harness-runtime, 2026.11.3), whatever kind of memory provider is loaded. Version 3.0.4.Verified
npm run ci: lint, typecheck,typecheck:sdk(2026.8.1), build, 143 pass / 3 skipped (the LIVE cases)currentUserMessageis the query; an explicit""searches nothing even with historytypecheck:sdkpasses, and a probe readingevent.currentUserMessagethrough the SDK's own types compiles (a misspelt field fails it, exit 2)Dropped from this PR: owner memory in group chats
The first revision also skipped the owner's user track when hook ctx said
memoryAudience.kind === "conversation". Review showed the host never sends that here, and the 2026.11.3 code confirms it:resolveEmbeddedAttemptMemoryAudienceresolves an audience only whenresolveLoadedMemoryProviderKindisnative, which needs aproviderRuntime. This plugin registersregisterMemoryCapability({}). So the gate never fired outside the tests, which supplied the field by hand. It is removed.The behaviour it targeted is unchanged and still open: in a group, channel, or other-sender turn, recall can inject the owner's profile and episodes, and capture writes other people's messages to the owner's user track. Fixing it host-sanctioned means registering a native memory provider runtime, a separate change.
🤖 Generated with Claude Code