π 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
TypeScript agentic-aiagentic-frameworkagentic-workflowagentsai-agentsai-assistantai-skillsautonomous-agentsclaudecodexdsh-pluginharnessmcp-servermulti-agentmulti-agent-systemsnpmskillsswarmswarm-intelligencetypescript
updates
rUv71e0f9f034ed
diff --git a/.gitignore b/.gitignoreindex 626f764a4a..fb1f669cc3 100644--- a/.gitignore+++ b/.gitignore@@ -42,7 +42,7 @@ claude-flow.config.json*.temp.cache/-bin+packagetest-inittest-full-initclaude-flow-1.0.0\ No newline at end of filediff --git a/CLAUDE.md b/CLAUDE.mdindex e7b0a6945a..8dfcbd8d51 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -1,500 +1,45 @@-# Claude-Flow: Advanced AI Agent Orchestration System Guide+# Claude Code Integration Guide-This document provides comprehensive guidance to Claude Code when working with the Claude-Flow system - an advanced multi-agent orchestration platform created by rUv for managing complex AI workflows with sophisticated coordination, memory management, and task allocation capabilities.+This document provides comprehensive guidance to Claude when working with this codebase.-## System Overview+## Project Overview+[Provide a detailed description of your project, its purpose, and main features]-Claude-Flow is a sophisticated multi-agent orchestration system built with Deno and TypeScript that enables:+## Architecture+[Describe the overall architecture, main components, and how they interact]-- **Multi-Agent Coordination**: Spawn and manage multiple Claude agents with different roles-- **Advanced Task Scheduling**: Priority-based scheduling with dependency management-- **Persistent Memory Management**: Hybrid SQLite/Markdown backends with CRDT conflict resolution-- **Terminal Session Management**: Efficient pooling and session management-- **Resource Coordination**: Deadlock detection and prevention-- **MCP Integration**: Model Context Protocol server for tool integration-- **Interactive CLI**: Rich command-line interface with REPL mode+## Code Conventions+- **Naming**: [Describe naming conventions for files, functions, variables, etc.]+- **Style**: [Code formatting preferences, linting rules]+- **Patterns**: [Design patterns used in the project]+- **Testing**: [Testing approach and requirements]-## Installation and Setup--### Using NPX (Recommended)-```bash-npx claude-flow-```--### Installing Globally-```bash-npm install -g claude-flow-```--### From Source-```bash-git clone https://github.com/ruvnet/claude-code-flow.git-cd claude-flow-deno task install-```--## Core CLI Commands and Usage--### 1. System Initialization--**Initialize Configuration**-```bash-claude-flow config init+## Directory Structure```-This creates the default configuration file with optimized settings for agent orchestration.--**Show Current Configuration**-```bash-claude-flow config show-```--**Validate Configuration**-```bash-claude-flow config validate [file]+project/+βββ src/ # Source code+βββ tests/ # Test files+βββ docs/ # Documentation+βββ ... # Other directories```-### 2. Starting the Orchestrator--**Basic Start**-```bash-claude-flow start-```--**Advanced Start Options**-```bash-claude-flow start --daemon --port 3000 --mcp-transport http-```--Options:-- `-d, --daemon`: Run as background daemon-- `-p, --port <port>`: Specify MCP server port-- `--mcp-transport <type>`: Set transport (stdio, http)--### 3. Agent Management--**Spawn a New Agent**-```bash-claude-flow agent spawn <type> --name "Agent Name"-```--Agent types available:-- `coordinator`: Plans and delegates tasks-- `researcher`: Gathers and analyzes information-- `implementer`: Writes code and creates solutions-- `analyst`: Identifies patterns and generates insights-- `custom`: User-defined agent types--**List All Agents**-```bash-claude-flow agent list-```--**Get Agent Information**-```bash-claude-flow agent info <agent-id>-```--**Terminate an Agent**-```bash-claude-flow agent terminate <agent-id>-```--### 4. Task Management--**Create a New Task**-```bash-claude-flow task create <type> "<description>"-```--Task types:-- `research`: Information gathering and analysis-- `implementation`: Code development-- `analysis`: Data analysis and pattern recognition-- `coordination`: Task planning and delegation--**List All Tasks**-```bash-claude-flow task list-```--**Check Task Status**-```bash-claude-flow task status <task-id>-```--**Cancel a Task**-```bash-claude-flow task cancel <task-id>-```--**Execute Workflow from File**-```bash-claude-flow task workflow <workflow-file.json>-```--### 5. Memory Management--**Query Memory Entries**-```bash-claude-flow memory query --filter "keyword" --agent-id "agent-1"-```--**Export Memory**-```bash-claude-flow memory export memory-backup.json-```--**Import Memory**-```bash-claude-flow memory import memory-backup.json-```--**Show Memory Statistics**-```bash-claude-flow memory stats-```--**Clean Up Old Entries**-```bash-claude-flow memory cleanup --older-than "30d"-```--## When and How to Use Claude-Flow--### Starting a New Development Session--1. **Initialize the system**:- ```bash- claude-flow config init- claude-flow start- ```--2. **Check system status**:- ```bash- claude-flow agent list- claude-flow task list- ```--3. **Spawn appropriate agents based on your needs**:- ```bash- # For research tasks- claude-flow agent spawn researcher --name "Research Assistant"-- # For development tasks- claude-flow agent spawn implementer --name "Code Developer"-- # For coordination- claude-flow agent spawn coordinator --name "Task Coordinator"- ```--### Creating New Terminal Sessions--The system automatically manages terminal sessions, but you can control session allocation:--**Check Terminal Pool Status**-```bash-claude-flow start --verbose # Shows terminal pool information-```--**Terminal sessions are automatically created when**:-- Spawning new agents-- Executing tasks that require terminal access-- Running parallel operations--### Task Allocation and Orchestration--**Priority-Based Task Creation**-```bash-claude-flow task create research "Analyze market trends" --priority high --assign-to researcher-agent-id-```--**Workflow Orchestration Example**-Create a workflow file (`research-workflow.json`):-```json-{- "name": "Research and Analysis Workflow",- "tasks": [- {- "id": "research-1",- "type": "research",- "description": "Research quantum computing basics",- "priority": 90,- "assignTo": "researcher"- },- {- "id": "analyze-1",- "type": "analysis",- "description": "Analyze research findings",- "dependencies": ["research-1"],- "assignTo": "analyst"- },- {- "id": "implement-1",- "type": "implementation",- "description": "Create proof of concept",- "dependencies": ["analyze-1"],- "assignTo": "implementer"- }- ]-}-```--Execute the workflow:-```bash-claude-flow task workflow research-workflow.json-```--## Monitoring and Status Checking--### Agent Status Monitoring+## Development Workflow+1. [Step-by-step development process]+2. [How to run tests]+3. [How to build/deploy]-**Real-time Agent Monitoring**-```bash-# Check all agents-claude-flow agent list --detailed--# Monitor specific agent-claude-flow agent info <agent-id> --watch-```--**Task Queue Monitoring**-```bash-# View task queue-claude-flow task list --status pending--# Monitor task progress-claude-flow task status <task-id> --follow-```--### Memory System Monitoring--**Check Memory Usage**-```bash-claude-flow memory stats --detailed-```--**Query Recent Agent Activities**-```bash-claude-flow memory query --recent --limit 10-```--### System Health Monitoring--**Overall System Status**-```bash-claude-flow start --status-```--This shows:-- Active agents count-- Task queue size-- Memory usage-- Terminal pool status-- MCP server status--## Advanced Usage Patterns--### Multi-Agent Coordination--**Coordinated Research Project**-```bash-# Spawn specialized agents-claude-flow agent spawn researcher --name "Primary Researcher" --capabilities "web-search,analysis"-claude-flow agent spawn researcher --name "Technical Researcher" --capabilities "code-analysis,documentation"-claude-flow agent spawn analyst --name "Data Analyst" --capabilities "statistical-analysis"-claude-flow agent spawn coordinator --name "Project Coordinator"--# Create coordinated tasks-claude-flow task create research "Research AI frameworks" --assign-to primary-researcher-claude-flow task create research "Analyze existing implementations" --assign-to technical-researcher-claude-flow task create analysis "Synthesize research findings" --dependencies "research-1,research-2" --assign-to data-analyst-```--### Memory-Backed Development--**Persistent Context Management**-```bash-# Start a development session with memory context-claude-flow agent spawn implementer --name "Backend Developer" --memory-context "backend-development"--# Create implementation task with memory persistence-claude-flow task create implementation "Develop API endpoints" --assign-to backend-developer --persist-memory-```--### Resource Coordination--**Managing Shared Resources**-```bash-# Create tasks that require exclusive resource access-claude-flow task create implementation "Database migration" --resource-lock "database" --priority high-claude-flow task create implementation "Schema updates" --resource-lock "database" --dependencies "migration-task"-```--## Configuration Management--### Default Configuration Structure--```json-{- "orchestrator": {- "maxConcurrentAgents": 10,- "taskQueueSize": 100,- "healthCheckInterval": 30000,- "shutdownTimeout": 30000- },- "terminal": {- "type": "auto",- "poolSize": 5,- "recycleAfter": 10,- "healthCheckInterval": 60000,- "commandTimeout": 300000- },- "memory": {- "backend": "hybrid",- "cacheSizeMB": 100,- "syncInterval": 5000,- "conflictResolution": "crdt",- "retentionDays": 30- },- "coordination": {- "maxRetries": 3,- "retryDelay": 1000,- "deadlockDetection": true,- "resourceTimeout": 60000,- "messageTimeout": 30000- },- "mcp": {- "transport": "stdio",- "port": 3000,- "tlsEnabled": false- }-}-```--### Customizing Configuration--**Set Specific Values**-```bash-claude-flow config set orchestrator.maxConcurrentAgents 20-claude-flow config set memory.cacheSizeMB 200-claude-flow config set coordination.deadlockDetection false-```--**Get Specific Values**-```bash-claude-flow config get orchestrator.maxConcurrentAgents-claude-flow config get memory.backend-```--## Interactive REPL Mode--**Start REPL Session**-```bash-claude-flow repl-```--In REPL mode, you can:-- Interactively manage agents and tasks-- Real-time monitoring-- Dynamic configuration changes-- Live debugging and troubleshooting--REPL commands:-```bash-> agent spawn researcher --name "Interactive Researcher"-> task create research "Real-time analysis task"-> memory query --filter "recent"-> status-> help-```--## Error Handling and Troubleshooting--### Common Status Checks--**System Health Check**-```bash-claude-flow start --health-check-```--**Component Status**-```bash-# Check orchestrator status-claude-flow agent list --health--# Check memory system-claude-flow memory stats --health--# Check task queue-claude-flow task list --queue-status-```--### Debugging Failed Tasks--**View Task Logs**-```bash-claude-flow task status <task-id> --logs-```--**Check Agent Logs**-```bash-claude-flow agent info <agent-id> --logs --tail 50-```--**Memory Conflict Resolution**-```bash-claude-flow memory query --conflicts-claude-flow memory export --conflicts-only conflict-analysis.json-```--## Best Practices--### Agent Management-1. **Specialized Agents**: Create agents with specific roles and capabilities-2. **Resource Monitoring**: Regularly check agent performance and resource usage-3. **Graceful Shutdown**: Always terminate agents properly to preserve memory state--### Task Organization-1. **Priority Assignment**: Use priority levels to ensure critical tasks are processed first-2. **Dependency Management**: Clearly define task dependencies for complex workflows-3. **Resource Coordination**: Use resource locks for tasks requiring exclusive access--### Memory Management-1. **Regular Cleanup**: Periodically clean up old memory entries-2. **Conflict Resolution**: Monitor and resolve memory conflicts promptly-3. **Backup Strategy**: Regular memory exports for disaster recovery--### System Monitoring-1. **Health Checks**: Regular system health monitoring-2. **Performance Metrics**: Track agent performance and task completion times-3. **Capacity Planning**: Monitor resource usage and plan for scaling--## Integration with Claude Code--When working with Claude Code, use Claude-Flow to:--1. **Orchestrate Complex Development Tasks**: Break down large development projects into coordinated agent tasks-2. **Manage Persistent Context**: Use memory management for maintaining context across development sessions-3. **Coordinate Multiple Development Streams**: Parallel development with proper resource coordination-4. **Quality Assurance**: Dedicated agents for testing, code review, and validation--**Example Development Workflow Integration**:-```bash-# Start Claude-Flow orchestrator-claude-flow start --daemon--# Spawn development team-claude-flow agent spawn coordinator --name "Development Coordinator"-claude-flow agent spawn implementer --name "Backend Developer"-claude-flow agent spawn implementer --name "Frontend Developer"-claude-flow agent spawn analyst --name "QA Analyst"--# Create coordinated development workflow-claude-flow task workflow development-pipeline.json-```+## Important Considerations+- [Security considerations]+- [Performance requirements]+- [Compatibility requirements]-This comprehensive guide enables effective utilization of Claude-Flow's advanced multi-agent orchestration capabilities for complex AI-driven development workflows.+## Common Tasks+- **Add a new feature**: [Instructions]+- **Fix a bug**: [Process]+- **Update documentation**: [Guidelines]----+## Dependencies+[List key dependencies and their purposes]-**Created by rUv** - [github.com/ruvnet/claude-code-flow](https://github.com/ruvnet/claude-code-flow)\ No newline at end of file+## Troubleshooting+[Common issues and solutions]diff --git a/coordination.md b/coordination.mdindex be83268b44..b8c59a01cb 100644--- a/coordination.md+++ b/coordination.md@@ -1,88 +1,85 @@-# Agent Coordination System--## Overview-The Claude-Flow coordination system manages multiple AI agents working together on complex tasks. It provides intelligent task distribution, resource management, and inter-agent communication.--## Agent Types and Capabilities-- **Researcher**: Web search, information gathering, knowledge synthesis-- **Coder**: Code analysis, development, debugging, testing-- **Analyst**: Data processing, pattern recognition, insights generation-- **Coordinator**: Task planning, resource allocation, workflow management-- **General**: Multi-purpose agent with balanced capabilities--## Task Management-- **Priority Levels**: 1 (lowest) to 10 (highest)-- **Dependencies**: Tasks can depend on completion of other tasks-- **Parallel Execution**: Independent tasks run concurrently-- **Load Balancing**: Automatic distribution based on agent capacity--## Coordination Commands-```bash-# Agent Management-npx claude-flow agent spawn <type> --name <name> --priority <1-10>-npx claude-flow agent list-npx claude-flow agent info <agent-id>-npx claude-flow agent terminate <agent-id>--# Task Management-npx claude-flow task create <type> <description> --priority <1-10> --deps <task-ids>-npx claude-flow task list --verbose-npx claude-flow task status <task-id>-npx claude-flow task cancel <task-id>--# System Monitoring-npx claude-flow status --verbose-npx claude-flow monitor --interval 5000-```+# Coordination Center-## Workflow Execution-Workflows are defined in JSON format and can orchestrate complex multi-agent operations:-```bash-npx claude-flow workflow examples/research-workflow.json-npx claude-flow workflow examples/development-config.json --async-```+Central coordination for multi-agent collaboration and task management.++## Active Agents+| Agent ID | Type | Status | Assigned Tasks | Last Active |+|----------|------|--------|----------------|-------------|+| [ID] | [Type] | [Status] | [Tasks] | [Timestamp] |++## Task Queue+### High Priority+1. **[Task Name]**+ - Description: [What needs to be done]+ - Assigned to: [Agent ID]+ - Dependencies: [Other tasks]+ - Deadline: [Date/Time]++### Medium Priority+1. [Task details]-## Advanced Features-- **Circuit Breakers**: Automatic failure handling and recovery-- **Work Stealing**: Dynamic load redistribution for efficiency-- **Resource Limits**: Memory and CPU usage constraints-- **Metrics Collection**: Performance monitoring and optimization--## Configuration-Coordination settings in `claude-flow.config.json`:-```json-{- "orchestrator": {- "maxConcurrentTasks": 10,- "taskTimeout": 300000,- "defaultPriority": 5- },- "agents": {- "maxAgents": 20,- "defaultCapabilities": ["research", "code", "terminal"],- "resourceLimits": {- "memory": "1GB",- "cpu": "50%"- }- }-}+### Low Priority+1. [Task details]++## Workflow Definitions+### [Workflow Name]+```yaml+name: [Workflow Name]+description: [What this workflow does]+steps:+ - name: [Step 1]+ agent: [Agent type]+ action: [What to do]+ - name: [Step 2]+ agent: [Agent type]+ action: [What to do]+ depends_on: [Step 1]```-## Communication Patterns-- **Direct Messaging**: Agent-to-agent communication-- **Event Broadcasting**: System-wide notifications-- **Shared Memory**: Common information access-- **Task Handoff**: Seamless work transfer between agents--## Best Practices-- Start with general agents and specialize as needed-- Use descriptive task names and clear requirements-- Monitor system resources during heavy workloads-- Implement proper error handling in workflows-- Regular cleanup of completed tasks and inactive agents--## Troubleshooting-- Check agent health with `npx claude-flow status`-- View detailed logs with `npx claude-flow monitor`-- Restart stuck agents with terminate/spawn cycle-- Use `--verbose` flags for detailed diagnostic information+## Resource Allocation+### Computational Resources+- CPU: [Usage/Limits]+- Memory: [Usage/Limits]+- Storage: [Usage/Limits]++### External Resources+- API Rate Limits: [Service: limit]+- Database Connections: [Current/Max]++## Communication Channels+### Inter-Agent Messages+- [Agent A β Agent B]: [Message type]++### External Communications+- Webhooks: [Configured webhooks]+- Notifications: [Notification settings]++## Synchronization Points+- [Sync Point 1]: [Description]+- [Sync Point 2]: [Description]++## Conflict Resolution+### Strategy+- [How conflicts are resolved]++### Recent Conflicts+- [Date]: [Conflict description] β [Resolution]++## Performance Metrics+### Task Completion+- Average time: [Time]+- Success rate: [Percentage]++### Agent Efficiency+- [Agent Type]: [Metrics]++## Scheduled Maintenance+- [Date/Time]: [What will be done]++## Emergency Procedures+### System Overload+1. [Step 1]+2. [Step 2]++### Agent Failure+1. [Recovery procedure]diff --git a/memory-bank.md b/memory-bank.mdindex 799fa4783d..b3503a422f 100644--- a/memory-bank.md+++ b/memory-bank.md@@ -1,58 +1,74 @@-# Memory Bank Configuration--## Overview-The Claude-Flow memory system provides persistent storage and intelligent retrieval of information across agent sessions. It uses a hybrid approach combining SQL databases with semantic search capabilities.--## Storage Backends-- **Primary**: JSON database (`./memory/claude-flow-data.json`)-- **Sessions**: File-based storage in `./memory/sessions/`-- **Cache**: In-memory cache for frequently accessed data--## Memory Organization-- **Namespaces**: Logical groupings of related information-- **Sessions**: Time-bound conversation contexts-- **Indexing**: Automatic content indexing for fast retrieval-- **Replication**: Optional distributed storage support--## Commands-- `npx claude-flow memory query <search>`: Search stored information-- `npx claude-flow memory stats`: Show memory usage statistics-- `npx claude-flow memory export <file>`: Export memory to file-- `npx claude-flow memory import <file>`: Import memory from file--## Configuration-Memory settings are configured in `claude-flow.config.json`:-```json-{- "memory": {- "backend": "json",- "path": "./memory/claude-flow-data.json",- "cacheSize": 1000,- "indexing": true,- "namespaces": ["default", "agents", "tasks", "sessions"],- "retentionPolicy": {- "sessions": "30d",- "tasks": "90d",- "agents": "permanent"- }- }-}+# Memory Bank++This file serves as persistent memory storage for Claude across sessions.++## Session Information+- **Current Session**: Started 2025-06-10T22:40:08.013Z+- **Project Phase**: [Development/Testing/Production]+- **Active Tasks**: [List current tasks]++## Project Context+### Technical Stack+- Languages: [List languages used]+- Frameworks: [List frameworks]+- Tools: [Development tools]++### Architecture Decisions+- [Record key architectural decisions]+- [Rationale for technology choices]++## Important Information+### API Keys and Secrets+- [Never store actual secrets here, just references]++### External Services+- [List integrated services]+- [Configuration requirements]++### Database Schema+- [Current schema version]+- [Recent migrations]++## Progress Tracking+### Completed Tasks+- [x] [Completed task 1]+- [x] [Completed task 2]++### In Progress+- [ ] [Current task 1]+- [ ] [Current task 2]++### Upcoming+- [ ] [Future task 1]+- [ ] [Future task 2]++## Code Patterns+### Established Patterns+```javascript+// Example pattern```-## Best Practices-- Use descriptive namespaces for different data types-- Regular memory exports for backup purposes-- Monitor memory usage with stats command-- Clean up old sessions periodically--## Memory Types-- **Episodic**: Conversation and interaction history-- **Semantic**: Factual knowledge and relationships-- **Procedural**: Task patterns and workflows-- **Meta**: System configuration and preferences--## Integration Notes-- Memory is automatically synchronized across agents-- Search supports both exact match and semantic similarity-- Memory contents are private to your local instance-- No data is sent to external services without explicit commands+### Anti-patterns to Avoid+- [List anti-patterns]++## Meeting Notes+### [Date]+- Participants: [Names]+- Decisions: [Key decisions]+- Action items: [Tasks assigned]++## Debugging History+### Issue: [Issue name]+- **Date**: [Date]+- **Symptoms**: [What was observed]+- **Root Cause**: [What caused it]+- **Solution**: [How it was fixed]++## Performance Metrics+- [Baseline metrics]+- [Optimization goals]++## Documentation Links+- [API Documentation]: [URL]+- [Design Documents]: [URL]+- [Issue Tracker]: [URL]diff --git a/memory/agents/README.md b/memory/agents/README.mdindex 4af32b8a09..5286fc62b5 100644--- a/memory/agents/README.md+++ b/memory/agents/README.md@@ -1,31 +1,18 @@-# Agent Memory Storage+# Agents Directory-## Purpose-This directory stores agent-specific memory data, configurations, and persistent state information for individual Claude agents in the orchestration system.+This directory stores agent-specific memory and state information.## Structure-Each agent gets its own subdirectory for isolated memory storage:+Each agent gets its own subdirectory named by agent ID:+- `agent-001/`: First agent's memory+- `agent-002/`: Second agent's memory+- etc.-```-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-```+## Files per Agent+- `profile.json`: Agent configuration and capabilities+- `memory.md`: Agent's working memory+- `tasks.json`: Assigned tasks and their status+- `metrics.json`: Performance metrics-## 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-06-10T17:00:28.353Z+## Usage+Files in this directory are automatically managed by the Claude-Flow system.diff --git a/memory/claude-flow-data.json b/memory/claude-flow-data.jsonindex 42b61b0b3f..8bec10dcde 100644--- a/memory/claude-flow-data.json+++ b/memory/claude-flow-data.json@@ -1,118 +1,5 @@{- "agents": [- {- "id": "agent-1749575024750-kk9yqj5mg",- "type": "coordinator",- "name": "coordinator-1749575024749",- "status": "active",- "capabilities": [- "task-assignment",- "planning",- "delegation"- ],- "systemPrompt": "You are a coordination agent responsible for planning and delegating tasks.",- "maxConcurrentTasks": 5,- "priority": 1,- "createdAt": 1749575024750- },- {- "id": "agent-1749575024788-yncmfydsg",- "type": "researcher",- "name": "researcher-1749575024787",- "status": "active",- "capabilities": [- "web-search",- "information-gathering",- "analysis"- ],- "systemPrompt": "You are a research agent specialized in gathering and analyzing information.",- "maxConcurrentTasks": 5,- "priority": 1,- "createdAt": 1749575024788- },- {- "id": "agent-1749575024835-u4g6xppuj",- "type": "implementer",- "name": "implementer-1749575024834",- "status": "active",- "capabilities": [- "code-generation",- "file-manipulation",- "testing"- ],- "systemPrompt": "You are an implementation agent focused on writing code and creating solutions.",- "maxConcurrentTasks": 5,- "priority": 1,- "createdAt": 1749575024835- },- {- "id": "agent-1749575024875-mmcz7tobo",- "type": "analyst",- "name": "analyst-1749575024875",- "status": "active",- "capabilities": [- "data-analysis",- "pattern-recognition",- "reporting"- ],- "systemPrompt": "You are an analysis agent that identifies patterns and generates insights.",- "maxConcurrentTasks": 5,- "priority": 1,- "createdAt": 1749575024875- },- {- "id": "agent-1749576897556-ye3qz5dmr",- "type": "implementer",- "name": "implementer-1749576897555",- "status": "active",- "capabilities": [- "code-generation",- "file-manipulation",- "testing"- ],- "systemPrompt": "You are an implementation agent focused on writing code and creating solutions.",- "maxConcurrentTasks": 5,- "priority": 1,- "createdAt": 1749576897556- }- ],- "tasks": [- {- "id": "task-1749575372522-rgulvgx8h",- "type": "research",- "description": "Analyze system architecture --priority 5",- "status": "assigned",- "priority": 1,- "dependencies": [],- "metadata": {},- "progress": 0,- "createdAt": 1749575372522,- "assignedAgent": "agent-1749575024788-yncmfydsg"- },- {- "id": "task-1749575380264-gblaptpcj",- "type": "development",- "description": "Implement caching layer --priority 8",- "status": "assigned",- "priority": 1,- "dependencies": [],- "metadata": {},- "progress": 0,- "createdAt": 1749575380264,- "assignedAgent": "agent-1749575024835-u4g6xppuj"- },- {- "id": "task-1749575380310-mg7dmrwkj",- "type": "analysis",- "description": "Performance metrics analysis --priority 3",- "status": "assigned",- "priority": 1,- "dependencies": [],- "metadata": {},- "progress": 0,- "createdAt": 1749575380310,- "assignedAgent": "agent-1749575024875-mmcz7tobo"- }- ],- "lastUpdated": 1749576897556+ "agents": [],+ "tasks": [],+ "lastUpdated": 1749595208016}\ No newline at end of filediff --git a/memory/sessions/README.md b/memory/sessions/README.mdindex 09f749ffe1..336c42d9e8 100644--- a/memory/sessions/README.md+++ b/memory/sessions/README.md@@ -1,32 +1,17 @@-# Session Memory Storage+# Sessions Directory-## Purpose-This directory stores session-based memory data, conversation history, and contextual information for development sessions using the Claude-Flow orchestration system.+This directory stores session-specific information and terminal states.## Structure-Sessions are organized by date and session ID for easy retrieval:+Each session gets a unique directory:+- `session-[timestamp]/`: Session data+ - `metadata.json`: Session metadata+ - `terminal.log`: Terminal output+ - `commands.history`: Command history+ - `state.json`: Session state snapshot-```-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-```+## Retention Policy+Sessions are retained for 30 days by default, then archived or deleted based on configuration.-## 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-06-10T17:00:28.354Z+## Usage+The Claude-Flow system automatically manages session files. Do not modify these files manually.diff --git a/package-lock.json b/package-lock.jsonindex 35fb2784d2..81037dda15 100644--- a/package-lock.json+++ b/package-lock.json@@ -1,12 +1,12 @@{"name": "claude-flow",- "version": "1.0.0",+ "version": "1.0.15","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "claude-flow",- "version": "1.0.0",+ "version": "1.0.15","hasInstallScript": true,"license": "MIT","bin": {@@ -16,7 +16,9 @@"node": ">=16.0.0"}},- "node_modules/.deno/@[email protected]": {},+ "node_modules/.deno/@[email protected]": {+ "extraneous": true+ },"node_modules/.deno/[email protected]/node_modules/undici-types": {"version": "6.21.0","extraneous": true,diff --git a/package.json b/package.jsonindex 242c055b39..30553ba590 100644--- a/package.json+++ b/package.json@@ -1,6 +1,6 @@{"name": "claude-flow",- "version": "1.0.4",+ "version": "1.0.21","description": "Advanced AI agent orchestration system for Claude Code","main": "src/cli/main.ts","bin": {diff --git a/src/cli/commands/help.ts b/src/cli/commands/help.tsindex 17ef348fef..75f0be2a06 100644--- a/src/cli/commands/help.ts+++ b/src/cli/commands/help.ts@@ -177,6 +177,67 @@ const HELP_TOPICS: HelpTopic[] = [],related: ['agents', 'workflows', 'coordination']},+ {+ name: 'claude',+ description: 'Spawning Claude instances with specific configurations',+ category: 'basic',+ examples: [+ {+ description: 'Spawn Claude with web research capabilities',+ command: 'claude-flow claude spawn "implement user authentication" --research --parallel',+ explanation: 'Creates a Claude instance with WebFetchTool and BatchTool for parallel web research'+ },+ {+ description: 'Spawn Claude without permission prompts',+ command: 'claude-flow claude spawn "fix payment bug" --no-permissions',+ explanation: 'Runs Claude with --dangerously-skip-permissions flag to avoid interruptions'+ },+ {+ description: 'Spawn Claude with custom tools',+ command: 'claude-flow claude spawn "analyze codebase" --tools "View,Edit,GrepTool,LS"',+ explanation: 'Specifies exactly which tools Claude can use for the task'+ },+ {+ description: 'Spawn Claude with test coverage target',+ command: 'claude-flow claude spawn "write unit tests" --coverage 95 --commit feature',+ explanation: 'Sets test coverage goal to 95% and commits after each feature'+ },+ {+ description: 'Dry run to preview command',+ command: 'claude-flow claude spawn "build API" --mode backend-only --dry-run',+ explanation: 'Shows what would be executed without actually running Claude'+ }+ ],+ tutorial: [+ 'The claude spawn command launches Claude instances with specific configurations.',+ '',+ 'Available Options:',+ 'β’ --tools, -t: Specify allowed tools (default: View,Edit,Replace,GlobTool,GrepTool,LS,Bash)',+ 'β’ --no-permissions: Skip permission prompts with --dangerously-skip-permissions',+ 'β’ --config, -c: Path to MCP configuration file',+ 'β’ --mode, -m: Development mode (full, backend-only, frontend-only, api-only)',+ 'β’ --parallel: Enable BatchTool and dispatch_agent for parallel execution',+ 'β’ --research: Enable WebFetchTool for web research capabilities',+ 'β’ --coverage: Test coverage target percentage (default: 80)',+ 'β’ --commit: Commit frequency (phase, feature, manual)',+ 'β’ --verbose, -v: Enable verbose output',+ 'β’ --dry-run, -d: Preview what would be executed',+ '',+ 'Environment Variables Set:',+ 'β’ CLAUDE_INSTANCE_ID: Unique identifier for the Claude instance',+ 'β’ CLAUDE_FLOW_MODE: Development mode setting',+ 'β’ CLAUDE_FLOW_COVERAGE: Target test coverage percentage',+ 'β’ CLAUDE_FLOW_COMMIT: Commit frequency setting',+ '',+ 'Common Use Cases:',+ 'β’ Full-stack development: --mode full --parallel',+ 'β’ API development: --mode backend-only --coverage 90',+ 'β’ Bug fixing: --no-permissions --verbose',+ 'β’ Research tasks: --research --parallel',+ 'β’ Test writing: --coverage 95 --commit feature'+ ],+ related: ['agents', 'tasks', 'workflows']+ },{name: 'workflows',description: 'Building complex multi-step workflows',diff --git a/src/cli/simple-cli.js b/src/cli/simple-cli.jsindex 2d29f5ebd5..17c75a5e9f 100644--- a/src/cli/simple-cli.js+++ b/src/cli/simple-cli.js@@ -14,6 +14,7 @@ USAGE:claude-flow [COMMAND] [OPTIONS]COMMANDS:+ init Initialize Claude Code integration filesstart Start the orchestration systemagent Manage agents (spawn, list, terminate, info)task Manage tasks (create, list, status, cancel, workflow)@@ -23,6 +24,7 @@ COMMANDS:monitor Monitor system in real-timesession Manage terminal sessionsworkflow Execute workflow files+ claude Spawn Claude instances with specific configurationsrepl Start interactive REPL modeversion Show version informationhelp Show this help message@@ -34,9 +36,12 @@ GLOBAL OPTIONS:--help Show help for specific commandEXAMPLES:+ claude-flow init # Initialize Claude integration filesclaude-flow start # Start orchestratorclaude-flow agent spawn researcher --name "Bot" # Spawn research agentclaude-flow task create research "Analyze data" # Create task+ claude-flow claude spawn "implement auth" --research # Spawn Claude with web research+ claude-flow claude spawn "fix bug" --no-permissions # Spawn Claude without permission promptsclaude-flow config init # Initialize configclaude-flow status # Show system statusclaude-flow workflow my-workflow.json # Execute workflow@@ -91,6 +96,100 @@ async function main() {printHelp();break;+ case 'init':+ // Parse init options+ const initForce = subArgs.includes('--force') || subArgs.includes('-f');+ const initMinimal = subArgs.includes('--minimal') || subArgs.includes('-m');++ try {+ printSuccess('Initializing Claude Code integration files...');++ // Check if files already exist+ const files = ['CLAUDE.md', 'memory-bank.md', 'coordination.md'];+ const existingFiles = [];++ for (const file of files) {+ try {+ await Deno.stat(file);+ existingFiles.push(file);+ } catch {+ // File doesn't exist, which is what we want+ }+ }++ if (existingFiles.length > 0 && !initForce) {+ printWarning(`The following files already exist: ${existingFiles.join(', ')}`);+ console.log('Use --force to overwrite existing files');+ break;+ }++ // Create CLAUDE.md+ const claudeMd = initMinimal ? createMinimalClaudeMd() : createFullClaudeMd();+ await Deno.writeTextFile('CLAUDE.md', claudeMd);+ console.log(' β Created CLAUDE.md');++ // Create memory-bank.md+ const memoryBankMd = initMinimal ? createMinimalMemoryBankMd() : createFullMemoryBankMd();+ await Deno.writeTextFile('memory-bank.md', memoryBankMd);+ console.log(' β Created memory-bank.md');++ // Create coordination.md+ const coordinationMd = initMinimal ? createMinimalCoordinationMd() : createFullCoordinationMd();+ await Deno.writeTextFile('coordination.md', coordinationMd);+ console.log(' β Created coordination.md');++ // Create directory structure+ const directories = [+ 'memory',+ 'memory/agents',+ 'memory/sessions',+ 'coordination',+ 'coordination/memory_bank',+ 'coordination/subtasks',+ 'coordination/orchestration'+ ];++ for (const dir of directories) {+ try {+ await Deno.mkdir(dir, { recursive: true });+ console.log(` β Created ${dir}/ directory`);+ } catch (err) {+ if (!(err instanceof Deno.errors.AlreadyExists)) {+ throw err;+ }+ }+ }++ // Create placeholder files+ const agentsReadme = createAgentsReadme();+ await Deno.writeTextFile('memory/agents/README.md', agentsReadme);+ console.log(' β Created memory/agents/README.md');++ const sessionsReadme = createSessionsReadme();+ await Deno.writeTextFile('memory/sessions/README.md', sessionsReadme);+ console.log(' β Created memory/sessions/README.md');++ // Initialize persistence database+ const initialData = {+ agents: [],+ tasks: [],+ lastUpdated: Date.now()+ };+ await Deno.writeTextFile('memory/claude-flow-data.json', JSON.stringify(initialData, null, 2));+ console.log(' β Created memory/claude-flow-data.json (persistence database)');++ printSuccess('Claude Code integration files initialized successfully!');+ console.log('\nNext steps:');+ console.log('1. Review and customize the generated files for your project');+ console.log('2. Run \'npx claude-flow start\' to begin the orchestration system');+ console.log('3. Use \'claude --dangerously-skip-permissions\' for unattended operation');+ console.log('\nNote: Persistence database initialized at memory/claude-flow-data.json');++ } catch (err) {+ printError(`Failed to initialize files: ${err.message}`);+ }+ break;+case 'start':printSuccess('Starting Claude-Flow orchestration system...');printWarning('Full orchestrator implementation coming soon!');@@ -199,6 +298,147 @@ async function main() {console.log('π‘ This will provide a full interactive shell for Claude-Flow operations');break;+ case 'claude':+ const claudeCmd = subArgs[0];+ switch (claudeCmd) {+ case 'spawn':+ // Extract task description and flags+ let taskEndIndex = subArgs.length;+ for (let i = 1; i < subArgs.length; i++) {+ if (subArgs[i].startsWith('-')) {+ taskEndIndex = i;+ break;+ }+ }++ const task = subArgs.slice(1, taskEndIndex).join(' ');+ if (!task) {+ printError('Usage: claude spawn <task description> [options]');+ break;+ }++ // Parse flags+ const flags = {};+ for (let i = taskEndIndex; i < subArgs.length; i++) {+ const arg = subArgs[i];+ if (arg === '--tools' || arg === '-t') {+ flags.tools = subArgs[++i];+ } else if (arg === '--no-permissions') {+ flags.noPermissions = true;+ } else if (arg === '--config' || arg === '-c') {+ flags.config = subArgs[++i];+ } else if (arg === '--mode' || arg === '-m') {+ flags.mode = subArgs[++i];+ } else if (arg === '--parallel') {+ flags.parallel = true;+ } else if (arg === '--research') {+ flags.research = true;+ } else if (arg === '--coverage') {+ flags.coverage = parseInt(subArgs[++i]);+ } else if (arg === '--commit') {+ flags.commit = subArgs[++i];+ } else if (arg === '--verbose' || arg === '-v') {+ flags.verbose = true;+ } else if (arg === '--dry-run' || arg === '-d') {+ flags.dryRun = true;+ }+ }++ // Build tools list+ let tools = flags.tools || 'View,Edit,Replace,GlobTool,GrepTool,LS,Bash';+ if (flags.parallel) {+ tools += ',BatchTool,dispatch_agent';+ }+ if (flags.research) {+ tools += ',WebFetchTool';+ }++ const instanceId = `claude-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;++ if (flags.dryRun) {+ printWarning('DRY RUN - Would execute:');+ console.log(`Command: claude "${task}" --allowedTools ${tools}`);+ console.log(`Instance ID: ${instanceId}`);+ console.log(`Task: ${task}`);+ console.log(`Tools: ${tools}`);+ console.log(`Mode: ${flags.mode || 'full'}`);+ console.log(`Coverage: ${flags.coverage || 80}%`);+ console.log(`Commit: ${flags.commit || 'phase'}`);+ } else {+ printSuccess(`Spawning Claude instance: ${instanceId}`);+ console.log(`π Task: ${task}`);+ console.log(`π§ Tools: ${tools}`);+ console.log(`βοΈ Mode: ${flags.mode || 'full'}`);+ console.log(`π Coverage: ${flags.coverage || 80}%`);+ console.log(`πΎ Commit: ${flags.commit || 'phase'}`);+ console.log('');++ // Build the actual claude command+ const claudeArgs = [task];+ claudeArgs.push('--allowedTools', tools);++ if (flags.noPermissions) {+ claudeArgs.push('--dangerously-skip-permissions');+ }++ if (flags.config) {+ claudeArgs.push('--mcp-config', flags.config);+ }++ if (flags.verbose) {+ claudeArgs.push('--verbose');+ }++ // Execute the actual claude command+ try {+ const command = new Deno.Command('claude', {+ args: claudeArgs,+ env: {+ ...Deno.env.toObject(),+ CLAUDE_INSTANCE_ID: instanceId,+ CLAUDE_FLOW_MODE: flags.mode || 'full',+ CLAUDE_FLOW_COVERAGE: (flags.coverage || 80).toString(),+ CLAUDE_FLOW_COMMIT: flags.commit || 'phase',+ },+ stdin: 'inherit',+ stdout: 'inherit',+ stderr: 'inherit',+ });++ const child = command.spawn();+ const status = await child.status;++ if (status.success) {+ printSuccess(`Claude instance ${instanceId} completed successfully`);+ } else {+ printError(`Claude instance ${instanceId} exited with code ${status.code}`);+ }+ } catch (err) {+ printError(`Failed to spawn Claude: ${err.message}`);+ console.log('Make sure you have the Claude CLI installed.');+ }+ }+ break;++ case 'batch':+ const workflowFile = subArgs[1];+ if (!workflowFile) {+ printError('Usage: claude batch <workflow-file>');+ break;+ }+ printSuccess(`Loading workflow: ${workflowFile}`);+ console.log('π Batch execution would process workflow file');+ break;++ default:+ console.log('Claude commands: spawn, batch');+ console.log('\nExamples:');+ console.log(' claude-flow claude spawn "implement user authentication" --research --parallel');+ console.log(' claude-flow claude spawn "fix bug in payment system" --no-permissions');+ console.log(' claude-flow claude batch workflow.json --dry-run');+ }+ break;+default:printError(`Unknown command: ${command}`);console.log('Run "claude-flow help" for available commands');@@ -206,6 +446,319 @@ async function main() {}}+// Helper functions for init command+function createMinimalClaudeMd() {+ return `# Claude Code Integration++This file provides guidance to Claude when working with this codebase.++## Project Overview+[Describe your project here]++## Key Conventions+- Code style guidelines+- Naming conventions+- Architecture patterns++## Important Notes+- Special considerations+- Areas to be careful with+`;+}++function createFullClaudeMd() {+ return `# Claude Code Integration Guide++This document provides comprehensive guidance to Claude when working with this codebase.++## Project Overview+[Provide a detailed description of your project, its purpose, and main features]++## Architecture+[Describe the overall architecture, main components, and how they interact]++## Code Conventions+- **Naming**: [Describe naming conventions for files, functions, variables, etc.]+- **Style**: [Code formatting preferences, linting rules]+- **Patterns**: [Design patterns used in the project]+- **Testing**: [Testing approach and requirements]++## Directory Structure+\`\`\`+project/+βββ src/ # Source code+βββ tests/ # Test files+βββ docs/ # Documentation+βββ ... # Other directories+\`\`\`++## Development Workflow+1. [Step-by-step development process]+2. [How to run tests]+3. [How to build/deploy]++## Important Considerations+- [Security considerations]+- [Performance requirements]+- [Compatibility requirements]++## Common Tasks+- **Add a new feature**: [Instructions]+- **Fix a bug**: [Process]+- **Update documentation**: [Guidelines]++## Dependencies+[List key dependencies and their purposes]++## Troubleshooting+[Common issues and solutions]+`;+}++function createMinimalMemoryBankMd() {+ return `# Memory Bank++Session memory and context storage.++## Current Session+- Started: ${new Date().toISOString()}+- Context: [Current work context]++## Key Information+- [Important facts to remember]++## Progress Log+- [Track progress here]+`;+}++function createFullMemoryBankMd() {+ return `# Memory Bank++This file serves as persistent memory storage for Claude across sessions.++## Session Information+- **Current Session**: Started ${new Date().toISOString()}+- **Project Phase**: [Development/Testing/Production]+- **Active Tasks**: [List current tasks]++## Project Context+### Technical Stack+- Languages: [List languages used]+- Frameworks: [List frameworks]+- Tools: [Development tools]++### Architecture Decisions+- [Record key architectural decisions]+- [Rationale for technology choices]++## Important Information+### API Keys and Secrets+- [Never store actual secrets here, just references]++### External Services+- [List integrated services]+- [Configuration requirements]++### Database Schema+- [Current schema version]+- [Recent migrations]++## Progress Tracking+### Completed Tasks+- [x] [Completed task 1]+- [x] [Completed task 2]++### In Progress+- [ ] [Current task 1]+- [ ] [Current task 2]++### Upcoming+- [ ] [Future task 1]+- [ ] [Future task 2]++## Code Patterns+### Established Patterns+\`\`\`javascript+// Example pattern+\`\`\`++### Anti-patterns to Avoid+- [List anti-patterns]++## Meeting Notes+### [Date]+- Participants: [Names]+- Decisions: [Key decisions]+- Action items: [Tasks assigned]++## Debugging History+### Issue: [Issue name]+- **Date**: [Date]+- **Symptoms**: [What was observed]+- **Root Cause**: [What caused it]+- **Solution**: [How it was fixed]++## Performance Metrics+- [Baseline metrics]+- [Optimization goals]++## Documentation Links+- [API Documentation]: [URL]+- [Design Documents]: [URL]+- [Issue Tracker]: [URL]+`;+}++function createMinimalCoordinationMd() {+ return `# Coordination++Task and workflow coordination.++## Active Tasks+1. [Current task]++## Workflow+- [ ] Step 1+- [ ] Step 2++## Resources+- [Available resources]+`;+}++function createFullCoordinationMd() {+ return `# Coordination Center++Central coordination for multi-agent collaboration and task management.++## Active Agents+| Agent ID | Type | Status | Assigned Tasks | Last Active |+|----------|------|--------|----------------|-------------|+| [ID] | [Type] | [Status] | [Tasks] | [Timestamp] |++## Task Queue+### High Priority+1. **[Task Name]**+ - Description: [What needs to be done]+ - Assigned to: [Agent ID]+ - Dependencies: [Other tasks]+ - Deadline: [Date/Time]++### Medium Priority+1. [Task details]++### Low Priority+1. [Task details]++## Workflow Definitions+### [Workflow Name]+\`\`\`yaml+name: [Workflow Name]+description: [What this workflow does]+steps:+ - name: [Step 1]+ agent: [Agent type]+ action: [What to do]+ - name: [Step 2]+ agent: [Agent type]+ action: [What to do]+ depends_on: [Step 1]+\`\`\`++## Resource Allocation+### Computational Resources+- CPU: [Usage/Limits]+- Memory: [Usage/Limits]+- Storage: [Usage/Limits]++### External Resources+- API Rate Limits: [Service: limit]+- Database Connections: [Current/Max]++## Communication Channels+### Inter-Agent Messages+- [Agent A β Agent B]: [Message type]++### External Communications+- Webhooks: [Configured webhooks]+- Notifications: [Notification settings]++## Synchronization Points+- [Sync Point 1]: [Description]+- [Sync Point 2]: [Description]++## Conflict Resolution+### Strategy+- [How conflicts are resolved]++### Recent Conflicts+- [Date]: [Conflict description] β [Resolution]++## Performance Metrics+### Task Completion+- Average time: [Time]+- Success rate: [Percentage]++### Agent Efficiency+- [Agent Type]: [Metrics]++## Scheduled Maintenance+- [Date/Time]: [What will be done]++## Emergency Procedures+### System Overload+1. [Step 1]+2. [Step 2]++### Agent Failure+1. [Recovery procedure]+`;+}++function createAgentsReadme() {+ return `# Agents Directory++This directory stores agent-specific memory and state information.++## Structure+Each agent gets its own subdirectory named by agent ID:+- \`agent-001/\`: First agent's memory+- \`agent-002/\`: Second agent's memory+- etc.++## Files per Agent+- \`profile.json\`: Agent configuration and capabilities+- \`memory.md\`: Agent's working memory+- \`tasks.json\`: Assigned tasks and their status+- \`metrics.json\`: Performance metrics++## Usage+Files in this directory are automatically managed by the Claude-Flow system.+`;+}++function createSessionsReadme() {+ return `# Sessions Directory++This directory stores session-specific information and terminal states.++## Structure+Each session gets a unique directory:+- \`session-[timestamp]/\`: Session data+ - \`metadata.json\`: Session metadata+ - \`terminal.log\`: Terminal output+ - \`commands.history\`: Command history+ - \`state.json\`: Session state snapshot++## Retention Policy+Sessions are retained for 30 days by default, then archived or deleted based on configuration.++## Usage+The Claude-Flow system automatically manages session files. Do not modify these files manually.+`;+}+if (import.meta.main) {await main();}\ No newline at end of file