Skip to content

Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.

fix(dsh-plugin): pass recallExcludeUris so subtrees can be excluded from recall (#5312)

ydflowde1c5c49541f
diff --git a/examples/claude-code-memory-plugin/scripts/shared/config-schema.mjs b/examples/claude-code-memory-plugin/scripts/shared/config-schema.mjs
index 4e2efafbd..958790f84 100644
--- a/examples/claude-code-memory-plugin/scripts/shared/config-schema.mjs
+++ b/examples/claude-code-memory-plugin/scripts/shared/config-schema.mjs
@@ -93,6 +93,17 @@ export const KNOBS = [
{ name: "logRankingDetails", type: "bool", default: false, env: "OPENVIKING_LOG_RANKING_DETAILS", capability: "recall" },
{ name: "recallLedger", type: "bool", default: true, env: "OPENVIKING_RECALL_LEDGER", capability: "recall" },
{ name: "recallQueryFilters", type: "list", default: [], env: "OPENVIKING_RECALL_QUERY_FILTERS", capability: "recall" },
+ // Subtree URIs the recall search must never return. Without this there is no
+ // way to keep generated directory files (viking://user/<space>/skills,
+ // viking://user/<space>/resources, viking://agent/skills) out of the hits:
+ // they match like ordinary content and carry only boilerplate text.
+ {
+ name: "recallExcludeUris",
+ type: "list",
+ default: [],
+ env: "OPENVIKING_RECALL_EXCLUDE_URIS",
+ capability: "recall",
+ },
// Digest compression. Claude Code reads this as the tri-state
// off/client/server/auto through `normalizeRewriteMode`; Codex reads the same
diff --git a/examples/codex-memory-plugin/scripts/shared/config-schema.mjs b/examples/codex-memory-plugin/scripts/shared/config-schema.mjs
index 4e2efafbd..958790f84 100644
--- a/examples/codex-memory-plugin/scripts/shared/config-schema.mjs
+++ b/examples/codex-memory-plugin/scripts/shared/config-schema.mjs
@@ -93,6 +93,17 @@ export const KNOBS = [
{ name: "logRankingDetails", type: "bool", default: false, env: "OPENVIKING_LOG_RANKING_DETAILS", capability: "recall" },
{ name: "recallLedger", type: "bool", default: true, env: "OPENVIKING_RECALL_LEDGER", capability: "recall" },
{ name: "recallQueryFilters", type: "list", default: [], env: "OPENVIKING_RECALL_QUERY_FILTERS", capability: "recall" },
+ // Subtree URIs the recall search must never return. Without this there is no
+ // way to keep generated directory files (viking://user/<space>/skills,
+ // viking://user/<space>/resources, viking://agent/skills) out of the hits:
+ // they match like ordinary content and carry only boilerplate text.
+ {
+ name: "recallExcludeUris",
+ type: "list",
+ default: [],
+ env: "OPENVIKING_RECALL_EXCLUDE_URIS",
+ capability: "recall",
+ },
// Digest compression. Claude Code reads this as the tri-state
// off/client/server/auto through `normalizeRewriteMode`; Codex reads the same
diff --git a/examples/dsh-memory-plugin/runtime.mjs b/examples/dsh-memory-plugin/runtime.mjs
index c0a8c1926..3fb20beb6 100644
--- a/examples/dsh-memory-plugin/runtime.mjs
+++ b/examples/dsh-memory-plugin/runtime.mjs
@@ -139,6 +139,7 @@ export class OpenVikingRuntime {
actorPeerId: state.config.peerId,
legacyPeerId: state.config.legacyPeerId,
sessionId: state.ovSessionId,
+ excludeUris: state.config.recallExcludeUris,
log: (stage, data) => this.log(stage, data),
},
);
diff --git a/examples/dsh-memory-plugin/runtime.test.mjs b/examples/dsh-memory-plugin/runtime.test.mjs
index 629a6c51e..05f8278e5 100644
--- a/examples/dsh-memory-plugin/runtime.test.mjs
+++ b/examples/dsh-memory-plugin/runtime.test.mjs
@@ -368,6 +368,53 @@ test("autoRecall false stops the recall request", async () => {
assert.equal(await runtime.recallMessage({}, [{ role: "user", content: "what did we decide" }]), null);
});
+// recall-core reads options.excludeUris, but the DSH runtime built its options
+// without it, so nothing a user configured could stop a subtree from being
+// recalled: generated directory files came back as ordinary hits.
+test("recallExcludeUris reaches the search request", async () => {
+ const bodies = [];
+ const runtime = new OpenVikingRuntime({
+ async fetchJSON(path, init) {
+ if (/\/search\/search$/.test(path)) bodies.push(JSON.parse(init.body));
+ return {
+ ok: true,
+ result: {
+ context: "<openviking-context>\nrecalled\n</openviking-context>",
+ stats: {},
+ },
+ };
+ },
+ }, { ...config(), recallExcludeUris: ["viking://user/default/skills", "viking://agent/skills"] }, { debug() {} });
+ runtime.initialize = async () => ({
+ ready: true,
+ config: { ...config(), recallExcludeUris: ["viking://user/default/skills", "viking://agent/skills"] },
+ });
+
+ await runtime.recallMessage({}, [{ role: "user", content: "what did we decide" }]);
+
+ assert.equal(bodies.length, 1);
+ assert.deepEqual(bodies[0].exclude_uris, ["viking://user/default/skills", "viking://agent/skills"]);
+});
+
+test("recall sends no exclude_uris when recallExcludeUris is unset", async () => {
+ const bodies = [];
+ const runtime = new OpenVikingRuntime({
+ async fetchJSON(path, init) {
+ if (/\/search\/search$/.test(path)) bodies.push(JSON.parse(init.body));
+ return {
+ ok: true,
+ result: { context: "<openviking-context>\nrecalled\n</openviking-context>", stats: {} },
+ };
+ },
+ }, config(), { debug() {} });
+ runtime.initialize = async () => ({ ready: true, config: config() });
+
+ await runtime.recallMessage({}, [{ role: "user", content: "what did we decide" }]);
+
+ assert.equal(bodies.length, 1);
+ assert.equal("exclude_uris" in bodies[0], false);
+});
+
test("syncTurns false sends nothing: no capture, no commit, no dispose flush, no replay", async () => {
const pendingDir = await mkdtemp(join(tmpdir(), "dsh-memory-sync-off-"));
tempDirs.push(pendingDir);
diff --git a/examples/memory-plugin-shared/lib/config-schema.mjs b/examples/memory-plugin-shared/lib/config-schema.mjs
index f8af41d62..915b0ea1a 100644
--- a/examples/memory-plugin-shared/lib/config-schema.mjs
+++ b/examples/memory-plugin-shared/lib/config-schema.mjs
@@ -92,6 +92,17 @@ export const KNOBS = [
{ name: "logRankingDetails", type: "bool", default: false, env: "OPENVIKING_LOG_RANKING_DETAILS", capability: "recall" },
{ name: "recallLedger", type: "bool", default: true, env: "OPENVIKING_RECALL_LEDGER", capability: "recall" },
{ name: "recallQueryFilters", type: "list", default: [], env: "OPENVIKING_RECALL_QUERY_FILTERS", capability: "recall" },
+ // Subtree URIs the recall search must never return. Without this there is no
+ // way to keep generated directory files (viking://user/<space>/skills,
+ // viking://user/<space>/resources, viking://agent/skills) out of the hits:
+ // they match like ordinary content and carry only boilerplate text.
+ {
+ name: "recallExcludeUris",
+ type: "list",
+ default: [],
+ env: "OPENVIKING_RECALL_EXCLUDE_URIS",
+ capability: "recall",
+ },
// Digest compression. Claude Code reads this as the tri-state
// off/client/server/auto through `normalizeRewriteMode`; Codex reads the same