pub fn default_agent_working_dir(agent_name: &str) -> StringExpand description
The working directory agent.open substitutes when an
AgentDefinition’s own working_directory is blank —
~/.agentmux/agents/<name-derived-slug>.
Blank is the DEFAULT for a newly defined agent, so this is the path most
agents actually run in. Extracted so agent.open (which creates and uses
it) and native-memory resolution (which must find the memories written
inside it) share one definition and cannot drift — they previously
disagreed, and the resolver simply gave up on a blank field, breaking
Memory → Personal for the common case. See
docs/specs/SPEC_FIX_PERSONAL_MEMORY_EMPTY_WORKDIR_2026_09_01.md.
NOTE: deliberately NOT derive_slug above. agent.open’s own inline
derivation is name.to_lowercase() with a Unicode-aware
char::is_alphanumeric() filter (keeping -/_), which differs from
derive_slug’s ASCII-only rule, dash-collapsing, 64-char trim and
"agent" fallback. Reusing derive_slug here would silently point at a
DIFFERENT directory than the one the agent is really running in for any
non-ASCII or dash-heavy name. This mirrors the real behaviour exactly.