Set process title to agent name in agent mode

When running g3 --agent butler, the process title is now "g3 [butler]"
which shows up in ps, Activity Monitor, top, etc.

Uses the proctitle crate for cross-platform support.
This commit is contained in:
Dhanji R. Prasanna
2026-01-16 14:37:58 +05:30
parent 1f6a5671b2
commit 4c6878a63d
3 changed files with 16 additions and 0 deletions

View File

@@ -31,6 +31,7 @@ regex = "1.10"
syntect = "5.3"
once_cell = "1.19"
rand = "0.8"
proctitle = "0.1.1"
[dev-dependencies]
tempfile = "3.8"

View File

@@ -29,6 +29,9 @@ pub async fn run_agent_mode(
use g3_core::find_incomplete_agent_session;
use g3_core::get_agent_system_prompt;
// Set process title to agent name (shows in ps, Activity Monitor, etc.)
proctitle::set_title(format!("g3 [{}]", agent_name));
// Initialize logging
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt, EnvFilter};
let filter = EnvFilter::from_default_env()