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协调的顶尖方案,采用女王主导的分层架构,由战略型女王协调者通过集体决策与共享记忆指挥专业的工作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:分析与调研
  • 编码Agent:实现与开发
  • 分析师Agent:数据处理与指标分析
  • 测试Agent:质量保证与验证
  • 架构师Agent:系统设计与规划
  • 评审Agent:代码评审与优化
  • 优化师Agent:性能提升
  • 文档师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

基础初始化

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

Force reinitialize

强制重新初始化

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

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

带目标的基础生成

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

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

战术型女王+最大工作Agent数

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

自适应型女王+拜占庭共识

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

生成Claude Code命令

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

检查Hive Mind状态

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

Get detailed metrics

获取详细指标

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

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

列出活跃会话

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

Pause a session

暂停会话

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

Resume a paused session

恢复暂停的会话

npx claude-flow hive-mind resume <session-id>
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
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
// 程序化共识构建
const decision = await hiveMind.buildConsensus(
  'Architecture pattern selection',
  ['microservices', 'monolith', 'serverless']
);

// 返回结果包括:
// - decision: 胜出选项
// - confidence: 投票占比
// - votes: 单个Agent的投票情况
共识算法
  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
// 存储到集体内存
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
undefined

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
};
const results = await memory.search('api*', { type: 'knowledge', minConfidence: 0.8, limit: 50 });

Integration Patterns

获取相关记忆

With 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")
const related = await memory.getRelated('api-patterns', 10);

With SPARC Methodology

建立关联

bash
undefined
await memory.associate('rest-api', 'authentication', 0.9);
undefined

Use hive mind for SPARC workflow

任务分配

npx claude-flow sparc tdd "User authentication" --hive-mind
自动工作Agent分配
系统基于以下因素智能分配任务:
  • 与Agent专长的关键词匹配
  • 历史性能指标
  • 工作Agent的可用性与负载
  • 任务复杂度分析
javascript
undefined

Spawns:

创建任务(自动分配)

- Specification agent

—

- Architecture agent

—

- Coder agents

—

- Tester agents

—

- Reviewer agents

—
undefined
const task = await hiveMind.createTask( 'Implement user authentication', priority: 8, { estimatedDuration: 30000 } );

**自动扩缩容**

