Files
ruflo/bin/init
Claude e59a043240 fix: Fix agent creation in init --force command (v2.7.41)
Fixes GitHub issue where `npx claude-flow init --force` with v2.7.40
was not creating agents in .claude/agents folder.

## Root Cause
1. Path calculation in agent-copier.js was incorrect (was ../../../../
   instead of ../../ from bin/init/)
2. SQLite native binding errors were crashing the init process before
   reaching the agent copying phase
3. Duplicate "Initializing Hive Mind System..." messages

## Changes
- bin/init/agent-copier.js: Fix path to ../../.claude/agents (from bin/init/)
- bin/init/hive-mind-init.js: Test SQLite binding availability before use
- src/cli/simple-commands/init/hive-mind-init.js: Same SQLite fix
- bin/init/index.js: Remove duplicate hive-mind init message
- src/cli/simple-commands/init/index.js: Remove duplicate message
- package.json: Bump version to 2.7.41

## Verified
- init --force --skip-mcp creates 76 agent files
- Creates agents, commands, skills, helpers directories
- Creates settings.json with hooks configuration
- Fallback to JSON database when SQLite unavailable

Fixes #887 (agent creation on init)
2025-11-29 18:00:18 +00:00
..

Init Command - Modular Structure

This directory contains the modular implementation of the claude-flow init command, which initializes Claude Code integration files for projects.

Directory Structure

init/
├── README.md                    # This file
├── index.js                     # Main entry point for init command
├── help.js                      # Help text and documentation
├── executable-wrapper.js        # Creates local executable wrappers
├── sparc-structure.js          # SPARC environment setup
├── templates/                   # Template files
│   ├── claude-md.js            # CLAUDE.md templates
│   ├── memory-bank-md.js       # memory-bank.md templates
│   ├── coordination-md.js      # coordination.md templates
│   └── readme-files.js         # README templates for directories
├── sparc/                       # SPARC-specific configuration
│   ├── roomodes-config.js      # .roomodes configuration
│   ├── workflows.js            # SPARC workflow templates
│   └── roo-readme.js           # .roo directory README
└── claude-commands/             # Claude Code slash commands
    ├── slash-commands.js        # Main slash command creator
    ├── sparc-commands.js        # SPARC-specific commands
    └── claude-flow-commands.js  # Claude-Flow specific commands

What Gets Created

With --sparc flag:

  1. Claude Code Configuration:

    • CLAUDE.md - SPARC-enhanced project instructions
    • .claude/ directory structure
    • .claude/commands/ - Slash commands for Claude Code
    • .claude/logs/ - Conversation logs directory
  2. Memory System:

    • memory-bank.md - Memory system documentation
    • memory/ directory structure
    • memory/agents/ - Agent-specific memory
    • memory/sessions/ - Session storage
    • memory/claude-flow-data.json - Persistence database
  3. Coordination System:

    • coordination.md - Agent coordination documentation
    • coordination/ directory structure
  4. SPARC Environment:

    • .roomodes - SPARC mode configurations (17+ modes)
    • .roo/ directory with templates and workflows
  5. Slash Commands Created:

    • /sparc - Main SPARC command
    • /sparc-<mode> - Individual mode commands (architect, code, tdd, etc.)
    • /claude-flow-help - Help command
    • /claude-flow-memory - Memory system command
    • /claude-flow-swarm - Swarm coordination command
  6. Local Executable:

    • ./claude-flow (Unix/Mac/Linux)
    • claude-flow.cmd (Windows)

With --minimal flag:

Creates minimal versions of all configuration files without SPARC features.

With --force flag:

Overwrites existing files if they already exist.

Usage

# Recommended first-time setup with SPARC
npx claude-flow@latest init --sparc

# Minimal setup
npx claude-flow init --minimal

# Force overwrite existing files
npx claude-flow init --force

Module Responsibilities

  • index.js: Main orchestration and file creation logic
  • help.js: User documentation and examples
  • executable-wrapper.js: Platform-specific executable creation
  • sparc-structure.js: SPARC environment setup and integration
  • templates/: All template content for generated files
  • sparc/: SPARC-specific configurations and templates
  • claude-commands/: Claude Code slash command generation

Notes

  • The init command detects Claude Code's .claude/ directory structure
  • Slash commands follow Claude Code's markdown format with YAML frontmatter
  • SPARC modes are fully integrated with Claude-Flow's orchestration system
  • All generated files include comprehensive documentation