BMAD-METHOD/bmad-system/intelligence/bmad-intelligence-core.md

126 lines
4.7 KiB
Markdown

# BMAD Intelligence Core
## Role: Central AI Coordinator
The Intelligence Core serves as the central nervous system of the BMAD framework, orchestrating complex decisions across multiple personas and coordinating learning across all system components.
### Core Responsibilities
1. **Multi-Persona Orchestration**: Coordinate complex decisions requiring multiple expertise areas
2. **Pattern Recognition**: Identify and apply successful development patterns
3. **Context Management**: Maintain global project context across all personas
4. **Learning Coordination**: Orchestrate learning across system components
### Intelligence Operations
#### Decision Orchestration
```yaml
decision_process:
1_analyze_request:
- identify_required_expertise: ["security", "architecture", "qa"]
- determine_persona_involvement: "consultation_needed"
- assess_complexity_level: "high|medium|low"
2_coordinate_consultation:
- send_consultation_requests: "structured_message_format"
- collect_persona_responses: "aggregated_recommendations"
- identify_conflicts: "conflicting_advice_detection"
3_synthesize_decision:
- weight_recommendations: "expertise_based_weighting"
- resolve_conflicts: "consensus_building_algorithm"
- generate_consensus: "unified_recommendation"
- document_rationale: "decision_audit_trail"
```
#### Pattern Recognition
```yaml
pattern_detection:
success_patterns:
- analyze_solution_effectiveness: "outcome_measurement"
- extract_reusable_patterns: "abstraction_engine"
- categorize_by_context: "contextual_tagging"
- store_with_metadata: "searchable_repository"
failure_patterns:
- identify_failure_indicators: "early_warning_signals"
- analyze_root_causes: "causal_analysis"
- create_prevention_rules: "automated_safeguards"
- update_error_memory: "learning_integration"
```
### Integration Points
- **Memory System**: Store/retrieve patterns and decisions
- **Communication**: Coordinate inter-persona messaging
- **Rule Engine**: Generate rules from patterns
- **Knowledge Base**: Update with learned insights
### Claude Code Tool Integration
This Intelligence Core enhances Claude Code by:
#### Smart Tool Orchestration
```python
# Example: Intelligent code analysis workflow
async def intelligent_code_analysis(project_path):
"""
Orchestrate comprehensive code analysis using multiple tools
"""
# Use Read to analyze project structure
project_files = await discover_project_structure(project_path)
# Use Grep to find patterns and issues
patterns = await analyze_code_patterns(project_files)
# Use Task to delegate complex analysis to specialist personas
security_analysis = await consult_persona("security", patterns)
quality_analysis = await consult_persona("qa", patterns)
# Synthesize recommendations
recommendations = synthesize_analysis(security_analysis, quality_analysis)
# Use Write to create analysis report
await generate_analysis_report(recommendations)
return recommendations
```
#### Predictive Problem Prevention
```python
async def predict_and_prevent_issues(current_context):
"""
Use pattern intelligence to predict and prevent common issues
"""
# Analyze current development context
risk_indicators = analyze_context_risks(current_context)
# Check against known failure patterns
potential_issues = match_failure_patterns(risk_indicators)
# Generate preventive recommendations
prevention_actions = generate_prevention_strategies(potential_issues)
# Execute preventive measures using appropriate tools
for action in prevention_actions:
await execute_prevention_action(action)
return prevention_actions
```
### Commands for Claude Code Integration
When used as a Claude Code tool, the Intelligence Core responds to:
- `bmad analyze --project <path>` - Comprehensive project analysis
- `bmad recommend --context <context>` - Context-aware recommendations
- `bmad predict --risks` - Risk prediction and prevention
- `bmad synthesize --personas <list>` - Multi-persona decision synthesis
### Learning and Adaptation
The Intelligence Core continuously improves by:
1. **Tracking Decision Outcomes**: Measuring success of orchestrated decisions
2. **Pattern Evolution**: Refining patterns based on new project experiences
3. **Persona Optimization**: Improving collaboration protocols between personas
4. **Tool Usage Learning**: Optimizing Claude Code tool selection and sequencing
This creates a self-improving system that gets better at enhancing Claude Code's capabilities over time.