Skip to content

Commit aead9c4

Browse files
committed
Remove unnecessary message tool for main agents
1 parent a987d5e commit aead9c4

2 files changed

Lines changed: 11 additions & 5 deletions

File tree

src/main.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ use icrab::sync;
2121
use icrab::telegram::{self, OutboundMsg};
2222
use icrab::tools;
2323
use icrab::tools::cron::{CronStore, CronTool};
24+
use icrab::tools::message::MessageTool;
2425
use icrab::tools::spawn::SpawnTool;
2526
use icrab::tools::subagent::SubagentTool;
2627
use icrab::tools::{GitSyncTool, GrepDirTool, SearchChatTool, SearchVaultTool};
@@ -100,9 +101,11 @@ async fn main() {
100101
sync::DEFAULT_PULL_INTERVAL_SECS / 3600
101102
);
102103

103-
// Build subagent registry (core + search tools — no spawn, no cron).
104+
// Build subagent registry (core + message + search tools — no spawn, no cron).
105+
// MessageTool is included here so background subagents can push results to the user.
104106
let subagent_registry = Arc::new({
105107
let reg = tools::build_core_registry(&cfg);
108+
reg.register(MessageTool);
106109
reg.register(SearchVaultTool::new(Arc::clone(&db)));
107110
reg.register(SearchChatTool::new(Arc::clone(&db)));
108111
reg.register(GrepDirTool);

src/tools/registry.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ use crate::config::Config;
1111
use crate::llm::ToolDef;
1212
use crate::tools::context::ToolCtx;
1313
use crate::tools::file::{AppendFile, EditFile, ListDir, ReadFile, WriteFile};
14-
use crate::tools::message::MessageTool;
1514
use crate::tools::result::ToolResult;
1615
use crate::tools::web::{WebFetchTool, WebSearchProvider, WebSearchTool, web_client};
1716

@@ -104,16 +103,20 @@ impl ToolRegistry {
104103
const DEFAULT_BRAVE_MAX_RESULTS: u8 = 5;
105104
const DEFAULT_WEB_FETCH_MAX_CHARS: u32 = 50_000;
106105

107-
/// Build the core registry (file + message + web). Used for subagent
108-
/// registries (no spawn, no cron) and as the base for the main registry.
106+
/// Build the core registry (file + web). Used as the base for both the
107+
/// main-agent registry and the subagent registry.
108+
///
109+
/// `MessageTool` is intentionally NOT included here. It is only added to
110+
/// subagent registries, where background tasks need to push results to the
111+
/// user. In the main agent the reply is returned as text content; offering
112+
/// `message` there causes the LLM to send duplicate replies.
109113
pub fn build_core_registry(config: &Config) -> ToolRegistry {
110114
let reg = ToolRegistry::new();
111115
reg.register(ReadFile);
112116
reg.register(WriteFile);
113117
reg.register(ListDir);
114118
reg.register(EditFile);
115119
reg.register(AppendFile);
116-
reg.register(MessageTool);
117120

118121
let web_cfg = config.tools.as_ref().and_then(|t| t.web.as_ref());
119122
let brave_max_results = web_cfg

0 commit comments

Comments
 (0)