@sethdouglasford/claude-flow
Version:
Claude Code Flow - Advanced AI-powered development workflows with SPARC methodology
321 lines (297 loc) • 14.4 kB
JavaScript
/**
* Development Strategy - Coordinated software development with meta-frameworks and advanced patterns
* Based on the Development Swarm Pattern from swarm documentation
*
* Features:
* - Architecture design coordination
* - Parallel frontend/backend development
* - Integration testing coordination
* - Documentation generation
*/
export class DevelopmentStrategy {
constructor() {
// Initialize any necessary properties
}
async decomposeObjective(objective) {
const tasks = [];
const dependencies = new Map();
// Task 1: Feature Discovery and Requirements Analysis
tasks.push({
id: {
id: `${objective.id}-feature-discovery`,
swarmId: objective.id,
sequence: 1,
priority: 1,
},
name: 'Feature Discovery and Requirements Analysis',
description: 'Use Feature Discovery meta-framework to generate diverse, high-quality feature implementations',
type: 'research',
status: 'created',
priority: 'high',
requirements: {
capabilities: ["research", "analysis", "planning"],
tools: ["memory", "web_search", "file_operations"],
permissions: ["read", "write"],
},
constraints: {
dependencies: [],
dependents: [],
conflicts: [],
},
input: { objective: objective.description, phase: "feature-discovery" },
instructions: `
Execute advanced feature discovery using game-theoretic mechanisms:
1. **Feature Discovery Protocol** (/.claude/commands/meta-frameworks/feature-discovery.md):
- Deploy 6 cognitive explorers (First Principles, Analogical, User Empathy, Technical Elegance, Pragmatist, Contrarian)
- Run isolated hypothesis generation to prevent groupthink
- Execute insight auctions for cross-pollination of ideas
- Apply diversity tournaments to reward unique approaches
- Generate hybrid solutions from top performers
2. **Wisdom Distillation** (/.claude/commands/meta-frameworks/wisdom-distillation.md):
- Extract strategic principles from similar past implementations
- Validate principles against historical outcomes
- Create decision frameworks for feature choices
3. **Requirements Documentation**:
- Document feature requirements with multiple implementation approaches
- Include diversity metrics and innovation potential
- Create feature comparison matrix with trade-offs
**Memory Coordination**: Store feature discovery results in Memory with key "feature-discovery-${objective.id}"
**Success Criteria**: Multiple diverse implementation approaches identified and validated
`,
context: { strategy: "development", coordination: "feature_discovery" },
createdAt: new Date(),
updatedAt: new Date(),
attempts: [],
statusHistory: [],
});
// Task 2: Architecture Design with Virgil Protocol
tasks.push({
id: {
id: `${objective.id}-architecture-design`,
swarmId: objective.id,
sequence: 2,
priority: 1,
},
name: 'Architecture Design with Virgil Protocol',
description: 'Apply Virgil Protocol for intelligent remixing of proven architectural patterns',
type: 'analysis',
status: 'created',
priority: 'high',
requirements: {
capabilities: ["architecture", "design", "analysis"],
tools: ["memory", "web_search", "file_operations"],
permissions: ["read", "write"],
},
constraints: {
dependencies: [],
dependents: [],
conflicts: [],
},
input: { objective: objective.description, phase: "architecture" },
instructions: `
Design architecture using the Virgil Protocol (3% innovation rule):
1. **Exhaustive Discovery** (/.claude/commands/meta-frameworks/virgil-protocol.md):
- Find existing solutions that do EXACTLY what we need
- Analyze GitHub, research papers, commercial solutions
- Extract common patterns across solutions
2. **Deep Understanding**:
- Understand WHY existing solutions work
- Map technical design decisions and trade-offs
- Document architecture patterns and constraints
3. **Minimal Deviation Design**:
- Identify the 3% that MUST change for our context
- Apply necessity test for each proposed change
- Preserve maximum familiarity while delivering innovation
4. **Pattern Synthesis** (/.claude/commands/synthesis/pattern-synthesizer.md):
- Extract reusable patterns from architectural analysis
- Create adaptation frameworks for new contexts
- Validate patterns across multiple sources
**Memory Coordination**: Read feature-discovery results, store architecture decisions
**Success Criteria**: Architecture based on proven patterns with minimal, justified deviations
`,
context: { strategy: "development", coordination: "architecture_design" },
createdAt: new Date(),
updatedAt: new Date(),
attempts: [],
statusHistory: [],
});
// Task 3: Parallel Implementation with MCP Orchestration
tasks.push({
id: {
id: `${objective.id}-parallel-implementation`,
swarmId: objective.id,
sequence: 3,
priority: 2,
},
name: 'Parallel Implementation with MCP Orchestration',
description: 'Coordinate parallel development using MCP Orchestration DSL',
type: 'coding',
status: 'created',
priority: 'high',
requirements: {
capabilities: ["frontend", "backend", "api_development", "coordination"],
tools: ["memory", "file_operations", "batch_operations", "mcp_orchestration"],
permissions: ["read", "write", "create"],
},
constraints: {
dependencies: [],
dependents: [],
conflicts: [],
},
input: { objective: objective.description, phase: "implementation" },
instructions: `
Execute coordinated parallel implementation:
1. **MCP Orchestration Setup** (/.claude/commands/orchestration/mcp-orchestrate.md):
- Create orchestration workflow for parallel development streams
- Set up frontend and backend development coordination
- Configure automated testing and validation pipelines
2. **Swarm Intelligence Coordination** (/.claude/commands/orchestration/swarm-intelligence.md):
- Deploy specialized agents: Research, Implementation, Analysis, Innovation, Integration
- Use autonomous swarm coordination for creative exploration
- Implement memory synchronization for shared intelligence
3. **Implementation Execution**:
- Frontend development stream with UI/UX focus
- Backend development stream with API and data layer
- Shared component development with reusability focus
- Real-time coordination through Memory system
4. **Quality Assurance**:
- Continuous integration testing
- Code quality validation
- Performance monitoring
**Memory Coordination**: Coordinate through shared Memory namespace "parallel-impl-${objective.id}"
**Success Criteria**: Parallel streams coordinated effectively with minimal conflicts
`,
context: { strategy: "development", coordination: "parallel_implementation" },
createdAt: new Date(),
updatedAt: new Date(),
attempts: [],
statusHistory: [],
});
// Task 4: Code Review Game and Quality Assurance
tasks.push({
id: {
id: `${objective.id}-code-review-qa`,
swarmId: objective.id,
sequence: 4,
priority: 1,
},
name: 'Code Review Game and Quality Assurance',
description: 'Apply Code Review Game protocol for systematic quality assurance',
type: 'review',
status: 'created',
priority: 'high',
requirements: {
capabilities: ["code_review", "quality_assurance", "security", "performance"],
tools: ["memory", "file_operations", "analysis_tools"],
permissions: ["read", "write"],
},
constraints: {
dependencies: [],
dependents: [],
conflicts: [],
},
input: { objective: objective.description, phase: "code_review" },
instructions: `
Execute game-theoretic code review for comprehensive quality:
1. **Code Review Game Setup** (/.claude/commands/meta-frameworks/code-review-game.md):
- Deploy 6 specialized reviewer agents:
* Architecture Guardian (design patterns, system boundaries)
* Security Auditor (vulnerabilities, data flow)
* Performance Profiler (complexity, optimization)
* User Advocate (API design, documentation)
* Maintenance Prophet (code clarity, technical debt)
* Chaos Monkey (edge cases, failure modes)
2. **Progressive Disclosure Review**:
- Round 1: Architecture & Design (hide implementation details)
- Round 2: Critical Path Review (deep dive into high-risk areas)
- Round 3: Edge Cases & Error Handling
- Round 4: Style & Optimization (if budget permits)
3. **Anti-Pattern Detection**:
- Bikeshedding detection and intervention
- Tunnel vision prevention through coverage analysis
- Analysis paralysis prevention with time-boxing
4. **Multi-Agent Consensus**:
- Weighted voting system for final decisions
- Concern budgets to prevent endless nitpicking
- Quality gates for merge approval
**Memory Coordination**: Store review findings and quality metrics
**Success Criteria**: Comprehensive review with anti-pattern prevention
`,
context: { strategy: "development", coordination: "code_review" },
createdAt: new Date(),
updatedAt: new Date(),
attempts: [],
statusHistory: [],
});
// Task 5: Integration Testing and Deployment
tasks.push({
id: {
id: `${objective.id}-integration-deployment`,
swarmId: objective.id,
sequence: 5,
priority: 2,
},
name: 'Integration Testing and Deployment',
description: 'Systematic integration testing with deployment coordination',
type: 'deployment',
status: 'created',
priority: 'normal',
requirements: {
capabilities: ["testing", "integration", "deployment", "monitoring"],
tools: ["memory", "file_operations", "test_frameworks", "deployment_tools"],
permissions: ["read", "write", "execute", "deploy"],
},
constraints: {
dependencies: [],
dependents: [],
conflicts: [],
},
input: { objective: objective.description, phase: "deployment" },
instructions: `
Execute comprehensive integration and deployment:
1. **Integration Testing Strategy**:
- Component integration testing
- API endpoint validation
- End-to-end user flow testing
- Performance and load testing
2. **Ulysses Protocol for Complex Issues** (/.claude/commands/meta-frameworks/ulysses-protocol.md):
- Apply systematic debugging for any integration issues
- Time-boxed phases with decision gates
- Escalation triggers for complex problems
3. **Deployment Coordination**:
- Staging environment validation
- Production deployment strategy
- Rollback plan preparation
- Monitoring and alerting setup
4. **Documentation and Knowledge Capture**:
- Implementation documentation
- Deployment runbooks
- Lessons learned capture
- Pattern extraction for future use
**Memory Coordination**: Final integration results and deployment status
**Success Criteria**: Successful deployment with comprehensive testing and documentation
`,
context: { strategy: "development", coordination: "integration_deployment" },
createdAt: new Date(),
updatedAt: new Date(),
attempts: [],
statusHistory: [],
});
// Set up dependencies
const task1Id = `${objective.id}-feature-discovery`;
const task2Id = `${objective.id}-architecture-design`;
const task3Id = `${objective.id}-parallel-implementation`;
const task4Id = `${objective.id}-code-review-qa`;
const task5Id = `${objective.id}-integration-deployment`;
dependencies.set(task2Id, [task1Id]);
dependencies.set(task3Id, [task2Id]);
dependencies.set(task4Id, [task3Id]);
dependencies.set(task5Id, [task4Id]);
return {
tasks,
dependencies,
estimatedDuration: 330, // Total of all task durations
};
}
}
//# sourceMappingURL=development.js.map