Skip to main content

maybe_auto_init_cwd_session

Function maybe_auto_init_cwd_session 

Source
pub fn maybe_auto_init_cwd_session(label: &str)
Expand description

v0.7.0-alpha.2: idempotent per-cwd session creation.

When the auto-detect (maybe_adopt_session_wire_home) finds no registered session for the current cwd — including via parent-walk — this creates one inline so every Claude tab in a fresh project gets its own wire identity rather than collapsing onto the machine-wide default. Without this, multiple Claudes in unwired cwds all render the same character (the default identity’s character), defeating the “every session looks different” promise.

Opt-out: WIRE_AUTO_INIT=0 env var (e.g. set in shell profile or run_wire_with_home subprocess context).

Best-effort: any failure (no home dir, name collision pathology, wire init subprocess crash) is logged to stderr and we fall back to default identity. Must not block MCP startup.

MUST be called BEFORE worker thread spawn (env::set_var safety).