diff --git a/crates/goose/src/agents/agent.rs b/crates/goose/src/agents/agent.rs index 1b562b2dd..e93199ee9 100644 --- a/crates/goose/src/agents/agent.rs +++ b/crates/goose/src/agents/agent.rs @@ -1083,18 +1083,6 @@ impl Agent { extension_configs } - pub(crate) async fn total_extension_and_tool_counts(&self, session_id: &str) -> (usize, usize) { - let (extension_count, tool_count) = self - .extension_manager - .get_extension_and_tool_counts(session_id) - .await; - - ( - extension_count + self.frontend_extensions.lock().await.len(), - tool_count + self.frontend_tools.lock().await.len(), - ) - } - pub async fn add_final_output_tool(&self, response: Response) { let mut final_output_tool = self.final_output_tool.lock().await; let created_final_output_tool = FinalOutputTool::new(response); @@ -3764,7 +3752,6 @@ impl Agent { .get_extensions_info(&session.working_dir) .await; tracing::debug!("Retrieved {} extensions info", extensions_info.len()); - let (extension_count, tool_count) = self.total_extension_and_tool_counts(session_id).await; let model_config = self.model_config_for_session(session_id).await?; let model_name = &model_config.model_name; @@ -3776,7 +3763,6 @@ impl Agent { .builder() .with_extensions(extensions_info.into_iter()) .with_frontend_instructions(self.frontend_instructions.lock().await.clone()) - .with_extension_and_tool_counts(extension_count, tool_count) .with_goose_mode(goose_mode) .build(); diff --git a/crates/goose/src/agents/extension_manager.rs b/crates/goose/src/agents/extension_manager.rs index 16a76c2c2..6f6fa0c9e 100644 --- a/crates/goose/src/agents/extension_manager.rs +++ b/crates/goose/src/agents/extension_manager.rs @@ -1291,18 +1291,6 @@ impl ExtensionManager { } } - pub async fn get_extension_and_tool_counts(&self, session_id: &str) -> (usize, usize) { - let enabled_extensions_count = self.extensions.lock().await.len(); - - let total_tools = self - .get_prefixed_tools(session_id, None) - .await - .map(|tools| tools.len()) - .unwrap_or(0); - - (enabled_extensions_count, total_tools) - } - pub async fn list_extensions(&self) -> ExtensionResult> { Ok(self.extensions.lock().await.keys().cloned().collect()) } diff --git a/crates/goose/src/agents/prompt_manager.rs b/crates/goose/src/agents/prompt_manager.rs index 0f6a59e7b..985250986 100644 --- a/crates/goose/src/agents/prompt_manager.rs +++ b/crates/goose/src/agents/prompt_manager.rs @@ -16,9 +16,6 @@ use crate::{ }; use std::path::Path; -const MAX_EXTENSIONS: usize = 5; -const MAX_TOOLS: usize = 50; - pub struct PromptManager { system_prompt_override: Option, system_prompt_extras: IndexMap, @@ -36,13 +33,9 @@ impl Default for PromptManager { struct SystemPromptContext { extensions: Vec, current_date_time: String, - #[serde(skip_serializing_if = "Option::is_none")] - extension_tool_limits: Option<(usize, usize)>, goose_mode: GooseMode, is_autonomous: bool, enable_subagents: bool, - max_extensions: usize, - max_tools: usize, code_execution_mode: bool, include_extensions: bool, #[serde(skip_serializing_if = "Option::is_none")] @@ -55,7 +48,6 @@ pub struct SystemPromptBuilder<'a, M> { extensions_info: Vec, frontend_instructions: Option, prompt_extras: IndexMap, - extension_tool_count: Option<(usize, usize)>, subagents_enabled: bool, hints: Option, code_execution_mode: bool, @@ -89,15 +81,6 @@ impl<'a> SystemPromptBuilder<'a, PromptManager> { self } - pub fn with_extension_and_tool_counts( - mut self, - extension_count: usize, - tool_count: usize, - ) -> Self { - self.extension_tool_count = Some((extension_count, tool_count)); - self - } - pub fn with_code_execution_mode(mut self, enabled: bool) -> Self { self.code_execution_mode = enabled; self @@ -156,19 +139,12 @@ impl<'a> SystemPromptBuilder<'a, PromptManager> { .goose_mode .unwrap_or_else(|| Config::global().get_goose_mode().unwrap_or_default()); - let extension_tool_limits = self - .extension_tool_count - .filter(|(extensions, tools)| *extensions > MAX_EXTENSIONS || *tools > MAX_TOOLS); - let context = SystemPromptContext { extensions: sanitized_extensions_info, current_date_time: self.manager.current_date_timestamp.clone(), - extension_tool_limits, goose_mode, is_autonomous: goose_mode == GooseMode::Auto, enable_subagents: self.subagents_enabled, - max_extensions: MAX_EXTENSIONS, - max_tools: MAX_TOOLS, code_execution_mode: self.code_execution_mode, include_extensions: self.include_extensions, moim_system_prompt_block: moim::system_prompt_block(), @@ -298,7 +274,6 @@ impl PromptManager { extensions_info: vec![], frontend_instructions: None, prompt_extras: IndexMap::new(), - extension_tool_count: None, subagents_enabled: false, hints: None, code_execution_mode: false, @@ -514,7 +489,6 @@ mod tests { "", false, )) - .with_extension_and_tool_counts(MAX_EXTENSIONS + 1, MAX_TOOLS + 1) .build(); assert_snapshot!(system_prompt) diff --git a/crates/goose/src/agents/reply_parts.rs b/crates/goose/src/agents/reply_parts.rs index 06eb12a93..331838140 100644 --- a/crates/goose/src/agents/reply_parts.rs +++ b/crates/goose/src/agents/reply_parts.rs @@ -205,8 +205,6 @@ impl Agent { .extension_manager .get_extensions_info(working_dir) .await; - let (extension_count, tool_count) = self.total_extension_and_tool_counts(session_id).await; - let model_config = self.model_config_for_session(session_id).await?; let goose_mode = *self.current_goose_mode.lock().await; @@ -220,7 +218,6 @@ impl Agent { .builder() .with_extensions(extensions_info.into_iter()) .with_frontend_instructions(self.frontend_instructions.lock().await.clone()) - .with_extension_and_tool_counts(extension_count, tool_count) .with_code_execution_mode(code_execution_active) .with_hints(working_dir) .with_goose_mode(goose_mode) diff --git a/crates/goose/src/agents/snapshots/goose__agents__prompt_manager__tests__all_platform_extensions.snap b/crates/goose/src/agents/snapshots/goose__agents__prompt_manager__tests__all_platform_extensions.snap index bffcbf650..7c4d9753e 100644 --- a/crates/goose/src/agents/snapshots/goose__agents__prompt_manager__tests__all_platform_extensions.snap +++ b/crates/goose/src/agents/snapshots/goose__agents__prompt_manager__tests__all_platform_extensions.snap @@ -156,7 +156,6 @@ Template: - # Response Guidelines Use Markdown formatting for all responses. diff --git a/crates/goose/src/agents/snapshots/goose__agents__prompt_manager__tests__basic.snap b/crates/goose/src/agents/snapshots/goose__agents__prompt_manager__tests__basic.snap index 2bacc5e5b..494d32289 100644 --- a/crates/goose/src/agents/snapshots/goose__agents__prompt_manager__tests__basic.snap +++ b/crates/goose/src/agents/snapshots/goose__agents__prompt_manager__tests__basic.snap @@ -1,5 +1,6 @@ --- source: crates/goose/src/agents/prompt_manager.rs +assertion_line: 457 expression: system_prompt --- You are a general-purpose AI agent called goose, created by AAIF (Agentic AI Foundation). @@ -30,7 +31,6 @@ You can dynamically enable or disable extensions as needed to help complete task No extensions are defined. You should let the user know that they should add extensions. - # Response Guidelines Use Markdown formatting for all responses. diff --git a/crates/goose/src/agents/snapshots/goose__agents__prompt_manager__tests__one_extension.snap b/crates/goose/src/agents/snapshots/goose__agents__prompt_manager__tests__one_extension.snap index 34207b9de..f81e7549a 100644 --- a/crates/goose/src/agents/snapshots/goose__agents__prompt_manager__tests__one_extension.snap +++ b/crates/goose/src/agents/snapshots/goose__agents__prompt_manager__tests__one_extension.snap @@ -1,5 +1,6 @@ --- source: crates/goose/src/agents/prompt_manager.rs +assertion_line: 473 expression: system_prompt --- You are a general-purpose AI agent called goose, created by AAIF (Agentic AI Foundation). @@ -40,7 +41,6 @@ test supports resources. ### Instructions how to use this extension - # Response Guidelines Use Markdown formatting for all responses. diff --git a/crates/goose/src/agents/snapshots/goose__agents__prompt_manager__tests__typical_setup.snap b/crates/goose/src/agents/snapshots/goose__agents__prompt_manager__tests__typical_setup.snap index 555fbe364..20c70bdeb 100644 --- a/crates/goose/src/agents/snapshots/goose__agents__prompt_manager__tests__typical_setup.snap +++ b/crates/goose/src/agents/snapshots/goose__agents__prompt_manager__tests__typical_setup.snap @@ -1,5 +1,6 @@ --- source: crates/goose/src/agents/prompt_manager.rs +assertion_line: 494 expression: system_prompt --- You are a general-purpose AI agent called goose, created by AAIF (Agentic AI Foundation). @@ -44,11 +45,6 @@ extension_A supports resources. ### Instructions -# Suggestion - -The user has 6 extensions with 51 tools enabled, exceeding recommended limits (5 extensions or 50 tools). -Consider asking if they'd like to disable some extensions to improve tool selection accuracy. - # Response Guidelines Use Markdown formatting for all responses. diff --git a/crates/goose/src/prompts/system.md b/crates/goose/src/prompts/system.md index 7c42beb2a..27a8d2fc9 100644 --- a/crates/goose/src/prompts/system.md +++ b/crates/goose/src/prompts/system.md @@ -34,15 +34,6 @@ No extensions are defined. You should let the user know that they should add ext {% endif %} {% endif %} -{% if include_extensions and extension_tool_limits is defined and not code_execution_mode %} -{% with (extension_count, tool_count) = extension_tool_limits %} -# Suggestion - -The user has {{extension_count}} extensions with {{tool_count}} tools enabled, exceeding recommended limits ({{max_extensions}} extensions or {{max_tools}} tools). -Consider asking if they'd like to disable some extensions to improve tool selection accuracy. -{% endwith %} -{% endif %} - # Response Guidelines Use Markdown formatting for all responses.