-
Notifications
You must be signed in to change notification settings - Fork 441
Open
Description
Problem
Currently, claude-squad stores all configuration and state in a hardcoded path ~/.claude-squad. This causes issues when working with multiple git repositories:
- Session mixing: All sessions from different repositories are displayed together, making it difficult to manage when working across multiple projects
- State corruption risk: If claude-squad crashes or terminates abnormally, the single
state.jsoncan become corrupted, affecting all repositories - No isolation: There's no way to have separate configurations per repository or project
Proposed Solution
Add support for a CLAUDE_SQUAD_HOME environment variable that allows users to customize the configuration directory location.
Implementation
Modify config/config.go's GetConfigDir() function to check for the environment variable first:
func GetConfigDir() (string, error) {
// Check for environment variable override
if envDir := os.Getenv("CLAUDE_SQUAD_HOME"); envDir != "" {
// Expand ~ if present
if strings.HasPrefix(envDir, "~") {
homeDir, err := os.UserHomeDir()
if err != nil {
return "", fmt.Errorf("failed to expand home directory: %w", err)
}
envDir = filepath.Join(homeDir, envDir[1:])
}
return envDir, nil
}
// Default behavior
homeDir, err := os.UserHomeDir()
if err != nil {
return "", fmt.Errorf("failed to get config home directory: %w", err)
}
return filepath.Join(homeDir, ".claude-squad"), nil
}Use Cases
1. Per-repository isolation via wrapper script:
#!/bin/bash
REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null)
if [[ -z "$REPO_ROOT" ]]; then
echo "Error: Not in a git repository"
exit 1
fi
REPO_NAME=$(basename "$REPO_ROOT")
export CLAUDE_SQUAD_HOME="$HOME/.claude-squad/repos/$REPO_NAME"
exec claude-squad "$@"2. Project-specific configurations:
# In .envrc or project setup script
export CLAUDE_SQUAD_HOME="$PWD/.claude-squad"3. Testing/development:
CLAUDE_SQUAD_HOME=/tmp/cs-test claude-squadBenefits
- 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
Related Issues
- Enable multiple git repos with claude squad #56 - Enable multiple git repos with claude squad
- Feature Request: Display repository name in session list view #238 - Display repository name in session list view
Environment
- claude-squad version: 1.0.14
- OS: macOS
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels