You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This patch changes the OpenViking OpenClaw plugin recall path so context-engine mode no longer injects recalled memories through before_prompt_build / prependContext.
Instead, auto-recall is owned by assemble() and added as a short internal context message alongside archive/session context. The recall payload is also shortened and filtered before injection.
Problem
The previous plugin path could inject recalled memory as plain text during before_prompt_build. In string-content model pipelines this can surface raw recall context in the final prompt/answer, increase prompt pollution, and duplicate recall work even when the context engine owns assembly.
Changes
Skip before_prompt_build recall injection whenever a context engine is registered.
Move recall lookup into context-engine assemble().
Inject only short, normalized recall facts into assembled context messages.
Prefer abstract recall by default when the option is not explicitly configured.
Filter instruction-like preference memories unless the query is asking for preferences.
Update focused unit tests for context-engine assembly and normal plugin flow.
Validation
Focused plugin tests passed:
npm test -- --run tests/ut/context-engine-assemble.test.ts tests/ut/plugin-normal-flow-real-
The pickMemoriesForInjection function still accepts a scoreThreshold parameter but no longer uses it to filter memories, which may lead to lower-scoring memories being included unexpectedly.
Add timeout logic to the client.find() and client.read() calls in the assemble recall path, similar to the AUTO_RECALL_TIMEOUT_MS pattern used in the plugin's before_prompt_build hook, to improve API resilience.
+// Add a timeout helper at the top of the file or use a shared utility+function withTimeout<T>(promise: Promise<T>, ms: number, message: string): Promise<T> {+ return Promise.race([+ promise,+ new Promise<never>((_, reject) => setTimeout(() => reject(new Error(message)), ms)),+ ]);+}++// Then use it in buildAssembleRecallFacts:
const [userSettled, agentSettled] = await Promise.allSettled([
- client.find(queryText, {- targetUri: "viking://user/memories",- limit: candidateLimit,- scoreThreshold: 0,- }, agentId),- client.find(queryText, {- targetUri: "viking://agent/memories",- limit: candidateLimit,- scoreThreshold: 0,- }, agentId),+ withTimeout(+ client.find(queryText, { targetUri: "viking://user/memories", limit: candidateLimit, scoreThreshold: 0 }, agentId),+ AUTO_RECALL_TIMEOUT_MS,+ "openviking: assemble user memories search timeout",+ ),+ withTimeout(+ client.find(queryText, { targetUri: "viking://agent/memories", limit: candidateLimit, scoreThreshold: 0 }, agentId),+ AUTO_RECALL_TIMEOUT_MS,+ "openviking: assemble agent memories search timeout",+ ),
]);
Suggestion importance[1-10]: 6
__
Why: The suggestion adds timeout logic to client.find() calls in the assemble recall path, aligning with the existing timeout pattern in before_prompt_build and improving API resilience. It's a useful robustness improvement.
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
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.
Fix OpenClaw plugin recall assembly
Summary
This patch changes the OpenViking OpenClaw plugin recall path so context-engine mode no longer injects recalled memories through
before_prompt_build/prependContext.Instead, auto-recall is owned by
assemble()and added as a short internal context message alongside archive/session context. The recall payload is also shortened and filtered before injection.Problem
The previous plugin path could inject recalled memory as plain text during
before_prompt_build. In string-content model pipelines this can surface raw recall context in the final prompt/answer, increase prompt pollution, and duplicate recall work even when the context engine owns assembly.Changes
before_prompt_buildrecall injection whenever a context engine is registered.assemble().Validation
Focused plugin tests passed:
npm test -- --run tests/ut/context-engine-assemble.test.ts tests/ut/plugin-normal-flow-real-