-
Notifications
You must be signed in to change notification settings - Fork 115
Description
Feature Request
Problem Description
When using claude-swarm generate or similar commands, the generated configuration files often contain errors that prevent the swarm from starting properly. Additionally, the command creates files with random names instead of following the expected naming convention.
Current Behavior
-
Configuration Validation Issues
- Generated configs frequently contain circular dependencies
- References to non-existent instances are common
- No validation occurs during generation
- Errors are revealed one at a time, requiring multiple runs to discover all issues
Example errors encountered:
$ claude-swarm Starting Claude Swarm from claude-swarm.yml... Circular dependency detected: lead_developer -> rails_optimizer -> lead_developer # After fixing the circular dependency... $ claude-swarm Starting Claude Swarm from claude-swarm.yml... Instance 'lead_developer' has connection to unknown instance 'distribution_expert' # After fixing the missing instance... $ claude-swarm Starting Claude Swarm from claude-swarm.yml... Instance 'rails_optimizer' has connection to unknown instance 'performance_analyst'
-
File Naming Issues
- Generated files have random names (e.g.,
random-name.yml) instead ofclaude-swarm.yml - No check for existing
claude-swarm.ymlfiles - Inconsistent with expected naming conventions
- Generated files have random names (e.g.,
Proposed Solution
Enhance the generate command with:
-
Comprehensive Configuration Validation
- Validate all issues at once during generation
- Check for:
- Circular dependencies (all cycles, not just the first one found)
- Missing instance references
- Duplicate instance names
- Invalid configuration syntax
- Display all validation errors in a single report
-
Smart File Naming
- Default to
claude-swarm.ymlfor generated files - If
claude-swarm.ymlexists, use incremental naming:claude-swarm-1.ymlclaude-swarm-2.yml- etc.
- Option to specify custom filename via flag
- Default to
Expected Behavior
$ claude-swarm generate
Generating swarm configuration...
Validation Report:
❌ 3 issues found:
1. Circular dependency: lead_developer -> rails_optimizer -> lead_developer
2. Unknown instance reference: 'distribution_expert' (referenced by lead_developer)
3. Unknown instance reference: 'performance_analyst' (referenced by rails_optimizer)
Configuration not saved due to validation errors.
Would you like to generate anyway? (y/N)Or when successful:
$ claude-swarm generate
Generating swarm configuration...
✓ Configuration validated successfully
✓ No circular dependencies detected
✓ All instance references verified
✓ Saved to claude-swarm.ymlBenefits
- Improved Developer Experience: See all configuration errors at once instead of discovering them one by one
- Faster Iteration: Fix all issues in a single pass rather than multiple trial-and-error cycles
- Reduced Debugging Time: No need to repeatedly run
claude-swarmto find each error - Consistent Workflow: Predictable file naming makes it easier to manage configurations
- Better Onboarding: New users won't be confused by random file names or cryptic runtime errors
Additional Context
Currently, the iterative nature of error discovery is particularly frustrating when dealing with configurations. I often need to:
- Run
claude-swarm - See first error
- Fix it manually
- Run
claude-swarmagain - See next error
- Repeat until all errors are fixed
This would be particularly helpful for users who are new to claude-swarm or those generating complex configurations with multiple interconnected agents. The validation could use the same logic that's already implemented for runtime checks, just applied during the generation phase with comprehensive reporting.