Files
ruflo/v2/examples/parallel-2/README.md
T
rUvandClaude Opus 4.5 1b6a1971f7 feat(v3): add comprehensive v3 implementation plans and swarm architecture
- Reorganize v3/ into implementation/ subfolders:
  - planning/, architecture/, migration/, integration/
  - security/, adrs/, research/, swarm-plans/

- Add 15-agent concurrent swarm implementation plans:
  - SWARM-OVERVIEW.md: Hierarchical mesh topology, 4 phases
  - AGENT-SPECIFICATIONS.md: 15 agent configs with capabilities
  - TDD-LONDON-SCHOOL-PLAN.md: Mock-first TDD methodology
  - BENCHMARK-OPTIMIZATION.md: Performance targets (2.49x-7.47x)
  - DEPLOYMENT-PLAN.md: Release strategy, CI/CD, rollback
  - GITHUB-ISSUE-TRACKING.md: Issue workflow with agent replies

- Update .claude/settings.json with proper hooks format
- Add bash aliases for claude --dangerously-skip-permissions

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-04 15:40:51 +00:00

174 lines
4.5 KiB
Markdown

# Claude-Flow Parallel Agent Testing
This example demonstrates how to run multiple Claude-Flow SPARC agents in parallel to test their capabilities and measure performance.
## Overview
The parallel test coordinator runs 8 different agent types simultaneously:
- **Specification Agent**: Creates detailed API specifications
- **Architecture Agent**: Designs system architectures
- **Code Agent**: Implements algorithms and data structures
- **TDD Agent**: Follows Test-Driven Development practices
- **Debug Agent**: Analyzes and fixes code issues
- **Documentation Agent**: Creates comprehensive documentation
- **Security Review Agent**: Analyzes security vulnerabilities
- **Integration Agent**: Plans system integration strategies
## Installation
```bash
# Navigate to the parallel-2 directory
cd examples/parallel-2
# Install dependencies
npm install
```
## Usage
### Run the Parallel Test
```bash
npm run test
```
This will:
1. Launch all agents in parallel
2. Execute their respective tasks
3. Save results to `results.json`
### Analyze Results
```bash
npm run analyze
```
This will:
1. Read the test results
2. Generate performance statistics
3. Create a detailed report in `detailed-report.md`
### Full Test Cycle
```bash
npm run test:full
```
This runs the complete test cycle: clean, test, and analyze.
## Test Configuration
Each agent is given a specific task designed to test its capabilities:
| Agent | Task Description |
|-------|-----------------|
| Specification | Create calculator API specification |
| Architecture | Design microservices for e-commerce |
| Code | Implement binary search tree |
| TDD | Create string utility library with tests |
| Debug | Analyze and fix memory leaks |
| Documentation | Create API documentation |
| Security | Review authentication implementation |
| Integration | Plan microservice integration |
## Understanding Results
### results.json
Contains raw test execution data:
- Agent execution times
- Success/failure status
- Output or error messages
- Overall statistics
### detailed-report.md
Provides comprehensive analysis:
- Executive summary
- Performance metrics
- Execution timeline
- Efficiency calculations
- Recommendations
## Performance Metrics
The test suite measures:
- **Individual agent duration**: Time taken by each agent
- **Parallel efficiency**: Comparison with sequential execution
- **Success rate**: Percentage of successful agent executions
- **Resource utilization**: Overall system performance
## Extending the Tests
To add new test cases:
1. Create a new test file in `test-agents/`:
```typescript
export const newTestCase = {
name: "Test Name",
description: "Test description",
task: "Detailed task for the agent",
expectedOutputs: ["Expected output 1", "Expected output 2"],
validateOutput: (output: string): boolean => {
// Validation logic
return true;
}
};
```
2. Add the test to `parallel-test.ts`:
```typescript
{
name: "New Agent",
mode: "agent-mode",
task: "Your task description",
priority: 1
}
```
## Troubleshooting
### Common Issues
1. **Agent timeout**: Increase timeout in `coordinator.ts` (default: 5 minutes)
2. **Missing results**: Ensure all agents complete before analyzing
3. **Permission errors**: Check write permissions for output files
### Debug Mode
To see detailed agent output, modify `coordinator.ts`:
```typescript
console.log(`Agent ${task.name} output:`, stdout);
```
## Architecture
```
parallel-2/
├── coordinator.ts # Main coordination logic
├── parallel-test.ts # Test configuration and runner
├── analyze-results.ts # Results analysis tool
├── test-agents/ # Individual agent test cases
│ ├── spec-test.ts
│ ├── architect-test.ts
│ ├── code-test.ts
│ ├── tdd-test.ts
│ └── debug-test.ts
├── results.json # Test execution results
└── detailed-report.md # Analysis report
```
## Best Practices
1. **Resource Management**: Monitor system resources during parallel execution
2. **Task Complexity**: Balance task complexity across agents
3. **Error Handling**: Implement proper error recovery
4. **Logging**: Enable detailed logging for debugging
5. **Scaling**: Consider batching for large numbers of agents
## Contributing
To contribute new test cases or improvements:
1. Follow the existing test structure
2. Ensure tests are meaningful and measurable
3. Update documentation accordingly
4. Test thoroughly before submitting
## License
This example is part of the Claude-Flow project and follows the same license terms.