Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions crates/goose/src/agents/prompt_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ impl PromptManager {
Value::String(suggest_disable_extensions_prompt.to_string()),
);

// Add the mode to the context for conditional rendering
let config = Config::global();
let goose_mode = config.get_param("GOOSE_MODE").unwrap_or("auto".to_string());
context.insert("goose_mode", Value::String(goose_mode.clone()));
context.insert("is_autonomous", Value::Bool(goose_mode == "auto"));

// First check the global store, and only if it's not available, fall back to the provided model_name
let model_to_use: Option<String> =
get_current_model().or_else(|| model_name.map(|s| s.to_string()));
Expand All @@ -139,8 +145,6 @@ impl PromptManager {
};

let mut system_prompt_extras = self.system_prompt_extras.clone();
let config = Config::global();
let goose_mode = config.get_param("GOOSE_MODE").unwrap_or("auto".to_string());
if goose_mode == "chat" {
system_prompt_extras.push(
"Right now you are in the chat only mode, no access to any tool use and system."
Expand Down
13 changes: 13 additions & 0 deletions crates/goose/src/agents/reply_parts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ async fn toolshim_postprocess(
impl Agent {
/// Prepares tools and system prompt for a provider request
pub async fn prepare_tools_and_prompt(&self) -> anyhow::Result<(Vec<Tool>, Vec<Tool>, String)> {
// Determine the current mode from config
let config = crate::config::Config::global();
let mode = config.get_param("GOOSE_MODE").unwrap_or("auto".to_string());
let is_autonomous = mode == "auto";
Comment thread
tlongwell-block marked this conversation as resolved.
Outdated

// Get router enabled status
let router_enabled = self.tool_route_manager.is_router_enabled().await;

Expand All @@ -42,7 +47,15 @@ impl Agent {

// If router is disabled and no tools were returned, fall back to regular tools
if !router_enabled && tools.is_empty() {
// Get all tools but filter out subagent tools if not in autonomous mode
tools = self.list_tools(None).await;
if !is_autonomous {
// Filter out subagent-related tools
tools.retain(|tool| {
tool.name != crate::agents::subagent_execution_tool::subagent_execute_task_tool::SUBAGENT_EXECUTE_TASK_TOOL_NAME
&& tool.name != crate::agents::recipe_tools::dynamic_task_tools::DYNAMIC_TASK_TOOL_NAME_PREFIX
});
}
}

// Add frontend tools
Expand Down
4 changes: 2 additions & 2 deletions crates/goose/src/agents/todo_extension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ impl TodoClient {
- [ ] Implement feature X
- [ ] Update API
- [ ] Write tests
- [ ] Run tests (subagent in parallel)
- [ ] Run lint (subagent in parallel)
- [ ] Run tests
- [ ] Run lint
- [ ] Blocked: waiting on credentials
"#}.to_string()),
};
Expand Down
3 changes: 2 additions & 1 deletion crates/goose/src/prompts/system.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ No extensions are defined. You should let the user know that they should add ext
{% endif %}

{{tool_selection_strategy}}

{% if is_autonomous %}
# sub agents

Execute self contained tasks where step-by-step visibility is not important through subagents.
Expand All @@ -60,6 +60,7 @@ Execute self contained tasks where step-by-step visibility is not important thro
- Provide all needed context — subagents cannot see your context
- Use extension filters to limit resource access
- Use return_last_only when only a summary or simple answer is required — inform subagent of this choice.
{% endif %}

# Response Guidelines

Expand Down
Loading