Skip to content

feat: support CLAUDE_SQUAD_HOME environment variable for custom config directory#246

Open
zimathon wants to merge 1 commit intosmtg-ai:mainfrom
zimathon:feature/claude-squad-home-env
Open

feat: support CLAUDE_SQUAD_HOME environment variable for custom config directory#246
zimathon wants to merge 1 commit intosmtg-ai:mainfrom
zimathon:feature/claude-squad-home-env

Conversation

@zimathon
Copy link

Summary

Add support for the CLAUDE_SQUAD_HOME environment variable to allow users to customize the configuration directory location.

Closes #245

Changes

  • Add EnvConfigDir constant for the environment variable name
  • Modify GetConfigDir() to check for the environment variable first
  • Support tilde expansion (~/) in the environment variable value
  • Add comprehensive tests for the new functionality

Use Cases

1. Per-repository session isolation:

#!/bin/bash
REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null)
REPO_NAME=$(basename "$REPO_ROOT")
export CLAUDE_SQUAD_HOME="$HOME/.claude-squad/repos/$REPO_NAME"
exec claude-squad "$@"

2. Project-specific configurations:

export CLAUDE_SQUAD_HOME="$PWD/.claude-squad"

3. Testing/development:

CLAUDE_SQUAD_HOME=/tmp/cs-test claude-squad

Benefits

  • Backwards compatible: Default behavior unchanged when env var is not set
  • Simple implementation: Minimal code change required
  • Flexible: Users can implement their own isolation strategies
  • Reduces state corruption impact: Issues in one config dir don't affect others

Test plan

  • go build . succeeds
  • go test ./config/... passes
  • Manual verification with CLAUDE_SQUAD_HOME=/tmp/test-cs ./claude-squad debug
  • Tilde expansion works correctly

Verification

$ CLAUDE_SQUAD_HOME=/tmp/test-cs ./claude-squad debug
Config: /tmp/test-cs/config.json
{
  "default_program": "/opt/homebrew/bin/claude",
  "auto_yes": false,
  "daemon_poll_interval": 1000,
  "branch_prefix": "y.sasajima/"
}

…g directory

Add support for the CLAUDE_SQUAD_HOME environment variable to allow users
to customize the configuration directory location. This enables:

- Per-repository session isolation via wrapper scripts
- Project-specific configurations
- Testing/development with isolated config directories

The environment variable takes precedence over the default ~/.claude-squad
path. Tilde expansion (~/) is supported for convenience.

Closes smtg-ai#245
@github-actions
Copy link

github-actions bot commented Jan 20, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@zimathon
Copy link
Author

I have read the CLA Document and I hereby sign the CLA

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.

Feature Request: Support CLAUDE_SQUAD_HOME environment variable for custom config directory

1 participant