fix(memory): wire LearningBridge into intelligence module (WM-013)#1263
Open
invidias-codem wants to merge 1 commit intoruvnet:mainfrom
Open
fix(memory): wire LearningBridge into intelligence module (WM-013)#1263invidias-codem wants to merge 1 commit intoruvnet:mainfrom
invidias-codem wants to merge 1 commit intoruvnet:mainfrom
Conversation
Closes ruvnet#1213 LearningBridge was exported from @claude-flow/memory but never instantiated at runtime. Config keys learningBridge.sonaMode, confidenceDecayRate, accessBoostAmount, and consolidationThreshold were read by WM-007b into intelligence.ts but never passed to an actual LearningBridge instance. Changes (WM-013a/b/c): - WM-013a: Add `_learningBridge` module-level singleton after `reasoningBank` - WM-013b: Instantiate LearningBridge in initializeIntelligence() after ReasoningBank init, reading config from `cfgMemory.learningBridge.*`. Uses dynamic import of @claude-flow/memory (optional peer) and resolves backend from ControllerRegistry via memory-bridge — degrades to null when either is unavailable, matching the graceful-degrade pattern used by LearningBridge for @claude-flow/neural. - WM-013c: Export getLearningBridge() getter function Additional: - Add optional `learningBridge` field to SonaConfig interface - Add `learningBridgeEnabled` to IntelligenceStats - Update initializeIntelligence() return type to include learningBridgeEnabled - Call _learningBridge.destroy() in clearIntelligence() to flush active trajectories before teardown Related: ruvnet#1210 (WM-011 ReasoningBank pattern), ruvnet#1204 (WM-007 config reads)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1213
LearningBridgewas exported from@claude-flow/memorybut never instantiated at runtime insideintelligence.ts(compiled:dist/src/memory/memory-initializer.js). Config keyslearningBridge.sonaMode,confidenceDecayRate,accessBoostAmount, andconsolidationThresholdwere read by WM-007b but never wired to an actualLearningBridgeinstance, leaving confidence decay, trajectory tracking, and pattern consolidation as dead code.Changes
Following the WM-011 (
ReasoningBank) initialization pattern:intelligence.tslet _learningBridge: any | null = null;module-level variable afterreasoningBankintelligence.tsLearningBridgeafter ReasoningBank init block, reading config fromfinalConfig.learningBridge.*intelligence.tsgetLearningBridge()getter functionAdditional:
learningBridge?field toSonaConfiginterfacelearningBridgeEnabled: booleantoIntelligenceStatsinitializeIntelligence()return type to surfacelearningBridgeEnabled_learningBridge.destroy()insideclearIntelligence()to flush active trajectories before teardownImplementation Notes
@claude-flow/memoryis not a direct dependency of@claude-flow/cli, soLearningBridgeis loaded via dynamic import (same optional-peer pattern thatLearningBridgeitself uses internally for@claude-flow/neural). The backend is resolved throughControllerRegistryviamemory-bridge.js. When either is unavailable,_learningBridgestaysnulland all paths degrade gracefully — no change in behavior for environments without@claude-flow/memoryinstalled.Testing
Existing
learning-bridge.test.tscovers theLearningBridgeclass API. The wiring inintelligence.tsdegrades silently when the package is absent, so no new required tests — but a follow-up integration test (checkinggetLearningBridge() !== nullafterinitializeIntelligence({ learningBridge: { enabled: true } })in a full install) would be a useful addition.Related