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

checkpoint: File edit:

rUv8eb6762763f6
diff --git a/v3/@claude-flow/cli/src/init/executor.ts b/v3/@claude-flow/cli/src/init/executor.ts
index 96cce15cb7..9a698ccba3 100644
--- a/v3/@claude-flow/cli/src/init/executor.ts
+++ b/v3/@claude-flow/cli/src/init/executor.ts
@@ -451,24 +451,57 @@ async function writeStatusline(
options: InitOptions,
result: InitResult
): Promise<void> {
+ const claudeDir = path.join(targetDir, '.claude');
const helpersDir = path.join(targetDir, '.claude', 'helpers');
- const statuslineScript = generateStatuslineScript(options);
- const statuslineHook = generateStatuslineHook(options);
+ // Try to copy existing advanced statusline files from source
+ const sourceBaseDir = options.sourceBaseDir;
+ const advancedStatuslineFiles = [
+ { src: 'statusline.sh', dest: 'statusline.sh', dir: claudeDir },
+ { src: 'statusline.mjs', dest: 'statusline.mjs', dir: claudeDir },
+ ];
- const files: Record<string, string> = {
- 'statusline.js': statuslineScript,
- 'statusline-hook.sh': statuslineHook,
- };
+ let copiedAdvanced = false;
+ if (sourceBaseDir) {
+ for (const file of advancedStatuslineFiles) {
+ const sourcePath = path.join(sourceBaseDir, '.claude', file.src);
+ const destPath = path.join(file.dir, file.dest);
+
+ if (fs.existsSync(sourcePath)) {
+ if (!fs.existsSync(destPath) || options.force) {
+ fs.copyFileSync(sourcePath, destPath);
+ // Make shell scripts executable
+ if (file.src.endsWith('.sh')) {
+ fs.chmodSync(destPath, '755');
+ }
+ result.created.files.push(`.claude/${file.dest}`);
+ copiedAdvanced = true;
+ } else {
+ result.skipped.push(`.claude/${file.dest}`);
+ }
+ }
+ }
+ }
- for (const [name, content] of Object.entries(files)) {
- const filePath = path.join(helpersDir, name);
+ // Fall back to generating simple statusline if advanced files not available
+ if (!copiedAdvanced) {
+ const statuslineScript = generateStatuslineScript(options);
+ const statuslineHook = generateStatuslineHook(options);
- if (!fs.existsSync(filePath) || options.force) {
- fs.writeFileSync(filePath, content, 'utf-8');
- result.created.files.push(`.claude/helpers/${name}`);
- } else {
- result.skipped.push(`.claude/helpers/${name}`);
+ const files: Record<string, string> = {
+ 'statusline.js': statuslineScript,
+ 'statusline-hook.sh': statuslineHook,
+ };
+
+ for (const [name, content] of Object.entries(files)) {
+ const filePath = path.join(helpersDir, name);
+
+ if (!fs.existsSync(filePath) || options.force) {
+ fs.writeFileSync(filePath, content, 'utf-8');
+ result.created.files.push(`.claude/helpers/${name}`);
+ } else {
+ result.skipped.push(`.claude/helpers/${name}`);
+ }
}
}
}
diff --git a/v3/implementation/init/CONFIGURATION.md b/v3/implementation/init/CONFIGURATION.md
new file mode 100644
index 0000000000..9207fc3024
--- /dev/null
+++ b/v3/implementation/init/CONFIGURATION.md
@@ -0,0 +1,294 @@
+# Configuration Options
+
+Complete reference for V3 init configuration options.
+
+## InitOptions Interface
+
+```typescript
+interface InitOptions {
+ targetDir: string; // Target directory for initialization
+ sourceBaseDir?: string; // Source directory for skills/commands/agents
+ force: boolean; // Overwrite existing files
+ interactive: boolean; // Enable interactive prompts
+ components: InitComponents; // Components to initialize
+ hooks: HooksConfig; // Hooks configuration
+ skills: SkillsConfig; // Skills selection
+ commands: CommandsConfig; // Commands selection
+ agents: AgentsConfig; // Agents selection
+ statusline: StatuslineConfig; // Statusline configuration
+ mcp: MCPConfig; // MCP server configuration
+ runtime: RuntimeConfig; // Runtime configuration
+}
+```
+
+## Components
+
+Control which components are created:
+
+```typescript
+interface InitComponents {
+ settings: boolean; // .claude/settings.json
+ skills: boolean; // .claude/skills/
+ commands: boolean; // .claude/commands/
+ agents: boolean; // .claude/agents/
+ helpers: boolean; // .claude/helpers/
+ statusline: boolean; // Statusline scripts
+ mcp: boolean; // .mcp.json
+ runtime: boolean; // .claude-flow/
+}
+```
+
+| Component | Default | Minimal | Full |
+|-----------|---------|---------|------|
+| settings | true | true | true |
+| skills | true | true | true |
+| commands | true | false | true |
+| agents | true | false | true |
+| helpers | true | false | true |
+| statusline | true | false | true |
+| mcp | true | true | true |
+| runtime | true | true | true |
+
+## Hooks Configuration
+
+Configure which Claude Code hooks are enabled:
+
+```typescript
+interface HooksConfig {
+ preToolUse: boolean; // Before tool execution
+ postToolUse: boolean; // After tool execution
+ userPromptSubmit: boolean; // Task routing
+ sessionStart: boolean; // Session initialization
+ stop: boolean; // Task completion evaluation
+ notification: boolean; // Swarm notifications
+ permissionRequest: boolean; // Auto-allow claude-flow tools
+ timeout: number; // Hook timeout (ms)
+ continueOnError: boolean; // Continue if hook fails
+}
+```
+
+### Default Hook Settings
+```typescript
+{
+ preToolUse: true,
+ postToolUse: true,
+ userPromptSubmit: true,
+ sessionStart: true,
+ stop: true,
+ notification: true,
+ permissionRequest: true,
+ timeout: 5000,
+ continueOnError: true
+}
+```
+
+## Skills Configuration
+
+Select which skill sets to install:
+
+```typescript
+interface SkillsConfig {
+ core: boolean; // swarm-orchestration, sparc-methodology, etc.
+ agentdb: boolean; // agentdb-*, reasoningbank-*
+ github: boolean; // github-code-review, github-multi-repo, etc.
+ flowNexus: boolean; // flow-nexus-neural, flow-nexus-platform, etc.
+ v3: boolean; // v3-cli-modernization, v3-core-implementation, etc.
+ all: boolean; // Install all available skills
+}
+```
+
+### Skills by Category
+
+**Core Skills:**
+- swarm-orchestration
+- swarm-advanced
+- sparc-methodology
+- hooks-automation
+- pair-programming
+- verification-quality
+- stream-chain
+- skill-builder
+
+**AgentDB Skills:**
+- agentdb-advanced
+- agentdb-learning
+- agentdb-memory-patterns
+- agentdb-optimization
+- agentdb-vector-search
+- reasoningbank-agentdb
+- reasoningbank-intelligence
+
+**GitHub Skills:**
+- github-code-review
+- github-multi-repo
+- github-project-management
+- github-release-management
+- github-workflow-automation
+
+**Flow Nexus Skills:**
+- flow-nexus-neural
+- flow-nexus-platform
+- flow-nexus-swarm
+
+**V3 Skills:**
+- v3-cli-modernization
+- v3-core-implementation
+- v3-ddd-architecture
+- v3-integration-deep
+- v3-mcp-optimization
+- v3-memory-unification
+- v3-performance-optimization
+- v3-security-overhaul
+- v3-swarm-coordination
+
+## Commands Configuration
+
+Select which command groups to install:
+
+```typescript
+interface CommandsConfig {
+ core: boolean; // claude-flow-help, claude-flow-swarm, etc.
+ analysis: boolean; // analysis/
+ automation: boolean; // automation/
+ github: boolean; // github/
+ hooks: boolean; // hooks/
+ monitoring: boolean; // monitoring/
+ optimization: boolean; // optimization/
+ sparc: boolean; // sparc/
+ all: boolean; // Install all commands
+}
+```
+
+## Agents Configuration
+
+Select which agent categories to install:
+
+```typescript
+interface AgentsConfig {
+ core: boolean; // core/ (coder, tester, reviewer, etc.)
+ consensus: boolean; // consensus/
+ github: boolean; // github/
+ hiveMind: boolean; // hive-mind/
+ sparc: boolean; // sparc/
+ swarm: boolean; // swarm/
+ all: boolean; // Install all agents
+}
+```
+
+## Statusline Configuration
+
+Configure shell statusline integration:
+
+```typescript
+interface StatuslineConfig {
+ enabled: boolean; // Enable statusline
+ showProgress: boolean; // Show V3 progress
+ showSecurity: boolean; // Show security status
+ showSwarm: boolean; // Show swarm activity
+ showHooks: boolean; // Show hooks metrics
+ showPerformance: boolean; // Show performance targets
+ refreshInterval: number; // Refresh interval (ms)
+}
+```
+
+## MCP Configuration
+
+Configure MCP server integration:
+
+```typescript
+interface MCPConfig {
+ claudeFlow: boolean; // Include claude-flow MCP server
+ ruvSwarm: boolean; // Include ruv-swarm MCP server
+ flowNexus: boolean; // Include flow-nexus MCP server
+ autoStart: boolean; // Auto-start MCP server
+ port: number; // Server port
+}
+```
+
+## Runtime Configuration
+
+Configure V3 runtime settings:
+
+```typescript
+interface RuntimeConfig {
+ topology: 'mesh' | 'hierarchical' | 'hierarchical-mesh' | 'adaptive';
+ maxAgents: number; // Maximum concurrent agents
+ memoryBackend: 'memory' | 'sqlite' | 'agentdb' | 'hybrid';
+ enableHNSW: boolean; // Enable HNSW indexing
+ enableNeural: boolean; // Enable neural learning
+}
+```
+
+### Topology Options
+
+| Topology | Description | Best For |
+|----------|-------------|----------|
+| mesh | Peer-to-peer coordination | Small teams, simple tasks |
+| hierarchical | Tree-based coordination | Large teams, complex tasks |
+| hierarchical-mesh | Combined approach | Complex projects (recommended) |
+| adaptive | Dynamic switching | Variable workloads |
+
+### Memory Backend Options
+
+| Backend | Speed | Persistence | Vector Search | Best For |
+|---------|-------|-------------|---------------|----------|
+| memory | Fast | No | No | Development, testing |
+| sqlite | Medium | Yes | No | Standard projects |
+| agentdb | Fast | Yes | 150x faster | AI-heavy workloads |
+| hybrid | Fast | Yes | Yes | Production (recommended) |
+
+## Preset Configurations
+
+### DEFAULT_INIT_OPTIONS
+```typescript
+{
+ components: { all: true except statusline },
+ hooks: { all: true },
+ skills: { core, agentdb, github, v3 },
+ commands: { all: true },
+ agents: { core, github, hiveMind, sparc, swarm },
+ runtime: {
+ topology: 'hierarchical-mesh',
+ maxAgents: 15,
+ memoryBackend: 'hybrid',
+ enableHNSW: true,
+ enableNeural: true
+ }
+}
+```
+
+### MINIMAL_INIT_OPTIONS
+```typescript
+{
+ components: { settings, skills, mcp, runtime only },
+ hooks: { preToolUse, postToolUse, permissionRequest only },
+ skills: { core only },
+ agents: { core only },
+ runtime: {
+ topology: 'mesh',
+ maxAgents: 5,
+ memoryBackend: 'memory',
+ enableHNSW: false,
+ enableNeural: false
+ }
+}
+```
+
+### FULL_INIT_OPTIONS
+```typescript
+{
+ components: { all: true },
+ hooks: { all: true },
+ skills: { all: true },
+ commands: { all: true },
+ agents: { all: true },
+ mcp: { claudeFlow, ruvSwarm, flowNexus },
+ runtime: {
+ topology: 'hierarchical-mesh',
+ maxAgents: 15,
+ memoryBackend: 'hybrid',
+ enableHNSW: true,
+ enableNeural: true
+ }
+}
+```
diff --git a/v3/implementation/init/README.md b/v3/implementation/init/README.md
new file mode 100644
index 0000000000..ff878734e0
--- /dev/null
+++ b/v3/implementation/init/README.md
@@ -0,0 +1,116 @@
+# V3 Init System
+
+Comprehensive initialization system for Claude Flow V3 with Claude Code integration.
+
+## Overview
+
+The V3 init system creates a complete Claude Code integration setup including:
+- `.claude/` directory with settings, skills, commands, agents, and helpers
+- `.claude-flow/` directory for V3 runtime configuration
+- `.mcp.json` for MCP server configuration
+
+## Quick Start
+
+```bash
+# Default initialization (recommended settings)
+claude-flow init
+
+# Interactive wizard
+claude-flow init wizard
+
+# Minimal setup (core features only)
+claude-flow init --minimal
+
+# Full setup (all components)
+claude-flow init --full
+```
+
+## Architecture
+
+```
+v3/@claude-flow/cli/src/init/
+β”œβ”€β”€ types.ts # Configuration interfaces
+β”œβ”€β”€ settings-generator.ts # settings.json with hooks
+β”œβ”€β”€ mcp-generator.ts # .mcp.json configuration
+β”œβ”€β”€ statusline-generator.ts # Shell statusline scripts
+β”œβ”€β”€ helpers-generator.ts # Utility helper scripts
+β”œβ”€β”€ executor.ts # Main execution logic
+└── index.ts # Module exports
+```
+
+## Generated Structure
+
+```
+project/
+β”œβ”€β”€ .claude/
+β”‚ β”œβ”€β”€ settings.json # Claude Code hooks configuration
+β”‚ β”œβ”€β”€ skills/ # Claude Code skills
+β”‚ β”œβ”€β”€ commands/ # Claude Code commands
+β”‚ β”œβ”€β”€ agents/ # Agent definitions
+β”‚ └── helpers/ # Utility scripts
+β”œβ”€β”€ .claude-flow/
+β”‚ β”œβ”€β”€ config.yaml # V3 runtime configuration
+β”‚ β”œβ”€β”€ data/ # Persistent data storage
+β”‚ β”œβ”€β”€ logs/ # Log files
+β”‚ β”œβ”€β”€ sessions/ # Session archives
+β”‚ β”œβ”€β”€ hooks/ # Custom hooks
+β”‚ β”œβ”€β”€ agents/ # Agent state
+β”‚ └── workflows/ # Workflow definitions
+└── .mcp.json # MCP server configuration
+```
+
+## Documentation
+
+- [Configuration Options](./CONFIGURATION.md) - All configuration options
+- [Hooks Reference](./HOOKS.md) - Generated hooks documentation
+- [Components](./COMPONENTS.md) - Component details
+- [API Reference](./API.md) - Programmatic API usage
+
+## Commands
+
+| Command | Description |
+|---------|-------------|
+| `init` | Initialize with default settings |
+| `init wizard` | Interactive setup wizard |
+| `init check` | Check initialization status |
+| `init skills` | Install only skills |
+| `init hooks` | Initialize only hooks |
+
+## Options
+
+| Flag | Short | Description |
+|------|-------|-------------|
+| `--force` | `-f` | Overwrite existing files |
+| `--minimal` | `-m` | Minimal configuration |
+| `--full` | | Full configuration with all components |
+| `--skip-claude` | | Skip .claude/ directory |
+| `--only-claude` | | Only create .claude/ directory |
+
+## Presets
+
+### Default
+Recommended settings for most projects:
+- Core skills, AgentDB, GitHub, V3 skills
+- All command groups
+- Core, GitHub, SPARC, Swarm agents
+- All 7 hook types enabled
+- Hierarchical-mesh topology
+- 15 max agents
+- Hybrid memory backend
+
+### Minimal
+Lightweight configuration:
+- Core skills only
+- Core agents only
+- Essential hooks (PreToolUse, PostToolUse, PermissionRequest)
+- Mesh topology
+- 5 max agents
+- In-memory backend
+
+### Full
+Everything enabled:
+- All skill sets including Flow Nexus
+- All command groups
+- All agent categories
+- All hook types
+- All MCP servers