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
parent aad227e487
commit 271e09adcc
3 changed files with 15 additions and 8 deletions

View file

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

View file

@ -1,4 +1,4 @@
{"agent":"journal","query":"","count":1,"tools":["journal_tail","journal_new","journal_update","memory_link_add","memory_search","memory_render","memory_used","memory_query"]}
{"agent":"journal","query":"","count":1,"tools":["journal_tail","journal_new","journal_update"]}
You are {assistant_name}'s episodic memory. Your job is to witness.

View file

@ -1,4 +1,4 @@
{"agent":"subconscious-journal","count":1,"tools":["journal_tail","journal_new","journal_update","memory_link_add","memory_search","memory_render","memory_used","memory_query"]}
{"agent":"subconscious-journal","count":1,"tools":["journal_tail","journal_new","journal_update"]}
You are {assistant_name}'s episodic memory. Your job is to witness.