feat(context): add recall fusion and zvec workspace adapters

Introduce RRF-based recall fusion for personal/episodic/temporal paths,
zvec-grep workspace shadow probing for code executors, and a local
headroom proxy starter aligned with the fusion plan defaults.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-09-09 21:28:04 +08:00
parent 49a1a68a29
commit 40e4a527fe
11 changed files with 677 additions and 1 deletions
+22
View File
@@ -8,6 +8,10 @@ import {
parseCursorAgentUsage,
} from './cursor-agent-usage.mjs';
import { resolveExecutorDisplayLabel } from './executor-display-label.mjs';
import {
searchZvecWorkspace,
shouldAttachZvecWorkspaceForTask,
} from './memind-zvec-workspace.mjs';
const BASE_CODE_EXECUTORS = ['aider', 'openhands'];
@@ -226,6 +230,22 @@ export function createToolGateway({
throw new Error('Tool Gateway job missing instruction');
}
const executor = selectExecutor({ userMessage, taskType });
const normalizedTaskType = String(taskType ?? userMessage?.metadata?.memindRun?.taskType ?? '').trim();
let zvecWorkspace = null;
if (shouldAttachZvecWorkspaceForTask(normalizedTaskType, env)) {
zvecWorkspace = searchZvecWorkspace({
query: instruction,
cwd,
env,
});
if (zvecWorkspace.mode === 'shadow' && zvecWorkspace.hitCount > 0) {
console.log('[tool-gateway] zvec workspace shadow', {
taskType: normalizedTaskType,
hitCount: zvecWorkspace.hitCount,
top: zvecWorkspace.hits[0],
});
}
}
const receiptPath = executor === 'aider'
? resolveAiderReceiptPath(userMessage, requestId)
: null;
@@ -274,6 +294,7 @@ export function createToolGateway({
runId,
requestId,
userId,
zvecWorkspace,
};
}
@@ -330,6 +351,7 @@ export function createToolGateway({
displayStdout: displayStdout || undefined,
usage: usage ?? undefined,
stderr,
zvecWorkspace,
});
return;
}