fix: run_one_agent uses memory tools as base, not filter

When def.tools was non-empty, it was filtering to ONLY those tools
instead of using memory tools as base + adding extras. This broke
digest agent (and any agent with explicit tools list) by removing
all 13 base memory tools.

Fixed to match the pattern in unconscious.rs:
- base = memory_tools()
- extras from journal_tools() if listed in def.tools

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
Kent Overstreet 2026-04-11 20:53:29 -04:00
commit d6a9870b9e

View file

@ -307,14 +307,21 @@ pub fn run_one_agent(
defs::run_agent(store, &def, effective_count, &Default::default())? defs::run_agent(store, &def, effective_count, &Default::default())?
}; };
// Filter tools based on agent def, add filesystem output tool // Base memory tools + extras from agent def (matching unconscious.rs pattern)
let all_tools = super::tools::memory_and_journal_tools(); let base_tools = super::tools::memory::memory_tools().to_vec();
let extra_tools = super::tools::memory::journal_tools().to_vec();
let mut effective_tools: Vec<super::tools::Tool> = if def.tools.is_empty() { let mut effective_tools: Vec<super::tools::Tool> = if def.tools.is_empty() {
all_tools.to_vec() let mut all = base_tools;
all.extend(extra_tools);
all
} else { } else {
all_tools.into_iter() let mut tools = base_tools;
.filter(|t| def.tools.iter().any(|w| w == &t.name)) for name in &def.tools {
.collect() if let Some(t) = extra_tools.iter().find(|t| t.name == *name) {
tools.push(t.clone());
}
}
tools
}; };
effective_tools.push(super::tools::Tool { effective_tools.push(super::tools::Tool {
name: "output", name: "output",