pub fn resolve_claude_config_dir(
meta: &HashMap<String, Value>,
agent_id: &str,
bound_dir: Option<PathBuf>,
) -> Option<PathBuf>Expand description
The authoritative Claude Code config directory for a block.
bound_dir — pass identity::resolver::resolve_bound_oauth_config_dir’s
result here. It wins when present: for an agent bound to an explicit
account, it’s the ONLY correct answer — cmd:env.CLAUDE_CONFIG_DIR
below is a write-once launch-time snapshot of the generic shared-provider
dir, while the identity-bound agent’s CLI actually runs (and writes
subagent files) under its own identity dir, re-resolved fresh on every
turn (inject_identity_env_with_broker,
SPEC_PROVIDER_ISOLATION_2026_06_20.md §4.3) — cmd:env is never
updated to match. Confirmed live: a real dispatch’s transcript landed
under the identity dir while the watcher, following cmd:env alone, was
watching the generic dir and never saw it — see
SPEC_SUBAGENT_WATCHER_IDENTITY_BOUND_CONFIG_DIR_2026_08_22.md.
Falls back to cmd:env.CLAUDE_CONFIG_DIR (written by the launch flow
before spawn — see srv’s provider.ensureauthdir) when bound_dir
is None (an ambient/unbound agent, where cmd:env IS correct and
stays correct — nothing to re-resolve). Falls back further to
derive_claude_config_dir’s legacy ~/.config/claude-<agent_id> guess
only when cmd:env isn’t set yet either.
This distinction matters: derive_claude_config_dir’s guess only holds
for an agent with an explicit per-account auth dir. Any agent
without one launches under the shared default at
~/.agentmux/shared/providers/claude/, a completely different path that
the guess never matches — silently disabling subagent tracking for that
agent forever (confirmed live: repeated “config dir does not exist yet”
over 38+ minutes and multiple re-registrations, for an agent that had, in
fact, already spawned subagents — just under the real shared path). See
docs/specs/archive/REPORT_SWARM_SUBAGENT_HISTORY_FLOOD_2026_07_07.md.