Skip to content

fix(openclaw): build the recall query from the current request - #41

Merged
gloryfromca merged 2 commits into
mainfrom
fix/openclaw-recall-audience
Nov 13, 2026
Merged

gloryfromca merged 2 commits into
mainfrom
fix/openclaw-recall-audience

Conversation

@gloryfromca

@gloryfromca gloryfromca commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

before_prompt_build gained currentUserMessage in OpenClaw 2026.11. The docs say prompt "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 of prompt, so on those runtimes the query could be old history.

Now: currentUserMessage when the host sends it; "" recalls nothing; hosts without the field keep using prompt. The host fills this field for every before_prompt_build listener (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)
  • two new tests: currentUserMessage is the query; an explicit "" searches nothing even with history
  • against the real 2026.11.3 SDK: typecheck:sdk passes, and a probe reading event.currentUserMessage through 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: resolveEmbeddedAttemptMemoryAudience resolves an audience only when resolveLoadedMemoryProviderKind is native, which needs a providerRuntime. This plugin registers registerMemoryCapability({}). 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

…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 gloryfromca left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread openclaw/src/handlers.ts Resolved
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 gloryfromca changed the title fix(openclaw): recall on the current request, owner memory in owner chats only fix(openclaw): build the recall query from the current request Nov 13, 2026

@gloryfromca gloryfromca left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@gloryfromca
gloryfromca merged commit 81589ba into main Nov 13, 2026
1 check passed
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.

1 participant