```javascript

With GitHub Integration

配置自动扩缩容

bash
undefined
const config = { autoScale: true, maxWorkers: 12, scaleUpThreshold: 2, // 每个空闲工作Agent对应的待处理任务数 scaleDownThreshold: 2 // 待处理任务数之上的空闲工作Agent数 };
undefined

Repository analysis with hive mind

集成模式

—

与Claude Code集成

npx claude-flow hive-mind spawn "Analyze repo quality" --objective "owner/repo"
直接生成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")

PR review coordination

与SPARC方法论集成

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

Performance Optimization

使用Hive Mind执行SPARC工作流

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
npx claude-flow sparc tdd "User authentication" --hive-mind

Performance Metrics

生成以下Agent:

—

- 规格制定Agent

—

- 架构设计Agent

—

- 编码Agent

—

- 测试Agent

—

- 评审Agent

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

// Includes:
// - asyncQueue utilization
// - Batch processing stats
// - Success rates
// - Average processing times
// - Memory efficiency
undefined

Task Execution

与GitHub集成

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
bash
undefined

Configuration

使用Hive Mind分析仓库

Hive Mind Config

—
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
}
npx claude-flow hive-mind spawn "Analyze repo quality" --objective "owner/repo"

Memory Config

PR评审协调

javascript
{
  "maxSize": 100, // MB
  "compressionThreshold": 1024, // bytes
  "gcInterval": 300000, // 5 minutes
  "cacheSize": 1000,
  "cacheMemoryMB": 50,
  "enablePooling": true,
  "enableAsyncOperations": true
}
npx claude-flow hive-mind spawn "Review PR #123" --queen-type tactical
undefined

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

Best Practices

性能指标

1. Choose the Right Queen Type

—
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
javascript
undefined

2. Leverage Consensus

获取性能洞察

Use consensus for critical decisions:
  • Architecture pattern selection
  • Technology stack choices
  • Implementation approach
  • Code review approval
  • Release readiness
const insights = hiveMind.getPerformanceInsights();

3. Utilize Collective Memory

包含:

—

- asyncQueue利用率

—

批量处理统计

—

- 成功率

—

- 平均处理时间

—

- 内存效率

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);
undefined

4. Monitor Performance

任务执行

bash
undefined
并行处理
  • 批量生成Agent(每批5个)
  • 并发任务编排
  • 异步操作优化
  • 非阻塞任务分配
基准测试
  • 批量生成速度提升10-20倍
  • 整体速度提升2.8-4.4倍
  • Token使用量减少32.3%
  • SWE-Bench解决率达84.8%

Regular status checks

配置

—

Hive Mind配置

npx claude-flow hive-mind status
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
}

Track metrics

内存配置

npx claude-flow hive-mind metrics
javascript
{
  "maxSize": 100, // MB
  "compressionThreshold": 1024, // bytes
  "gcInterval": 300000, // 5 minutes
  "cacheSize": 1000,
  "cacheMemoryMB": 50,
  "enablePooling": true,
  "enableAsyncOperations": true
}

Analyze memory usage

Hooks集成

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

5. Session Management

最佳实践

—

1. 选择合适的女王类型

Checkpoint Frequently
javascript
// Create checkpoints at key milestones
await sessionManager.saveCheckpoint(
  sessionId,
  'api-routes-complete',
  { completedRoutes: [...], remaining: [...] }
);
Resume Sessions
bash
undefined
战略型女王 - 适用于研究、规划与分析
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

Resume from any previous state

2. 利用共识机制

npx claude-flow hive-mind resume <session-id>
undefined
在关键决策中使用共识:
  • 架构模式选择
  • 技术栈选型
  • 实现方案
  • 代码评审批准
  • 发布就绪性

Troubleshooting

3. 利用集体记忆

Memory Issues

—
High Memory Usage
bash
undefined
存储经验
javascript
undefined

Run garbage collection

成功实现模式后

npx claude-flow hive-mind memory --gc
await memory.store('auth-pattern', { approach: 'JWT with refresh tokens', pros: ['Stateless', 'Scalable'], cons: ['Token size', 'Revocation complexity'], implementation: {...} }, 'knowledge', { confidence: 0.95 });

**建立关联**
```javascript

Optimize database

关联相关概念

npx claude-flow hive-mind memory --optimize
await memory.associate('jwt-auth', 'refresh-tokens', 0.9); await memory.associate('jwt-auth', 'oauth2', 0.7);
undefined

Export and clear

4. 监控性能

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

**Low Cache Hit Rate**
```javascript
// Increase cache size in config
{
  "cacheSize": 2000,
  "cacheMemoryMB": 100
}
bash
undefined

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)
}
npx claude-flow hive-mind status

Consensus Failures

追踪指标

No Consensus Reached (Byzantine)
bash
undefined
npx claude-flow hive-mind metrics

Switch to weighted consensus for more decisive results

分析内存使用

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

Or use simple majority

5. 会话管理

npx claude-flow hive-mind spawn "..." --consensus majority
undefined
频繁创建检查点
javascript
undefined

Advanced Topics

在关键里程碑创建检查点

Custom Worker Types

—
Define specialized workers in
.claude/agents/
:
yaml
name: security-auditor
type: specialist
capabilities:
  - vulnerability-scanning
  - security-review
  - penetration-testing
  - compliance-checking
priority: high
await sessionManager.saveCheckpoint( sessionId, 'api-routes-complete', { completedRoutes: [...], remaining: [...] } );

**恢复会话**
```bash

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

Multi-Hive Coordination

故障排除

—

内存问题

Run multiple hive minds simultaneously:
bash
undefined
高内存占用
bash
undefined

Frontend hive

执行垃圾回收

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

Backend hive

优化数据库

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

They share collective memory for coordination

导出并清理

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

**缓存命中率低**
```javascript

Export/Import Sessions

在配置中增大缓存大小

bash
undefined
{ "cacheSize": 2000, "cacheMemoryMB": 100 }
undefined

Export session for backup

性能问题

npx claude-flow hive-mind export <session-id> --output backup.json
任务分配缓慢
javascript
undefined

Import session

启用工作Agent类型缓存

—

系统会缓存最佳工作Agent匹配结果5分钟

—

自动生效 - 无需配置

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

**队列利用率高**
```javascript

API Reference

