Skip to main content

carry_agent_id_env

Function carry_agent_id_env 

Source
pub(crate) fn carry_agent_id_env(
    env_vars: &mut HashMap<String, String>,
    display_name: &str,
    persisted_slug: Option<&str>,
)
Expand description

AGENTMUX_AGENT_ID (and its MUXBUS_AGENT_ID mirror) when the launch’s cmd:env didn’t carry one. It is the canonical, app-wide agent-identity variable (MCP tool routing, native memory, shell OSC titling, jekt auto-registration, gh-agent; see this repo’s CLAUDE.md Naming Conventions table), and a cmd:env value takes precedence, unlike the reserved variables. The fallback is the row’s slug, as every launch path sets it and as the name-keyed signing keys are filed (identity M4d, agent_self_keys.rs); for a pane with no row (quick launch), its display name as a route name, since a name that isn’t a valid agent id (a fork’s “Loap #3”) fails every registration (REPORT_FORK_AGENT_ISOLATION_2026_10_12.md F3). MUXBUS_AGENT_ID mirrors it so muxbus-client picks it up under the prefix it checks first; scoped to that one hand-off point, not a second source of truth (ARCH-002).