Skip to content

feat(memory): wire StoreRoutingConfig into build_router() for cost-sensitive routing #2484

@bug-ops

Description

@bug-ops

Context

PR implementing #2444 (cost-sensitive store routing) added StoreRoutingConfig, LlmRouter, HybridRouter, and the AsyncMemoryRouter trait. However, context_manager.rs::build_router() still always returns HeuristicRouter regardless of the [memory.store_routing] config.

Required Change

In zeph-core/src/agent/context_manager.rs, update build_router() to read memory.store_routing config and return the appropriate router:

  • strategy = "heuristic"HeuristicRouter (current behavior)
  • strategy = "llm"LlmRouter constructed with the configured routing_classifier_provider
  • strategy = "hybrid"HybridRouter with configured provider and confidence_threshold

The router is Arc<dyn MemoryRouter> — async callers in the recall path should downcast to AsyncMemoryRouter when LLM routing is active.

Acceptance Criteria

  • build_router() respects [memory.store_routing] strategy
  • strategy = "heuristic" is identical to current behavior
  • LLM and hybrid strategies call the configured provider
  • Fallback to heuristic on LLM failure preserved

Metadata

Metadata

Assignees

Labels

P3Research — medium-high complexityenhancementNew feature or requestmemoryzeph-memory crate (SQLite)

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions