hive-mind-advanced

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Hive Mind Advanced Skill

Hive Mind 高级技能

Master the advanced Hive Mind collective intelligence system for sophisticated multi-agent coordination using queen-led architecture, Byzantine consensus, and collective memory.
掌握基于女王主导架构、拜占庭共识算法与集体记忆的高级Hive Mind集体智能系统,实现复杂的多Agent协调。

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.
Hive Mind系统是Claude Flow中多Agent协调的顶尖方案,采用女王主导的分层架构,由战略型女王协调者通过集体决策与共享记忆指挥专业的Worker Agent。

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
女王主导式协调
  • 战略型女王Agent统筹高层目标
  • 战术型女王Agent管理中层执行
  • 自适应型女王Agent根据性能动态调整策略
Worker Agent专业化
  • Researcher Agent:分析与调研
  • Coder Agent:实现与开发
  • Analyst Agent:数据处理与指标分析
  • Tester Agent:质量保证与验证
  • Architect Agent:系统设计与规划
  • Reviewer Agent:代码评审与优化
  • Optimizer Agent:性能提升
  • Documenter Agent:文档生成
集体记忆系统
  • 所有Agent共享的知识库
  • 带内存压力处理的LRU缓存
  • 开启WAL模式的SQLite持久化存储
  • 记忆整合与关联
  • 访问模式追踪与优化

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.
多数共识 得票最多的选项获胜的简单投票机制。
加权共识 女王的投票权重为普通Agent的3倍,提供战略导向。
拜占庭容错 决策需获得2/3多数通过,确保即使存在故障Agent也能达成可靠共识。

Getting Started

快速开始

1. Initialize Hive Mind

1. 初始化Hive Mind

bash
undefined
bash
undefined

Basic initialization

Basic initialization

npx claude-flow hive-mind init
npx claude-flow hive-mind init

Force reinitialize

Force reinitialize

npx claude-flow hive-mind init --force
npx claude-flow hive-mind init --force

Custom configuration

Custom configuration

npx claude-flow hive-mind init --config hive-config.json
undefined
npx claude-flow hive-mind init --config hive-config.json
undefined

2. Spawn a Swarm

2. 生成Agent集群

bash
undefined
bash
undefined

Basic spawn with objective

Basic spawn with objective

npx claude-flow hive-mind spawn "Build microservices architecture"
npx claude-flow hive-mind spawn "Build microservices architecture"

Strategic queen type

Strategic queen type

npx claude-flow hive-mind spawn "Research AI patterns" --queen-type strategic
npx claude-flow hive-mind spawn "Research AI patterns" --queen-type strategic

Tactical queen with max workers

Tactical queen with max workers

npx claude-flow hive-mind spawn "Implement API" --queen-type tactical --max-workers 12
npx claude-flow hive-mind spawn "Implement API" --queen-type tactical --max-workers 12

Adaptive queen with consensus

Adaptive queen with consensus

npx claude-flow hive-mind spawn "Optimize system" --queen-type adaptive --consensus byzantine
npx claude-flow hive-mind spawn "Optimize system" --queen-type adaptive --consensus byzantine

Generate Claude Code commands

Generate Claude Code commands

npx claude-flow hive-mind spawn "Build full-stack app" --claude
undefined
npx claude-flow hive-mind spawn "Build full-stack app" --claude
undefined

3. Monitor Status

3. 监控状态

bash
undefined
bash
undefined

Check hive mind status

Check hive mind status

npx claude-flow hive-mind status
npx claude-flow hive-mind status

Get detailed metrics

Get detailed metrics

npx claude-flow hive-mind metrics
npx claude-flow hive-mind metrics

Monitor collective memory

Monitor collective memory

npx claude-flow hive-mind memory
undefined
npx claude-flow hive-mind memory
undefined

Advanced Workflows

高级工作流

Session Management

会话管理

Create and Manage Sessions
bash
undefined
创建与管理会话
bash
undefined

List active sessions

List active sessions

npx claude-flow hive-mind sessions
npx claude-flow hive-mind sessions

Pause a session

Pause a session

npx claude-flow hive-mind pause <session-id>
npx claude-flow hive-mind pause <session-id>

Resume a paused session

Resume a paused session

npx claude-flow hive-mind resume <session-id>
npx claude-flow hive-mind resume <session-id>

Stop a running session

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
npx claude-flow hive-mind stop <session-id>

**会话功能**
- 自动创建检查点
- 带完成百分比的进度追踪
- 父子进程管理
- 带事件追踪的会话日志
- 导出/导入功能

Consensus Building

共识构建

The Hive Mind builds consensus through structured voting:
javascript
// 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
  1. Majority - Simple democratic voting
  2. Weighted - Queen has 3x voting power
  3. Byzantine - 2/3 supermajority required
Hive Mind通过结构化投票构建共识:
javascript
// 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
共识算法
  1. 多数共识 - 简单民主投票
  2. 加权共识 - 女王拥有3倍投票权
  3. 拜占庭共识 - 需要2/3超级多数通过

Collective Memory

集体记忆

Storing Knowledge
javascript
// 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
javascript
// 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);
存储知识
javascript
// Store in collective memory
await memory.store('api-patterns', {
  rest: { pros: [...], cons: [...] },
  graphql: { pros: [...], cons: [...] }
}, 'knowledge', { confidence: 0.95 });
记忆类型
  • knowledge
    :永久见解(无过期时间)
  • context
    :会话上下文(1小时过期)
  • task
    :任务特定数据(30分钟过期)
  • result
    :执行结果(永久存储,已压缩)
  • error
    :错误日志(24小时过期)
  • metric
    :性能指标(1小时过期)
  • consensus
    :决策记录(永久存储)
  • system
    :系统配置(永久存储)
搜索与检索
javascript
// 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
javascript
// Create task (auto-assigned)
const task = await hiveMind.createTask(
  'Implement user authentication',
  priority: 8,
  { estimatedDuration: 30000 }
);
Auto-Scaling
javascript
// Configure auto-scaling
const config = {
  autoScale: true,
  maxWorkers: 12,
  scaleUpThreshold: 2, // Pending tasks per idle worker
  scaleDownThreshold: 2 // Idle workers above pending tasks
};
自动Worker Agent分配
系统基于以下因素智能分配任务:
  • 与Agent专业领域的关键词匹配
  • 历史性能指标
  • Worker Agent可用性与负载
  • 任务复杂度分析
javascript
// Create task (auto-assigned)
const task = await hiveMind.createTask(
  'Implement user authentication',
  priority: 8,
  { estimatedDuration: 30000 }
);
自动扩缩容
javascript
// 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

与Claude Code集成

Generate Claude Code spawn commands directly:
bash
npx claude-flow hive-mind spawn "Build REST API" --claude
Output:
javascript
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")
直接生成Claude Code集群命令:
bash
npx claude-flow hive-mind spawn "Build REST API" --claude
输出:
javascript
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

与SPARC方法论集成

bash
undefined
bash
undefined

Use hive mind for SPARC workflow

Use hive mind for SPARC workflow

npx claude-flow sparc tdd "User authentication" --hive-mind
npx claude-flow sparc tdd "User authentication" --hive-mind

Spawns:

Spawns:

- Specification agent

- Specification agent

- Architecture agent

- Architecture agent

- Coder agents

- Coder agents

- Tester agents

- Tester agents

- Reviewer agents

- Reviewer agents

undefined
undefined

With GitHub Integration

与GitHub集成

bash
undefined
bash
undefined

Repository analysis with hive mind

Repository analysis with hive mind

npx claude-flow hive-mind spawn "Analyze repo quality" --objective "owner/repo"
npx claude-flow hive-mind spawn "Analyze repo quality" --objective "owner/repo"

PR review coordination

PR review coordination

npx claude-flow hive-mind spawn "Review PR #123" --queen-type tactical
undefined
npx claude-flow hive-mind spawn "Review PR #123" --queen-type tactical
undefined

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
集体记忆系统包含高级优化功能:
LRU缓存
  • 可配置缓存大小(默认:1000条记录)
  • 内存压力处理(默认:50MB)
  • 自动淘汰最少使用的记录
数据库优化
  • WAL(预写日志)模式
  • 64MB缓存大小
  • 256MB内存映射
  • 常见查询使用预编译语句
  • 自动执行ANALYZE与OPTIMIZE
对象池化
  • 查询结果池化
  • 内存条目池化
  • 减少垃圾回收压力

Performance Metrics

性能指标

javascript
// Get performance insights
const insights = hiveMind.getPerformanceInsights();

// Includes:
// - asyncQueue utilization
// - Batch processing stats
// - Success rates
// - Average processing times
// - Memory efficiency
javascript
// 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
并行处理
  • 批量生成Agent(每批5个)
  • 并发任务编排
  • 异步操作优化
  • 非阻塞任务分配
基准测试结果
  • 批量生成速度提升10-20倍
  • 整体速度提升2.8-4.4倍
  • Token使用量减少32.3%
  • SWE-Bench解决率达84.8%

Configuration

配置

Hive Mind Config

Hive Mind配置

javascript
{
  "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
}
javascript
{
  "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

内存配置

javascript
{
  "maxSize": 100, // MB
  "compressionThreshold": 1024, // bytes
  "gcInterval": 300000, // 5 minutes
  "cacheSize": 1000,
  "cacheMemoryMB": 50,
  "enablePooling": true,
  "enableAsyncOperations": true
}
javascript
{
  "maxSize": 100, // MB
  "compressionThreshold": 1024, // bytes
  "gcInterval": 300000, // 5 minutes
  "cacheSize": 1000,
  "cacheMemoryMB": 50,
  "enablePooling": true,
  "enableAsyncOperations": true
}

Hooks Integration

Hooks集成

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
Hive Mind与Claude Flow Hooks集成以实现自动化:
任务前Hooks
  • 根据文件类型自动分配Agent
  • 验证目标复杂度
  • 优化拓扑选择
  • 缓存搜索模式
任务后Hooks
  • 自动格式化交付物
  • 训练神经模式
  • 更新集体记忆
  • 分析性能瓶颈
会话Hooks
  • 生成会话摘要
  • 持久化检查点数据
  • 追踪全面指标
  • 恢复执行上下文

Best Practices

最佳实践

1. Choose the Right Queen Type

1. 选择合适的女王类型

Strategic Queens - For research, planning, and analysis
bash
npx claude-flow hive-mind spawn "Research ML frameworks" --queen-type strategic
Tactical Queens - For implementation and execution
bash
npx claude-flow hive-mind spawn "Build authentication" --queen-type tactical
Adaptive Queens - For optimization and dynamic tasks
bash
npx claude-flow hive-mind spawn "Optimize performance" --queen-type adaptive
战略型女王 - 适用于调研、规划与分析
bash
npx claude-flow hive-mind spawn "Research ML frameworks" --queen-type strategic
战术型女王 - 适用于实现与执行
bash
npx claude-flow hive-mind spawn "Build authentication" --queen-type tactical
自适应型女王 - 适用于优化与动态任务
bash
npx claude-flow hive-mind spawn "Optimize performance" --queen-type adaptive

2. Leverage Consensus

2. 利用共识机制

Use consensus for critical decisions:
  • Architecture pattern selection
  • Technology stack choices
  • Implementation approach
  • Code review approval
  • Release readiness
在关键决策中使用共识:
  • 架构模式选择
  • 技术栈选型
  • 实现方案
  • 代码评审批准
  • 发布就绪判断

3. Utilize Collective Memory

3. 利用集体记忆

Store Learnings
javascript
// 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
javascript
// Link related concepts
await memory.associate('jwt-auth', 'refresh-tokens', 0.9);
await memory.associate('jwt-auth', 'oauth2', 0.7);
存储经验
javascript
// 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 });
构建关联
javascript
// Link related concepts
await memory.associate('jwt-auth', 'refresh-tokens', 0.9);
await memory.associate('jwt-auth', 'oauth2', 0.7);

4. Monitor Performance

4. 监控性能

bash
undefined
bash
undefined

Regular status checks

Regular status checks

npx claude-flow hive-mind status
npx claude-flow hive-mind status

Track metrics

Track metrics

npx claude-flow hive-mind metrics
npx claude-flow hive-mind metrics

Analyze memory usage

Analyze memory usage

npx claude-flow hive-mind memory
undefined
npx claude-flow hive-mind memory
undefined

5. Session Management

5. 会话管理

Checkpoint Frequently
javascript
// Create checkpoints at key milestones
await sessionManager.saveCheckpoint(
  sessionId,
  'api-routes-complete',
  { completedRoutes: [...], remaining: [...] }
);
Resume Sessions
bash
undefined
频繁创建检查点
javascript
// Create checkpoints at key milestones
await sessionManager.saveCheckpoint(
  sessionId,
  'api-routes-complete',
  { completedRoutes: [...], remaining: [...] }
);
恢复会话
bash
undefined

Resume from any previous state

Resume from any previous state

npx claude-flow hive-mind resume <session-id>
undefined
npx claude-flow hive-mind resume <session-id>
undefined

Troubleshooting

故障排除

Memory Issues

内存问题

High Memory Usage
bash
undefined
高内存占用
bash
undefined

Run garbage collection

Run garbage collection

npx claude-flow hive-mind memory --gc
npx claude-flow hive-mind memory --gc

Optimize database

Optimize database

npx claude-flow hive-mind memory --optimize
npx claude-flow hive-mind memory --optimize

Export and clear

Export and clear

npx claude-flow hive-mind memory --export --clear

**Low Cache Hit Rate**
```javascript
// Increase cache size in config
{
  "cacheSize": 2000,
  "cacheMemoryMB": 100
}
npx claude-flow hive-mind memory --export --clear

**缓存命中率低**
```javascript
// Increase cache size in config
{
  "cacheSize": 2000,
  "cacheMemoryMB": 100
}

Performance Issues

性能问题

Slow Task Assignment
javascript
// Enable worker type caching
// The system caches best worker matches for 5 minutes
// Automatic - no configuration needed
High Queue Utilization
javascript
// Increase async queue concurrency
{
  "asyncQueueConcurrency": 20 // Default: min(maxWorkers * 2, 20)
}
任务分配缓慢
javascript
// Enable worker type caching
// The system caches best worker matches for 5 minutes
// Automatic - no configuration needed
队列利用率高
javascript
// Increase async queue concurrency
{
  "asyncQueueConcurrency": 20 // Default: min(maxWorkers * 2, 20)
}

Consensus Failures

共识失败

No Consensus Reached (Byzantine)
bash
undefined
未达成共识(拜占庭模式)
bash
undefined

Switch to weighted consensus for more decisive results

Switch to weighted consensus for more decisive results

npx claude-flow hive-mind spawn "..." --consensus weighted
npx claude-flow hive-mind spawn "..." --consensus weighted

Or use simple majority

Or use simple majority

npx claude-flow hive-mind spawn "..." --consensus majority
undefined
npx claude-flow hive-mind spawn "..." --consensus majority
undefined

Advanced Topics

高级主题

Custom Worker Types

自定义Worker类型

Define specialized workers in
.claude/agents/
:
yaml
name: security-auditor
type: specialist
capabilities:
  - vulnerability-scanning
  - security-review
  - penetration-testing
  - compliance-checking
priority: high
.claude/agents/
目录下定义专业Worker:
yaml
name: security-auditor
type: specialist
capabilities:
  - vulnerability-scanning
  - security-review
  - penetration-testing
  - compliance-checking
priority: high

Neural Pattern Training

神经模式训练

The system trains on successful patterns:
javascript
// Automatic pattern learning
// Happens after successful task completion
// Stores in collective memory
// Improves future task matching
系统会对成功模式进行训练:
javascript
// Automatic pattern learning
// Happens after successful task completion
// Stores in collective memory
// Improves future task matching

Multi-Hive Coordination

多Hive协调

Run multiple hive minds simultaneously:
bash
undefined
同时运行多个Hive Mind:
bash
undefined

Frontend hive

Frontend hive

npx claude-flow hive-mind spawn "Build UI" --name frontend-hive
npx claude-flow hive-mind spawn "Build UI" --name frontend-hive

Backend hive

Backend hive

npx claude-flow hive-mind spawn "Build API" --name backend-hive
npx claude-flow hive-mind spawn "Build API" --name backend-hive

They share collective memory for coordination

They share collective memory for coordination

undefined
undefined

Export/Import Sessions

导出/导入会话

bash
undefined
bash
undefined

Export session for backup

Export session for backup

npx claude-flow hive-mind export <session-id> --output backup.json
npx claude-flow hive-mind export <session-id> --output backup.json

Import session

Import session

npx claude-flow hive-mind import backup.json
undefined
npx claude-flow hive-mind import backup.json
undefined

API Reference

API参考

HiveMindCore

HiveMindCore

javascript
const hiveMind = new HiveMindCore({
  objective: 'Build system',
  queenType: 'strategic',
  maxWorkers: 8,
  consensusAlgorithm: 'byzantine'
});

await hiveMind.initialize();
await hiveMind.spawnQueen(queenData);
await hiveMind.spawnWorkers(['coder', 'tester']);
await hiveMind.createTask('Implement feature', 7);
const decision = await hiveMind.buildConsensus('topic', options);
const status = hiveMind.getStatus();
await hiveMind.shutdown();
javascript
const hiveMind = new HiveMindCore({
  objective: 'Build system',
  queenType: 'strategic',
  maxWorkers: 8,
  consensusAlgorithm: 'byzantine'
});

await hiveMind.initialize();
await hiveMind.spawnQueen(queenData);
await hiveMind.spawnWorkers(['coder', 'tester']);
await hiveMind.createTask('Implement feature', 7);
const decision = await hiveMind.buildConsensus('topic', options);
const status = hiveMind.getStatus();
await hiveMind.shutdown();

CollectiveMemory

CollectiveMemory

javascript
const memory = new CollectiveMemory({
  swarmId: 'hive-123',
  maxSize: 100,
  cacheSize: 1000
});

await memory.store(key, value, type, metadata);
const data = await memory.retrieve(key);
const results = await memory.search(pattern, options);
const related = await memory.getRelated(key, limit);
await memory.associate(key1, key2, strength);
const stats = memory.getStatistics();
const analytics = memory.getAnalytics();
const health = await memory.healthCheck();
javascript
const memory = new CollectiveMemory({
  swarmId: 'hive-123',
  maxSize: 100,
  cacheSize: 1000
});

await memory.store(key, value, type, metadata);
const data = await memory.retrieve(key);
const results = await memory.search(pattern, options);
const related = await memory.getRelated(key, limit);
await memory.associate(key1, key2, strength);
const stats = memory.getStatistics();
const analytics = memory.getAnalytics();
const health = await memory.healthCheck();

HiveMindSessionManager

HiveMindSessionManager

javascript
const sessionManager = new HiveMindSessionManager();

const sessionId = await sessionManager.createSession(
  swarmId, swarmName, objective, metadata
);

await sessionManager.saveCheckpoint(sessionId, name, data);
const sessions = await sessionManager.getActiveSessions();
const session = await sessionManager.getSession(sessionId);
await sessionManager.pauseSession(sessionId);
await sessionManager.resumeSession(sessionId);
await sessionManager.stopSession(sessionId);
await sessionManager.completeSession(sessionId);
javascript
const sessionManager = new HiveMindSessionManager();

const sessionId = await sessionManager.createSession(
  swarmId, swarmName, objective, metadata
);

await sessionManager.saveCheckpoint(sessionId, name, data);
const sessions = await sessionManager.getActiveSessions();
const session = await sessionManager.getSession(sessionId);
await sessionManager.pauseSession(sessionId);
await sessionManager.resumeSession(sessionId);
await sessionManager.stopSession(sessionId);
await sessionManager.completeSession(sessionId);

Examples

示例

Full-Stack Development

全栈开发

bash
undefined
bash
undefined

Initialize hive mind

Initialize hive mind

npx claude-flow hive-mind init
npx claude-flow hive-mind init

Spawn full-stack hive

Spawn full-stack hive

npx claude-flow hive-mind spawn "Build e-commerce platform"
--queen-type strategic
--max-workers 10
--consensus weighted
--claude
npx claude-flow hive-mind spawn "Build e-commerce platform"
--queen-type strategic
--max-workers 10
--consensus weighted
--claude

Output generates Claude Code commands:

Output generates Claude Code commands:

- Queen coordinator

- Queen coordinator

- Frontend developers (React)

- Frontend developers (React)

- Backend developers (Node.js)

- Backend developers (Node.js)

- Database architects

- Database architects

- DevOps engineers

- DevOps engineers

- Security auditors

- Security auditors

- Test engineers

- Test engineers

- Documentation specialists

- Documentation specialists

undefined
undefined

Research and Analysis

调研与分析

bash
undefined
bash
undefined

Spawn research hive

Spawn research hive

npx claude-flow hive-mind spawn "Research GraphQL vs REST"
--queen-type adaptive
--consensus byzantine
npx claude-flow hive-mind spawn "Research GraphQL vs REST"
--queen-type adaptive
--consensus byzantine

Researchers gather data

Researchers gather data

Analysts process findings

Analysts process findings

Queen builds consensus on recommendation

Queen builds consensus on recommendation

Results stored in collective memory

Results stored in collective memory

undefined
undefined

Code Review

代码评审

bash
undefined
bash
undefined

Review coordination

Review coordination

npx claude-flow hive-mind spawn "Review PR #456"
--queen-type tactical
--max-workers 6
npx claude-flow hive-mind spawn "Review PR #456"
--queen-type tactical
--max-workers 6

Spawns:

Spawns:

- Code analyzers

- Code analyzers

- Security reviewers

- Security reviewers

- Performance reviewers

- Performance reviewers

- Test coverage analyzers

- Test coverage analyzers

- Documentation reviewers

- Documentation reviewers

- Consensus on approval/changes

- Consensus on approval/changes

undefined
undefined

Skill Progression

技能进阶

Beginner

入门级

  1. Initialize hive mind
  2. Spawn basic swarms
  3. Monitor status
  4. Use majority consensus
  1. 初始化Hive Mind
  2. 生成基础集群
  3. 监控状态
  4. 使用多数共识

Intermediate

进阶级

  1. Configure queen types
  2. Implement session management
  3. Use weighted consensus
  4. Access collective memory
  5. Enable auto-scaling
  1. 配置女王类型
  2. 实现会话管理
  3. 使用加权共识
  4. 访问集体记忆
  5. 启用自动扩缩容

Advanced

专家级

  1. Byzantine fault tolerance
  2. Memory optimization
  3. Custom worker types
  4. Multi-hive coordination
  5. Neural pattern training
  6. Session export/import
  7. Performance tuning
  1. 拜占庭容错
  2. 内存优化
  3. 自定义Worker类型
  4. 多Hive协调
  5. 神经模式训练
  6. 会话导出/导入
  7. 性能调优

Related Skills

相关技能

  • swarm-orchestration
    : Basic swarm coordination
  • consensus-mechanisms
    : Distributed decision making
  • memory-systems
    : Advanced memory management
  • sparc-methodology
    : Structured development workflow
  • github-integration
    : Repository coordination
  • swarm-orchestration
    : 基础集群协调
  • consensus-mechanisms
    : 分布式决策
  • memory-systems
    : 高级内存管理
  • sparc-methodology
    : 结构化开发工作流
  • github-integration
    : 仓库协调

References

参考资料


Skill Version: 1.0.0 Last Updated: 2025-10-19 Maintained By: Claude Flow Team License: MIT

技能版本: 1.0.0 最后更新: 2025-10-19 维护团队: Claude Flow Team 许可证: MIT