From 1f6a5671b21d851d597266eaf043f981b2acd9ff Mon Sep 17 00:00:00 2001 From: "Dhanji R. Prasanna" Date: Fri, 16 Jan 2026 13:58:45 +0530 Subject: [PATCH] Use agent name as prompt in --agent --chat mode (e.g., "butler>") Changed run_interactive() parameter from bool to Option<&str> agent_name. When agent_name is Some, use it as the prompt instead of "g3>". --- crates/g3-cli/src/accumulative.rs | 2 +- crates/g3-cli/src/agent_mode.rs | 2 +- crates/g3-cli/src/interactive.rs | 16 ++++++++++++---- crates/g3-cli/src/lib.rs | 2 +- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/crates/g3-cli/src/accumulative.rs b/crates/g3-cli/src/accumulative.rs index 6fed11a..5dee156 100644 --- a/crates/g3-cli/src/accumulative.rs +++ b/crates/g3-cli/src/accumulative.rs @@ -300,7 +300,7 @@ async fn handle_command( chat_combined_content, workspace_dir, cli.new_session, - false, // from_agent_mode + None, // agent_name (not in agent mode) ) .await?; diff --git a/crates/g3-cli/src/agent_mode.rs b/crates/g3-cli/src/agent_mode.rs index 944ab0b..0344504 100644 --- a/crates/g3-cli/src/agent_mode.rs +++ b/crates/g3-cli/src/agent_mode.rs @@ -268,7 +268,7 @@ pub async fn run_agent_mode( combined_content, &workspace_dir, new_session, - true, // from_agent_mode - skip session resume and verbose welcome + Some(agent_name), // agent name for prompt (e.g., "butler>") ) .await; } diff --git a/crates/g3-cli/src/interactive.rs b/crates/g3-cli/src/interactive.rs index 594511a..19ed5de 100644 --- a/crates/g3-cli/src/interactive.rs +++ b/crates/g3-cli/src/interactive.rs @@ -16,7 +16,8 @@ use crate::task_execution::execute_task_with_retry; use crate::utils::display_context_progress; /// Run interactive mode with console output. -/// If `from_agent_mode` is true, skip session resume and verbose welcome (agent_mode already printed context info). +/// If `agent_name` is Some, we're in agent+chat mode: skip session resume/verbose welcome, +/// and use the agent name as the prompt (e.g., "butler>"). pub async fn run_interactive( mut agent: Agent, show_prompt: bool, @@ -24,9 +25,10 @@ pub async fn run_interactive( combined_content: Option, workspace_path: &Path, new_session: bool, - from_agent_mode: bool, + agent_name: Option<&str>, ) -> Result<()> { let output = SimpleOutput::new(); + let from_agent_mode = agent_name.is_some(); // Check for session continuation (skip if --new-session was passed or coming from agent mode) // Agent mode with --chat should start fresh without prompting @@ -167,9 +169,15 @@ pub async fn run_interactive( display_context_progress(&agent, &output); // Adjust prompt based on whether we're in multi-line mode - let prompt = if in_multiline { "... > " } else { "g3> " }; + let prompt = if in_multiline { + "... > ".to_string() + } else if let Some(name) = agent_name { + format!("{}> ", name) + } else { + "g3> ".to_string() + }; - let readline = rl.readline(prompt); + let readline = rl.readline(&prompt); match readline { Ok(line) => { let trimmed = line.trim_end(); diff --git a/crates/g3-cli/src/lib.rs b/crates/g3-cli/src/lib.rs index 565b919..7768fa9 100644 --- a/crates/g3-cli/src/lib.rs +++ b/crates/g3-cli/src/lib.rs @@ -218,7 +218,7 @@ async fn run_console_mode( combined_content, project.workspace(), cli.new_session, - false, // from_agent_mode + None, // agent_name (not in agent mode) ) .await }