增大异步队列并发数

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();
{ "asyncQueueConcurrency": 20 // 默认值: min(maxWorkers * 2, 20) }
undefined

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();
未达成共识(拜占庭模式)
bash
undefined

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);
npx claude-flow hive-mind spawn "..." --consensus weighted

Examples

或使用简单多数投票

Full-Stack Development

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

Initialize hive mind

高级主题

—

自定义工作Agent类型

npx claude-flow hive-mind init
在
.claude/agents/
中定义专业工作Agent:
yaml
name: security-auditor
type: specialist
capabilities:
  - vulnerability-scanning
  - security-review
  - penetration-testing
  - compliance-checking
priority: high

Spawn full-stack hive

神经模式训练

npx claude-flow hive-mind spawn "Build e-commerce platform"
--queen-type strategic
--max-workers 10
--consensus weighted
--claude
系统会从成功模式中学习:
javascript
undefined

Output generates Claude Code commands:

自动模式学习

- Queen coordinator

在任务成功完成后执行

- Frontend developers (React)

存储到集体内存

- Backend developers (Node.js)

提升未来任务匹配效率

- Database architects

—

- DevOps engineers

—

- Security auditors

—

- Test engineers

—

- Documentation specialists

—
undefined
undefined

Research and Analysis

多Hive协调

bash
undefined
同时运行多个Hive Mind:
bash
undefined

Spawn research hive

前端Hive

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

Researchers gather data

后端Hive

Analysts process findings

—

Queen builds consensus on recommendation

—

Results stored in collective memory

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

Code Review

它们共享集体内存以实现协调

bash
undefined
undefined

Review coordination

导出/导入会话

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

Spawns:

导出会话以备份

- Code analyzers

—

- Security reviewers

—

- Performance reviewers

—

- Test coverage analyzers

—

- Documentation reviewers

—

- Consensus on approval/changes

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

Skill Progression

导入会话

Beginner

—
  1. Initialize hive mind
  2. Spawn basic swarms
  3. Monitor status
  4. Use majority consensus
npx claude-flow hive-mind import backup.json
undefined

Intermediate

API参考

—

HiveMindCore

  1. Configure queen types
  2. Implement session management
  3. Use weighted consensus
  4. Access collective memory
  5. Enable auto-scaling
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();

Advanced

CollectiveMemory

  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
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();

Related Skills

HiveMindSessionManager

  • swarm-orchestration
    : Basic swarm coordination
  • consensus-mechanisms
    : Distributed decision making
  • memory-systems
    : Advanced memory management
  • sparc-methodology
    : Structured development workflow
  • github-integration
    : Repository coordination
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);

References

示例

—

全栈开发


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

初始化Hive Mind

—
npx claude-flow hive-mind init
—

生成全栈Hive

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

输出会生成Claude Code命令:

—

- 女王协调者

—

- 前端开发(React)

—

- 后端开发(Node.js)

—

- 数据库架构师

—

- DevOps工程师

—

- 安全审计员

—

- 测试工程师

—

- 文档专员

—
undefined
—

研究与分析

—
bash
undefined
—

生成研究Hive

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

研究员收集数据

—

分析师处理研究结果

—

女王就建议达成共识

—

结果存储到集体内存

—
undefined
—

代码评审

—
bash
undefined
—

评审协调

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

生成以下Agent:

—

- 代码分析员

—

- 安全评审员

—

- 性能评审员

—

- 测试覆盖率分析员

—

- 文档评审员

—

- 就批准/修改达成共识

—
undefined
—

技能进阶

—

初级

—
  1. 初始化Hive Mind
  2. 生成基础集群
  3. 监控状态
  4. 使用多数共识
—

中级

—
  1. 配置女王类型
  2. 实现会话管理
  3. 使用加权共识
  4. 访问集体内存
  5. 启用自动扩缩容
—

高级

—
  1. 拜占庭容错
  2. 内存优化
  3. 自定义工作Agent类型
  4. 多Hive协调
  5. 神经模式训练
  6. 会话导出/导入
  7. 性能调优
—

相关技能

—
  • swarm-orchestration
    : 基础集群协调
  • consensus-mechanisms
    : 分布式决策
  • memory-systems
    : 高级内存管理
  • sparc-methodology
    : 结构化开发工作流
  • github-integration
    : 仓库协调
—

参考资料

—

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