fix(agent): use config max_tool_iterations, add memory relevance filtering, rebalance search weights

Three fixes for conversation quality issues:

1. loop_.rs and channels now read max_tool_iterations from AgentConfig
   instead of using a hardcoded constant of 10, making it configurable.

2. Memory recall now filters entries below a configurable
   min_relevance_score threshold (default 0.4), preventing unrelated
   memories from bleeding into conversation context.

3. Default hybrid search weights rebalanced from 70/30 vector/keyword
   to 40/60, reducing cross-topic semantic bleed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Edvard 2026-02-17 20:09:06 -05:00 committed by Chummy
parent 21c5f58363
commit 8a1e7cc7ef
6 changed files with 90 additions and 24 deletions

View file

@ -271,7 +271,10 @@ impl Agent {
.memory(memory)
.observer(observer)
.tool_dispatcher(tool_dispatcher)
.memory_loader(Box::new(DefaultMemoryLoader::default()))
.memory_loader(Box::new(DefaultMemoryLoader::new(
5,
config.memory.min_relevance_score,
)))
.prompt_builder(SystemPromptBuilder::with_defaults())
.config(config.agent.clone())
.model_name(model_name)