Wire knowledge graph traversal into passive hydration

t-821·WorkTask·
·
·
Created9 hours ago·Updated9 hours ago·pipeline runs →

Description

Edit

Currently, passiveSemanticKnowledgeSource in Omni/Agent/Context.hs only does a flat vector search (recallMemoriesEnhanced) and never traverses MemoryLink edges. The KnowledgeResult.krContradictions field is populated from the dedup pass, not from actual graph traversal.

What to change

In passiveSemanticKnowledgeSource (Omni/Agent/Context.hs ~line 189), after retrieving top memories via recallMemoriesEnhanced, walk the graph for each top memory using Memory.queryGraph (or equivalent), then fold linked/related memories into the hydrated section with provenance labels (e.g. 'related via elaborates link').

KnowledgeResult may need a new field (e.g. krLinkedMemories :: [(Text, RelationType, Text)]) to carry these linked records through to buildKnowledgeSection.

buildKnowledgeSection in Omni/Agent/Prompt/Hydrate.hs should render linked memories as a subsection, e.g.: ### Linked memories

  • [elaborates] <content>
  • [contradicts] <content>

Acceptance criteria

  • passiveSemanticKnowledgeSource traverses graph edges for top-k recalled memories
  • Linked memories appear in the rendered context section with their relation type
  • Existing tests still pass; add a unit test for the new linked-memories rendering
  • Token budget still respected (linked memories should count toward krTotalTokens)

Context

This is the first step in proving out a pluggable/stacked hydration architecture. The knowledge graph is currently only reachable via active agent tools (queryGraphTool), never passively injected. This closes that gap.

Timeline (0)

No activity yet.