Simplify --agent --chat startup: minimal output, no session resume
When running g3 --agent <name> --chat, the output is now minimal: - Workspace path (-> ~/path) - Status line (README/AGENTS.md/Memory) - Context progress bar - Prompt (g3>) Skipped in this mode: - Session resume prompts - "agent mode | name (source)" header - "g3 programming agent" welcome - Provider info display - Language guidance messages Added from_agent_mode parameter to run_interactive() to control whether verbose welcome and session resume are shown.
This commit is contained in:
@@ -300,6 +300,7 @@ async fn handle_command(
|
|||||||
chat_combined_content,
|
chat_combined_content,
|
||||||
workspace_dir,
|
workspace_dir,
|
||||||
cli.new_session,
|
cli.new_session,
|
||||||
|
false, // from_agent_mode
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
|||||||
@@ -49,15 +49,22 @@ pub async fn run_agent_mode(
|
|||||||
// Change to the workspace directory first so session scanning works correctly
|
// Change to the workspace directory first so session scanning works correctly
|
||||||
std::env::set_current_dir(&workspace_dir)?;
|
std::env::set_current_dir(&workspace_dir)?;
|
||||||
|
|
||||||
// Check for incomplete agent sessions before starting a new one (unless --new-session is set)
|
// Check for incomplete agent sessions before starting a new one
|
||||||
let resuming_session = if new_session {
|
// Skip session resume entirely when in chat mode (--agent --chat)
|
||||||
|
let resuming_session = if chat {
|
||||||
|
None // Chat mode always starts fresh
|
||||||
|
} else if new_session {
|
||||||
|
if !chat {
|
||||||
output.print("\n🆕 Starting new session (--new-session flag set)");
|
output.print("\n🆕 Starting new session (--new-session flag set)");
|
||||||
output.print("");
|
output.print("");
|
||||||
|
}
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
find_incomplete_agent_session(agent_name).ok().flatten()
|
find_incomplete_agent_session(agent_name).ok().flatten()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Only show session resume info when not in chat mode
|
||||||
|
if !chat {
|
||||||
if let Some(ref incomplete_session) = resuming_session {
|
if let Some(ref incomplete_session) = resuming_session {
|
||||||
output.print(&format!(
|
output.print(&format!(
|
||||||
"\n🔄 Found incomplete session for agent '{}'",
|
"\n🔄 Found incomplete session for agent '{}'",
|
||||||
@@ -74,6 +81,7 @@ pub async fn run_agent_mode(
|
|||||||
output.print(" Resuming incomplete session...");
|
output.print(" Resuming incomplete session...");
|
||||||
output.print("");
|
output.print("");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Load agent prompt: workspace agents/<name>.md first, then embedded fallback
|
// Load agent prompt: workspace agents/<name>.md first, then embedded fallback
|
||||||
let (agent_prompt, from_disk) = load_agent_prompt(agent_name, &workspace_dir).ok_or_else(|| {
|
let (agent_prompt, from_disk) = load_agent_prompt(agent_name, &workspace_dir).ok_or_else(|| {
|
||||||
@@ -85,8 +93,10 @@ pub async fn run_agent_mode(
|
|||||||
})?;
|
})?;
|
||||||
|
|
||||||
let source = if from_disk { "workspace" } else { "embedded" };
|
let source = if from_disk { "workspace" } else { "embedded" };
|
||||||
|
// Only print verbose header when not in chat mode
|
||||||
|
if !chat {
|
||||||
output.print(&format!(">> agent mode | {} ({})", agent_name, source));
|
output.print(&format!(">> agent mode | {} ({})", agent_name, source));
|
||||||
// Format workspace path, replacing home dir with ~
|
}
|
||||||
let workspace_display = {
|
let workspace_display = {
|
||||||
let path_str = workspace_dir.display().to_string();
|
let path_str = workspace_dir.display().to_string();
|
||||||
dirs::home_dir()
|
dirs::home_dir()
|
||||||
@@ -97,7 +107,8 @@ pub async fn run_agent_mode(
|
|||||||
})
|
})
|
||||||
.unwrap_or(path_str)
|
.unwrap_or(path_str)
|
||||||
};
|
};
|
||||||
output.print(&format!("-> {}", workspace_display));
|
// Always print workspace path (it's part of minimal output)
|
||||||
|
print!("{}-> {}{}\n", crossterm::style::SetForegroundColor(crossterm::style::Color::DarkGrey), workspace_display, crossterm::style::ResetColor);
|
||||||
|
|
||||||
// Load config
|
// Load config
|
||||||
let mut config = g3_config::Config::load(config_path)?;
|
let mut config = g3_config::Config::load(config_path)?;
|
||||||
@@ -139,10 +150,13 @@ pub async fn run_agent_mode(
|
|||||||
} else {
|
} else {
|
||||||
"·"
|
"·"
|
||||||
};
|
};
|
||||||
output.print(&format!(
|
// Always print status line (part of minimal output)
|
||||||
" {} README {} AGENTS.md {} Memory",
|
print!(
|
||||||
|
"{} {} README {} AGENTS.md {} Memory{}\n",
|
||||||
|
crossterm::style::SetForegroundColor(crossterm::style::Color::DarkGrey),
|
||||||
readme_status, agents_status, memory_status,
|
readme_status, agents_status, memory_status,
|
||||||
));
|
crossterm::style::ResetColor
|
||||||
|
);
|
||||||
|
|
||||||
// Get language-specific prompts (same mechanism as normal mode)
|
// Get language-specific prompts (same mechanism as normal mode)
|
||||||
let language_content = get_language_prompts_for_workspace(&workspace_dir);
|
let language_content = get_language_prompts_for_workspace(&workspace_dir);
|
||||||
@@ -153,9 +167,12 @@ pub async fn run_agent_mode(
|
|||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
let (content, matched_langs) = get_agent_language_prompts_for_workspace_with_langs(&workspace_dir, agent_name);
|
let (content, matched_langs) = get_agent_language_prompts_for_workspace_with_langs(&workspace_dir, agent_name);
|
||||||
|
// Only print language guidance info when not in chat mode
|
||||||
|
if !chat {
|
||||||
for lang in matched_langs {
|
for lang in matched_langs {
|
||||||
output.print(&format!(" ✓ {}: {} language guidance", agent_name, lang));
|
output.print(&format!(" ✓ {}: {} language guidance", agent_name, lang));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
content
|
content
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -244,7 +261,6 @@ pub async fn run_agent_mode(
|
|||||||
|
|
||||||
// If chat mode is enabled, run interactive loop instead of single task
|
// If chat mode is enabled, run interactive loop instead of single task
|
||||||
if chat {
|
if chat {
|
||||||
output.print("");
|
|
||||||
return run_interactive(
|
return run_interactive(
|
||||||
agent,
|
agent,
|
||||||
false, // show_prompt
|
false, // show_prompt
|
||||||
@@ -252,6 +268,7 @@ pub async fn run_agent_mode(
|
|||||||
combined_content,
|
combined_content,
|
||||||
&workspace_dir,
|
&workspace_dir,
|
||||||
new_session,
|
new_session,
|
||||||
|
true, // from_agent_mode - skip session resume and verbose welcome
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ use crate::task_execution::execute_task_with_retry;
|
|||||||
use crate::utils::display_context_progress;
|
use crate::utils::display_context_progress;
|
||||||
|
|
||||||
/// Run interactive mode with console output.
|
/// Run interactive mode with console output.
|
||||||
|
/// If `from_agent_mode` is true, skip session resume and verbose welcome (agent_mode already printed context info).
|
||||||
pub async fn run_interactive<W: UiWriter>(
|
pub async fn run_interactive<W: UiWriter>(
|
||||||
mut agent: Agent<W>,
|
mut agent: Agent<W>,
|
||||||
show_prompt: bool,
|
show_prompt: bool,
|
||||||
@@ -23,11 +24,13 @@ pub async fn run_interactive<W: UiWriter>(
|
|||||||
combined_content: Option<String>,
|
combined_content: Option<String>,
|
||||||
workspace_path: &Path,
|
workspace_path: &Path,
|
||||||
new_session: bool,
|
new_session: bool,
|
||||||
|
from_agent_mode: bool,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let output = SimpleOutput::new();
|
let output = SimpleOutput::new();
|
||||||
|
|
||||||
// Check for session continuation (skip if --new-session was passed)
|
// Check for session continuation (skip if --new-session was passed or coming from agent mode)
|
||||||
if !new_session {
|
// Agent mode with --chat should start fresh without prompting
|
||||||
|
if !new_session && !from_agent_mode {
|
||||||
if let Ok(Some(continuation)) = g3_core::load_continuation() {
|
if let Ok(Some(continuation)) = g3_core::load_continuation() {
|
||||||
output.print("");
|
output.print("");
|
||||||
output.print(&format!(
|
output.print(&format!(
|
||||||
@@ -67,6 +70,8 @@ pub async fn run_interactive<W: UiWriter>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Skip verbose welcome when coming from agent mode (it already printed context info)
|
||||||
|
if !from_agent_mode {
|
||||||
output.print("");
|
output.print("");
|
||||||
output.print("g3 programming agent");
|
output.print("g3 programming agent");
|
||||||
output.print(" >> what shall we build today?");
|
output.print(" >> what shall we build today?");
|
||||||
@@ -138,6 +143,7 @@ pub async fn run_interactive<W: UiWriter>(
|
|||||||
ResetColor
|
ResetColor
|
||||||
);
|
);
|
||||||
output.print("");
|
output.print("");
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize rustyline editor with history
|
// Initialize rustyline editor with history
|
||||||
let mut rl = DefaultEditor::new()?;
|
let mut rl = DefaultEditor::new()?;
|
||||||
|
|||||||
@@ -218,6 +218,7 @@ async fn run_console_mode(
|
|||||||
combined_content,
|
combined_content,
|
||||||
project.workspace(),
|
project.workspace(),
|
||||||
cli.new_session,
|
cli.new_session,
|
||||||
|
false, // from_agent_mode
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user