claude-flow-novice
Version:
Claude Flow Novice - Advanced orchestration platform for multi-agent AI workflows with CFN Loop architecture Includes Local RuVector Accelerator and all CFN skills for complete functionality.
571 lines (443 loc) โข 15.7 kB
Markdown
# Installation Process - claude-flow-novice v2.9.1
This document explains what happens when users install `claude-flow-novice` via npm or npx, including the namespace-isolated installation process with `cfn-init`.
---
## ๐ฆ Installation Methods
### Method 1: Local Installation + cfn-init (Recommended)
```bash
npm install claude-flow-novice
npx cfn-init
```
**What happens:**
1. **Package Download** - npm downloads `claude-flow-novice-2.9.1.tgz` from npm registry (~573 KB compressed)
2. **Extraction** - Extracts 303 files to local node_modules (~2.4 MB unpacked - 68% smaller than v2.0.0)
3. **Dependency Installation** - Installs 8 production dependencies:
- `ajv` - JSON schema validation
- `better-sqlite3` - SQLite database (may require compilation)
- `chalk` - Terminal colors
- `commander` - CLI framework
- `dotenv` - Environment variables
- `lodash` - Utility functions
- `redis` - Redis client
- `sqlite3` - SQLite bindings
4. **Binary Linking** - Creates symlinks in local node_modules/.bin:
- `claude-flow-novice` โ Main CLI
- `cfn-init` โ Project initialization (NEW in v2.9.0)
- `cfn-spawn` โ Agent spawning
- `cfn-loop` โ CFN Loop execution
- `cfn-swarm` โ Swarm coordination
- `cfn-portal` โ Web portal management
- `cfn-context` โ Context operations
- `cfn-metrics` โ Metrics tracking
- `cfn-redis` โ Redis operations
5. **Postinstall Hook** - Displays welcome message:
```
โ
claude-flow-novice installed successfully!
๐ Get started: npx claude-flow-novice --help
๐ง Initialize project: npx cfn-init
๐ก CFN loops: npx cfn-loop "Task description"
```
6. **Initialize Project** - Run `npx cfn-init` to copy namespace-isolated files:
```
โ
Created directory: .claude/agents/cfn-dev-team
โ
Copied 23 agents
โ
Copied 43 cfn-* skills
โ
Copied 7 cfn-* hooks
โ
Copied 45 commands to cfn/
โ
CFN-CLAUDE.md copied to project root
```
**Installation time:** ~6-10 seconds for npm install, ~2 seconds for cfn-init
**Location:**
- Linux/Mac: `~/.nvm/versions/node/vX.X.X/lib/node_modules/claude-flow-novice/`
- Windows: `%APPDATA%\npm\node_modules\claude-flow-novice\`
**Usage after install:**
```bash
# Global command available
claude-flow-novice --help
claude-flow-novice status
# Or with npx (same result)
npx claude-flow-novice --help
```
---
### Method 2: Local Project Installation
```bash
cd my-project
npm install claude-flow-novice
```
**What happens:**
1. **Same download and extraction** as global install
2. **Installed to local node_modules** - `./node_modules/claude-flow-novice/`
3. **Binary in local .bin** - `./node_modules/.bin/claude-flow-novice`
4. **Postinstall hook runs** - Same welcome message
**Usage after install:**
```bash
# Via npx (searches local first)
npx claude-flow-novice --help
# Via npm scripts in package.json
{
"scripts": {
"orchestrate": "claude-flow-novice status"
}
}
# Direct path
./node_modules/.bin/claude-flow-novice --help
```
---
### Method 3: npx Without Installation (One-Time Use)
```bash
npx claude-flow-novice@latest --help
```
**What happens:**
1. **Temporary Download** - npx downloads package to npm cache
2. **Temporary Extraction** - Extracts to temporary directory
3. **Runs Command** - Executes the CLI command
4. **Keeps in Cache** - Package remains in npm cache for future use
5. **No Postinstall Hook** - Skipped for npx one-time use
**Cache location:**
- Linux/Mac: `~/.npm/_npx/`
- Windows: `%LOCALAPPDATA%\npm-cache\_npx\`
**When to use:**
- Testing the CLI before installing
- One-off commands
- CI/CD pipelines (no persistent install needed)
---
## ๐ง What Gets Installed
### File Structure After Installation (v2.9.1 - Namespace Isolated)
**In node_modules:**
```
node_modules/claude-flow-novice/
โโโ dist/ # 101 compiled JS files
โ โโโ cli/
โ โ โโโ index.js # Main CLI entry point
โ โ โโโ spawn.js # Agent spawning utility
โ โโโ core/ # Core orchestration logic
โ โโโ swarm/ # Swarm management
โ โโโ ... (other modules)
โ
โโโ .claude/ # Namespace-isolated files (NOT copied to project)
โ โโโ agents/
โ โ โโโ cfn-dev-team/ # 23 agents (isolated in subfolder)
โ โ โโโ coordinators/
โ โ โโโ developers/
โ โ โโโ reviewers/
โ โ โโโ testers/
โ โ
โ โโโ skills/ # 43 cfn-* prefixed skills
โ โ โโโ cfn-redis-coordination/
โ โ โโโ cfn-agent-spawning/
โ โ โโโ cfn-loop-validation/
โ โ โโโ ... (40 more cfn-* skills)
โ โ
โ โโโ commands/
โ โ โโโ cfn/ # 45+ commands in subfolder
โ โ โโโ cfn-loop.md
โ โ โโโ cfn-loop-single.md
โ โ โโโ ... (43 more)
โ โ
โ โโโ hooks/ # 7 cfn-* prefixed hooks
โ โ โโโ cfn-post-edit.sh
โ โ โโโ cfn-invoke-post-edit.sh
โ โ โโโ ... (5 more)
โ โ
โ โโโ cfn-data/ # SQLite databases, playbook data
โ
โโโ scripts/
โ โโโ cfn-init.js # cfn-init script
โ โโโ ... (essential scripts)
โโโ package.json # Package metadata
โโโ README.md # User documentation
โโโ CFN-CLAUDE.md # Project instructions (renamed)
โโโ LICENSE # MIT License
```
**After running `npx cfn-init` (copied to your project root):**
```
your-project/
โโโ .claude/
โ โโโ agents/
โ โ โโโ cfn-dev-team/ # โ
Copied from package
โ โ โโโ your-custom-team/ # โ ๏ธ Preserved (not overwritten)
โ โ
โ โโโ skills/
โ โ โโโ cfn-redis-coordination/ # โ
Copied
โ โ โโโ cfn-agent-spawning/ # โ
Copied
โ โ โโโ your-custom-skill/ # โ ๏ธ Preserved
โ โ
โ โโโ hooks/
โ โ โโโ cfn-post-edit.sh # โ
Copied
โ โ โโโ your-custom-hook.sh # โ ๏ธ Preserved
โ โ
โ โโโ commands/
โ โ โโโ cfn/ # โ
Copied (isolated in subfolder)
โ โ โโโ your-commands.md # โ ๏ธ Preserved
โ โ
โ โโโ cfn-data/ # โ
Copied
โ
โโโ CFN-CLAUDE.md # โ
Copied (reference file)
โโโ CLAUDE.md # โ ๏ธ Preserved (user's existing file)
```
**Key Benefits:**
- โ
Only `cfn-*` prefixed files are copied/overwritten
- โ
User's custom agents, skills, hooks preserved
- โ
~0.01% collision risk
- โ
Safe to run `npx cfn-init` multiple times (updates CFN files only)
---
## โ๏ธ Installation Hooks & Lifecycle
### NPM Lifecycle Scripts
Our package uses these lifecycle hooks:
#### 1. `prepack` (Before Creating Tarball)
```json
"prepack": "npm run build"
```
- **Runs:** When npm creates the package tarball (`npm pack`, `npm publish`)
- **Purpose:** Ensures `dist/` directory is built before packaging
- **Users don't see this** - Only runs during publishing
#### 2. `postinstall` (After Installation)
```json
"postinstall": "node -e \"console.log('...')\"
```
- **Runs:** After package is installed to node_modules
- **Purpose:** Welcome message with quick start instructions
- **Output:**
```
โ
claude-flow-novice installed successfully!
๐ Get started: npx claude-flow-novice --help
๐ง Initialize: npx claude-flow-novice status
```
---
## ๐ What Users See
### Typical Installation Output
```bash
$ npm install -g claude-flow-novice
added 145 packages, and audited 146 packages in 8s
17 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
โ
claude-flow-novice installed successfully!
๐ Get started: npx claude-flow-novice --help
๐ง Initialize: npx claude-flow-novice status
```
### First Run
```bash
$ claude-flow-novice --help
Claude Flow Novice v2.0 - Clean Architecture
Claude Flow Novice CLI v2.0.0
Usage: claude-flow-novice [options] [command]
AI agent orchestration framework with skills-based coordination
Options:
-V, --version output the version number
-h, --help display help for command
Commands:
status Check system status
agent <type> Spawn an agent
swarm <objective> Execute swarm coordination
help [command] display help for command
```
---
## ๐งช Dependency Compilation
### better-sqlite3 (Native Module)
**May require compilation** on some systems:
```bash
# During install, users may see:
> better-sqlite3@12.4.1 install
> node-gyp rebuild
# This is normal - compiling native SQLite bindings
```
**Requirements:**
- **Linux:** `python3`, `make`, `g++`
- **Mac:** Xcode Command Line Tools
- **Windows:** `windows-build-tools` or Visual Studio
**If compilation fails:**
```bash
# Linux/Mac
sudo apt-get install python3 make g++
npm install -g claude-flow-novice
# Windows
npm install --global windows-build-tools
npm install -g claude-flow-novice
```
**Alternative:** Pre-built binaries are usually available for common platforms
---
## ๐ Post-Installation Setup
### Required: Redis Server
Users must have Redis running for coordination features:
```bash
# Check Redis status
redis-cli ping
# Expected: PONG
# If not installed:
# Mac
brew install redis
brew services start redis
# Linux
sudo apt-get install redis-server
sudo systemctl start redis
# Docker
docker run -d -p 6379:6379 redis:latest
```
### Verify Installation
```bash
# Check CLI is accessible
claude-flow-novice status
# Expected output:
# Claude Flow Novice v2.0 - Clean Architecture
# Claude Flow Novice CLI v2.0.0
# Redis: Connected โ
/ Not Connected โ
# SQLite: Available โ
# Skills: 12 loaded
# Agents: 60 available
```
### Optional: Configuration
```bash
# Create .env file (optional)
cat > .env <<EOF
REDIS_URL=redis://localhost:6379
ANTHROPIC_API_KEY=your_key_here
ZAI_API_KEY=your_key_here
EOF
# Initialize project configuration
claude-flow-novice init
```
---
## ๐ Installation Metrics (v2.9.1)
### Package Size
- **Compressed (download):** ~573 KB (68% reduction from v2.0.0)
- **Unpacked (disk):** ~2.4 MB (84% reduction from v2.0.0)
- **With dependencies:** ~25-30 MB
- **After cfn-init:** +~2 MB in project root (namespace-isolated files)
### Installation Time
- **Fast network:** 4-6 seconds (smaller package)
- **Average network:** 8-12 seconds
- **Slow network:** 15-20 seconds
- **With native compilation:** +10-20 seconds
- **cfn-init:** +1-2 seconds (file copying)
### File Count
- **Package files:** 303 (68% reduction from v2.0.0)
- **Agents:** 23 in cfn-dev-team
- **Skills:** 43 with cfn- prefix
- **Hooks:** 7 with cfn- prefix
- **Commands:** 45+ in cfn/ subdirectory
### Dependency Count
- **Production deps:** 8
- **Total packages (with transitive):** ~145
---
## ๐ Update Process
### Updating the Package
```bash
# Check current version
claude-flow-novice --version
# Output: 2.0.0
# Update to latest
npm update -g claude-flow-novice
# Or reinstall
npm uninstall -g claude-flow-novice
npm install -g claude-flow-novice@latest
# Check new version
claude-flow-novice --version
# Output: 2.1.0 (or latest)
```
**What happens during update:**
1. npm downloads new version
2. Replaces old files in node_modules
3. Re-runs `postinstall` hook (welcome message)
4. Updates binary symlinks
---
## โ Uninstallation
### Remove Package
```bash
# Global uninstall
npm uninstall -g claude-flow-novice
# Local uninstall
npm uninstall claude-flow-novice
```
**What gets removed:**
- All package files from node_modules
- Binary symlinks from bin directory
- NPM cache entry (if using `--cache`)
**What persists:**
- User-created configuration files (`.env`, etc.)
- Redis data (swarm state, metrics)
- SQLite databases (if created)
- Generated files in user's projects
---
## ๐ Common Installation Issues
### Issue 1: Permission Denied (Global Install)
```bash
# Error: EACCES: permission denied
# Solution: Use npx or fix npm permissions
# Option 1: Use npx (no global install needed)
npx claude-flow-novice --help
# Option 2: Fix npm permissions (recommended)
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
npm install -g claude-flow-novice
# Option 3: Use sudo (not recommended)
sudo npm install -g claude-flow-novice
```
### Issue 2: better-sqlite3 Compilation Failure
```bash
# Error: node-gyp rebuild failed
# Solution: Install build tools
# Ubuntu/Debian
sudo apt-get install python3 make g++
# Mac
xcode-select --install
# Windows
npm install --global windows-build-tools
```
### Issue 3: Redis Not Found
```bash
# After install, running commands fails
# Error: Redis connection refused
# Solution: Install and start Redis
brew install redis # Mac
sudo apt install redis # Linux
brew services start redis # Mac
sudo systemctl start redis # Linux
```
---
## ๐ฏ Best Practices for Users
### Recommended Installation Flow
```bash
# 1. Install Redis first
brew install redis && brew services start redis
# 2. Install claude-flow-novice
npm install -g claude-flow-novice
# 3. Verify installation
claude-flow-novice status
# 4. Create project configuration (optional)
cd my-project
claude-flow-novice init
# 5. Start using
claude-flow-novice swarm "Build REST API"
```
### For CI/CD Pipelines
```bash
# Use npx for one-time execution (no install)
npx claude-flow-novice@latest agent coder
# Or cache installation in pipeline
npm ci
npx claude-flow-novice status
```
---
## ๐ Summary (v2.9.1)
**Installation is straightforward:**
1. **Download** - npm fetches package (~573 KB - 68% smaller than v2.0.0)
2. **Extract** - 303 files to node_modules (~2.4 MB)
3. **Dependencies** - 145 packages installed
4. **Binaries** - 8 CLI commands linked (including cfn-init)
5. **Welcome** - Postinstall message guides next steps
6. **Initialize** - `npx cfn-init` copies namespace-isolated files to project root
**Users can then:**
- Run `npx cfn-loop "Task description"` for self-correcting workflows
- Access 23 production agents in cfn-dev-team
- Use 43 namespace-isolated skills (cfn-* prefix)
- Execute CFN Loop workflows with 95-98% cost savings
- Coordinate swarms via Redis with zero-token waiting
- Customize and extend with their own agents/skills (preserved)
**Namespace isolation benefits:**
- โ
~0.01% collision risk with user files
- โ
Safe to update (only cfn-* files overwritten)
- โ
User's custom agents, skills, hooks fully preserved
- โ
Can run `npx cfn-init` multiple times safely
**All skills and supporting files are included and ready to use!**