Split journal tools from default definitions, expose to all for now

journal_definitions() separated from definitions() in memory.rs.
All agents get memory + journal tools via memory_and_journal_definitions().
TODO: implement per-agent tool whitelist from header to properly
restrict journal tools to journal agent only.

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
Kent Overstreet 2026-04-01 15:12:14 -04:00
parent 4173f5ac5d
commit 834247fa53
3 changed files with 17 additions and 1 deletions

View file

@ -44,7 +44,9 @@ pub async fn call_api_with_tools(
let (ui_tx, mut ui_rx) = crate::agent::ui_channel::channel(); let (ui_tx, mut ui_rx) = crate::agent::ui_channel::channel();
// Subconscious agents only get memory tools — no filesystem access. // Subconscious agents only get memory tools — no filesystem access.
let tool_defs = thought::memory_definitions(); // TODO: respect tools whitelist from agent header to filter which
// native tools each agent gets (e.g. journal agent only gets journal tools)
let tool_defs = thought::memory_and_journal_definitions();
let tracker = ProcessTracker::new(); let tracker = ProcessTracker::new();
// Provenance tracks which agent:phase is making writes. // Provenance tracks which agent:phase is making writes.
// Updated between steps by the bail function via set_provenance(). // Updated between steps by the bail function via set_provenance().

View file

@ -57,6 +57,12 @@ pub fn definitions() -> Vec<ToolDef> {
"key":{"type":"string","description":"Output name (e.g. 'relevant_memories')"}, "key":{"type":"string","description":"Output name (e.g. 'relevant_memories')"},
"value":{"type":"string","description":"Output value"} "value":{"type":"string","description":"Output value"}
},"required":["key","value"]})), },"required":["key","value"]})),
]
}
/// Journal-only tools — only given to the journal agent
pub fn journal_definitions() -> Vec<ToolDef> {
vec![
ToolDef::new("journal_tail", ToolDef::new("journal_tail",
"Read the last N journal entries (default 1).", "Read the last N journal entries (default 1).",
json!({"type":"object","properties":{ json!({"type":"object","properties":{

View file

@ -128,3 +128,11 @@ pub fn all_definitions() -> Vec<ToolDef> {
pub fn memory_definitions() -> Vec<ToolDef> { pub fn memory_definitions() -> Vec<ToolDef> {
memory::definitions() memory::definitions()
} }
/// Return memory + journal tool definitions.
/// Used by the journal agent only.
pub fn memory_and_journal_definitions() -> Vec<ToolDef> {
let mut defs = memory::definitions();
defs.extend(memory::journal_definitions());
defs
}