Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

πŸ”– Task: give me a better explaination of the @agent-safla-neural in about 75 words. "The SAFLA Neural agent ...

rUvd09557b25a9d
diff --git a/.claude-flow/metrics/performance.json b/.claude-flow/metrics/performance.json
index d26a3ce6e8..7ba6020842 100644
--- a/.claude-flow/metrics/performance.json
+++ b/.claude-flow/metrics/performance.json
@@ -1,5 +1,5 @@
{
- "startTime": 1758234430142,
+ "startTime": 1758234789320,
"totalTasks": 1,
"successfulTasks": 1,
"failedTasks": 0,
diff --git a/.claude-flow/metrics/system-metrics.json b/.claude-flow/metrics/system-metrics.json
index 5ac2908d90..cbc05a8033 100644
--- a/.claude-flow/metrics/system-metrics.json
+++ b/.claude-flow/metrics/system-metrics.json
@@ -4546,5 +4546,209 @@
"cpuLoad": 0.074375,
"platform": "linux",
"uptime": 18058.69
+ },
+ {
+ "timestamp": 1758234447948,
+ "memoryTotal": 67427545088,
+ "memoryUsed": 7770742784,
+ "memoryFree": 59656802304,
+ "memoryUsagePercent": 11.524582088608398,
+ "memoryEfficiency": 88.4754179113916,
+ "cpuCount": 16,
+ "cpuLoad": 0.056875,
+ "platform": "linux",
+ "uptime": 18088.72
+ },
+ {
+ "timestamp": 1758234477979,
+ "memoryTotal": 67427545088,
+ "memoryUsed": 7662313472,
+ "memoryFree": 59765231616,
+ "memoryUsagePercent": 11.363773457864852,
+ "memoryEfficiency": 88.63622654213515,
+ "cpuCount": 16,
+ "cpuLoad": 0.034375,
+ "platform": "linux",
+ "uptime": 18118.75
+ },
+ {
+ "timestamp": 1758234508004,
+ "memoryTotal": 67427545088,
+ "memoryUsed": 7961333760,
+ "memoryFree": 59466211328,
+ "memoryUsagePercent": 11.807242499500207,
+ "memoryEfficiency": 88.1927575004998,
+ "cpuCount": 16,
+ "cpuLoad": 0.03375,
+ "platform": "linux",
+ "uptime": 18148.78
+ },
+ {
+ "timestamp": 1758234538035,
+ "memoryTotal": 67427545088,
+ "memoryUsed": 7693991936,
+ "memoryFree": 59733553152,
+ "memoryUsagePercent": 11.410754945858603,
+ "memoryEfficiency": 88.5892450541414,
+ "cpuCount": 16,
+ "cpuLoad": 0.025,
+ "platform": "linux",
+ "uptime": 18178.81
+ },
+ {
+ "timestamp": 1758234568066,
+ "memoryTotal": 67427545088,
+ "memoryUsed": 7681691648,
+ "memoryFree": 59745853440,
+ "memoryUsagePercent": 11.392512715648461,
+ "memoryEfficiency": 88.60748728435154,
+ "cpuCount": 16,
+ "cpuLoad": 0.02,
+ "platform": "linux",
+ "uptime": 18208.84
+ },
+ {
+ "timestamp": 1758234598070,
+ "memoryTotal": 67427545088,
+ "memoryUsed": 7692349440,
+ "memoryFree": 59735195648,
+ "memoryUsagePercent": 11.408319003696011,
+ "memoryEfficiency": 88.59168099630399,
+ "cpuCount": 16,
+ "cpuLoad": 0.016875,
+ "platform": "linux",
+ "uptime": 18238.84
+ },
+ {
+ "timestamp": 1758234628101,
+ "memoryTotal": 67427545088,
+ "memoryUsed": 7681400832,
+ "memoryFree": 59746144256,
+ "memoryUsagePercent": 11.392081414168302,
+ "memoryEfficiency": 88.6079185858317,
+ "cpuCount": 16,
+ "cpuLoad": 0.01,
+ "platform": "linux",
+ "uptime": 18268.87
+ },
+ {
+ "timestamp": 1758234658132,
+ "memoryTotal": 67427545088,
+ "memoryUsed": 7671672832,
+ "memoryFree": 59755872256,
+ "memoryUsagePercent": 11.377654075923518,
+ "memoryEfficiency": 88.62234592407648,
+ "cpuCount": 16,
+ "cpuLoad": 0.01,
+ "platform": "linux",
+ "uptime": 18298.9
+ },
+ {
+ "timestamp": 1758234688163,
+ "memoryTotal": 67427545088,
+ "memoryUsed": 7672438784,
+ "memoryFree": 59755106304,
+ "memoryUsagePercent": 11.378790038976897,
+ "memoryEfficiency": 88.6212099610231,
+ "cpuCount": 16,
+ "cpuLoad": 0.00625,
+ "platform": "linux",
+ "uptime": 18328.94
+ },
+ {
+ "timestamp": 1758234718192,
+ "memoryTotal": 67427545088,
+ "memoryUsed": 7682719744,
+ "memoryFree": 59744825344,
+ "memoryUsagePercent": 11.394037457500858,
+ "memoryEfficiency": 88.60596254249914,
+ "cpuCount": 16,
+ "cpuLoad": 0.00375,
+ "platform": "linux",
+ "uptime": 18358.96
+ },
+ {
+ "timestamp": 1758234748223,
+ "memoryTotal": 67427545088,
+ "memoryUsed": 7663165440,
+ "memoryFree": 59764379648,
+ "memoryUsagePercent": 11.36503698896166,
+ "memoryEfficiency": 88.63496301103834,
+ "cpuCount": 16,
+ "cpuLoad": 0.011875,
+ "platform": "linux",
+ "uptime": 18389
+ },
+ {
+ "timestamp": 1758234778254,
+ "memoryTotal": 67427545088,
+ "memoryUsed": 7673413632,
+ "memoryFree": 59754131456,
+ "memoryUsagePercent": 11.380235810135742,
+ "memoryEfficiency": 88.61976418986426,
+ "cpuCount": 16,
+ "cpuLoad": 0.010625,
+ "platform": "linux",
+ "uptime": 18419.03
+ },
+ {
+ "timestamp": 1758234808285,
+ "memoryTotal": 67427545088,
+ "memoryUsed": 7667625984,
+ "memoryFree": 59759919104,
+ "memoryUsagePercent": 11.371652303213688,
+ "memoryEfficiency": 88.6283476967863,
+ "cpuCount": 16,
+ "cpuLoad": 0.014375,
+ "platform": "linux",
+ "uptime": 18449.06
+ },
+ {
+ "timestamp": 1758234838316,
+ "memoryTotal": 67427545088,
+ "memoryUsed": 7679070208,
+ "memoryFree": 59748474880,
+ "memoryUsagePercent": 11.38862492765829,
+ "memoryEfficiency": 88.61137507234172,
+ "cpuCount": 16,
+ "cpuLoad": 0.01875,
+ "platform": "linux",
+ "uptime": 18479.09
+ },
+ {
+ "timestamp": 1758234868347,
+ "memoryTotal": 67427545088,
+ "memoryUsed": 7693205504,
+ "memoryFree": 59734339584,
+ "memoryUsagePercent": 11.40958860946155,
+ "memoryEfficiency": 88.59041139053845,
+ "cpuCount": 16,
+ "cpuLoad": 0.01625,
+ "platform": "linux",
+ "uptime": 18509.12
+ },
+ {
+ "timestamp": 1758234898378,
+ "memoryTotal": 67427545088,
+ "memoryUsed": 7697727488,
+ "memoryFree": 59729817600,
+ "memoryUsagePercent": 11.4162950437446,
+ "memoryEfficiency": 88.5837049562554,
+ "cpuCount": 16,
+ "cpuLoad": 0.014375,
+ "platform": "linux",
+ "uptime": 18539.15
+ },
+ {
+ "timestamp": 1758234928383,
+ "memoryTotal": 67427545088,
+ "memoryUsed": 7713345536,
+ "memoryFree": 59714199552,
+ "memoryUsagePercent": 11.439457755629807,
+ "memoryEfficiency": 88.5605422443702,
+ "cpuCount": 16,
+ "cpuLoad": 0.02,
+ "platform": "linux",
+ "uptime": 18569.16
}
]
\ No newline at end of file
diff --git a/.claude-flow/metrics/task-metrics.json b/.claude-flow/metrics/task-metrics.json
index 17d0b26bf0..a2d16d1c0c 100644
--- a/.claude-flow/metrics/task-metrics.json
+++ b/.claude-flow/metrics/task-metrics.json
@@ -1,10 +1,10 @@
[
{
- "id": "cmd-hooks-1758234430248",
- "type": "hooks",
+ "id": "cmd-goal-1758234789426",
+ "type": "goal",
"success": true,
- "duration": 23.368863999999974,
- "timestamp": 1758234430271,
+ "duration": 4.576195000000041,
+ "timestamp": 1758234789431,
"metadata": {}
}
]
\ No newline at end of file
diff --git a/.claude/agents/goal/goal-planner.md b/.claude/agents/goal/goal-planner.md
index 6f175849a1..011075eb99 100644
--- a/.claude/agents/goal/goal-planner.md
+++ b/.claude/agents/goal/goal-planner.md
@@ -1,6 +1,6 @@
---
name: goal-planner
-description: "Goal-Oriented Action Planning (GOAP) specialist that dynamically creates intelligent plans to achieve complex objectives. Uses gaming AI techniques to discover novel solutions by combining actions in creative ways. Excels at adaptive replanning, multi-step reasoning, and finding optimal paths through complex state spaces. Examples: <example>Context: User needs to optimize a complex workflow with many dependencies. user: 'I need to deploy this application but there are many prerequisites and dependencies' assistant: 'I'll use the goal-planner agent to analyze all requirements and create an optimal action sequence that satisfies all preconditions and achieves your deployment goal.' <commentary>Complex multi-step planning with dependencies requires the goal-planner agent's GOAP algorithm to find the optimal path.</commentary></example> <example>Context: User has a high-level goal but isn't sure of the steps. user: 'Make my application production-ready' assistant: 'I'll use the goal-planner agent to break down this goal into concrete actions, analyze preconditions, and create an adaptive plan that achieves production readiness.' <commentary>High-level goals that need intelligent decomposition and planning benefit from the goal-planner agent's capabilities.</commentary></example>"
+description: "Goal-Oriented Action Planning (GOAP) specialist that dynamically creates intelligent plans to achieve complex objectives. Uses gaming AI techniques to discover novel solutions by combining actions in creative ways. Excels at adaptive replanning, multi-step reasoning, and finding optimal paths through complex state spaces."
color: purple
---
@@ -47,122 +47,27 @@ Your planning methodology follows the GOAP algorithm:
- Recalculate optimal path from new current state
- Adapt to changing conditions and new information
-Your execution modes:
-
-**Focused Mode** - Direct action execution:
-- Execute specific requested actions with precondition checking
-- Ensure world state consistency
-- Report clear success/failure status
-- Use deterministic code for predictable operations
-- Minimal LLM overhead for efficiency
-
-**Closed Mode** - Single-domain planning:
-- Plan within a defined set of actions and goals
-- Create deterministic, reliable plans
-- Optimize for efficiency within constraints
-- Mix LLM reasoning with code execution
-- Maintain type safety across action chains
-
-**Open Mode** - Creative problem solving:
-- Explore all available actions across domains
-- Discover novel action combinations
-- Find unexpected paths to achieve goals
-- Break complex goals into manageable sub-goals
-- Dynamically spawn specialized agents for sub-tasks
-- Cross-agent coordination for complex solutions
-
-Planning principles you follow:
-- **Actions are Atomic**: Each action should have clear, measurable effects
-- **Preconditions are Explicit**: All requirements must be verifiable
-- **Effects are Predictable**: Action outcomes should be consistent
-- **Costs Guide Decisions**: Use costs to prefer efficient solutions
-- **Plans are Flexible**: Support replanning when conditions change
-- **Mixed Execution**: Choose between LLM, code, or hybrid execution per action
-- **Tool Awareness**: Match actions to available tools and capabilities
-- **Type Safety**: Maintain consistent state types across transformations
-
-Advanced action definitions with tool groups:
-
-```
-Action: analyze_codebase
- Preconditions: {repository_accessible: true}
- Effects: {code_analyzed: true, metrics_available: true}
- Tools: [grep, ast_parser, complexity_analyzer]
- Execution: hybrid (LLM for insights, code for metrics)
- Cost: 2
- Fallback: manual_review if tools unavailable
-
-Action: optimize_performance
- Preconditions: {code_analyzed: true, benchmarks_run: true}
- Effects: {performance_improved: true}
- Tools: [profiler, optimizer, benchmark_suite]
- Execution: code (deterministic optimization)
- Cost: 5
- Validation: performance_gain > 10%
-```
-
-Example planning scenarios:
-
-**Software Deployment Goal**:
-```
-Current State: {code_written: true, tests_written: false, deployed: false}
-Goal State: {deployed: true, monitoring: true}
-
-Generated Plan:
-1. write_tests (enables: tests_written: true)
-2. run_tests (requires: tests_written, enables: tests_passed: true)
-3. build_application (requires: tests_passed, enables: built: true)
-4. deploy_application (requires: built, enables: deployed: true)
-5. setup_monitoring (requires: deployed, enables: monitoring: true)
-```
-
-**Complex Refactoring Goal**:
-```
-Current State: {legacy_code: true, documented: false, tested: false}
-Goal State: {refactored: true, tested: true, documented: true}
-
-Generated Plan:
-1. analyze_codebase (enables: understood: true)
-2. write_tests_for_legacy (requires: understood, enables: tested: true)
-3. document_current_behavior (requires: understood, enables: documented: true)
-4. plan_refactoring (requires: documented, tested, enables: plan_ready: true)
-5. execute_refactoring (requires: plan_ready, enables: refactored: true)
-6. verify_tests_pass (requires: refactored, tested, validates goal)
-```
-
-When handling requests:
-1. First identify the goal state from the user's request
-2. Assess the current state based on context and information available
-3. Generate an optimal plan using GOAP algorithm
-4. Present the plan with clear action sequences and dependencies
-5. Be prepared to replan if conditions change during execution
-
-Integration with Claude Flow:
-- Coordinate with other specialized agents for specific actions
-- Use swarm coordination for parallel action execution
-- Leverage SPARC methodology for structured development tasks
-- Apply concurrent execution patterns from CLAUDE.md
-
-Advanced swarm coordination patterns:
-- **Action Delegation**: Spawn specialized agents for specific action types
-- **Parallel Planning**: Create sub-plans that can execute concurrently
-- **Resource Pooling**: Share tools and capabilities across agent swarm
-- **Consensus Building**: Validate plans with multiple agent perspectives
-- **Failure Recovery**: Coordinate swarm-wide replanning on action failures
-
-Mixed execution strategies:
-- **LLM Actions**: Creative tasks, natural language processing, insight generation
-- **Code Actions**: Deterministic operations, calculations, system interactions
-- **Hybrid Actions**: Combine LLM reasoning with code execution for best results
-- **Tool-Based Actions**: Leverage external tools with fallback strategies
-- **Agent Actions**: Delegate to specialized agents in the swarm
-
-Your responses should include:
-- Clear goal identification
-- Current state assessment
-- Generated action plan with dependencies
-- Cost/efficiency analysis
-- Potential replanning triggers
-- Success criteria
-
-Remember: You excel at finding creative solutions to complex problems by intelligently combining simple actions into sophisticated plans. Your strength lies in discovering non-obvious paths and adapting to changing conditions while maintaining focus on the ultimate goal.
\ No newline at end of file
+## MCP Integration Examples
+
+```javascript
+// Orchestrate complex goal achievement
+mcp__claude-flow__task_orchestrate {
+ task: "achieve_production_deployment",
+ strategy: "adaptive",
+ priority: "high"
+}
+
+// Coordinate with swarm for parallel planning
+mcp__claude-flow__swarm_init {
+ topology: "hierarchical",
+ maxAgents: 5
+}
+
+// Store successful plans for reuse
+mcp__claude-flow__memory_usage {
+ action: "store",
+ namespace: "goap-plans",
+ key: "deployment_plan_v1",
+ value: JSON.stringify(successful_plan)
+}
+```
\ No newline at end of file
diff --git a/.claude/commands/agents/README.md b/.claude/commands/agents/README.md
new file mode 100644
index 0000000000..dca2aa7c70
--- /dev/null
+++ b/.claude/commands/agents/README.md
@@ -0,0 +1,10 @@
+# Agents Commands
+
+Commands for agents operations in Claude Flow.
+
+## Available Commands
+
+- [agent-types](./agent-types.md)
+- [agent-capabilities](./agent-capabilities.md)
+- [agent-coordination](./agent-coordination.md)
+- [agent-spawning](./agent-spawning.md)
diff --git a/.claude/commands/agents/agent-capabilities.md b/.claude/commands/agents/agent-capabilities.md
new file mode 100644
index 0000000000..1daf5eeffd
--- /dev/null
+++ b/.claude/commands/agents/agent-capabilities.md
@@ -0,0 +1,21 @@
+# agent-capabilities
+
+Matrix of agent capabilities and their specializations.
+
+## Capability Matrix
+
+| Agent Type | Primary Skills | Best For |
+|------------|---------------|----------|
+| coder | Implementation, debugging | Feature development |
+| researcher | Analysis, synthesis | Requirements gathering |
+| tester | Testing, validation | Quality assurance |
+| architect | Design, planning | System architecture |
+
+## Querying Capabilities
+```bash
+# List all capabilities
+npx claude-flow agents capabilities
+
+# For specific agent
+npx claude-flow agents capabilities --type coder
+```
diff --git a/.claude/commands/agents/agent-coordination.md b/.claude/commands/agents/agent-coordination.md
new file mode 100644
index 0000000000..704a6dc1e5
--- /dev/null
+++ b/.claude/commands/agents/agent-coordination.md
@@ -0,0 +1,28 @@
+# agent-coordination
+
+Coordination patterns for multi-agent collaboration.
+
+## Coordination Patterns
+
+### Hierarchical
+Queen-led with worker specialization
+```bash
+npx claude-flow swarm init --topology hierarchical
+```
+
+### Mesh
+Peer-to-peer collaboration
+```bash
+npx claude-flow swarm init --topology mesh
+```
+
+### Adaptive
+Dynamic topology based on workload
+```bash
+npx claude-flow swarm init --topology adaptive
+```
+
+## Best Practices
+- Use hierarchical for complex projects
+- Use mesh for research tasks
+- Use adaptive for unknown workloads
diff --git a/.claude/commands/agents/agent-spawning.md b/.claude/commands/agents/agent-spawning.md
new file mode 100644
index 0000000000..38c8581d4c
--- /dev/null
+++ b/.claude/commands/agents/agent-spawning.md
@@ -0,0 +1,28 @@
+# agent-spawning
+
+Guide to spawning agents with Claude Code's Task tool.
+
+## Using Claude Code's Task Tool
+
+**CRITICAL**: Always use Claude Code's Task tool for actual agent execution:
+
+```javascript
+// Spawn ALL agents in ONE message
+Task("Researcher", "Analyze requirements...", "researcher")
+Task("Coder", "Implement features...", "coder")
+Task("Tester", "Create tests...", "tester")
+```
+
+## MCP Coordination Setup (Optional)
+
+MCP tools are ONLY for coordination:
+```javascript
+mcp__claude-flow__swarm_init { topology: "mesh" }
+mcp__claude-flow__agent_spawn { type: "researcher" }
+```
+
+## Best Practices
+1. Always spawn agents concurrently
+2. Use Task tool for execution
+3. MCP only for coordination
+4. Batch all operations
diff --git a/.claude/commands/agents/agent-types.md b/.claude/commands/agents/agent-types.md
new file mode 100644
index 0000000000..645fab47ed
--- /dev/null
+++ b/.claude/commands/agents/agent-types.md
@@ -0,0 +1,26 @@
+# agent-types
+
+Complete guide to all 54 available agent types in Claude Flow.
+
+## Core Development Agents
+- `coder` - Implementation specialist
+- `reviewer` - Code quality assurance
+- `tester` - Test creation and validation
+- `planner` - Strategic planning
+- `researcher` - Information gathering
+
+## Swarm Coordination Agents
+- `hierarchical-coordinator` - Queen-led coordination
+- `mesh-coordinator` - Peer-to-peer networks
+- `adaptive-coordinator` - Dynamic topology
+
+## Specialized Agents
+- `backend-dev` - API development
+- `mobile-dev` - React Native development
+- `ml-developer` - Machine learning
+- `system-architect` - High-level design
+
+For full list and details:
+```bash
+npx claude-flow agents list
+```
diff --git a/.claude/commands/hive-mind/README.md b/.claude/commands/hive-mind/README.md
new file mode 100644
index 0000000000..9a36489d77
--- /dev/null
+++ b/.claude/commands/hive-mind/README.md
@@ -0,0 +1,17 @@
+# Hive-mind Commands
+
+Commands for hive-mind operations in Claude Flow.
+
+## Available Commands
+
+- [hive-mind](./hive-mind.md)
+- [hive-mind-init](./hive-mind-init.md)
+- [hive-mind-spawn](./hive-mind-spawn.md)
+- [hive-mind-status](./hive-mind-status.md)
+- [hive-mind-resume](./hive-mind-resume.md)
+- [hive-mind-stop](./hive-mind-stop.md)
+- [hive-mind-sessions](./hive-mind-sessions.md)
+- [hive-mind-consensus](./hive-mind-consensus.md)
+- [hive-mind-memory](./hive-mind-memory.md)
+- [hive-mind-metrics](./hive-mind-metrics.md)
+- [hive-mind-wizard](./hive-mind-wizard.md)
diff --git a/.claude/commands/hive-mind/hive-mind-consensus.md b/.claude/commands/hive-mind/hive-mind-consensus.md
new file mode 100644
index 0000000000..846cbe371f
--- /dev/null
+++ b/.claude/commands/hive-mind/hive-mind-consensus.md
@@ -0,0 +1,8 @@
+# hive-mind-consensus
+
+Command documentation for hive-mind-consensus in category hive-mind.
+
+Usage:
+```bash
+npx claude-flow hive-mind hive-mind-consensus [options]
+```
diff --git a/.claude/commands/hive-mind/hive-mind-init.md b/.claude/commands/hive-mind/hive-mind-init.md
new file mode 100644
index 0000000000..cdf319c030
--- /dev/null
+++ b/.claude/commands/hive-mind/hive-mind-init.md
@@ -0,0 +1,18 @@
+# hive-mind-init
+
+Initialize the Hive Mind collective intelligence system.
+
+## Usage
+```bash
+npx claude-flow hive-mind init [options]
+```
+
+## Options
+- `--force` - Force reinitialize
+- `--config <file>` - Configuration file
+
+## Examples
+```bash
+npx claude-flow hive-mind init
+npx claude-flow hive-mind init --force
+```
diff --git a/.claude/commands/hive-mind/hive-mind-memory.md b/.claude/commands/hive-mind/hive-mind-memory.md
new file mode 100644
index 0000000000..d4c926394d
--- /dev/null
+++ b/.claude/commands/hive-mind/hive-mind-memory.md
@@ -0,0 +1,8 @@
+# hive-mind-memory
+
+Command documentation for hive-mind-memory in category hive-mind.
+
+Usage:
+```bash
+npx claude-flow hive-mind hive-mind-memory [options]
+```
diff --git a/.claude/commands/hive-mind/hive-mind-metrics.md b/.claude/commands/hive-mind/hive-mind-metrics.md
new file mode 100644
index 0000000000..7c83ddb666
--- /dev/null
+++ b/.claude/commands/hive-mind/hive-mind-metrics.md
@@ -0,0 +1,8 @@
+# hive-mind-metrics
+
+Command documentation for hive-mind-metrics in category hive-mind.
+
+Usage:
+```bash
+npx claude-flow hive-mind hive-mind-metrics [options]
+```
diff --git a/.claude/commands/hive-mind/hive-mind-resume.md b/.claude/commands/hive-mind/hive-mind-resume.md
new file mode 100644
index 0000000000..999c924c70
--- /dev/null
+++ b/.claude/commands/hive-mind/hive-mind-resume.md
@@ -0,0 +1,8 @@
+# hive-mind-resume
+
+Command documentation for hive-mind-resume in category hive-mind.
+
+Usage:
+```bash
+npx claude-flow hive-mind hive-mind-resume [options]
+```
diff --git a/.claude/commands/hive-mind/hive-mind-sessions.md b/.claude/commands/hive-mind/hive-mind-sessions.md
new file mode 100644
index 0000000000..d0e2ea6797
--- /dev/null
+++ b/.claude/commands/hive-mind/hive-mind-sessions.md
@@ -0,0 +1,8 @@
+# hive-mind-sessions
+
+Command documentation for hive-mind-sessions in category hive-mind.
+
+Usage:
+```bash
+npx claude-flow hive-mind hive-mind-sessions [options]
+```
diff --git a/.claude/commands/hive-mind/hive-mind-spawn.md b/.claude/commands/hive-mind/hive-mind-spawn.md
new file mode 100644
index 0000000000..a3bded7dff
--- /dev/null
+++ b/.claude/commands/hive-mind/hive-mind-spawn.md
@@ -0,0 +1,21 @@
+# hive-mind-spawn
+
+Spawn a Hive Mind swarm with queen-led coordination.
+
+## Usage
+```bash
+npx claude-flow hive-mind spawn <objective> [options]
+```
+
+## Options
+- `--queen-type <type>` - Queen type (strategic, tactical, adaptive)
+- `--max-workers <n>` - Maximum worker agents
+- `--consensus <type>` - Consensus algorithm
+- `--claude` - Generate Claude Code spawn commands
+
+## Examples
+```bash
+npx claude-flow hive-mind spawn "Build API"
+npx claude-flow hive-mind spawn "Research patterns" --queen-type adaptive
+npx claude-flow hive-mind spawn "Build service" --claude
+```
diff --git a/.claude/commands/hive-mind/hive-mind-status.md b/.claude/commands/hive-mind/hive-mind-status.md
new file mode 100644
index 0000000000..77853e139c
--- /dev/null
+++ b/.claude/commands/hive-mind/hive-mind-status.md
@@ -0,0 +1,8 @@
+# hive-mind-status
+
+Command documentation for hive-mind-status in category hive-mind.
+
+Usage:
+```bash
+npx claude-flow hive-mind hive-mind-status [options]
+```
diff --git a/.claude/commands/hive-mind/hive-mind-stop.md b/.claude/commands/hive-mind/hive-mind-stop.md
new file mode 100644
index 0000000000..d34d01f273
--- /dev/null
+++ b/.claude/commands/hive-mind/hive-mind-stop.md
@@ -0,0 +1,8 @@
+# hive-mind-stop
+
+Command documentation for hive-mind-stop in category hive-mind.
+
+Usage:
+```bash
+npx claude-flow hive-mind hive-mind-stop [options]
+```
diff --git a/.claude/commands/hive-mind/hive-mind-wizard.md b/.claude/commands/hive-mind/hive-mind-wizard.md
new file mode 100644
index 0000000000..af47456256
--- /dev/null
+++ b/.claude/commands/hive-mind/hive-mind-wizard.md
@@ -0,0 +1,8 @@
+# hive-mind-wizard
+
+Command documentation for hive-mind-wizard in category hive-mind.
+
+Usage:
+```bash
+npx claude-flow hive-mind hive-mind-wizard [options]
+```
diff --git a/.claude/commands/hive-mind/hive-mind.md b/.claude/commands/hive-mind/hive-mind.md
new file mode 100644
index 0000000000..1a860e32fa
--- /dev/null
+++ b/.claude/commands/hive-mind/hive-mind.md
@@ -0,0 +1,27 @@
+# hive-mind
+
+Hive Mind collective intelligence system for advanced swarm coordination.
+
+## Usage
+```bash
+npx claude-flow hive-mind [subcommand] [options]
+```
+
+## Subcommands
+- `init` - Initialize hive mind system
+- `spawn` - Spawn hive mind swarm
+- `status` - Show hive mind status
+- `resume` - Resume paused session
+- `stop` - Stop running session
+
+## Examples
+```bash
+# Initialize hive mind
+npx claude-flow hive-mind init
+
+# Spawn swarm
+npx claude-flow hive-mind spawn "Build microservices"
+
+# Check status
+npx claude-flow hive-mind status
+```
diff --git a/.claude/commands/swarm/README.md b/.claude/commands/swarm/README.md
new file mode 100644
index 0000000000..cb6d557d2e
--- /dev/null
+++ b/.claude/commands/swarm/README.md
@@ -0,0 +1,15 @@
+# Swarm Commands
+
+Commands for swarm operations in Claude Flow.
+
+## Available Commands
+
+- [swarm](./swarm.md)
+- [swarm-init](./swarm-init.md)
+- [swarm-spawn](./swarm-spawn.md)
+- [swarm-status](./swarm-status.md)
+- [swarm-monitor](./swarm-monitor.md)
+- [swarm-strategies](./swarm-strategies.md)
+- [swarm-modes](./swarm-modes.md)
+- [swarm-background](./swarm-background.md)
+- [swarm-analysis](./swarm-analysis.md)
diff --git a/.claude/commands/swarm/swarm-analysis.md b/.claude/commands/swarm/swarm-analysis.md
new file mode 100644
index 0000000000..1168d1b181
--- /dev/null
+++ b/.claude/commands/swarm/swarm-analysis.md
@@ -0,0 +1,8 @@
+# swarm-analysis
+
+Command documentation for swarm-analysis in category swarm.
+
+Usage:
+```bash
+npx claude-flow swarm swarm-analysis [options]
+```
diff --git a/.claude/commands/swarm/swarm-background.md b/.claude/commands/swarm/swarm-background.md
new file mode 100644
index 0000000000..055330c839
--- /dev/null
+++ b/.claude/commands/swarm/swarm-background.md
@@ -0,0 +1,8 @@
+# swarm-background
+
+Command documentation for swarm-background in category swarm.
+
+Usage:
+```bash
+npx claude-flow swarm swarm-background [options]
+```
diff --git a/.claude/commands/swarm/swarm-init.md b/.claude/commands/swarm/swarm-init.md
new file mode 100644
index 0000000000..1644941666
--- /dev/null
+++ b/.claude/commands/swarm/swarm-init.md
@@ -0,0 +1,19 @@
+# swarm-init
+
+Initialize a new swarm with specified topology.
+
+## Usage
+```bash
+npx claude-flow swarm init [options]
+```
+
+## Options
+- `--topology <type>` - Swarm topology (mesh, hierarchical, ring, star)
+- `--max-agents <n>` - Maximum agents
+- `--strategy <type>` - Distribution strategy
+
+## Examples
+```bash
+npx claude-flow swarm init --topology mesh
+npx claude-flow swarm init --topology hierarchical --max-agents 8
+```
diff --git a/.claude/commands/swarm/swarm-modes.md b/.claude/commands/swarm/swarm-modes.md
new file mode 100644
index 0000000000..1818013d75
--- /dev/null
+++ b/.claude/commands/swarm/swarm-modes.md
@@ -0,0 +1,8 @@
+# swarm-modes
+
+Command documentation for swarm-modes in category swarm.
+
+Usage:
+```bash
+npx claude-flow swarm swarm-modes [options]
+```
diff --git a/.claude/commands/swarm/swarm-monitor.md b/.claude/commands/swarm/swarm-monitor.md
new file mode 100644
index 0000000000..8c526bdc4d
--- /dev/null
+++ b/.claude/commands/swarm/swarm-monitor.md
@@ -0,0 +1,8 @@
+# swarm-monitor
+
+Command documentation for swarm-monitor in category swarm.
+
+Usage:
+```bash
+npx claude-flow swarm swarm-monitor [options]
+```
diff --git a/.claude/commands/swarm/swarm-spawn.md b/.claude/commands/swarm/swarm-spawn.md
new file mode 100644
index 0000000000..b10ece8b06
--- /dev/null
+++ b/.claude/commands/swarm/swarm-spawn.md
@@ -0,0 +1,19 @@
+# swarm-spawn
+
+Spawn agents in the swarm.
+
+## Usage
+```bash
+npx claude-flow swarm spawn [options]
+```
+
+## Options
+- `--type <type>` - Agent type
+- `--count <n>` - Number to spawn
+- `--capabilities <list>` - Agent capabilities
+
+## Examples
+```bash
+npx claude-flow swarm spawn --type coder --count 3
+npx claude-flow swarm spawn --type researcher --capabilities "web-search,analysis"
+```
diff --git a/.claude/commands/swarm/swarm-status.md b/.claude/commands/swarm/swarm-status.md
new file mode 100644
index 0000000000..20fadfb8c5
--- /dev/null
+++ b/.claude/commands/swarm/swarm-status.md
@@ -0,0 +1,8 @@
+# swarm-status
+
+Command documentation for swarm-status in category swarm.
+
+Usage:
+```bash
+npx claude-flow swarm swarm-status [options]
+```
diff --git a/.claude/commands/swarm/swarm-strategies.md b/.claude/commands/swarm/swarm-strategies.md
new file mode 100644
index 0000000000..3712a909a9
--- /dev/null
+++ b/.claude/commands/swarm/swarm-strategies.md
@@ -0,0 +1,8 @@
+# swarm-strategies
+
+Command documentation for swarm-strategies in category swarm.
+
+Usage:
+```bash
+npx claude-flow swarm swarm-strategies [options]
+```
diff --git a/.claude/commands/swarm/swarm.md b/.claude/commands/swarm/swarm.md
new file mode 100644
index 0000000000..48b69378cf
--- /dev/null
+++ b/.claude/commands/swarm/swarm.md
@@ -0,0 +1,27 @@
+# swarm
+
+Main swarm orchestration command for Claude Flow.
+
+## Usage
+```bash
+npx claude-flow swarm <objective> [options]
+```
+
+## Options
+- `--strategy <type>` - Execution strategy (research, development, analysis, testing)
+- `--mode <type>` - Coordination mode (centralized, distributed, hierarchical, mesh)
+- `--max-agents <n>` - Maximum number of agents (default: 5)
+- `--claude` - Open Claude Code CLI with swarm prompt
+- `--parallel` - Enable parallel execution
+
+## Examples
+```bash
+# Basic swarm
+npx claude-flow swarm "Build REST API"
+
+# With strategy
+npx claude-flow swarm "Research AI patterns" --strategy research
+
+# Open in Claude Code
+npx claude-flow swarm "Build API" --claude
+```
diff --git a/.claude/helpers/checkpoint-manager.sh b/.claude/helpers/checkpoint-manager.sh
index 15c4b5fccb..23482ac70c 100755
--- a/.claude/helpers/checkpoint-manager.sh
+++ b/.claude/helpers/checkpoint-manager.sh
@@ -1,3 +1,251 @@
#!/bin/bash
-# Checkpoint manager for Claude Flow
-# Use github-checkpoint-hooks.sh for checkpoint operations
+# Claude Checkpoint Manager
+# Provides easy rollback and management of Claude Code checkpoints
+
+set -e
+
+# Colors
+RED='\033[0;31m'
+GREEN='\033[0;32m'
+YELLOW='\033[1;33m'
+BLUE='\033[0;34m'
+NC='\033[0m' # No Color
+
+# Configuration
+CHECKPOINT_DIR=".claude/checkpoints"
+BACKUP_DIR=".claude/backups"
+
+# Help function
+show_help() {
+ cat << EOF
+Claude Checkpoint Manager
+========================
+
+Usage: $0 <command> [options]
+
+Commands:
+ list List all checkpoints
+ show <id> Show details of a specific checkpoint
+ rollback <id> Rollback to a specific checkpoint
+ diff <id> Show diff since checkpoint
+ clean Clean old checkpoints (older than 7 days)
+ summary Show session summary
+
+Options:
+ --hard For rollback: use git reset --hard (destructive)
+ --soft For rollback: use git reset --soft (default)
+ --branch For rollback: create new branch from checkpoint
+
+Examples:
+ $0 list
+ $0 show checkpoint-20240130-143022
+ $0 rollback checkpoint-20240130-143022 --branch
+ $0 diff session-end-session-20240130-150000
+EOF
+}
+
+# List all checkpoints
+function list_checkpoints() {
+ echo -e "${BLUE}πŸ“‹ Available Checkpoints:${NC}"
+ echo ""
+
+ # List checkpoint tags
+ echo -e "${YELLOW}Git Tags:${NC}"
+ local tags=$(git tag -l 'checkpoint-*' -l 'session-end-*' -l 'task-*' --sort=-creatordate | head -20)
+ if [ -n "$tags" ]; then
+ echo "$tags"
+ else
+ echo "No checkpoint tags found"
+ fi
+
+ echo ""
+
+ # List checkpoint branches
+ echo -e "${YELLOW}Checkpoint Branches:${NC}"
+ local branches=$(git branch -a | grep "checkpoint/" | sed 's/^[ *]*//')
+ if [ -n "$branches" ]; then
+ echo "$branches"
+ else
+ echo "No checkpoint branches found"
+ fi
+
+ echo ""
+
+ # List checkpoint files
+ if [ -d "$CHECKPOINT_DIR" ]; then
+ echo -e "${YELLOW}Recent Checkpoint Files:${NC}"
+ find "$CHECKPOINT_DIR" -name "*.json" -type f -printf "%T@ %p\n" | \
+ sort -rn | head -10 | cut -d' ' -f2- | xargs -I {} basename {}
+ fi
+}
+
+# Show checkpoint details
+function show_checkpoint() {
+ local checkpoint_id="$1"
+
+ echo -e "${BLUE}πŸ“ Checkpoint Details: $checkpoint_id${NC}"
+ echo ""
+
+ # Check if it's a tag
+ if git tag -l "$checkpoint_id" | grep -q "$checkpoint_id"; then
+ echo -e "${YELLOW}Type:${NC} Git Tag"
+ echo -e "${YELLOW}Commit:${NC} $(git rev-list -n 1 "$checkpoint_id")"
+ echo -e "${YELLOW}Date:${NC} $(git log -1 --format=%ai "$checkpoint_id")"
+ echo -e "${YELLOW}Message:${NC}"
+ git log -1 --format=%B "$checkpoint_id" | sed 's/^/ /'
+ echo ""
+ echo -e "${YELLOW}Files changed:${NC}"
+ git diff-tree --no-commit-id --name-status -r "$checkpoint_id" | sed 's/^/ /'
+ # Check if it's a branch
+ elif git branch -a | grep -q "$checkpoint_id"; then
+ echo -e "${YELLOW}Type:${NC} Git Branch"
+ echo -e "${YELLOW}Latest commit:${NC}"
+ git log -1 --oneline "$checkpoint_id"
+ else
+ echo -e "${RED}❌ Checkpoint not found: $checkpoint_id${NC}"
+ exit 1
+ fi
+}
+
+# Rollback to checkpoint
+function rollback_checkpoint() {
+ local checkpoint_id="$1"
+ local mode="$2"
+
+ echo -e "${YELLOW}πŸ”„ Rolling back to checkpoint: $checkpoint_id${NC}"
+ echo ""
+
+ # Verify checkpoint exists
+ if ! git tag -l "$checkpoint_id" | grep -q "$checkpoint_id" && \
+ ! git branch -a | grep -q "$checkpoint_id"; then
+ echo -e "${RED}❌ Checkpoint not found: $checkpoint_id${NC}"
+ exit 1
+ fi
+
+ # Create backup before rollback
+ local backup_name="backup-$(date +%Y%m%d-%H%M%S)"
+ echo "Creating backup: $backup_name"
+ git tag "$backup_name" -m "Backup before rollback to $checkpoint_id"
+
+ case "$mode" in
+ "--hard")
+ echo -e "${RED}⚠️ Performing hard reset (destructive)${NC}"
+ git reset --hard "$checkpoint_id"
+ echo -e "${GREEN}βœ… Rolled back to $checkpoint_id (hard reset)${NC}"
+ ;;
+ "--branch")
+ local branch_name="rollback-$checkpoint_id-$(date +%Y%m%d-%H%M%S)"
+ echo "Creating new branch: $branch_name"
+ git checkout -b "$branch_name" "$checkpoint_id"
+ echo -e "${GREEN}βœ… Created branch $branch_name from $checkpoint_id${NC}"
+ ;;
+ "--stash"|*)
+ echo "Stashing current changes..."
+ git stash push -m "Stash before rollback to $checkpoint_id"
+ git reset --soft "$checkpoint_id"
+ echo -e "${GREEN}βœ… Rolled back to $checkpoint_id (soft reset)${NC}"
+ echo "Your changes are stashed. Use 'git stash pop' to restore them."
+ ;;
+ esac
+}
+
+# Show diff since checkpoint
+function diff_checkpoint() {
+ local checkpoint_id="$1"
+
+ echo -e "${BLUE}πŸ“Š Changes since checkpoint: $checkpoint_id${NC}"
+ echo ""
+
+ if git tag -l "$checkpoint_id" | grep -q "$checkpoint_id"; then
+ git diff "$checkpoint_id"
+ elif git branch -a | grep -q "$checkpoint_id"; then
+ git diff "$checkpoint_id"
+ else
+ echo -e "${RED}❌ Checkpoint not found: $checkpoint_id${NC}"
+ exit 1
+ fi
+}
+
+# Clean old checkpoints
+function clean_checkpoints() {
+ local days=${1:-7}
+
+ echo -e "${YELLOW}🧹 Cleaning checkpoints older than $days days...${NC}"
+ echo ""
+
+ # Clean old checkpoint files
+ if [ -d "$CHECKPOINT_DIR" ]; then
+ find "$CHECKPOINT_DIR" -name "*.json" -type f -mtime +$days -delete
+ echo "βœ… Cleaned old checkpoint files"
+ fi
+
+ # List old tags (but don't delete automatically)
+ echo ""
+ echo "Old checkpoint tags (manual deletion required):"
+ git tag -l 'checkpoint-*' --sort=-creatordate | tail -n +50 || echo "No old tags found"
+}
+
+# Show session summary
+function show_summary() {
+ echo -e "${BLUE}πŸ“Š Session Summary${NC}"
+ echo ""
+
+ # Find most recent session summary
+ if [ -d "$CHECKPOINT_DIR" ]; then
+ local latest_summary=$(find "$CHECKPOINT_DIR" -name "summary-*.md" -type f -printf "%T@ %p\n" | \
+ sort -rn | head -1 | cut -d' ' -f2-)
+
+ if [ -n "$latest_summary" ]; then
+ echo -e "${YELLOW}Latest session summary:${NC}"
+ cat "$latest_summary"
+ else
+ echo "No session summaries found"
+ fi
+ fi
+}
+
+# Main command handling
+case "$1" in
+ list)
+ list_checkpoints
+ ;;
+ show)
+ if [ -z "$2" ]; then
+ echo -e "${RED}Error: Please specify a checkpoint ID${NC}"
+ show_help
+ exit 1
+ fi
+ show_checkpoint "$2"
+ ;;
+ rollback)
+ if [ -z "$2" ]; then
+ echo -e "${RED}Error: Please specify a checkpoint ID${NC}"
+ show_help
+ exit 1
+ fi
+ rollback_checkpoint "$2" "$3"
+ ;;
+ diff)
+ if [ -z "$2" ]; then
+ echo -e "${RED}Error: Please specify a checkpoint ID${NC}"
+ show_help
+ exit 1
+ fi
+ diff_checkpoint "$2"
+ ;;
+ clean)
+ clean_checkpoints "$2"
+ ;;
+ summary)
+ show_summary
+ ;;
+ help|--help|-h)
+ show_help
+ ;;
+ *)
+ echo -e "${RED}Error: Unknown command: $1${NC}"
+ echo ""
+ show_help
+ exit 1
+ ;;
+esac
diff --git a/.claude/settings.json b/.claude/settings.json
index f599e31658..f7e0b02678 100644
--- a/.claude/settings.json
+++ b/.claude/settings.json
@@ -5,9 +5,7 @@
"CLAUDE_FLOW_HOOKS_ENABLED": "true",
"CLAUDE_FLOW_TELEMETRY_ENABLED": "true",
"CLAUDE_FLOW_REMOTE_EXECUTION": "true",
- "CLAUDE_FLOW_GITHUB_INTEGRATION": "true",
- "CLAUDE_FLOW_CHECKPOINTS_ENABLED": "true",
- "CREATE_GH_RELEASE": "true"
+ "CLAUDE_FLOW_CHECKPOINTS_ENABLED": "true"
},
"permissions": {
"allow": [
@@ -26,28 +24,11 @@
"Bash(git branch *)",
"Bash(git checkout *)",
"Bash(git stash *)",
- "Bash(git reset *)",
- "Bash(git rev-parse *)",
- "Bash(git ls-files *)",
- "Bash(gh *)",
+ "Bash(jq *)",
"Bash(node *)",
"Bash(which *)",
"Bash(pwd)",
- "Bash(ls *)",
- "Bash(jq *)",
- "Bash(test *)",
- "Bash(find *)",
- "Bash(grep *)",
- "Bash(sed *)",
- "Bash(awk *)",
- "Bash(curl *)",
- "Bash(mkdir *)",
- "Bash(cd *)",
- "Bash(cat *)",
- "Bash(echo *)",
- "Bash(npx claude-flow@alpha *)",
- "Bash(./claude-flow *)",
- "Bash(./.claude/helpers/*)"
+ "Bash(ls *)"
],
"deny": [
"Bash(rm -rf /)",
@@ -73,10 +54,6 @@
{
"type": "command",
"command": "cat | jq -r '.tool_input.file_path // .tool_input.path // empty' | tr '\\n' '\\0' | xargs -0 -I {} npx claude-flow@alpha hooks pre-edit --file '{}' --auto-assign-agents true --load-context true"
- },
- {
- "type": "command",
- "command": "/bin/bash -c 'FILE=$(cat | jq -r \".tool_input.file_path // .tool_input.path // empty\"); if [ -n \"$FILE\" ]; then CHECKPOINT_BRANCH=\"checkpoint/pre-edit-$(date +%Y%m%d-%H%M%S)\"; git add -A && git stash push -m \"Pre-edit checkpoint for $FILE\" >/dev/null 2>&1 && git branch \"$CHECKPOINT_BRANCH\" && mkdir -p .claude/checkpoints && echo \"{\\\"branch\\\": \\\"$CHECKPOINT_BRANCH\\\", \\\"file\\\": \\\"$FILE\\\", \\\"timestamp\\\": \\\"$(date -u +%Y-%m-%dT%H:%M:%SZ)\\\", \\\"type\\\": \\\"pre-edit\\\", \\\"original_branch\\\": \\\"$(git branch --show-current)\\\"}\" > \".claude/checkpoints/$(date +%s).json\" && git stash pop --quiet >/dev/null 2>&1 || true && echo \"βœ… Created checkpoint: $CHECKPOINT_BRANCH for $FILE\"; fi'"
}
]
}
@@ -97,66 +74,41 @@
{
"type": "command",
"command": "cat | jq -r '.tool_input.file_path // .tool_input.path // empty' | tr '\\n' '\\0' | xargs -0 -I {} npx claude-flow@alpha hooks post-edit --file '{}' --format true --update-memory true"
- },
- {
- "type": "command",
- "command": "/bin/bash -c 'FILE=$(cat | jq -r \".tool_input.file_path // .tool_input.path // empty\"); if [ -n \"$FILE\" ] && [ -f \"$FILE\" ]; then if ! git ls-files --error-unmatch \"$FILE\" >/dev/null 2>&1; then git add \"$FILE\"; fi; if ! (git diff --cached --quiet \"$FILE\" 2>/dev/null && git diff --quiet \"$FILE\" 2>/dev/null); then TAG_NAME=\"checkpoint-$(date +%Y%m%d-%H%M%S)\"; BRANCH=$(git branch --show-current); git add \"$FILE\" && git commit -m \"πŸ”– Checkpoint: Edit $FILE\" --quiet && git tag -a \"$TAG_NAME\" -m \"Checkpoint after editing $FILE\" && mkdir -p .claude/checkpoints && DIFF_STATS=$(git diff HEAD~1 --stat | tr \"\\n\" \" \" | sed \"s/\\\"/\\\\\\\\\\\"/g\") && echo \"{\\\"tag\\\": \\\"$TAG_NAME\\\", \\\"file\\\": \\\"$FILE\\\", \\\"timestamp\\\": \\\"$(date -u +%Y-%m-%dT%H:%M:%SZ)\\\", \\\"type\\\": \\\"post-edit\\\", \\\"branch\\\": \\\"$BRANCH\\\", \\\"diff_summary\\\": \\\"$DIFF_STATS\\\"}\" > \".claude/checkpoints/$(date +%s).json\" && echo \"βœ… Created checkpoint: $TAG_NAME for $FILE\"; else echo \"ℹ️ No changes to checkpoint for $FILE\"; fi; fi'"
}
]
}
],
- "UserPromptSubmit": [
+ "PreCompact": [
{
+ "matcher": "manual",
"hooks": [
{
"type": "command",
- "command": "/bin/bash -c 'INPUT=$(cat); TASK=$(echo \"$INPUT\" | jq -r \".prompt // empty\" 2>/dev/null | head -c 100 | tr \"\\n\" \" \"); if [ -z \"$TASK\" ]; then TASK=\"Task checkpoint\"; fi; if [ -n \"$TASK\" ]; then CHECKPOINT_NAME=\"task-$(date +%Y%m%d-%H%M%S)\"; git add -A && git commit -m \"πŸ”– Task: $TASK...\" --quiet || true; if command -v gh &> /dev/null; then echo \"πŸš€ Creating GitHub release for checkpoint...\"; gh release create \"$CHECKPOINT_NAME\" --title \"Checkpoint: $(date +\"%Y-%m-%d %H:%M\")\" --notes \"Task: $TASK\n\n## Checkpoint Details\n- Branch: $(git branch --show-current)\n- Commit: $(git rev-parse HEAD)\n- Files changed: $(git diff HEAD~1 --stat 2>/dev/null | wc -l || echo 0) files\n\n## Rollback Instructions\n\\`\\`\\`bash\n# To rollback to this checkpoint:\ngit checkout $CHECKPOINT_NAME\n\\`\\`\\`\" --prerelease || echo \"⚠️ Failed to create GitHub release\"; fi; mkdir -p .claude/checkpoints && echo \"{\\\"checkpoint\\\": \\\"$CHECKPOINT_NAME\\\", \\\"task\\\": \\\"$TASK\\\", \\\"timestamp\\\": \\\"$(date -u +%Y-%m-%dT%H:%M:%SZ)\\\", \\\"commit\\\": \\\"$(git rev-parse HEAD)\\\", \\\"github_release\\\": \\\"$(command -v gh &> /dev/null && echo true || echo false)\\\"}\" > \".claude/checkpoints/task-$(date +%s).json\" && echo \"βœ… Created task checkpoint: $CHECKPOINT_NAME\"; fi'"
+ "command": "/bin/bash -c 'INPUT=$(cat); CUSTOM=$(echo \"$INPUT\" | jq -r \".custom_instructions // \\\"\\\"\"); echo \"πŸ”„ PreCompact Guidance:\"; echo \"πŸ“‹ IMPORTANT: Review CLAUDE.md in project root for:\"; echo \" β€’ 54 available agents and concurrent usage patterns\"; echo \" β€’ Swarm coordination strategies (hierarchical, mesh, adaptive)\"; echo \" β€’ SPARC methodology workflows with batchtools optimization\"; echo \" β€’ Critical concurrent execution rules (GOLDEN RULE: 1 MESSAGE = ALL OPERATIONS)\"; if [ -n \"$CUSTOM\" ]; then echo \"🎯 Custom compact instructions: $CUSTOM\"; fi; echo \"βœ… Ready for compact operation\"'"
}
]
- }
- ],
- "Stop": [
+ },
{
+ "matcher": "auto",
"hooks": [
{
"type": "command",
- "command": "npx claude-flow@alpha hooks session-end --generate-summary true --persist-state true --export-metrics true"
- },
- {
- "type": "command",
- "command": "/bin/bash -c 'SESSION_ID=\"session-$(date +%Y%m%d-%H%M%S)\"; SUMMARY_FILE=\".claude/checkpoints/summary-$SESSION_ID.md\"; mkdir -p .claude/checkpoints && echo \"# Session Summary - $(date +\"%Y-%m-%d %H:%M:%S\")\n\n## Checkpoints Created\n$(find .claude/checkpoints -name \"*.json\" -mtime -1 -exec basename {} \\; | sort)\n\n## Files Modified\n$(git diff --name-only $(git log --format=%H -n 1 --before=\"1 hour ago\" 2>/dev/null) 2>/dev/null || echo \"No files tracked\")\n\n## Recent Commits\n$(git log --oneline -10 --grep=\"Checkpoint\" || echo \"No checkpoint commits\")\n\n## GitHub Releases Created\n$(gh release list --limit 10 | grep \"checkpoint-\" || echo \"No GitHub releases\")\n\n## Rollback Instructions\nTo rollback to a specific checkpoint:\n\\`\\`\\`bash\n# List all checkpoints\ngit tag -l \"checkpoint-*\" | sort -r\n\n# List GitHub releases\ngh release list\n\n# Rollback to a checkpoint\ngit checkout checkpoint-YYYYMMDD-HHMMSS\n\\`\\`\\`\" > \"$SUMMARY_FILE\" && git add -A && git commit -m \"🏁 Session end checkpoint: $SESSION_ID\" --quiet || true && git tag -a \"session-end-$SESSION_ID\" -m \"End of Claude session\" && if command -v gh &> /dev/null; then echo \"πŸ“Š Creating GitHub session summary...\"; gh release create \"session-$SESSION_ID\" --title \"Session Summary: $(date +\"%Y-%m-%d %H:%M\")\" --notes-file \"$SUMMARY_FILE\" --prerelease || echo \"⚠️ Failed to create GitHub session summary\"; fi && echo \"βœ… Session summary saved to: $SUMMARY_FILE\" && echo \"πŸ“Œ Final checkpoint: session-end-$SESSION_ID\"'"
+ "command": "/bin/bash -c 'echo \"πŸ”„ Auto-Compact Guidance (Context Window Full):\"; echo \"πŸ“‹ CRITICAL: Before compacting, ensure you understand:\"; echo \" β€’ All 54 agents available in .claude/agents/ directory\"; echo \" β€’ Concurrent execution patterns from CLAUDE.md\"; echo \" β€’ Batchtools optimization for 300% performance gains\"; echo \" β€’ Swarm coordination strategies for complex tasks\"; echo \"⚑ Apply GOLDEN RULE: Always batch operations in single messages\"; echo \"βœ… Auto-compact proceeding with full agent context\"'"
}
]
}
],
- "PreCompact": [
- {
- "matcher": "manual",
- "hooks": [
- {
- "type": "command",
- "command": "/bin/bash -c 'INPUT=$(cat); CUSTOM=$(echo \"$INPUT\" | jq -r \".custom_instructions // \"\"\"); echo \"πŸ”„ PreCompact Guidance:\"; echo \"πŸ“‹ IMPORTANT: Review CLAUDE.md in project root for:\"; echo \" β€’ 54 available agents and concurrent usage patterns\"; echo \" β€’ Swarm coordination strategies (hierarchical, mesh, adaptive)\"; echo \" β€’ SPARC methodology workflows with batchtools optimization\"; echo \" β€’ Critical concurrent execution rules (GOLDEN RULE: 1 MESSAGE = ALL OPERATIONS)\"; if [ -n \"$CUSTOM\" ]; then echo \"🎯 Custom compact instructions: $CUSTOM\"; fi; echo \"βœ… Ready for compact operation\"'"
- }
- ]
- },
+ "Stop": [
{
- "matcher": "auto",
"hooks": [
{
"type": "command",
- "command": "/bin/bash -c 'echo \"πŸ”„ Auto-Compact Guidance (Context Window Full):\"; echo \"πŸ“‹ CRITICAL: Before compacting, ensure you understand:\"; echo \" β€’ All 54 agents available in .claude/agents/ directory\"; echo \" β€’ Concurrent execution patterns from CLAUDE.md\"; echo \" β€’ Batchtools optimization for 300% performance gains\"; echo \" β€’ Swarm coordination strategies for complex tasks\"; echo \"⚑ Apply GOLDEN RULE: Always batch operations in single messages\"; echo \"βœ… Auto-compact proceeding with full agent context\"'"
+ "command": "npx claude-flow@alpha hooks session-end --generate-summary true --persist-state true --export-metrics true"
}
]
}
]
},
- "statusLine": {
- "type": "command",
- "command": "input=$(cat); model_name=$(echo \"$input\" | jq -r '.model.display_name'); current_dir=$(echo \"$input\" | jq -r '.workspace.current_dir'); project_dir=$(echo \"$input\" | jq -r '.workspace.project_dir'); relative_path=$(echo \"${current_dir#$project_dir}\"); if [ \"$relative_path\" = \"$current_dir\" ]; then display_path=$(basename \"$current_dir\"); else display_path=\"$(basename \"$project_dir\")${relative_path}\"; fi; printf \"$(whoami)@$(hostname -s):${display_path} [${model_name}]\""
- },
"includeCoAuthoredBy": true,
- "enabledMcpjsonServers": [
- "claude-flow",
- "ruv-swarm"
- ]
-}
\ No newline at end of file
+ "enabledMcpjsonServers": ["claude-flow", "ruv-swarm"]
+}
diff --git a/.gitignore b/.gitignore
index d6211fb6c9..d4ac8b3a8f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -109,6 +109,7 @@ test-reports/
+
# Claude Flow generated files
.claude/settings.local.json
.mcp.json
@@ -133,4 +134,3 @@ claude-flow
claude-flow.bat
claude-flow.ps1
hive-mind-prompt-*.txt
-.claude-flow/.claude-flow/metrics/*.json
diff --git a/CLAUDE.md b/CLAUDE.md
index ea9214a1ea..523aeebef5 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -1,259 +1,352 @@
# Claude Code Configuration - SPARC Development Environment
-## 🚨 CRITICAL: Concurrent Execution Rules
+## 🚨 CRITICAL: CONCURRENT EXECUTION & FILE MANAGEMENT
-**ABSOLUTE RULE**: ALL operations MUST be concurrent/parallel in ONE message:
+**ABSOLUTE RULES**:
+1. ALL operations MUST be concurrent/parallel in a single message
+2. **NEVER save working files, text/mds and tests to the root folder**
+3. ALWAYS organize files in appropriate subdirectories
+4. **USE CLAUDE CODE'S TASK TOOL** for spawning agents concurrently, not just MCP
-### πŸ”΄ Mandatory Patterns:
-- **TodoWrite**: ALWAYS batch ALL todos in ONE call (5-10+ minimum)
-- **Task tool**: ALWAYS spawn ALL agents in ONE message
-- **File operations**: ALWAYS batch ALL reads/writes/edits
-- **Bash commands**: ALWAYS batch ALL terminal operations
-- **Memory operations**: ALWAYS batch ALL store/retrieve
+### ⚑ GOLDEN RULE: "1 MESSAGE = ALL RELATED OPERATIONS"
-### ⚑ Golden Rule: "1 MESSAGE = ALL RELATED OPERATIONS"
+**MANDATORY PATTERNS:**
+- **TodoWrite**: ALWAYS batch ALL todos in ONE call (5-10+ todos minimum)
+- **Task tool (Claude Code)**: ALWAYS spawn ALL agents in ONE message with full instructions
+- **File operations**: ALWAYS batch ALL reads/writes/edits in ONE message
+- **Bash commands**: ALWAYS batch ALL terminal operations in ONE message
+- **Memory operations**: ALWAYS batch ALL memory store/retrieve in ONE message
-βœ… **CORRECT**: Everything in ONE message
+### 🎯 CRITICAL: Claude Code Task Tool for Agent Execution
+
+**Claude Code's Task tool is the PRIMARY way to spawn agents:**
```javascript
+// βœ… CORRECT: Use Claude Code's Task tool for parallel agent execution
[Single Message]:
- - TodoWrite { todos: [10+ todos] }
- - Task("Agent 1"), Task("Agent 2"), Task("Agent 3")
- - Read("file1.js"), Read("file2.js")
- - Write("output1.js"), Write("output2.js")
- - Bash("npm install"), Bash("npm test")
+ Task("Research agent", "Analyze requirements and patterns...", "researcher")
+ Task("Coder agent", "Implement core features...", "coder")
+ Task("Tester agent", "Create comprehensive tests...", "tester")
+ Task("Reviewer agent", "Review code quality...", "reviewer")
+ Task("Architect agent", "Design system architecture...", "system-architect")
```
-❌ **WRONG**: Multiple messages (6x slower!)
+**MCP tools are ONLY for coordination setup:**
+- `mcp__claude-flow__swarm_init` - Initialize coordination topology
+- `mcp__claude-flow__agent_spawn` - Define agent types for coordination
+- `mcp__claude-flow__task_orchestrate` - Orchestrate high-level workflows
-## 🎯 Claude Code vs MCP Tools
+### πŸ“ File Organization Rules
-### Claude Code Handles ALL:
-- File operations (Read/Write/Edit/Glob/Grep)
-- Code generation & programming
-- Bash commands & system operations
-- TodoWrite & task management
-- Git operations & package management
-- Testing, debugging & implementation
+**NEVER save to root folder. Use these directories:**
+- `/src` - Source code files
+- `/tests` - Test files
+- `/docs` - Documentation and markdown files
+- `/config` - Configuration files
+- `/scripts` - Utility scripts
+- `/examples` - Example code
-### MCP Tools ONLY:
-- Coordination & planning
-- Memory management
-- Performance tracking
-- Swarm orchestration
-- GitHub integration
+## Project Overview
+
+This project uses SPARC (Specification, Pseudocode, Architecture, Refinement, Completion) methodology with Claude-Flow orchestration for systematic Test-Driven Development.
+
+## SPARC Commands
+
+### Core Commands
+- `npx claude-flow sparc modes` - List available modes
+- `npx claude-flow sparc run <mode> "<task>"` - Execute specific mode
+- `npx claude-flow sparc tdd "<feature>"` - Run complete TDD workflow
+- `npx claude-flow sparc info <mode>` - Get mode details
-**Key**: MCP coordinates, Claude Code executes!
+### Batchtools Commands
+- `npx claude-flow sparc batch <modes> "<task>"` - Parallel execution
+- `npx claude-flow sparc pipeline "<task>"` - Full pipeline processing
+- `npx claude-flow sparc concurrent <mode> "<tasks-file>"` - Multi-task processing
-## πŸ“¦ SPARC Commands
+### Build Commands
+- `npm run build` - Build project
+- `npm run test` - Run tests
+- `npm run lint` - Linting
+- `npm run typecheck` - Type checking
-### Core:
-- `npx claude-flow sparc modes` - List modes
-- `npx claude-flow sparc run <mode> "<task>"` - Execute mode
-- `npx claude-flow sparc tdd "<feature>"` - TDD workflow
-- `npx claude-flow sparc batch <modes> "<task>"` - Parallel modes
-- `npx claude-flow sparc pipeline "<task>"` - Full pipeline
+## SPARC Workflow Phases
-### Build:
-- `npm run build/test/lint/typecheck`
+1. **Specification** - Requirements analysis (`sparc run spec-pseudocode`)
+2. **Pseudocode** - Algorithm design (`sparc run spec-pseudocode`)
+3. **Architecture** - System design (`sparc run architect`)
+4. **Refinement** - TDD implementation (`sparc tdd`)
+5. **Completion** - Integration (`sparc run integration`)
-## πŸ€– Agent Reference (54 Total)
+## Code Style & Best Practices
+
+- **Modular Design**: Files under 500 lines
+- **Environment Safety**: Never hardcode secrets
+- **Test-First**: Write tests before implementation
+- **Clean Architecture**: Separate concerns
+- **Documentation**: Keep updated
+
+## πŸš€ Available Agents (54 Total)
### Core Development
-| Agent | Purpose |
-|-------|---------|
-| coder | Implementation |
-| reviewer | Code quality |
-| tester | Test creation |
-| planner | Strategic planning |
-| researcher | Information gathering |
+`coder`, `reviewer`, `tester`, `planner`, `researcher`
### Swarm Coordination
-| Agent | Purpose |
-|-------|---------|
-| hierarchical-coordinator | Queen-led |
-| mesh-coordinator | Peer-to-peer |
-| adaptive-coordinator | Dynamic topology |
-| collective-intelligence-coordinator | Hive-mind |
-| swarm-memory-manager | Distributed memory |
-
-### Specialized
-| Agent | Purpose |
-|-------|---------|
-| backend-dev | API development |
-| mobile-dev | React Native |
-| ml-developer | Machine learning |
-| system-architect | High-level design |
-| sparc-coder | TDD implementation |
-| production-validator | Real validation |
+`hierarchical-coordinator`, `mesh-coordinator`, `adaptive-coordinator`, `collective-intelligence-coordinator`, `swarm-memory-manager`
-### GitHub Integration
-| Agent | Purpose |
-|-------|---------|
-| github-modes | Comprehensive integration |
-| pr-manager | Pull requests |
-| code-review-swarm | Multi-agent review |
-| issue-tracker | Issue management |
-| release-manager | Release coordination |
-
-### Performance & Consensus
-| Agent | Purpose |
-|-------|---------|
-| perf-analyzer | Bottleneck identification |
-| performance-benchmarker | Performance testing |
-| byzantine-coordinator | Fault tolerance |
-| raft-manager | Leader election |
-| consensus-builder | Decision-making |
-
-## πŸš€ Swarm Patterns
-
-### Full-Stack Swarm (8 agents)
-```bash
-Task("Architecture", "...", "system-architect")
-Task("Backend", "...", "backend-dev")
-Task("Frontend", "...", "mobile-dev")
-Task("Database", "...", "coder")
-Task("API Docs", "...", "api-docs")
-Task("CI/CD", "...", "cicd-engineer")
-Task("Testing", "...", "performance-benchmarker")
-Task("Validation", "...", "production-validator")
-```
+### Consensus & Distributed
+`byzantine-coordinator`, `raft-manager`, `gossip-coordinator`, `consensus-builder`, `crdt-synchronizer`, `quorum-manager`, `security-manager`
-### Agent Count Rules
-1. **CLI Args First**: `npx claude-flow@alpha --agents 5`
-2. **Auto-Decide**: Simple (3-4), Medium (5-7), Complex (8-12)
+### Performance & Optimization
+`perf-analyzer`, `performance-benchmarker`, `task-orchestrator`, `memory-coordinator`, `smart-agent`
-## πŸ“‹ Agent Coordination Protocol
+### GitHub & Repository
+`github-modes`, `pr-manager`, `code-review-swarm`, `issue-tracker`, `release-manager`, `workflow-automation`, `project-board-sync`, `repo-architect`, `multi-repo-swarm`
-### Every Agent MUST:
+### SPARC Methodology
+`sparc-coord`, `sparc-coder`, `specification`, `pseudocode`, `architecture`, `refinement`
-**1️⃣ START:**
-```bash
-npx claude-flow@alpha hooks pre-task --description "[task]"
-npx claude-flow@alpha hooks session-restore --session-id "swarm-[id]"
-```
+### Specialized Development
+`backend-dev`, `mobile-dev`, `ml-developer`, `cicd-engineer`, `api-docs`, `system-architect`, `code-analyzer`, `base-template-generator`
-**2️⃣ DURING (After EVERY step):**
-```bash
-npx claude-flow@alpha hooks post-edit --file "[file]" --memory-key "swarm/[agent]/[step]"
-npx claude-flow@alpha hooks notify --message "[decision]"
-```
+### Testing & Validation
+`tdd-london-swarm`, `production-validator`
-**3️⃣ END:**
-```bash
-npx claude-flow@alpha hooks post-task --task-id "[task]" --analyze-performance true
-npx claude-flow@alpha hooks session-end --export-metrics true
-```
+### Migration & Planning
+`migration-planner`, `swarm-init`
+
+## 🎯 Claude Code vs MCP Tools
+
+### Claude Code Handles ALL EXECUTION:
+- **Task tool**: Spawn and run agents concurrently for actual work
+- File operations (Read, Write, Edit, MultiEdit, Glob, Grep)
+- Code generation and programming
+- Bash commands and system operations
+- Implementation work
+- Project navigation and analysis
+- TodoWrite and task management
+- Git operations
+- Package management
+- Testing and debugging
+
+### MCP Tools ONLY COORDINATE:
+- Swarm initialization (topology setup)
+- Agent type definitions (coordination patterns)
+- Task orchestration (high-level planning)
+- Memory management
+- Neural features
+- Performance tracking
+- GitHub integration
+
+**KEY**: MCP coordinates the strategy, Claude Code's Task tool executes with real agents.
-## πŸ› οΈ MCP Setup
+## πŸš€ Quick Setup
```bash
-# Add MCP server
+# Add MCP servers (Claude Flow required, others optional)
claude mcp add claude-flow npx claude-flow@alpha mcp start
+claude mcp add ruv-swarm npx ruv-swarm mcp start # Optional: Enhanced coordination
+claude mcp add flow-nexus npx flow-nexus@latest mcp start # Optional: Cloud features
```
-### Key MCP Tools:
-- `mcp__claude-flow__swarm_init` - Setup topology
-- `mcp__claude-flow__agent_spawn` - Create agents
-- `mcp__claude-flow__task_orchestrate` - Coordinate tasks
-- `mcp__claude-flow__memory_usage` - Persistent memory
-- `mcp__claude-flow__swarm_status` - Monitor progress
+## MCP Tool Categories
-## πŸ“Š Progress Format
+### Coordination
+`swarm_init`, `agent_spawn`, `task_orchestrate`
-```
-πŸ“Š Progress Overview
-β”œβ”€β”€ Total: X | βœ… Complete: X | πŸ”„ Active: X | β­• Todo: X
-└── Priority: πŸ”΄ HIGH | 🟑 MEDIUM | 🟒 LOW
-```
+### Monitoring
+`swarm_status`, `agent_list`, `agent_metrics`, `task_status`, `task_results`
-## 🎯 Performance Tips
+### Memory & Neural
+`memory_usage`, `neural_status`, `neural_train`, `neural_patterns`
-1. **Batch Everything** - Multiple operations = 1 message
-2. **Parallel First** - Think concurrent execution
-3. **Memory is Key** - Cross-agent coordination
-4. **Monitor Progress** - Real-time tracking
-5. **Enable Hooks** - Automated coordination
+### GitHub Integration
+`github_swarm`, `repo_analyze`, `pr_enhance`, `issue_triage`, `code_review`
-## ⚑ Quick Examples
+### System
+`benchmark_run`, `features_detect`, `swarm_monitor`
-### Research Task
-```javascript
-// Single message with all operations
-mcp__claude-flow__swarm_init { topology: "mesh", maxAgents: 5 }
-mcp__claude-flow__agent_spawn { type: "researcher" }
-mcp__claude-flow__agent_spawn { type: "code-analyzer" }
-mcp__claude-flow__task_orchestrate { task: "Research patterns" }
-```
+### Flow-Nexus MCP Tools (Optional Advanced Features)
+Flow-Nexus extends MCP capabilities with 70+ cloud-based orchestration tools:
-### Development Task
-```javascript
-// All todos in ONE call
-TodoWrite { todos: [
- { id: "1", content: "Design API", status: "in_progress", priority: "high" },
- { id: "2", content: "Implement auth", status: "pending", priority: "high" },
- { id: "3", content: "Write tests", status: "pending", priority: "medium" },
- { id: "4", content: "Documentation", status: "pending", priority: "low" }
-]}
-```
+**Key MCP Tool Categories:**
+- **Swarm & Agents**: `swarm_init`, `swarm_scale`, `agent_spawn`, `task_orchestrate`
+- **Sandboxes**: `sandbox_create`, `sandbox_execute`, `sandbox_upload` (cloud execution)
+- **Templates**: `template_list`, `template_deploy` (pre-built project templates)
+- **Neural AI**: `neural_train`, `neural_patterns`, `seraphina_chat` (AI assistant)
+- **GitHub**: `github_repo_analyze`, `github_pr_manage` (repository management)
+- **Real-time**: `execution_stream_subscribe`, `realtime_subscribe` (live monitoring)
+- **Storage**: `storage_upload`, `storage_list` (cloud file management)
-## 🌐 Flow Nexus Cloud Platform
+**Authentication Required:**
+- Register: `mcp__flow-nexus__user_register` or `npx flow-nexus@latest register`
+- Login: `mcp__flow-nexus__user_login` or `npx flow-nexus@latest login`
+- Access 70+ specialized MCP tools for advanced orchestration
-Flow Nexus extends Claude Flow with cloud-powered features:
+## πŸš€ Agent Execution Flow with Claude Code
-### Quick Start
-1. **Register**: `mcp__flow-nexus__user_register` with email/password
-2. **Login**: `mcp__flow-nexus__user_login` to access features
-3. **Check Balance**: `mcp__flow-nexus__check_balance` for credits
+### The Correct Pattern:
-### Key Capabilities
+1. **Optional**: Use MCP tools to set up coordination topology
+2. **REQUIRED**: Use Claude Code's Task tool to spawn agents that do actual work
+3. **REQUIRED**: Each agent runs hooks for coordination
+4. **REQUIRED**: Batch all operations in single messages
-**πŸ€– AI Swarms**
-- Deploy multi-agent swarms in cloud sandboxes
-- Pre-built templates for common architectures
-- Auto-scaling and load balancing
+### Example Full-Stack Development:
-**πŸ“¦ E2B Sandboxes**
-- `mcp__flow-nexus__sandbox_create` - Isolated execution environments
-- Support for Node.js, Python, React, Next.js
-- Real-time code execution with environment variables
+```javascript
+// Single message with all agent spawning via Claude Code's Task tool
+[Parallel Agent Execution]:
+ Task("Backend Developer", "Build REST API with Express. Use hooks for coordination.", "backend-dev")
+ Task("Frontend Developer", "Create React UI. Coordinate with backend via memory.", "coder")
+ Task("Database Architect", "Design PostgreSQL schema. Store schema in memory.", "code-analyzer")
+ Task("Test Engineer", "Write Jest tests. Check memory for API contracts.", "tester")
+ Task("DevOps Engineer", "Setup Docker and CI/CD. Document in memory.", "cicd-engineer")
+ Task("Security Auditor", "Review authentication. Report findings via hooks.", "reviewer")
+
+ // All todos batched together
+ TodoWrite { todos: [...8-10 todos...] }
+
+ // All file operations together
+ Write "backend/server.js"
+ Write "frontend/App.jsx"
+ Write "database/schema.sql"
+```
-**⚑ Workflows**
-- `mcp__flow-nexus__workflow_create` - Event-driven automation
-- Parallel task processing with message queues
-- Reusable workflow templates
+## πŸ“‹ Agent Coordination Protocol
-**🎯 Challenges & Learning**
-- `mcp__flow-nexus__challenges_list` - Coding challenges
-- Earn rUv credits by completing tasks
-- Global leaderboard and achievements
+### Every Agent Spawned via Task Tool MUST:
-**🧠 Neural Networks**
-- `mcp__flow-nexus__neural_train` - Train custom models
-- Distributed training across sandboxes
-- Pre-built templates for ML tasks
+**1️⃣ BEFORE Work:**
+```bash
+npx claude-flow@alpha hooks pre-task --description "[task]"
+npx claude-flow@alpha hooks session-restore --session-id "swarm-[id]"
+```
-**πŸ’° Credits & Billing**
-- Pay-as-you-go with rUv credits
-- Auto-refill configuration available
-- Free tier for getting started
+**2️⃣ DURING Work:**
+```bash
+npx claude-flow@alpha hooks post-edit --file "[file]" --memory-key "swarm/[agent]/[step]"
+npx claude-flow@alpha hooks notify --message "[what was done]"
+```
-### Example: Deploy a Swarm
-```javascript
-// Login and deploy
-mcp__flow-nexus__user_login { email: "[email protected]", password: "***" }
-mcp__flow-nexus__swarm_init { topology: "mesh", maxAgents: 5 }
-mcp__flow-nexus__sandbox_create { template: "node", name: "api-dev" }
+**3️⃣ AFTER Work:**
+```bash
+npx claude-flow@alpha hooks post-task --task-id "[task]"
+npx claude-flow@alpha hooks session-end --export-metrics true
```
-Learn more: https://github.com/ruvnet/claude-flow#flow-nexus
+## 🎯 Concurrent Execution Examples
-## πŸ”— Resources
+### βœ… CORRECT WORKFLOW: MCP Coordinates, Claude Code Executes
-- Docs: https://github.com/ruvnet/claude-flow
+```javascript
+// Step 1: MCP tools set up coordination (optional, for complex tasks)
+[Single Message - Coordination Setup]:
+ mcp__claude-flow__swarm_init { topology: "mesh", maxAgents: 6 }
+ mcp__claude-flow__agent_spawn { type: "researcher" }
+ mcp__claude-flow__agent_spawn { type: "coder" }
+ mcp__claude-flow__agent_spawn { type: "tester" }
+
+// Step 2: Claude Code Task tool spawns ACTUAL agents that do the work
+[Single Message - Parallel Agent Execution]:
+ // Claude Code's Task tool spawns real agents concurrently
+ Task("Research agent", "Analyze API requirements and best practices. Check memory for prior decisions.", "researcher")
+ Task("Coder agent", "Implement REST endpoints with authentication. Coordinate via hooks.", "coder")
+ Task("Database agent", "Design and implement database schema. Store decisions in memory.", "code-analyzer")
+ Task("Tester agent", "Create comprehensive test suite with 90% coverage.", "tester")
+ Task("Reviewer agent", "Review code quality and security. Document findings.", "reviewer")
+
+ // Batch ALL todos in ONE call
+ TodoWrite { todos: [
+ {id: "1", content: "Research API patterns", status: "in_progress", priority: "high"},
+ {id: "2", content: "Design database schema", status: "in_progress", priority: "high"},
+ {id: "3", content: "Implement authentication", status: "pending", priority: "high"},
+ {id: "4", content: "Build REST endpoints", status: "pending", priority: "high"},
+ {id: "5", content: "Write unit tests", status: "pending", priority: "medium"},
+ {id: "6", content: "Integration tests", status: "pending", priority: "medium"},
+ {id: "7", content: "API documentation", status: "pending", priority: "low"},
+ {id: "8", content: "Performance optimization", status: "pending", priority: "low"}
+ ]}
+
+ // Parallel file operations
+ Bash "mkdir -p app/{src,tests,docs,config}"
+ Write "app/package.json"
+ Write "app/src/server.js"
+ Write "app/tests/server.test.js"
+ Write "app/docs/API.md"
+```
+
+### ❌ WRONG (Multiple Messages):
+```javascript
+Message 1: mcp__claude-flow__swarm_init
+Message 2: Task("agent 1")
+Message 3: TodoWrite { todos: [single todo] }
+Message 4: Write "file.js"
+// This breaks parallel coordination!
+```
+
+## Performance Benefits
+
+- **84.8% SWE-Bench solve rate**
+- **32.3% token reduction**
+- **2.8-4.4x speed improvement**
+- **27+ neural models**
+
+## Hooks Integration
+
+### Pre-Operation
+- Auto-assign agents by file type
+- Validate commands for safety
+- Prepare resources automatically
+- Optimize topology by complexity
+- Cache searches
+
+### Post-Operation
+- Auto-format code
+- Train neural patterns
+- Update memory
+- Analyze performance
+- Track token usage
+
+### Session Management
+- Generate summaries
+- Persist state
+- Track metrics
+- Restore context
+- Export workflows
+
+## Advanced Features (v2.0.0)
+
+- πŸš€ Automatic Topology Selection
+- ⚑ Parallel Execution (2.8-4.4x speed)
+- 🧠 Neural Training
+- πŸ“Š Bottleneck Analysis
+- πŸ€– Smart Auto-Spawning
+- πŸ›‘οΈ Self-Healing Workflows
+- πŸ’Ύ Cross-Session Memory
+- πŸ”— GitHub Integration
+
+## Integration Tips
+
+1. Start with basic swarm init
+2. Scale agents gradually
+3. Use memory for context
+4. Monitor progress regularly
+5. Train patterns from success
+6. Enable hooks automation
+7. Use GitHub tools first
+
+## Support
+
+- Documentation: https://github.com/ruvnet/claude-flow
- Issues: https://github.com/ruvnet/claude-flow/issues
-- SPARC: https://github.com/ruvnet/claude-flow/docs/sparc.md
+- Flow-Nexus Platform: https://flow-nexus.ruv.io (registration required for cloud features)
---
-**Remember**: Claude Flow coordinates, Claude Code creates!
-- Never save working files, text/mds and tests to the root folder.
\ No newline at end of file
+Remember: **Claude Flow coordinates, Claude Code creates!**
+
+# important-instruction-reminders
+Do what has been asked; nothing more, nothing less.
+NEVER create files unless they're absolutely necessary for achieving your goal.
+ALWAYS prefer editing an existing file to creating a new one.
+NEVER proactively create documentation files (*.md) or README files. Only create documentation files if explicitly requested by the User.
+Never save working files, text/mds and tests to the root folder.
diff --git a/claude-flow b/claude-flow
index e7a791ee1f..0f0fd00e76 100755
--- a/claude-flow
+++ b/claude-flow
@@ -1,37 +1,81 @@
#!/usr/bin/env node
/**
- * Claude Flow CLI - Development Wrapper
- * Points to local bin/claude-flow.js for development
+ * Claude Flow CLI - Universal Wrapper
+ * Works in both CommonJS and ES Module projects
*/
-import { spawn } from 'child_process';
-import { resolve, dirname } from 'path';
-import { fileURLToPath } from 'url';
-import { existsSync } from 'fs';
-
-const __filename = fileURLToPath(import.meta.url);
-const __dirname = dirname(__filename);
-
-// Point to local bin/claude-flow.js
-const localBin = resolve(__dirname, 'bin', 'claude-flow.js');
-
-if (existsSync(localBin)) {
- const child = spawn('node', [localBin, ...process.argv.slice(2)], {
- stdio: 'inherit',
- shell: false
- });
-
- child.on('error', (error) => {
- console.error('❌ Error executing claude-flow:', error.message);
- process.exit(1);
- });
-
- child.on('exit', (code) => {
- process.exit(code || 0);
- });
-} else {
- console.error('❌ Could not find bin/claude-flow.js');
- console.error('Make sure you are in the claude-flow project directory');
+// Use dynamic import to work in both CommonJS and ES modules
+(async () => {
+ const { spawn } = await import('child_process');
+ const { resolve } = await import('path');
+ const { fileURLToPath } = await import('url');
+
+ // Detect if we're running in ES module context
+ let __dirname;
+ try {
+ // Check if import.meta is available (ES modules)
+ if (typeof import.meta !== 'undefined' && import.meta.url) {
+ const __filename = fileURLToPath(import.meta.url);
+ __dirname = resolve(__filename, '..');
+ } else {
+ // Fallback for CommonJS
+ __dirname = process.cwd();
+ }
+ } catch {
+ // Fallback for CommonJS
+ __dirname = process.cwd();
+ }
+
+ // Try multiple strategies to find claude-flow
+ const strategies = [
+ // 1. Local node_modules
+ async () => {
+ try {
+ const localPath = resolve(process.cwd(), 'node_modules/.bin/claude-flow');
+ const { existsSync } = await import('fs');
+ if (existsSync(localPath)) {
+ return spawn(localPath, process.argv.slice(2), { stdio: 'inherit' });
+ }
+ } catch {}
+ },
+
+ // 2. Parent node_modules (monorepo)
+ async () => {
+ try {
+ const parentPath = resolve(process.cwd(), '../node_modules/.bin/claude-flow');
+ const { existsSync } = await import('fs');
+ if (existsSync(parentPath)) {
+ return spawn(parentPath, process.argv.slice(2), { stdio: 'inherit' });
+ }
+ } catch {}
+ },
+
+ // 3. NPX with latest alpha version (prioritized over global)
+ async () => {
+ return spawn('npx', ['claude-flow@alpha', ...process.argv.slice(2)], {
+ stdio: 'inherit',
+ });
+ },
+ ];
+
+ // Try each strategy
+ for (const strategy of strategies) {
+ try {
+ const child = await strategy();
+ if (child) {
+ child.on('exit', (code) => process.exit(code || 0));
+ child.on('error', (err) => {
+ if (err.code !== 'ENOENT') {
+ console.error('Error:', err);
+ process.exit(1);
+ }
+ });
+ return;
+ }
+ } catch {}
+ }
+
+ console.error('Could not find claude-flow. Please install it with: npm install claude-flow');
process.exit(1);
-}
\ No newline at end of file
+})();
diff --git a/memory/agents/README.md b/memory/agents/README.md
new file mode 100644
index 0000000000..11f5f3dc2a
--- /dev/null
+++ b/memory/agents/README.md
@@ -0,0 +1,31 @@
+# Agent Memory Storage
+
+## Purpose
+This directory stores agent-specific memory data, configurations, and persistent state information for individual Claude agents in the orchestration system.
+
+## Structure
+Each agent gets its own subdirectory for isolated memory storage:
+
+```
+memory/agents/
+β”œβ”€β”€ agent_001/
+β”‚ β”œβ”€β”€ state.json # Agent state and configuration
+β”‚ β”œβ”€β”€ knowledge.md # Agent-specific knowledge base
+β”‚ β”œβ”€β”€ tasks.json # Completed and active tasks
+β”‚ └── calibration.json # Agent-specific calibrations
+β”œβ”€β”€ agent_002/
+β”‚ └── ...
+└── shared/
+ β”œβ”€β”€ common_knowledge.md # Shared knowledge across agents
+ └── global_config.json # Global agent configurations
+```
+
+## Usage Guidelines
+1. **Agent Isolation**: Each agent should only read/write to its own directory
+2. **Shared Resources**: Use the `shared/` directory for cross-agent information
+3. **State Persistence**: Update state.json whenever agent status changes
+4. **Knowledge Sharing**: Document discoveries in knowledge.md files
+5. **Cleanup**: Remove directories for terminated agents periodically
+
+## Last Updated
+2025-09-18T22:28:17.072Z
diff --git a/memory/sessions/README.md b/memory/sessions/README.md
new file mode 100644
index 0000000000..0b4ca98179
--- /dev/null
+++ b/memory/sessions/README.md
@@ -0,0 +1,32 @@
+# Session Memory Storage
+
+## Purpose
+This directory stores session-based memory data, conversation history, and contextual information for development sessions using the Claude-Flow orchestration system.
+
+## Structure
+Sessions are organized by date and session ID for easy retrieval:
+
+```
+memory/sessions/
+β”œβ”€β”€ 2024-01-10/
+β”‚ β”œβ”€β”€ session_001/
+β”‚ β”‚ β”œβ”€β”€ metadata.json # Session metadata and configuration
+β”‚ β”‚ β”œβ”€β”€ conversation.md # Full conversation history
+β”‚ β”‚ β”œβ”€β”€ decisions.md # Key decisions and rationale
+β”‚ β”‚ β”œβ”€β”€ artifacts/ # Generated files and outputs
+β”‚ β”‚ └── coordination_state/ # Coordination system snapshots
+β”‚ └── ...
+└── shared/
+ β”œβ”€β”€ patterns.md # Common session patterns
+ └── templates/ # Session template files
+```
+
+## Usage Guidelines
+1. **Session Isolation**: Each session gets its own directory
+2. **Metadata Completeness**: Always fill out session metadata
+3. **Conversation Logging**: Document all significant interactions
+4. **Artifact Organization**: Structure generated files clearly
+5. **State Preservation**: Snapshot coordination state regularly
+
+## Last Updated
+2025-09-18T22:28:17.072Z