MCPcopy Index your code
hub / github.com/forloopcodes/contextplus / decayWeight

Function decayWeight

src/core/memory-graph.ts:79–82  ·  view source on GitHub ↗
(edge: MemoryEdge)

Source from the content-addressed store, hash-verified

77}
78
79function decayWeight(edge: MemoryEdge): number {
80 const daysSinceCreation = (Date.now() - edge.createdAt) / 86_400_000;
81 return edge.weight * Math.exp(-DECAY_LAMBDA * daysSinceCreation);
82}
83
84async function loadGraph(rootDir: string): Promise<GraphStore> {
85 if (graphCache.has(rootDir)) return graphCache.get(rootDir)!;

Callers 3

traverseNeighborsFunction · 0.85
pruneStaleLinksFunction · 0.85
collectTraversalFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected