Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.
Python agent-contextagent-memoryagent-pluginsagentic-ragcontext-databasedsh-pluginknowledge-basememorymemory-managementself-evolvingvector-database
fix: allow opencode recall after session context (#3464)
yijie zhao09cd4782df3c
diff --git a/examples/opencode-plugin/lib/memory-recall.mjs b/examples/opencode-plugin/lib/memory-recall.mjsindex 2a7860efa..40cd292ea 100644--- a/examples/opencode-plugin/lib/memory-recall.mjs+++ b/examples/opencode-plugin/lib/memory-recall.mjs@@ -35,12 +35,13 @@ export function createMemoryRecall({ config }) {return { injectRelevantMemories }}-function extractCurrentUserText(parts) {+export function extractCurrentUserText(parts) {const texts = []for (const part of parts) {if (part.type !== "text" || typeof part.text !== "string") continue+ if (part.synthetic || part.ignored) continueif (part.text.includes("<openviking-context")) return null- if (!part.synthetic && !part.ignored) texts.push(part.text)+ texts.push(part.text)}const joined = texts.join(" ").trim()return joined || nulldiff --git a/examples/opencode-plugin/tests/memory-recall.test.mjs b/examples/opencode-plugin/tests/memory-recall.test.mjsnew file mode 100644index 000000000..2f97d446a--- /dev/null+++ b/examples/opencode-plugin/tests/memory-recall.test.mjs@@ -0,0 +1,34 @@+import test from "node:test"+import assert from "node:assert/strict"+import { extractCurrentUserText } from "../lib/memory-recall.mjs"++test("extractCurrentUserText skips synthetic session context before user text", () => {+ const query = extractCurrentUserText([+ {+ type: "text",+ text: "<openviking-context source=\"session-start\">Profile</openviking-context>",+ synthetic: true,+ },+ {+ type: "text",+ text: "Find the deployment notes for the recall test",+ },+ ])++ assert.equal(query, "Find the deployment notes for the recall test")+})++test("extractCurrentUserText still rejects non-synthetic OpenViking context text", () => {+ const query = extractCurrentUserText([+ {+ type: "text",+ text: "<openviking-context>Injected context</openviking-context>",+ },+ {+ type: "text",+ text: "Find the deployment notes for the recall test",+ },+ ])++ assert.equal(query, null)+})