@@ -185,7 +185,7 @@ class DreamService extends Base {
185185 ids : [ session . id ] ,
186186 metadatas : [ { ...session . meta , graphDigested : true } ]
187187 } ) ;
188- logger . info ( `[DreamService] Session ${ session . meta . sessionId } marked as graphDigested in ChromaDB .` ) ;
188+ logger . info ( `[DreamService] Session ${ session . meta . sessionId } marked as graphDigested in Memory Core .` ) ;
189189 }
190190 }
191191
@@ -500,9 +500,14 @@ ${contextText}
500500
501501 // Gather test framework paths directly
502502 const testFilePaths = GraphService . db . nodes . items . filter ( n =>
503- n . label === 'FILE' && n . properties ?. path ?. startsWith ( 'test/' )
503+ n . type === 'FILE' && n . properties ?. path ?. startsWith ( 'test/' )
504504 ) . map ( n => n . properties ?. path || '' ) . map ( p => p . toLowerCase ( ) ) ;
505505
506+ // Gather architectural guide paths natively
507+ const guideFilePaths = GraphService . db . nodes . items . filter ( n =>
508+ n . type === 'FILE' && n . properties ?. path ?. startsWith ( 'learn/guides/' )
509+ ) . map ( n => n . properties ?. path || '' ) ;
510+
506511 for ( const node of structuralNodes ) {
507512 let docGap = null ;
508513 let testGap = null ;
@@ -530,27 +535,32 @@ ${contextText}
530535
531536 let combinedGaps = [ docGap , testGap ] . filter ( Boolean ) ;
532537
533- // --- GUIDE GAP INFERENCE (Vector Fast-Fail & Boolean LLM Verification) ---
538+ // --- GUIDE GAP INFERENCE (Native File-System & Boolean LLM Verification) ---
534539 let guideGap = null ;
535540 if ( node . type === 'CLASS' || node . type === 'CONCEPT' || node . type === 'COMPONENT' ) {
536541 try {
537- const { default : QueryService } = await import ( '../mcp/server/knowledge-base/services/QueryService.mjs' ) ;
538- await QueryService . ready ( ) ;
539-
540- const queryResult = await QueryService . queryDocuments ( { query : node . name , type : 'guide' , limit : 1 } ) ;
541-
542- if ( queryResult . message || ! queryResult . topResult ) {
542+ const nodeTokensGuide = node . name . replace ( / ( [ A - Z ] ) / g, ' $1' ) . toLowerCase ( ) . split ( / [ ^ a - z 0 - 9 ] + / ) . filter ( t => t . length > 2 ) ;
543+ if ( nodeTokensGuide . length === 0 ) nodeTokensGuide . push ( node . name . toLowerCase ( ) ) ;
544+
545+ // Loose path scan matching node tokens inside the learn/guides namespace
546+ const matchingGuide = guideFilePaths . find ( p => {
547+ const pLower = p . toLowerCase ( ) ;
548+ return nodeTokensGuide . some ( term => pLower . includes ( term ) ) ;
549+ } ) ;
550+
551+ if ( ! matchingGuide ) {
543552 guideGap = `[GUIDE_GAP] The ${ node . type } '${ node . name } ' lacks a corresponding architectural learning Guide in the knowledge base.` ;
544553 } else {
545- // Fast-Fail passed: Top result found. Now do Boolean LLM verification.
554+ // Core Match Passed: Now do Boolean LLM verification natively via file content
546555 const provider = Neo . create ( OpenAiCompatible , {
547556 modelName : aiConfig . openAiCompatible . model ,
548557 host : aiConfig . openAiCompatible . host
549558 } ) ;
550559
551560 let topContent = '' ;
552- if ( fs . existsSync ( queryResult . topResult ) ) {
553- topContent = fs . readFileSync ( queryResult . topResult , 'utf8' ) ;
561+ const guideAbsolutePath = path . resolve ( neoRootDir , matchingGuide ) ;
562+ if ( fs . existsSync ( guideAbsolutePath ) ) {
563+ topContent = fs . readFileSync ( guideAbsolutePath , 'utf8' ) ;
554564 }
555565
556566 // Truncate to save inference time on large guides
@@ -567,13 +577,13 @@ ${topContent}
567577 const res = await provider . generate ( verifyPrompt ) ;
568578 const vPayload = Json . extract ( res . content ) ;
569579 if ( vPayload && vPayload . verified === false ) {
570- guideGap = `[GUIDE_GAP] The ${ node . type } '${ node . name } ' lacks a dedicated architectural Guide (Existing vector hits failed LLM semantic verification).` ;
580+ guideGap = `[GUIDE_GAP] The ${ node . type } '${ node . name } ' lacks a dedicated architectural Guide (Existing file match failed LLM semantic verification).` ;
571581 } else if ( ! vPayload ) {
572582 logger . warn ( `[DreamService] Failed to extract boolean JSON for Guide verification of ${ node . name } .` ) ;
573583 }
574584 }
575585 } catch ( e ) {
576- logger . warn ( `[DreamService] Fast-Fail Vector Inference failed for ${ node . name } :` , e . message ) ;
586+ logger . warn ( `[DreamService] Native Knowledge Base Inference failed for ${ node . name } :` , e . message ) ;
577587 }
578588 }
579589
@@ -1065,7 +1075,7 @@ DO NOT output markdown, \`\`\`json blocks, or any other explanations. Provide pu
10651075 } else {
10661076 gaps = node . properties . capabilityGap . split ( / \\ n | \n / ) ;
10671077 }
1068-
1078+ gaps = [ ... new Set ( gaps ) ] ;
10691079 gaps . forEach ( gapMessage => {
10701080 if ( gapMessage && gapMessage . trim ( ) . length > 0 ) {
10711081 handoffContent += `- **[Codebase Gap]** Node \`${ node . id } \`: ${ gapMessage . trim ( ) } \n` ;
0 commit comments