MCPcopy Create free account
hub / github.com/echoVic/blade-code / hashContext

Method hashContext

src/context/ContextManager.ts:460–471  ·  view source on GitHub ↗
(contextData: ContextData)

Source from the content-addressed store, hash-verified

458 }
459
460 private hashContext(contextData: ContextData): string {
461 const content = JSON.stringify({
462 messageCount: contextData.layers.conversation.messages.length,
463 lastMessage:
464 contextData.layers.conversation.messages[
465 contextData.layers.conversation.messages.length - 1
466 ]?.id,
467 toolCallCount: contextData.layers.tool.recentCalls.length,
468 });
469
470 return crypto.createHash('md5').update(content).digest('hex');
471 }
472
473 private calculateRelevance(query: string, topics: string[]): number {
474 const queryLower = query.toLowerCase();

Callers 1

getFormattedContextMethod · 0.95

Calls 1

updateMethod · 0.80

Tested by

no test coverage detected