Skip to content

feat(spawn): configurable CLAUDE_CONFIG_DIR for hands-free multi-account claude launch#634

Open
tkt028 wants to merge 2 commits into
kunchenguid:mainfrom
tkt028:feat/599-crew-config-dir-hands-free
Open

feat(spawn): configurable CLAUDE_CONFIG_DIR for hands-free multi-account claude launch#634
tkt028 wants to merge 2 commits into
kunchenguid:mainfrom
tkt028:feat/599-crew-config-dir-hands-free

Conversation

@tkt028

@tkt028 tkt028 commented Jul 16, 2026

Copy link
Copy Markdown

Fixes #599

Problem

bin/fm-spawn.sh's claude launch template runs bare claude, which resolves to the default config dir (~/.claude). On a machine with multiple Claude accounts — where auth lives in alternate config dirs and the default ~/.claude is empty/unauthenticated — a spawned crewmate lands on the "Select login method" wall and can never start. There was no way to tell fm-spawn which authenticated config dir a claude crewmate should use.

Change

Add a local, gitignored config/crew-config-dir knob naming the Claude config dir (CLAUDE_CONFIG_DIR) a spawned claude crewmate authenticates with. When set, fm-spawn prefixes the claude launch command with CLAUDE_CONFIG_DIR=<dir> , while still appending its own autonomy and brief args unchanged.

  • Claude-harness only. A new __CLAUDECONFIGDIR__ placeholder lives solely in the claude launch template; every other harness ignores the knob.
  • Scoped, not global. The value becomes a per-launch env prefix on the launch command, so it never mutates the captain's global config.
  • Backward compatible. An absent or empty knob is byte-identical to prior behavior — bare claude on its default config dir — so single-account machines are unaffected.
  • Path-safe. Only leading/trailing whitespace is trimmed (internal spaces in a config-dir path are preserved), and the value is shell-quoted into the launch string.

Tests

tests/fm-spawn-claude-config-dir.test.sh drives a real claude ship spawn through fm-spawn.sh with a fake tmux that records the literal launch string, and asserts both directions:

  1. With config/crew-config-dir set → the launch gains the CLAUDE_CONFIG_DIR=<value> prefix in the correct position.
  2. With the knob absent → no CLAUDE_CONFIG_DIR prefix (the byte-identical prior launch).

The behavioral assertion drives the launch-string construction rather than grepping for a token, and was negative-tested (it fails when the substitution is removed).

Validation

  • bin/fm-lint.sh (full shellcheck set, pinned version) — clean.
  • bash -n on the whole bin/ toolbelt — clean.
  • New test passes; the rest of the suite shows only pre-existing environment-dependent failures (missing/incompatible tasks-axi, optional backends absent) unchanged by this diff.

Docs

docs/configuration.md documents the knob in the harness support section: what it names, claude-harness-only scope, and the absent-knob backward-compat guarantee.


🤖 Claude Code · claude-opus-4-8 · 2026-07-16

tkt028 added 2 commits July 16, 2026 15:16
kunchenguid#599)

On a multi-account machine the default ~/.claude can be empty or
unauthenticated, so a bare-`claude` crewmate lands on the login wall and
never starts. Add a local, gitignored config/crew-config-dir knob naming
the Claude config dir a claude crewmate authenticates with; when set,
fm-spawn prefixes the claude launch command with CLAUDE_CONFIG_DIR=<dir>.

The prefix is claude-harness only and scoped to the firstmate-launched
agent, so it never mutates the captain's global config. An absent or
empty knob is byte-identical to prior behavior (bare `claude`, default
config dir). A backward-compat test drives the launch-string construction
in both directions.
…d#599)

Describe the local, gitignored config/crew-config-dir file in the harness
support section: it names the Claude config dir a spawned claude crewmate
authenticates with, is claude-harness only, and is byte-identical to prior
behavior when absent or empty.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fm-spawn: claude crewmate launch hardcodes bare 'claude', failing on multi-account machines

1 participant