MCPcopy Index your code
hub / github.com/PatrickSys/codebase-context / getMemoryScopeBoost

Function getMemoryScopeBoost

src/tools/search-codebase.ts:339–355  ·  view source on GitHub ↗
(memory: MemoryWithConfidence)

Source from the content-addressed store, hash-verified

337 );
338
339 function getMemoryScopeBoost(memory: MemoryWithConfidence): number {
340 if (!memory.scope || memory.scope.kind === 'global') return 0;
341
342 const normalizedFile = normalizeGraphPath(memory.scope.file);
343 if (memory.scope.kind === 'file') {
344 return resultPathSet.has(normalizedFile) ? 3 : 0;
345 }
346
347 const symbolMatch =
348 resultSymbolSet.has(normalizeSymbolName(memory.scope.symbol)) ||
349 queryTermSet.has(normalizeSymbolName(memory.scope.symbol));
350
351 if (resultPathSet.has(normalizedFile) && symbolMatch) return 4;
352 if (resultPathSet.has(normalizedFile)) return 2;
353 if (symbolMatch) return 1;
354 return 0;
355 }
356
357 function getMemoryTextMatchCount(memory: MemoryWithConfidence): number {
358 const haystack =

Callers 2

handleFunction · 0.85
filterStrongMemoriesFunction · 0.85

Calls 3

normalizeGraphPathFunction · 0.85
hasMethod · 0.80
normalizeSymbolNameFunction · 0.70

Tested by

no test coverage detected