A multi-agent coordination system that uses a 'queen' to manage specialized worker agents. It features shared memory and voting for complex problem solving.
Install
mkdir -p .claude/skills/hive-mind-advanced && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/476" && unzip -o skill.zip -d .claude/skills/hive-mind-advanced && rm skill.zipInstalls to .claude/skills/hive-mind-advanced
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Advanced Hive Mind collective intelligence system for queen-led multi-agent coordination with consensus mechanisms and persistent memoryKey capabilities
- →Orchestrate multi-agent swarms with queen-led hierarchy
- →Implement Byzantine, weighted, or majority consensus mechanisms
- →Maintain persistent shared memory with SQLite
- →Automate task distribution based on agent specialization
- →Manage session checkpoints and progress tracking
How it works
A strategic queen agent manages specialized workers, using a shared memory system and consensus algorithms to validate decisions and execute complex tasks.
Inputs & outputs
When to use hive-mind-advanced
- →Coordinating complex multi-agent tasks
- →Managing large-scale development projects
- →Ensuring consensus in multi-step AI reasoning
About this skill
Hive Mind Advanced Skill
Master the advanced Hive Mind collective intelligence system for sophisticated multi-agent coordination using queen-led architecture, Byzantine consensus, and collective memory.
Overview
The Hive Mind system represents the pinnacle of multi-agent coordination in Claude Flow, implementing a queen-led hierarchical architecture where a strategic queen coordinator directs specialized worker agents through collective decision-making and shared memory.
Core Concepts
Architecture Patterns
Queen-Led Coordination
- Strategic queen agents orchestrate high-level objectives
- Tactical queens manage mid-level execution
- Adaptive queens dynamically adjust strategies based on performance
Worker Specialization
- Researcher agents: Analysis and investigation
- Coder agents: Implementation and development
- Analyst agents: Data processing and metrics
- Tester agents: Quality assurance and validation
- Architect agents: System design and planning
- Reviewer agents: Code review and improvement
- Optimizer agents: Performance enhancement
- Documenter agents: Documentation generation
Collective Memory System
- Shared knowledge base across all agents
- LRU cache with memory pressure handling
- SQLite persistence with WAL mode
- Memory consolidation and association
- Access pattern tracking and optimization
Consensus Mechanisms
Majority Consensus Simple voting where the option with most votes wins.
Weighted Consensus Queen vote counts as 3x weight, providing strategic guidance.
Byzantine Fault Tolerance Requires 2/3 majority for decision approval, ensuring robust consensus even with faulty agents.
Getting Started
1. Initialize Hive Mind
# Basic initialization
npx claude-flow hive-mind init
# Force reinitialize
npx claude-flow hive-mind init --force
# Custom configuration
npx claude-flow hive-mind init --config hive-config.json
2. Spawn a Swarm
# Basic spawn with objective
npx claude-flow hive-mind spawn "Build microservices architecture"
# Strategic queen type
npx claude-flow hive-mind spawn "Research AI patterns" --queen-type strategic
# Tactical queen with max workers
npx claude-flow hive-mind spawn "Implement API" --queen-type tactical --max-workers 12
# Adaptive queen with consensus
npx claude-flow hive-mind spawn "Optimize system" --queen-type adaptive --consensus byzantine
# Generate Claude Code commands
npx claude-flow hive-mind spawn "Build full-stack app" --claude
3. Monitor Status
# Check hive mind status
npx claude-flow hive-mind status
# Get detailed metrics
npx claude-flow hive-mind metrics
# Monitor collective memory
npx claude-flow hive-mind memory
Advanced Workflows
Session Management
Create and Manage Sessions
# List active sessions
npx claude-flow hive-mind sessions
# Pause a session
npx claude-flow hive-mind pause <session-id>
# Resume a paused session
npx claude-flow hive-mind resume <session-id>
# Stop a running session
npx claude-flow hive-mind stop <session-id>
Session Features
- Automatic checkpoint creation
- Progress tracking with completion percentages
- Parent-child process management
- Session logs with event tracking
- Export/import capabilities
Consensus Building
The Hive Mind builds consensus through structured voting:
// Programmatic consensus building
const decision = await hiveMind.buildConsensus(
'Architecture pattern selection',
['microservices', 'monolith', 'serverless']
);
// Result includes:
// - decision: Winning option
// - confidence: Vote percentage
// - votes: Individual agent votes
Consensus Algorithms
- Majority - Simple democratic voting
- Weighted - Queen has 3x voting power
- Byzantine - 2/3 supermajority required
Collective Memory
Storing Knowledge
// Store in collective memory
await memory.store('api-patterns', {
rest: { pros: [...], cons: [...] },
graphql: { pros: [...], cons: [...] }
}, 'knowledge', { confidence: 0.95 });
Memory Types
knowledge: Permanent insights (no TTL)context: Session context (1 hour TTL)task: Task-specific data (30 min TTL)result: Execution results (permanent, compressed)error: Error logs (24 hour TTL)metric: Performance metrics (1 hour TTL)consensus: Decision records (permanent)system: System configuration (permanent)
Searching and Retrieval
// Search memory by pattern
const results = await memory.search('api*', {
type: 'knowledge',
minConfidence: 0.8,
limit: 50
});
// Get related memories
const related = await memory.getRelated('api-patterns', 10);
// Build associations
await memory.associate('rest-api', 'authentication', 0.9);
Task Distribution
Automatic Worker Assignment
The system intelligently assigns tasks based on:
- Keyword matching with agent specialization
- Historical performance metrics
- Worker availability and load
- Task complexity analysis
// Create task (auto-assigned)
const task = await hiveMind.createTask(
'Implement user authentication',
priority: 8,
{ estimatedDuration: 30000 }
);
Auto-Scaling
// Configure auto-scaling
const config = {
autoScale: true,
maxWorkers: 12,
scaleUpThreshold: 2, // Pending tasks per idle worker
scaleDownThreshold: 2 // Idle workers above pending tasks
};
Integration Patterns
With Claude Code
Generate Claude Code spawn commands directly:
npx claude-flow hive-mind spawn "Build REST API" --claude
Output:
Task("Queen Coordinator", "Orchestrate REST API development...", "coordinator")
Task("Backend Developer", "Implement Express routes...", "backend-dev")
Task("Database Architect", "Design PostgreSQL schema...", "code-analyzer")
Task("Test Engineer", "Create Jest test suite...", "tester")
With SPARC Methodology
# Use hive mind for SPARC workflow
npx claude-flow sparc tdd "User authentication" --hive-mind
# Spawns:
# - Specification agent
# - Architecture agent
# - Coder agents
# - Tester agents
# - Reviewer agents
With GitHub Integration
# Repository analysis with hive mind
npx claude-flow hive-mind spawn "Analyze repo quality" --objective "owner/repo"
# PR review coordination
npx claude-flow hive-mind spawn "Review PR #123" --queen-type tactical
Performance Optimization
Memory Optimization
The collective memory system includes advanced optimizations:
LRU Cache
- Configurable cache size (default: 1000 entries)
- Memory pressure handling (default: 50MB)
- Automatic eviction of least-used entries
Database Optimization
- WAL (Write-Ahead Logging) mode
- 64MB cache size
- 256MB memory mapping
- Prepared statements for common queries
- Automatic ANALYZE and OPTIMIZE
Object Pooling
- Query result pooling
- Memory entry pooling
- Reduced garbage collection pressure
Performance Metrics
// Get performance insights
const insights = hiveMind.getPerformanceInsights();
// Includes:
// - asyncQueue utilization
// - Batch processing stats
// - Success rates
// - Average processing times
// - Memory efficiency
Task Execution
Parallel Processing
- Batch agent spawning (5 agents per batch)
- Concurrent task orchestration
- Async operation optimization
- Non-blocking task assignment
Benchmarks
- 10-20x faster batch spawning
- 2.8-4.4x speed improvement overall
- 32.3% token reduction
- 84.8% SWE-Bench solve rate
Configuration
Hive Mind Config
{
"objective": "Build microservices",
"name": "my-hive",
"queenType": "strategic", // strategic | tactical | adaptive
"maxWorkers": 8,
"consensusAlgorithm": "byzantine", // majority | weighted | byzantine
"autoScale": true,
"memorySize": 100, // MB
"taskTimeout": 60, // minutes
"encryption": false
}
Memory Config
{
"maxSize": 100, // MB
"compressionThreshold": 1024, // bytes
"gcInterval": 300000, // 5 minutes
"cacheSize": 1000,
"cacheMemoryMB": 50,
"enablePooling": true,
"enableAsyncOperations": true
}
Hooks Integration
Hive Mind integrates with Claude Flow hooks for automation:
Pre-Task Hooks
- Auto-assign agents by file type
- Validate objective complexity
- Optimize topology selection
- Cache search patterns
Post-Task Hooks
- Auto-format deliverables
- Train neural patterns
- Update collective memory
- Analyze performance bottlenecks
Session Hooks
- Generate session summaries
- Persist checkpoint data
- Track comprehensive metrics
- Restore execution context
Best Practices
1. Choose the Right Queen Type
Strategic Queens - For research, planning, and analysis
npx claude-flow hive-mind spawn "Research ML frameworks" --queen-type strategic
Tactical Queens - For implementation and execution
npx claude-flow hive-mind spawn "Build authentication" --queen-type tactical
Adaptive Queens - For optimization and dynamic tasks
npx claude-flow hive-mind spawn "Optimize performance" --queen-type adaptive
2. Leverage Consensus
Use consensus for critical decisions:
- Architecture pattern selection
- Technology stack choices
- Implementation approach
- Code review approval
- Release readiness
3. Utilize Collective Memory
Store Learnings
// After successful pattern implementation
await memory.store('auth-pattern', {
approach: 'JWT with refresh tokens',
pros: ['Stateless', 'Scalable'],
cons: ['Token size', 'Revocation complexity'],
implementation: {...}
}, 'knowledge', { confidence: 0.95 });
Build Associations
// Link related concepts
await memory.associate('jwt-auth', 'refresh-tokens', 0.9);
await memory.associate('jwt-auth', 'oauth2', 0.7);
4. Monitor Performance
# Regular status checks
npx claude-flow hive-mind status
# Track me
---
*Content truncated.*
When not to use it
- →Simple tasks that do not require multi-agent coordination
- →Projects where agent consensus overhead exceeds task complexity
Prerequisites
Limitations
- →Requires configuration of consensus algorithms for optimal results
- →Memory management is subject to cache and database constraints
How it compares
It provides a formal hierarchical coordination system with fault-tolerant consensus, unlike basic swarm scripts that lack persistent memory or structured voting.
Compared to similar skills
hive-mind-advanced side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| hive-mind-advanced (this skill) | 6 | 4mo | Review | Advanced |
| meta-automation-architect | 7 | 8mo | Review | Advanced |
| babysitter:assimilate | 0 | 5mo | No flags | Advanced |
| loop-engineer | 0 | 1mo | No flags | Advanced |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by ruvnet
View all by ruvnet →You might also like
meta-automation-architect
comzine
Use when user wants to set up comprehensive automation for their project. Generates custom subagents, skills, commands, and hooks tailored to project needs. Creates a multi-agent system with robust communication protocol.
babysitter:assimilate
MaTriXy
Assimilate an external methodology, harness, or specification into babysitter process definitions.
loop-engineer
PancrePal-xiaoyibao
Loop 系统工程师 — 从用户需求出发,设计并开发完整的多 skill 联动 package。扫描现有 skill 资产,识别可复用与缺失项,逐一开发后组包,编写主调度 skill 平滑层。也可用于对已有 package 进行联动完整性审计(格式合规+主调度逻辑+入口文档同步+命名一致性)。当用户说"我需要一个 XX 系统/loop/agent 包"、"帮我设计一个多技能联动方案"、"检查 package 联动完整性"时触发。不适用于单个 skill 开发。
mcp-builder
anthropics
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).
openspec-onboard
studyzy
Guided onboarding for OpenSpec - walk through a complete workflow cycle with narration and real codebase work.
opencode-cli
SpillwaveSolutions
This skill should be used when configuring or using the OpenCode CLI for headless LLM automation. Use when the user asks to "configure opencode", "use opencode cli", "set up opencode", "opencode run command", "opencode model selection", "opencode providers", "opencode vertex ai", "opencode mcp servers", "opencode ollama", "opencode local models", "opencode deepseek", "opencode kimi", "opencode mistral", "fallback cli tool", or "headless llm cli". Covers command syntax, provider configuration, Vertex AI setup, MCP servers, local models, cloud providers, and subprocess integration patterns.