Refactor HydrationConfig to stacked HydrationSource list

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

Description

Edit

Currently HydrationConfig has three hardcoded named slots: hcTemporalSource :: Maybe (ContextSource TemporalResult) hcSemanticSource :: Maybe (ContextSource SemanticResult) hcKnowledgeSource :: Maybe (ContextSource KnowledgeResult)

This prevents plugging in arbitrary hydration sources (e.g. per-repo coding memory, git log, docs-RAG).

Goal

Replace the three named slots with a stacked list: hcSources :: [HydrationSource]

Where HydrationSource is self-rendering: data HydrationSource = HydrationSource { hsName :: Text , hsPriority :: Priority -- or Int ordering , hsBudget :: Maybe Int -- token budget , hsRun :: SourceParams -> IO [Section] }

The hydrator (Omni/Agent/Prompt/Hydrate.hs) runs each source in order, enforces per-source token budgets, and merges the resulting Section list.

Two-layer design

1. HydrationSource — the universal stacking interface (name, priority, budget, IO [Section]) 2. Typed source builders (temporalSource, semanticSource, knowledgeSource) remain as helper functions that produce a HydrationSource — preserving typed ergonomics without hardcoded slots

The existing passiveTemporalSource, passiveSemanticSource, passiveSemanticKnowledgeSource in Context.hs become builders that produce HydrationSource values.

Acceptance criteria

  • hcSources :: [HydrationSource] replaces the three named slots
  • All existing sources refactored to use the new interface
  • buildContextHydrationConfig updated to build a list of sources
  • New source can be added by appending to the list (no schema change required)
  • All existing tests pass
  • The per-repo coding memory use case is unblocked (can instantiate a new source with a different memory scope)

Context

This is the second step in proving out a pluggable/stacked hydration architecture (follows t-821 which adds graph traversal). The goal is to make 'any (temporal x semantic) data source' pluggable as a hydration source — essentially generalized RAG with budget enforcement on top. See also: Ben's adaptive context framing (passive/active x temporal/semantic quadrants) which maps to source tags, not structure.

Timeline (2)

💬[human]9 hours ago

Depends on t-821 (graph traversal in passive hydration) — implement t-821 first.