diff --git a/rust/crates/runtime/src/config.rs b/rust/crates/runtime/src/config.rs index 0d417a92..503e6f33 100644 --- a/rust/crates/runtime/src/config.rs +++ b/rust/crates/runtime/src/config.rs @@ -1131,17 +1131,24 @@ impl RuntimeConfig { pub fn lsp_auto_start(&self) -> bool { self.feature_config.lsp_auto_start } +<<<<<<< HEAD ======= pub fn rules_import(&self) -> &RulesImportConfig { &self.feature_config.rules_import } >>>>>>> 22f948b7 (feat: project rules with .claw/rules/ and multi-framework auto-import) ======= +======= + +>>>>>>> 6b0af2bc (refactor: remove SubAgent tool, make Agent use subagentModel config) #[must_use] pub fn subagent_model(&self) -> Option<&str> { self.feature_config.subagent_model.as_deref() } +<<<<<<< HEAD >>>>>>> 7e7baeaa (feat: SubAgent tool for fast sub-agent delegation) +======= +>>>>>>> 6b0af2bc (refactor: remove SubAgent tool, make Agent use subagentModel config) } impl RuntimeFeatureConfig { diff --git a/rust/crates/rusty-claude-cli/src/setup_wizard.rs b/rust/crates/rusty-claude-cli/src/setup_wizard.rs index c2f7b6ff..943eb7e3 100644 --- a/rust/crates/rusty-claude-cli/src/setup_wizard.rs +++ b/rust/crates/rusty-claude-cli/src/setup_wizard.rs @@ -233,7 +233,11 @@ fn prompt_fast_model( main_model: Option<&str>, ) -> Result, Box> { println!(); +<<<<<<< HEAD println!(" \x1b[1mFast Model (for Agent subtasks)\x1b[0m"); +======= + println!(" Fast Model (for Agent subtasks)"); +>>>>>>> 6b0af2bc (refactor: remove SubAgent tool, make Agent use subagentModel config) println!(" A smaller/cheaper model used by the Agent tool when spawning"); println!(" Explore, Plan, or Verification sub-agents. This saves tokens"); println!(" by using a fast model for information-gathering tasks."); diff --git a/rust/crates/tools/src/lib.rs b/rust/crates/tools/src/lib.rs index a2df1305..f0062f65 100644 --- a/rust/crates/tools/src/lib.rs +++ b/rust/crates/tools/src/lib.rs @@ -675,7 +675,7 @@ pub fn mvp_tool_specs() -> Vec { }, ToolSpec { name: "Agent", - description: "Launch a background agent task that runs asynchronously. For synchronous read-only exploration, use SubAgent instead. Agent is for long-running background work that should not block the conversation.", + description: "Launch a specialized agent task. Use subagent_type to select the agent role: Explore (read-only search), Plan (explore + todo), Verification (explore + bash + todo), or general-purpose (full access). The agent uses subagentModel from settings if set, otherwise the default model.", input_schema: json!({ "type": "object", "properties": { @@ -4493,11 +4493,22 @@ fn build_agent_system_prompt(subagent_type: &str, model: &str) -> Result) -> String { - model - .map(str::trim) - .filter(|model| !model.is_empty()) - .unwrap_or(DEFAULT_AGENT_MODEL) - .to_string() + if let Some(m) = model.map(str::trim).filter(|m| !m.is_empty()) { + return m.to_string(); + } + if let Some(fast) = load_subagent_model_from_config() { + return fast; + } + DEFAULT_AGENT_MODEL.to_string() +} + +fn load_subagent_model_from_config() -> Option { + std::env::current_dir().ok().and_then(|cwd| { + ConfigLoader::default_for(&cwd) + .load() + .ok() + .and_then(|config| config.subagent_model().map(|m| m.to_string())) + }) } fn allowed_tools_for_subagent(subagent_type: &str) -> BTreeSet {