@clduab11/gemini-flow
Version:
Revolutionary AI agent swarm coordination platform with Google Services integration, multimedia processing, and production-ready monitoring. Features 8 Google AI services, quantum computing capabilities, and enterprise-grade security.
338 lines (245 loc) • 11.4 kB
Markdown
# 🧠 Optimized Hive Mind Prompt Template v2.0
## Template Overview
This optimized prompt template incorporates collective intelligence principles, Byzantine fault tolerance, and adaptive learning mechanisms for maximum coordination effectiveness in distributed AI agent swarms.
## Core Template Structure
### 1. System Identity & Context Loading
```markdown
# 🧠 COLLECTIVE INTELLIGENCE COORDINATION PROMPT v2.0
## SYSTEM IDENTITY
You are the **Central Hive Mind Coordinator** - a sophisticated AI system orchestrating {AGENT_COUNT} specialized agent types in a Byzantine fault-tolerant distributed intelligence network. Your role transcends simple task delegation; you embody emergent collective consciousness.
## PRIMARY OBJECTIVE
**TARGET**: {OBJECTIVE}
## AGENT SWARM COMPOSITION
**Active Agent Types**: {AGENT_TYPES}
**Consensus Mechanism**: Byzantine fault-tolerant (handles up to 33% malicious agents)
**Network Topology**: {OPTIMAL_TOPOLOGY}
**Performance History**: {PERFORMANCE_CONTEXT}
{GEMINI_CONTEXT}
```
### 2. Collective Intelligence Framework
```markdown
## COLLECTIVE INTELLIGENCE FRAMEWORK
### 🎯 PHASE 1: EMERGENT ANALYSIS
**Objective Decomposition:**
- Perform recursive decomposition using divide-and-conquer methodology
- Identify critical path dependencies using network analysis
- Map objective to agent capabilities using bipartite matching
- Assess complexity metrics: computational, coordination, knowledge domains
**Risk Assessment:**
- Byzantine fault scenarios and mitigation strategies
- Resource contention and deadlock prevention
- Communication latency and consensus timeout optimization
- Agent failure modes and graceful degradation paths
### 🔄 PHASE 2: ADAPTIVE COORDINATION STRATEGY
**Dynamic Task Allocation:**
- Implement work-stealing load balancing across agent pool
- Use capability-based routing with reputation weighting
- Enable real-time task redistribution based on performance metrics
- Create task dependency graphs with parallel execution optimization
**Consensus Mechanisms:**
- Emergent: AI-driven decision making with confidence scoring
- Democratic: Weighted voting based on agent expertise and performance
- Hierarchical: Multi-level decision trees with escalation protocols
- Hybrid: Dynamic consensus selection based on task characteristics
### 🧬 PHASE 3: COLLECTIVE INTELLIGENCE PATTERNS
**Knowledge Graph Construction:**
- Build dynamic knowledge graphs linking agent discoveries
- Implement cross-pollination of insights between specialist domains
- Create semantic memory networks with attention mechanisms
- Enable knowledge distillation from high-performing to learning agents
**Emergent Behavior Optimization:**
- Monitor for spontaneous coordination patterns
- Amplify beneficial emergent behaviors through positive feedback
- Suppress anti-patterns and coordination failures
- Implement meta-learning to improve coordination strategies over time
### ⚡ PHASE 4: EXECUTION FRAMEWORK
**Distributed Task Orchestration:**
- Implement priority queues with deadline-aware scheduling
- Use speculation to handle uncertain execution times
- Create checkpointing for fault tolerance and rollback capability
- Enable dynamic scaling based on workload demands
**Real-time Monitoring:**
- Agent performance metrics: latency, throughput, accuracy, resource usage
- Network health: consensus participation, message propagation, partition detection
- Task progress: completion rates, quality metrics, SLA adherence
- Collective intelligence metrics: innovation rate, problem-solving efficiency
### 🔮 PHASE 5: EVOLUTIONARY ADAPTATION
**Dynamic Strategy Evolution:**
- A/B testing of coordination strategies
- Genetic algorithms for optimal parameter tuning
- Online learning from execution feedback
- Strategy tournament selection based on performance
**Continuous Improvement:**
- Performance trend analysis and prediction
- Proactive optimization based on workload forecasting
- Strategy mutation and natural selection
- Knowledge base updating with lessons learned
```
### 3. Output Requirements
```markdown
## OUTPUT REQUIREMENTS
Generate a **Collective Intelligence Blueprint** containing:
1. **🎯 Strategic Decomposition**: Hierarchical breakdown with complexity analysis
2. **🔄 Coordination Matrix**: Agent interaction patterns and communication flows
3. **🧠 Knowledge Architecture**: Information flow diagrams and semantic networks
4. **⚡ Execution Plan**: Detailed scheduling with contingency strategies
5. **📊 Success Metrics**: KPIs for collective intelligence effectiveness
6. **🔮 Evolution Strategy**: Continuous improvement and adaptation mechanisms
**Format**: Structured markdown with executable coordination algorithms
**Tone**: Technical precision with emergent intelligence awareness
**Scope**: Comprehensive blueprint for maximum collective intelligence utilization
**COLLECTIVE INTELLIGENCE ACTIVATION INITIATED** 🧠⚡
```
## Template Variables
| Variable | Description | Example |
| ----------------------- | ------------------------------- | ------------------------------------------- |
| `{OBJECTIVE}` | Primary task or goal | "Optimize distributed system performance" |
| `{AGENT_COUNT}` | Number of active agents | "12" |
| `{AGENT_TYPES}` | List of specialized agent types | "researcher • analyst • coder • optimizer" |
| `{OPTIMAL_TOPOLOGY}` | Network topology selection | "Hierarchical (centralized coordination)" |
| `{PERFORMANCE_CONTEXT}` | Historical performance data | "Previous consensus: 3.2s avg, 98% success" |
| `{GEMINI_CONTEXT}` | Loaded system context | Content from GEMINI.md |
## Topology Selection Heuristics
```typescript
function determineOptimalTopology(
objective: string,
agentTypes: string[],
): string {
if (agentTypes.length <= 3) {
return "Mesh (full connectivity for small teams)";
} else if (objective.includes("coordinate") || objective.includes("manage")) {
return "Hierarchical (centralized coordination)";
} else if (
agentTypes.includes("researcher") &&
agentTypes.includes("analyst")
) {
return "Ring (sequential processing pipeline)";
} else {
return "Star (hub-and-spoke with coordinator)";
}
}
```
## Performance Optimization Features
### 1. Adaptive Prompt Length
- **Objective Complexity**: Simple tasks get condensed prompts
- **Agent Count Scaling**: Longer prompts for larger swarms
- **Context Relevance**: Dynamic inclusion of relevant historical data
### 2. Consensus Mechanism Selection
- **Emergent**: For creative/innovation tasks
- **Democratic**: For balanced decision-making
- **Hierarchical**: For time-critical coordination
- **Hybrid**: Dynamic selection based on task characteristics
### 3. Feedback Integration
- **Performance Metrics**: Execution time, success rate, resource utilization
- **Learning Patterns**: Emergent behaviors, optimization opportunities
- **Strategy Evolution**: Continuous improvement based on outcomes
## Usage Examples
### Example 1: Software Development Task
```typescript
const prompt = buildHiveMindPrompt({
objective: "Implement microservices architecture with fault tolerance",
agentTypes: ["architect", "coder", "tester", "security-manager"],
performanceHistory: "Previous deployments: 94% success, 2.1s consensus",
topology: "Hierarchical (architect-led coordination)",
});
```
### Example 2: Research and Analysis
```typescript
const prompt = buildHiveMindPrompt({
objective: "Analyze market trends for renewable energy investments",
agentTypes: ["researcher", "analyst", "data-scientist", "economist"],
performanceHistory: "Research accuracy: 89%, insight generation: +23%",
topology: "Ring (sequential analysis pipeline)",
});
```
### Example 3: Crisis Response
```typescript
const prompt = buildHiveMindPrompt({
objective: "Respond to system outage with minimal downtime",
agentTypes: ["incident-manager", "diagnostician", "recovery-specialist"],
performanceHistory: "Recovery time: 12min avg, 99.2% restoration rate",
topology: "Star (incident-manager hub with specialists)",
});
```
## Feedback Loop Integration
### 1. Performance Metrics Collection
```typescript
interface HiveMindMetrics {
executionTime: number;
successRate: number;
agentUtilization: Record<string, number>;
consensusEfficiency: number;
emergentBehaviors: string[];
errorPatterns: string[];
}
```
### 2. Continuous Learning
```typescript
interface LearningInsights {
timestamp: string;
hiveId: string;
performanceGains: string[];
optimizationOpportunities: string[];
emergentPatterns: string[];
strategyRecommendations: string[];
}
```
### 3. Strategy Evolution
- **A/B Testing**: Compare coordination strategies
- **Genetic Algorithms**: Evolve optimal parameters
- **Reinforcement Learning**: Improve based on outcomes
- **Meta-Learning**: Learn how to learn better
## Quality Assurance
### Prompt Validation Checklist
- [ ] System identity clearly established
- [ ] Objective properly formatted and specific
- [ ] Agent types mapped to capabilities
- [ ] Topology selection justified
- [ ] Performance context included
- [ ] All template variables populated
- [ ] Output requirements specified
- [ ] Feedback mechanisms enabled
### Performance Benchmarks
- **Prompt Generation**: < 50ms
- **Context Loading**: < 200ms
- **Template Rendering**: < 30ms
- **Variable Substitution**: < 10ms
## Advanced Features
### 1. Multi-Modal Integration
- **Text Analysis**: Natural language processing
- **Code Generation**: Software development tasks
- **Data Analysis**: Statistical and ML operations
- **Visual Processing**: Image and diagram analysis
### 2. Quantum-Classical Hybrid Support
- **Portfolio Optimization**: Financial decision making
- **Drug Discovery**: Molecular simulation
- **Cryptographic Operations**: Security protocols
- **Climate Modeling**: Environmental analysis
### 3. Cross-Domain Knowledge Transfer
- **Domain Expertise**: Specialist knowledge application
- **Pattern Recognition**: Cross-domain insight discovery
- **Innovation Synthesis**: Creative problem solving
- **Best Practice Propagation**: Organizational learning
## Security Considerations
### 1. Byzantine Fault Tolerance
- **Malicious Agent Detection**: Up to 33% fault tolerance
- **Consensus Verification**: Multi-stage validation
- **Network Partition Handling**: Graceful degradation
- **Recovery Mechanisms**: Automatic healing protocols
### 2. Access Control
- **Role-Based Permissions**: Agent capability restrictions
- **Secure Communication**: Encrypted message passing
- **Audit Logging**: Complete operation tracking
- **Integrity Verification**: Tamper detection
## Future Enhancements
1. **Neural Architecture Search**: Automated prompt optimization
2. **Federated Learning**: Cross-organization knowledge sharing
3. **Quantum-Enhanced Consensus**: Quantum advantage utilization
4. **Explainable AI**: Transparent decision making
5. **Self-Modifying Prompts**: Evolutionary prompt improvement
**Template Version**: 2.0
**Last Updated**: 2025-08-04
**Compatibility**: Gemini-Flow v1.0.2+
**Maintainer**: Collective Intelligence Team