[Feature Request] Add proper uninstallation/removal command for Claude-Flow
[Feature Request] Add proper uninstallation/removal command for Claude-Flow
Problem Description
Currently, there is no official way to properly remove Claude-Flow from a repository after installation. Running npm uninstall -g claude-flow only removes the global package but leaves behind numerous artifacts and directories that continue to affect the repository.
Current Issues
-
No documentation for removal: The README and documentation lack any uninstallation guide
-
Persistent artifacts: After npm uninstall, the following directories and files remain:
.swarm/(with constantly updating SQLite database).hive-mind/memory/coordination/.claude/modificationsclaude-flow.config.json.mcp.jsonCLAUDE.md
-
Constantly changing files: The metrics files in
.swarm/memory.dbcontinuously update, causing git to show uncommitted changes:performance.jsonsystem-metrics.jsontask-metrics.jsonmemory.db
-
Interference with Claude Code: Users who want to keep using native Claude Code (the official Anthropic tool) but remove Claude-Flow wrapper have no clean way to do so without potentially affecting their Claude Code setup.
Reproduction Steps
- Install claude-flow:
npm install -g claude-flow - Initialize in a project:
claude-flow init - Try to uninstall:
npm uninstall -g claude-flow - Observe that all directories and configurations remain
- VS Code continues showing changing files in
.swarm/
Expected Behavior
There should be a command like claude-flow uninstall or claude-flow remove that:
- Removes all Claude-Flow specific directories (
.swarm/,.hive-mind/,memory/,coordination/) - Reverts any modifications to
.claude/settings while preserving native Claude Code configuration - Removes Claude-Flow specific config files (
claude-flow.config.json,.mcp.json,CLAUDE.md) - Provides clear feedback about what was removed
- Optionally backs up configurations before removal
Proposed Solution
Implement a removal command that could work like:
# Remove Claude-Flow from current repository
claude-flow remove
# With options:
claude-flow remove --backup # Creates backup before removal
claude-flow remove --global # Also uninstalls the global package
claude-flow remove --force # Skip confirmation prompts
Workaround (Manual Removal)
Until an official solution is provided, users must manually clean up:
# Remove all Claude-Flow artifacts (preserving native Claude Code)
rm -rf .swarm/
rm -rf .hive-mind/
rm -rf memory/
rm -rf coordination/
rm -f claude-flow.config.json
rm -f .mcp.json
rm -f CLAUDE.md
# Then uninstall globally
npm uninstall -g claude-flow
npm cache clean --force
Additional Context
- Related to issue #373 where users report
.swarmdirectories respawning after deletion - The lack of proper cleanup affects users who want to switch between Claude-Flow and native Claude Code
- This is particularly problematic in version-controlled projects where the constantly updating metrics files create noise in git status
Environment
- Claude-Flow version: 2.0.0 Alpha
- Using with: VS Code + Claude Code
This feature would greatly improve the user experience and make Claude-Flow more production-ready by providing a clean exit strategy for users who need to remove it from their projects.
#!/bin/bash
# ============================================================================
# Claude-Flow Uninstaller Script
# ============================================================================
# This script safely removes Claude-Flow while preserving Claude Code
# Version: 1.0.0
# Date: 2025-01-18
# ============================================================================
set -e
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Script configuration
BACKUP_DIR=".claude-flow-backup-$(date +%Y%m%d-%H%M%S)"
DRY_RUN=false
FORCE=false
VERBOSE=false
# Parse command line arguments
while [[ $# -gt 0 ]]; do
case $1 in
--dry-run)
DRY_RUN=true
shift
;;
--force)
FORCE=true
shift
;;
--verbose)
VERBOSE=true
shift
;;
--help)
echo "Usage: $0 [OPTIONS]"
echo ""
echo "Options:"
echo " --dry-run Show what would be removed without actually removing"
echo " --force Skip confirmation prompts"
echo " --verbose Show detailed output"
echo " --help Show this help message"
exit 0
;;
*)
echo -e "${RED}Unknown option: $1${NC}"
exit 1
;;
esac
done
# Function to print messages
print_info() {
echo -e "${BLUE}[INFO]${NC} $1"
}
print_success() {
echo -e "${GREEN}[SUCCESS]${NC} $1"
}
print_warning() {
echo -e "${YELLOW}[WARNING]${NC} $1"
}
print_error() {
echo -e "${RED}[ERROR]${NC} $1"
}
# Function to execute or simulate commands
execute_cmd() {
if [ "$VERBOSE" = true ]; then
echo -e "${BLUE}[CMD]${NC} $1"
fi
if [ "$DRY_RUN" = true ]; then
echo -e "${YELLOW}[DRY-RUN]${NC} Would execute: $1"
else
eval "$1"
fi
}
# Header
echo ""
echo "============================================"
echo " Claude-Flow Uninstaller Script"
echo "============================================"
echo ""
if [ "$DRY_RUN" = true ]; then
print_warning "Running in DRY-RUN mode - no changes will be made"
echo ""
fi
# Check if we're in a git repository
if ! git rev-parse --is-inside-work-tree > /dev/null 2>&1; then
print_warning "Not in a git repository. Some features may not work."
fi
# Confirmation
if [ "$FORCE" = false ] && [ "$DRY_RUN" = false ]; then
echo -e "${YELLOW}This script will remove Claude-Flow from your project.${NC}"
echo -e "${GREEN}Claude Code settings and data will be preserved.${NC}"
echo ""
read -p "Do you want to continue? (y/N): " -n 1 -r
echo ""
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
print_info "Uninstallation cancelled"
exit 0
fi
fi
# Create backup directory
if [ "$DRY_RUN" = false ]; then
print_info "Creating backup directory: $BACKUP_DIR"
mkdir -p "$BACKUP_DIR"
fi
# ============================================================================
# STEP 1: Backup Claude-Flow configurations
# ============================================================================
print_info "Step 1: Backing up Claude-Flow configurations..."
# Backup configuration files if they exist
for file in "claude-flow.config.json" ".mcp.json" "CLAUDE.md"; do
if [ -f "$file" ]; then
execute_cmd "cp '$file' '$BACKUP_DIR/' 2>/dev/null || true"
print_success "Backed up: $file"
fi
done
# ============================================================================
# STEP 2: Remove Claude-Flow from npm dependencies
# ============================================================================
print_info "Step 2: Removing Claude-Flow from npm dependencies..."
if [ -f "package.json" ]; then
if grep -q "claude-flow" package.json; then
execute_cmd "npm uninstall claude-flow --save"
print_success "Removed claude-flow from package.json"
else
print_info "claude-flow not found in package.json"
fi
fi
# ============================================================================
# STEP 3: Clean Claude settings from Claude-Flow hooks
# ============================================================================
print_info "Step 3: Cleaning Claude Code settings..."
# Backup original Claude settings
if [ -f ".claude/settings.json" ]; then
execute_cmd "cp '.claude/settings.json' '$BACKUP_DIR/claude-settings.json.backup'"
if [ "$DRY_RUN" = false ]; then
# Create cleaned settings file
print_info "Removing Claude-Flow hooks from .claude/settings.json..."
# Create a temporary Python script to clean the JSON
cat > /tmp/clean_claude_settings.py << 'EOF'
import json
import sys
with open('.claude/settings.json', 'r') as f:
settings = json.load(f)
# Remove Claude-Flow specific entries
if 'enabledMcpjsonServers' in settings:
settings['enabledMcpjsonServers'] = [
s for s in settings['enabledMcpjsonServers']
if s not in ['claude-flow', 'ruv-swarm']
]
if not settings['enabledMcpjsonServers']:
del settings['enabledMcpjsonServers']
# Remove Claude-Flow from approved tools
if 'approvedTools' in settings:
settings['approvedTools'] = [
tool for tool in settings['approvedTools']
if 'claude-flow' not in tool.lower() and 'ruv-swarm' not in tool.lower()
]
# Remove Claude-Flow hooks
if 'hooks' in settings:
for hook_type in ['preCommand', 'postCommand', 'preEdit', 'postEdit', 'sessionEnd']:
if hook_type in settings['hooks']:
settings['hooks'][hook_type] = [
hook for hook in settings['hooks'][hook_type]
if 'claude-flow' not in hook.get('command', '').lower()
]
if not settings['hooks'][hook_type]:
del settings['hooks'][hook_type]
if not settings['hooks']:
del settings['hooks']
# Write cleaned settings
with open('.claude/settings.json', 'w') as f:
json.dump(settings, f, indent=2)
print("Claude settings cleaned successfully")
EOF
python3 /tmp/clean_claude_settings.py
rm /tmp/clean_claude_settings.py
print_success "Cleaned .claude/settings.json"
fi
fi
# ============================================================================
# STEP 4: Remove Claude-Flow directories
# ============================================================================
print_info "Step 4: Removing Claude-Flow directories..."
# List of directories to remove
CLAUDE_FLOW_DIRS=(
".claude-flow"
".swarm"
".hive-mind"
"memory"
"coordination"
"swarm-runs"
)
for dir in "${CLAUDE_FLOW_DIRS[@]}"; do
if [ -d "$dir" ]; then
execute_cmd "rm -rf '$dir'"
print_success "Removed directory: $dir"
fi
done
# ============================================================================
# STEP 5: Remove Claude-Flow files
# ============================================================================
print_info "Step 5: Removing Claude-Flow files..."
# List of files to remove
CLAUDE_FLOW_FILES=(
"claude-flow"
"claude-flow.bat"
"claude-flow.ps1"
"claude-flow.config.json"
"swarm-commands.sh"
"coordination.md"
"memory-bank.md"
"CLAUDE.md"
".mcp.json"
)
for file in "${CLAUDE_FLOW_FILES[@]}"; do
if [ -f "$file" ]; then
execute_cmd "rm -f '$file'"
print_success "Removed file: $file"
fi
done
# Remove any hive-mind-prompt files
execute_cmd "rm -f hive-mind-prompt-*.txt 2>/dev/null || true"
# ============================================================================
# STEP 6: Clean up .gitignore
# ============================================================================
print_info "Step 6: Cleaning .gitignore..."
if [ -f ".gitignore" ] && [ "$DRY_RUN" = false ]; then
# Backup .gitignore
cp .gitignore "$BACKUP_DIR/.gitignore.backup"
# Create a temporary file with cleaned gitignore
sed '/# Claude Flow generated files/,/^$/d' .gitignore | \
sed '/# Claude Flow metrics/,/^$/d' | \
grep -v "\.swarm/" | \
grep -v "\.hive-mind/" | \
grep -v "memory/claude-flow-data\.json" | \
grep -v "memory/sessions/\*" | \
grep -v "memory/agents/\*" | \
grep -v "coordination/memory_bank/\*" | \
grep -v "coordination/subtasks/\*" | \
grep -v "coordination/orchestration/\*" | \
grep -v "claude-flow\.config\.json" | \
grep -v "claude-flow$" | \
grep -v "claude-flow\.bat" | \
grep -v "claude-flow\.ps1" | \
grep -v "hive-mind-prompt-\*\.txt" | \
grep -v "\.claude-flow/metrics/" > .gitignore.tmp
mv .gitignore.tmp .gitignore
print_success "Cleaned .gitignore"
fi
# ============================================================================
# STEP 7: Clear npm cache (optional)
# ============================================================================
print_info "Step 7: Clearing npm cache..."
execute_cmd "npm cache clean --force 2>/dev/null || true"
# ============================================================================
# STEP 8: Uninstall global Claude-Flow (if requested)
# ============================================================================
if command -v claude-flow &> /dev/null; then
print_warning "Global claude-flow installation detected"
if [ "$FORCE" = false ] && [ "$DRY_RUN" = false ]; then
read -p "Do you want to uninstall global claude-flow? (y/N): " -n 1 -r
echo ""
if [[ $REPLY =~ ^[Yy]$ ]]; then
execute_cmd "npm uninstall -g claude-flow"
print_success "Uninstalled global claude-flow"
fi
fi
fi
# ============================================================================
# STEP 9: Final cleanup and verification
# ============================================================================
print_info "Step 9: Final verification..."
# Check for any remaining Claude-Flow artifacts
remaining_files=$(find . -name "*claude-flow*" -o -name "*swarm*" -o -name "*hive-mind*" 2>/dev/null | grep -v node_modules | grep -v "$BACKUP_DIR" || true)
if [ -n "$remaining_files" ]; then
print_warning "Some Claude-Flow related files may still exist:"
echo "$remaining_files"
fi
# ============================================================================
# Summary
# ============================================================================
echo ""
echo "============================================"
echo " Uninstallation Complete"
echo "============================================"
echo ""
if [ "$DRY_RUN" = true ]; then
print_info "This was a DRY-RUN. No actual changes were made."
else
print_success "Claude-Flow has been successfully removed!"
print_info "Backup created at: $BACKUP_DIR"
print_info "Claude Code settings have been preserved"
echo ""
echo "Next steps:"
echo "1. Run 'git status' to review changes"
echo "2. Commit the changes if everything looks correct"
echo "3. Delete the backup directory when you're sure: rm -rf $BACKUP_DIR"
fi
echo ""
print_info "Thank you for using Claude-Flow!"
@westhighr the script didnt work. .claude-flow and .swarn directories keep spawning
@westhighr the script didnt work. .claude-flow and .swarn directories keep spawning
I apologize for not having the time to write a detailed response, as I am not the maintainer of this project and have only tested it on an isolated container. The script provided is intended solely as inspiration for the maintainer to implement a mechanismfor removing this tool.
WARNING: This tool injected 45,216 lines of code and 259 files into my project
Here's a comprehensive removal guide based on my experience:
#!/bin/bash
# Claude-Flow Complete Removal Script - TESTED ORDER
# 1. Kill ALL processes (they respawn!)
pkill -f "claude-flow"
pkill -f "ruv-swarm"
pkill -f "mcp"
# Check what's still running
ps aux | grep -i "claude-flow" | grep -v grep
# Force kill by PID if needed: kill -9 [PID]
# 2. NPM cleanup
sudo npm uninstall -g claude-flow
npm uninstall claude-flow
sudo rm -rf ~/.npm/_npx/*claude-flow*
npm cache clean --force
# 3. Remove directories (they're EVERYWHERE!)
rm -rf .claude-flow/
rm -rf .swarm/
rm -rf .hive-mind/
rm -rf .roo/ # Yes, this too!
rm -rf .claude/agents/
rm -rf .claude/commands/
rm -rf .claude/helpers/
rm -f .claude/config.json
rm -f .claude/settings.local.json
# 4. Clean up hidden scripts
rm -f init-agent-knowledge.sh
rm -f use-custom-agent.sh
rm -f claude-flow*
# 5. Remove from node_modules
rm -rf node_modules/claude-flow
rm -rf node_modules/@claude-flow
# 6. Clean package files
grep -v "claude-flow" package.json > package.json.tmp && mv package.json.tmp package.json
npm prune
npm dedupe
# 7. Clean documentation pollution
rm -f docs/enterprise-*.md
rm -f docs/swarm-*.md
rm -f security-audit-report.json
rm -rf security-reports/
# 8. Clean .gitignore
# Remove all claude-flow related entries manually
# 9. System-wide cleanup
sudo rm -rf ~/.claude-flow/
sudo rm -rf /tmp/*claude-flow*
# 10. Git cleanup (if you committed by accident)
git rm -r --cached .claude-flow/ .swarm/ .roo/
Additional directories/files this tool creates:
- .claude/ - Completely restructured with 70+ "agent" files
- .roo/ - 30+ "rules" files
- docs/ - Filled with "enterprise-architecture"
- .gitignore - Modified with 20+ claude-flow entries
- Hidden shell scripts throughout the project
@westhighr, thank you for your effort. This really should be something done by the development team, as it's a recurring issue affecting a lot of users. I was unable to find ANY documentation in discord or github on how to remove claude-flow effectively
EDIT.. If anyone else runs into this issue check --> ~/.claude/settings.json for injected claude-flow hooks.
Extended removal script based on my current setup. Please check it yourself.
#!/bin/bash
# ============================================================
# PERMANENT CLAUDE FLOW REMOVAL SCRIPT
# ============================================================
# This script completely removes all Claude Flow and Swarm
# MCP servers from your system and prevents them from
# coming back.
# ============================================================
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
CYAN='\033[0;36m'
NC='\033[0m'
echo -e "${RED}ββββββββββββββββββββββββββββββββββββββββββββββ${NC}"
echo -e "${RED}β CLAUDE FLOW PERMANENT REMOVAL SCRIPT β${NC}"
echo -e "${RED}ββββββββββββββββββββββββββββββββββββββββββββββ${NC}"
echo ""
echo -e "${YELLOW}This will permanently remove Claude Flow/Swarm from your system!${NC}"
echo ""
# Step 1: Kill all running processes
echo -e "${CYAN}Step 1: Killing all Claude Flow/Swarm processes...${NC}"
PIDS=$(ps aux | grep -E "claude-flow|ruv-swarm" | grep -v grep | awk '{print $2}')
if [ -n "$PIDS" ]; then
echo "$PIDS" | xargs -r kill -9 2>/dev/null
echo -e "${GREEN}β Killed $(echo "$PIDS" | wc -l) processes${NC}"
else
echo -e "${GREEN}β No processes found${NC}"
fi
# Step 2: Remove directories
echo ""
echo -e "${CYAN}Step 2: Removing Claude Flow directories...${NC}"
rm -rf .swarm .claude-flow 2>/dev/null
rm -rf ~/.swarm ~/.claude-flow 2>/dev/null
rm -rf /tmp/.swarm /tmp/.claude-flow 2>/dev/null
rm -rf ~/.config/claude-flow ~/.config/ruv-swarm 2>/dev/null
echo -e "${GREEN}β Directories removed${NC}"
# Step 3: Clean npm cache
echo ""
echo -e "${CYAN}Step 3: Cleaning npm cache...${NC}"
rm -rf ~/.npm/_npx/*claude-flow* 2>/dev/null
rm -rf ~/.npm/_npx/*ruv-swarm* 2>/dev/null
npm cache clean --force 2>/dev/null
echo -e "${GREEN}β NPM cache cleaned${NC}"
# Step 4: Remove from package.json if exists
echo ""
echo -e "${CYAN}Step 4: Checking package.json...${NC}"
if [ -f "package.json" ]; then
if grep -q "claude-flow\|ruv-swarm" package.json; then
cp package.json package.json.backup
sed -i '/claude-flow/d' package.json
sed -i '/ruv-swarm/d' package.json
echo -e "${GREEN}β Removed from package.json (backup saved)${NC}"
else
echo -e "${GREEN}β Not found in package.json${NC}"
fi
fi
# Step 5: Remove from claude_desktop_config.json
echo ""
echo -e "${CYAN}Step 5: Checking Claude Desktop config...${NC}"
CLAUDE_CONFIG="$HOME/.config/Claude/claude_desktop_config.json"
if [ -f "$CLAUDE_CONFIG" ]; then
if grep -q "claude-flow\|ruv-swarm" "$CLAUDE_CONFIG"; then
cp "$CLAUDE_CONFIG" "$CLAUDE_CONFIG.backup"
# Remove claude-flow and ruv-swarm MCP server entries
jq 'del(.mcpServers."claude-flow") | del(.mcpServers."ruv-swarm")' "$CLAUDE_CONFIG" > "$CLAUDE_CONFIG.tmp"
mv "$CLAUDE_CONFIG.tmp" "$CLAUDE_CONFIG"
echo -e "${GREEN}β Removed from Claude Desktop config (backup saved)${NC}"
else
echo -e "${GREEN}β Not found in Claude Desktop config${NC}"
fi
else
echo -e "${YELLOW}β Claude Desktop config not found${NC}"
fi
# Step 6: Create prevention script
echo ""
echo -e "${CYAN}Step 6: Creating prevention measures...${NC}"
# Create a blocking script
cat > ~/.config/block-claude-flow.sh << 'EOF'
#!/bin/bash
# This script blocks Claude Flow from running
while true; do
pkill -f "claude-flow" 2>/dev/null
pkill -f "ruv-swarm" 2>/dev/null
rm -rf .swarm .claude-flow 2>/dev/null
sleep 5
done
EOF
chmod +x ~/.config/block-claude-flow.sh
echo -e "${GREEN}β Created blocking script${NC}"
# Step 7: Check for any remaining references
echo ""
echo -e "${CYAN}Step 7: Checking for remaining references...${NC}"
REMAINING=$(find . -type f -name "*.json" -o -name "*.js" -o -name "*.ts" 2>/dev/null | xargs grep -l "claude-flow\|ruv-swarm" 2>/dev/null | grep -v node_modules | grep -v ".git")
if [ -n "$REMAINING" ]; then
echo -e "${YELLOW}β Found references in:${NC}"
echo "$REMAINING"
echo ""
echo "Review these files manually and remove any Claude Flow references."
else
echo -e "${GREEN}β No references found${NC}"
fi
# Step 8: Final verification
echo ""
echo -e "${CYAN}Step 8: Final verification...${NC}"
sleep 2
# Check if processes came back
if ps aux | grep -E "claude-flow|ruv-swarm" | grep -v grep > /dev/null; then
echo -e "${RED}β WARNING: Processes have respawned!${NC}"
echo "Claude Flow is being started by another process."
echo "Check your shell configuration and startup scripts."
else
echo -e "${GREEN}β No processes running${NC}"
fi
# Check if directories came back
if [ -d ".swarm" ] || [ -d ".claude-flow" ]; then
echo -e "${RED}β WARNING: Directories have been recreated!${NC}"
echo "Something is actively creating these directories."
else
echo -e "${GREEN}β Directories remain deleted${NC}"
fi
echo ""
echo -e "${GREEN}ββββββββββββββββββββββββββββββββββββββββ${NC}"
echo -e "${GREEN} CLEANUP COMPLETE!${NC}"
echo -e "${GREEN}ββββββββββββββββββββββββββββββββββββββββ${NC}"
echo ""
echo "Actions taken:"
echo " β Killed all Claude Flow/Swarm processes"
echo " β Removed all related directories"
echo " β Cleaned NPM cache"
echo " β Removed from configuration files"
echo " β Created prevention measures"
echo ""
echo -e "${YELLOW}IMPORTANT for team members:${NC}"
echo "1. Run this script: ./REMOVE_CLAUDE_FLOW_PERMANENTLY.sh"
echo "2. Restart Claude Desktop after running this script"
echo "3. Never run: npm exec claude-flow or npm exec ruv-swarm"
echo ""
echo -e "${CYAN}To prevent auto-start (optional):${NC}"
echo "Run the blocker in background: ~/.config/block-claude-flow.sh &"
echo ""
echo -e "${RED}If problems persist, check:${NC}"
echo " - Claude Desktop settings"
echo " - Shell startup files (.bashrc, .zshrc)"
echo " - Any automation scripts"
@westhighr Thank you kind sir.
I had this issue: βΊ PreToolUse:Bash [cat | jq -r '.tool_input.command // empty' | tr '\n' '\0' | xargs -0 -I {} npx claude-flow@alpha hooks pre-command --command '{}' --validate-safety true --prepare-resources true] failed with non-blocking status code 1: xargs: command line cannot be assembled, too long
βΊ PostToolUse:Bash [cat | jq -r '.tool_input.command // empty' | tr '\n' '\0' | xargs -0 -I {} npx claude-flow@alpha hooks post-command --command '{}' --track-metrics true --store-results true] failed with non-blocking status code 1: xargs: command line cannot be assembled, too long
This is the small fix:
` - CLAUDE_FLOW_HOOKS_ENABLED=true
- CLAUDE_FLOW_AUTO_COMMIT=true
- CLAUDE_FLOW_AUTO_PUSH=true
- CLAUDE_FLOW_TELEMETRY_ENABLED=true
- CLAUDE_FLOW_REMOTE_EXECUTION=true
- CLAUDE_FLOW_CHECKPOINTS_ENABLED=true`
with the whole script (check it carefully run it on your own responsibility!)
# ============================================================
# SURGICAL CLAUDE FLOW REMOVAL SCRIPT v2.1
# ============================================================
# Only removes claude-flow hooks, preserves all other hooks
# ============================================================
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
CYAN='\033[0;36m'
BLUE='\033[0;34m'
NC='\033[0m'
# Detect OS
OS="$(uname -s)"
case "${OS}" in
Linux*) MACHINE=Linux;;
Darwin*) MACHINE=Mac;;
*) MACHINE="UNKNOWN:${OS}"
esac
echo -e "${RED}ββββββββββββββββββββββββββββββββββββββββββββββ${NC}"
echo -e "${RED}β SURGICAL CLAUDE FLOW REMOVAL SCRIPT β${NC}"
echo -e "${RED}β Version 2.1 β${NC}"
echo -e "${RED}ββββββββββββββββββββββββββββββββββββββββββββββ${NC}"
echo ""
echo -e "${BLUE}Detected OS: ${MACHINE}${NC}"
echo -e "${YELLOW}This will surgically remove ONLY Claude Flow/Swarm components!${NC}"
echo ""
# Function to backup file with timestamp
backup_file() {
local file="$1"
if [ -f "$file" ]; then
local backup="${file}.backup.$(date +%Y%m%d_%H%M%S)"
cp "$file" "$backup"
echo -e "${GREEN}β Backed up to: $backup${NC}"
fi
}
# Function to remove claude-flow lines with sed (cross-platform)
remove_claude_flow_lines() {
local file="$1"
if [ -f "$file" ]; then
if [[ "$MACHINE" == "Mac" ]]; then
# Remove lines containing claude-flow or ruv-swarm
sed -i '' '/claude-flow/d' "$file"
sed -i '' '/ruv-swarm/d' "$file"
sed -i '' '/CLAUDE_FLOW_/d' "$file"
else
sed -i '/claude-flow/d' "$file"
sed -i '/ruv-swarm/d' "$file"
sed -i '/CLAUDE_FLOW_/d' "$file"
fi
fi
}
# Step 1: Kill all running processes
echo -e "${CYAN}Step 1: Killing Claude Flow/Swarm processes...${NC}"
PIDS=$(ps aux | grep -E "claude-flow|ruv-swarm" | grep -v grep | awk '{print $2}')
if [ -n "$PIDS" ]; then
echo "$PIDS" | xargs -r kill -9 2>/dev/null
echo -e "${GREEN}β Killed $(echo "$PIDS" | wc -l) processes${NC}"
else
echo -e "${GREEN}β No processes found${NC}"
fi
# Step 2: Remove NPM packages
echo ""
echo -e "${CYAN}Step 2: Removing Claude Flow NPM packages...${NC}"
npm uninstall -g claude-flow 2>/dev/null
npm uninstall -g claude-flow@alpha 2>/dev/null
npm uninstall -g claude-flow@beta 2>/dev/null
npm uninstall -g claude-flow@latest 2>/dev/null
npm uninstall -g ruv-swarm 2>/dev/null
npm uninstall -g ruv-swarm@alpha 2>/dev/null
# Clean NPX cache (claude-flow specific)
rm -rf ~/.npm/_npx/*claude-flow* 2>/dev/null
rm -rf ~/.npm/_npx/*ruv-swarm* 2>/dev/null
echo -e "${GREEN}β Claude Flow NPM packages removed${NC}"
# Step 3: Remove directories
echo ""
echo -e "${CYAN}Step 3: Removing Claude Flow directories...${NC}"
DIRS_TO_REMOVE=(
".swarm"
".claude-flow"
"~/.swarm"
"~/.claude-flow"
"/tmp/.swarm"
"/tmp/.claude-flow"
"~/.config/claude-flow"
"~/.config/ruv-swarm"
"~/.local/share/claude-flow"
"~/.local/share/ruv-swarm"
)
# Add macOS-specific paths
if [[ "$MACHINE" == "Mac" ]]; then
DIRS_TO_REMOVE+=(
"~/Library/Application Support/claude-flow"
"~/Library/Application Support/ruv-swarm"
)
fi
for dir in "${DIRS_TO_REMOVE[@]}"; do
expanded_dir=$(eval echo "$dir")
if [ -d "$expanded_dir" ]; then
rm -rf "$expanded_dir" 2>/dev/null
echo -e "${GREEN}β Removed: $expanded_dir${NC}"
fi
done
# Step 4: SURGICAL Claude Code settings.json cleaning
echo ""
echo -e "${CYAN}Step 4: Surgically cleaning Claude Code settings...${NC}"
CLAUDE_SETTINGS="$HOME/.claude/settings.json"
if [ -f "$CLAUDE_SETTINGS" ]; then
backup_file "$CLAUDE_SETTINGS"
echo "Surgically removing ONLY claude-flow hooks and settings..."
if command -v jq >/dev/null 2>&1; then
# SURGICAL JQ APPROACH - Only removes claude-flow items
jq '
# Remove CLAUDE_FLOW_ environment variables
if .env then
.env |= with_entries(select(.key | startswith("CLAUDE_FLOW_") | not))
else . end |
# Remove claude-flow and ruv-swarm from MCP servers
if .enabledMcpjsonServers then
.enabledMcpjsonServers |= map(select(. != "claude-flow" and . != "ruv-swarm"))
else . end |
# SURGICAL HOOK REMOVAL - only remove hooks containing claude-flow
if .hooks then
if .hooks.PreToolUse then
.hooks.PreToolUse |= map(
if .hooks then
.hooks |= map(select(.command // "" | contains("claude-flow") or contains("ruv-swarm") | not))
else . end |
select(.hooks and (.hooks | length > 0) or (.hooks | not))
)
else . end |
if .hooks.PostToolUse then
.hooks.PostToolUse |= map(
if .hooks then
.hooks |= map(select(.command // "" | contains("claude-flow") or contains("ruv-swarm") | not))
else . end |
select(.hooks and (.hooks | length > 0) or (.hooks | not))
)
else . end |
if .hooks.Stop then
.hooks.Stop |= map(
if .hooks then
.hooks |= map(select(.command // "" | contains("claude-flow") or contains("ruv-swarm") | not))
else . end |
select(.hooks and (.hooks | length > 0) or (.hooks | not))
)
else . end |
if .hooks.PreCompact then
.hooks.PreCompact |= map(
if .hooks then
.hooks |= map(select(.command // "" | contains("claude-flow") or contains("ruv-swarm") | not))
else . end |
select(.hooks and (.hooks | length > 0) or (.hooks | not))
)
else . end
else . end
' "$CLAUDE_SETTINGS" > "${CLAUDE_SETTINGS}.tmp"
if [ $? -eq 0 ]; then
mv "${CLAUDE_SETTINGS}.tmp" "$CLAUDE_SETTINGS"
echo -e "${GREEN}β Surgically cleaned Claude Code settings with jq${NC}"
else
echo -e "${YELLOW}β jq failed, falling back to sed...${NC}"
rm -f "${CLAUDE_SETTINGS}.tmp"
remove_claude_flow_lines "$CLAUDE_SETTINGS"
echo -e "${GREEN}β Cleaned Claude Code settings with sed${NC}"
fi
else
# SED FALLBACK - Line-by-line removal
echo "Using sed for surgical removal..."
remove_claude_flow_lines "$CLAUDE_SETTINGS"
echo -e "${GREEN}β Cleaned Claude Code settings with sed${NC}"
fi
else
echo -e "${YELLOW}β Claude Code settings not found${NC}"
fi
# Step 5: Clean package.json
echo ""
echo -e "${CYAN}Step 5: Checking project package.json...${NC}"
if [ -f "package.json" ]; then
if grep -q "claude-flow\|ruv-swarm" package.json; then
backup_file "package.json"
remove_claude_flow_lines "package.json"
echo -e "${GREEN}β Removed claude-flow from package.json${NC}"
else
echo -e "${GREEN}β No claude-flow found in package.json${NC}"
fi
fi
# Step 6: Clean Claude Desktop config
echo ""
echo -e "${CYAN}Step 6: Cleaning Claude Desktop config...${NC}"
if [[ "$MACHINE" == "Mac" ]]; then
CLAUDE_CONFIG="$HOME/Library/Application Support/Claude/claude_desktop_config.json"
else
CLAUDE_CONFIG="$HOME/.config/Claude/claude_desktop_config.json"
fi
if [ -f "$CLAUDE_CONFIG" ]; then
if grep -q "claude-flow\|ruv-swarm" "$CLAUDE_CONFIG"; then
backup_file "$CLAUDE_CONFIG"
if command -v jq >/dev/null 2>&1; then
jq 'del(.mcpServers."claude-flow") | del(.mcpServers."ruv-swarm")' "$CLAUDE_CONFIG" > "${CLAUDE_CONFIG}.tmp"
mv "${CLAUDE_CONFIG}.tmp" "$CLAUDE_CONFIG"
else
remove_claude_flow_lines "$CLAUDE_CONFIG"
fi
echo -e "${GREEN}β Removed claude-flow from Claude Desktop config${NC}"
else
echo -e "${GREEN}β No claude-flow found in Claude Desktop config${NC}"
fi
else
echo -e "${YELLOW}β Claude Desktop config not found${NC}"
fi
# Step 7: Clean shell configs
echo ""
echo -e "${CYAN}Step 7: Cleaning shell configuration files...${NC}"
SHELL_FILES=(
"~/.bashrc"
"~/.zshrc"
"~/.profile"
"~/.bash_profile"
"~/.zprofile"
"~/.zshenv"
"~/.config/fish/config.fish"
)
for shell_file in "${SHELL_FILES[@]}"; do
expanded_file=$(eval echo "$shell_file")
if [ -f "$expanded_file" ]; then
if grep -q "claude-flow\|ruv-swarm\|CLAUDE_FLOW" "$expanded_file"; then
backup_file "$expanded_file"
remove_claude_flow_lines "$expanded_file"
echo -e "${GREEN}β Cleaned: $expanded_file${NC}"
fi
fi
done
# Step 8: Clear environment variables
echo ""
echo -e "${CYAN}Step 8: Clearing claude-flow environment variables...${NC}"
unset CLAUDE_FLOW_AUTO_COMMIT
unset CLAUDE_FLOW_AUTO_PUSH
unset CLAUDE_FLOW_HOOKS_ENABLED
unset CLAUDE_FLOW_TELEMETRY_ENABLED
unset CLAUDE_FLOW_REMOTE_EXECUTION
unset CLAUDE_FLOW_CHECKPOINTS_ENABLED
echo -e "${GREEN}β Claude Flow environment variables cleared${NC}"
# Step 9: Final verification
echo ""
echo -e "${CYAN}Step 9: Verification...${NC}"
sleep 1
# Check processes
if ps aux | grep -E "claude-flow|ruv-swarm" | grep -v grep > /dev/null; then
echo -e "${RED}β WARNING: Processes still running!${NC}"
else
echo -e "${GREEN}β No claude-flow processes running${NC}"
fi
# Check packages
if npm list -g claude-flow 2>/dev/null | grep -q claude-flow; then
echo -e "${RED}β WARNING: NPM packages still installed!${NC}"
else
echo -e "${GREEN}β NPM packages removed${NC}"
fi
# Check settings file
if [ -f "$CLAUDE_SETTINGS" ] && grep -q "claude-flow\|ruv-swarm" "$CLAUDE_SETTINGS"; then
echo -e "${YELLOW}β Some claude-flow references may remain in settings${NC}"
echo "Check: $CLAUDE_SETTINGS"
else
echo -e "${GREEN}β Settings cleaned${NC}"
fi
echo ""
echo -e "${GREEN}ββββββββββββββββββββββββββββββββββββββββββββββββββββ${NC}"
echo -e "${GREEN} SURGICAL CLEANUP COMPLETE!${NC}"
echo -e "${GREEN}ββββββββββββββββββββββββββββββββββββββββββββββββββββ${NC}"
echo ""
echo "β
SAFELY removed:"
echo " β’ Claude Flow/Swarm processes"
echo " β’ Claude Flow NPM packages (all versions)"
echo " β’ Claude Flow directories"
echo " β’ Claude Flow hooks (preserving other hooks)"
echo " β’ Claude Flow environment variables"
echo " β’ Claude Flow MCP server references"
echo ""
echo "β
PRESERVED:"
echo " β’ All other Claude Code hooks"
echo " β’ All other MCP servers"
echo " β’ All other environment variables"
echo " β’ General npm cache (only removed claude-flow cache)"
echo ""
echo -e "${YELLOW}NEXT STEPS:${NC}"
echo "1. Restart terminal"
echo "2. Restart Claude Desktop"
echo "3. Test Claude Code - hooks error should be gone!"
echo ""
echo -e "${CYAN}If you need to restore settings:${NC}"
echo "All files were backed up with timestamps"```
Thanks for at least sharing some deletion scripts!
But honestly, the fact that there still isnβt a proper deletion command in this repo is pretty absurd. Weβre talking about probably thousands of users who donβt even use Claude Flow ending up with ~20% of their context wasted on this junk.
better version :
#!/bin/bash
# ============================================================
# SURGICAL CLAUDE FLOW REMOVAL SCRIPT v3.1
# ============================================================
# Complete removal of Claude Flow ecosystem components
# Supports: claude-flow, ruv-swarm, flow-nexus
# Features: yarn/pnpm support, database cleanup, PATH cleaning
# ============================================================
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
CYAN='\033[0;36m'
BLUE='\033[0;34m'
NC='\033[0m'
# Detect OS
OS="$(uname -s)"
case "${OS}" in
Linux*) MACHINE=Linux;;
Darwin*) MACHINE=Mac;;
*) MACHINE="UNKNOWN:${OS}"
esac
echo -e "${RED}ββββββββββββββββββββββββββββββββββββββββββββββ${NC}"
echo -e "${RED}β SURGICAL CLAUDE FLOW REMOVAL SCRIPT β${NC}"
echo -e "${RED}β Version 3.1 β${NC}"
echo -e "${RED}ββββββββββββββββββββββββββββββββββββββββββββββ${NC}"
echo ""
echo -e "${BLUE}Detected OS: ${MACHINE}${NC}"
echo -e "${YELLOW}This will surgically remove Claude Flow ecosystem (flow/swarm/nexus)!${NC}"
echo ""
# Function to backup file with timestamp
backup_file() {
local file="$1"
if [ -f "$file" ]; then
local backup="${file}.backup.$(date +%Y%m%d_%H%M%S)"
cp "$file" "$backup"
echo -e "${GREEN}β Backed up to: $backup${NC}"
fi
}
# Function to remove claude-flow lines with sed (cross-platform)
remove_claude_flow_lines() {
local file="$1"
if [ -f "$file" ]; then
if [[ "$MACHINE" == "Mac" ]]; then
# Remove lines containing claude-flow, ruv-swarm, or flow-nexus
sed -i '' '/claude-flow/d' "$file"
sed -i '' '/ruv-swarm/d' "$file"
sed -i '' '/flow-nexus/d' "$file"
sed -i '' '/CLAUDE_FLOW_/d' "$file"
else
sed -i '/claude-flow/d' "$file"
sed -i '/ruv-swarm/d' "$file"
sed -i '/flow-nexus/d' "$file"
sed -i '/CLAUDE_FLOW_/d' "$file"
fi
fi
}
# Step 1: Kill all running processes
echo -e "${CYAN}Step 1: Killing Claude Flow/Swarm/Nexus processes...${NC}"
PIDS=$(ps aux | grep -E "claude-flow|ruv-swarm|flow-nexus" | grep -v grep | awk '{print $2}')
if [ -n "$PIDS" ]; then
# Kill processes without xargs -r (not available on macOS)
while read -r pid; do
kill -9 "$pid" 2>/dev/null
done <<< "$PIDS"
echo -e "${GREEN}β Killed $(echo "$PIDS" | wc -l) processes${NC}"
else
echo -e "${GREEN}β No processes found${NC}"
fi
# Step 2: Remove packages from all package managers
echo ""
echo -e "${CYAN}Step 2: Removing Claude Flow packages from all package managers...${NC}"
# NPM
if command -v npm >/dev/null 2>&1; then
npm uninstall -g claude-flow 2>/dev/null
npm uninstall -g claude-flow@alpha 2>/dev/null
npm uninstall -g claude-flow@beta 2>/dev/null
npm uninstall -g claude-flow@latest 2>/dev/null
npm uninstall -g ruv-swarm 2>/dev/null
npm uninstall -g ruv-swarm@alpha 2>/dev/null
npm uninstall -g flow-nexus 2>/dev/null
npm uninstall -g flow-nexus@latest 2>/dev/null
echo -e "${GREEN}β NPM packages removed${NC}"
fi
# Yarn
if command -v yarn >/dev/null 2>&1; then
yarn global remove claude-flow 2>/dev/null
yarn global remove ruv-swarm 2>/dev/null
yarn global remove flow-nexus 2>/dev/null
echo -e "${GREEN}β Yarn packages removed${NC}"
fi
# PNPM
if command -v pnpm >/dev/null 2>&1; then
pnpm uninstall -g claude-flow 2>/dev/null
pnpm uninstall -g ruv-swarm 2>/dev/null
pnpm uninstall -g flow-nexus 2>/dev/null
echo -e "${GREEN}β PNPM packages removed${NC}"
fi
# Clean NPX cache and other npm cache locations (claude-flow specific)
rm -rf ~/.npm/_npx/*claude-flow* 2>/dev/null
rm -rf ~/.npm/_npx/*ruv-swarm* 2>/dev/null
rm -rf ~/.npm/_npx/*flow-nexus* 2>/dev/null
rm -rf ~/.npm/_cacache/*claude-flow* 2>/dev/null
rm -rf ~/.npm/_cacache/*ruv-swarm* 2>/dev/null
rm -rf ~/.npm/_cacache/*flow-nexus* 2>/dev/null
# Clean npm cache for claude-flow specifically
if command -v npm >/dev/null 2>&1; then
npm cache clean --force 2>/dev/null || true
NPM_CACHE=$(npm config get cache 2>/dev/null)
if [ -n "$NPM_CACHE" ] && [ -d "$NPM_CACHE" ]; then
find "$NPM_CACHE" -type d -name "*claude-flow*" -exec rm -rf {} + 2>/dev/null || true
find "$NPM_CACHE" -type d -name "*ruv-swarm*" -exec rm -rf {} + 2>/dev/null || true
find "$NPM_CACHE" -type d -name "*flow-nexus*" -exec rm -rf {} + 2>/dev/null || true
fi
fi
# Clean yarn cache
if command -v yarn >/dev/null 2>&1; then
yarn cache clean 2>/dev/null || true
YARN_CACHE=$(yarn cache dir 2>/dev/null)
if [ -n "$YARN_CACHE" ] && [ -d "$YARN_CACHE" ]; then
find "$YARN_CACHE" -type d -name "*claude-flow*" -exec rm -rf {} + 2>/dev/null || true
find "$YARN_CACHE" -type d -name "*ruv-swarm*" -exec rm -rf {} + 2>/dev/null || true
find "$YARN_CACHE" -type d -name "*flow-nexus*" -exec rm -rf {} + 2>/dev/null || true
fi
fi
# Clean pnpm cache
if command -v pnpm >/dev/null 2>&1; then
PNPM_HOME=$(pnpm store path 2>/dev/null)
if [ -n "$PNPM_HOME" ] && [ -d "$PNPM_HOME" ]; then
find "$PNPM_HOME" -type d -name "*claude-flow*" -exec rm -rf {} + 2>/dev/null || true
find "$PNPM_HOME" -type d -name "*ruv-swarm*" -exec rm -rf {} + 2>/dev/null || true
find "$PNPM_HOME" -type d -name "*flow-nexus*" -exec rm -rf {} + 2>/dev/null || true
fi
fi
echo -e "${GREEN}β All package manager caches cleaned${NC}"
# Clean global node_modules directly
if command -v npm >/dev/null 2>&1; then
NPM_PREFIX=$(npm config get prefix 2>/dev/null)
if [ -n "$NPM_PREFIX" ]; then
GLOBAL_NODE_MODULES="$NPM_PREFIX/lib/node_modules"
if [ -d "$GLOBAL_NODE_MODULES/claude-flow" ]; then
rm -rf "$GLOBAL_NODE_MODULES/claude-flow"
echo -e "${GREEN}β Removed claude-flow from global node_modules${NC}"
fi
if [ -d "$GLOBAL_NODE_MODULES/ruv-swarm" ]; then
rm -rf "$GLOBAL_NODE_MODULES/ruv-swarm"
echo -e "${GREEN}β Removed ruv-swarm from global node_modules${NC}"
fi
if [ -d "$GLOBAL_NODE_MODULES/flow-nexus" ]; then
rm -rf "$GLOBAL_NODE_MODULES/flow-nexus"
echo -e "${GREEN}β Removed flow-nexus from global node_modules${NC}"
fi
# Also check for binaries in bin directory
if [ -f "$NPM_PREFIX/bin/claude-flow" ]; then
rm -f "$NPM_PREFIX/bin/claude-flow"
echo -e "${GREEN}β Removed claude-flow binary${NC}"
fi
if [ -f "$NPM_PREFIX/bin/ruv-swarm" ]; then
rm -f "$NPM_PREFIX/bin/ruv-swarm"
echo -e "${GREEN}β Removed ruv-swarm binary${NC}"
fi
if [ -f "$NPM_PREFIX/bin/flow-nexus" ]; then
rm -f "$NPM_PREFIX/bin/flow-nexus"
echo -e "${GREEN}β Removed flow-nexus binary${NC}"
fi
fi
fi
# Step 3: Remove directories
echo ""
echo -e "${CYAN}Step 3: Removing Claude Flow directories...${NC}"
DIRS_TO_REMOVE=(
".swarm"
".claude-flow"
".hive-mind"
".claude"
"~/.swarm"
"~/.claude-flow"
"~/.hive-mind"
"/tmp/.swarm"
"/tmp/.claude-flow"
"/tmp/.hive-mind"
"~/.config/claude-flow"
"~/.config/ruv-swarm"
"~/.config/flow-nexus"
"~/.local/share/claude-flow"
"~/.local/share/ruv-swarm"
"~/.local/share/flow-nexus"
)
# Add macOS-specific paths
if [[ "$MACHINE" == "Mac" ]]; then
DIRS_TO_REMOVE+=(
"~/Library/Application Support/claude-flow"
"~/Library/Application Support/ruv-swarm"
"~/Library/Application Support/flow-nexus"
"~/Library/Caches/claude-flow"
"~/Library/Caches/ruv-swarm"
"~/Library/Caches/flow-nexus"
)
fi
for dir in "${DIRS_TO_REMOVE[@]}"; do
expanded_dir=$(eval echo "$dir")
if [ -d "$expanded_dir" ]; then
rm -rf "$expanded_dir" 2>/dev/null
echo -e "${GREEN}β Removed: $expanded_dir${NC}"
fi
done
# Remove specific database files
echo ""
echo -e "${CYAN}Removing Claude Flow database files...${NC}"
DB_FILES=(
".swarm/memory.db"
".hive-mind/hive.db"
"~/.swarm/memory.db"
"~/.hive-mind/hive.db"
".claude-flow/token-usage.json"
"~/.claude-flow/token-usage.json"
)
for db_file in "${DB_FILES[@]}"; do
expanded_file=$(eval echo "$db_file")
if [ -f "$expanded_file" ]; then
rm -f "$expanded_file" 2>/dev/null
echo -e "${GREEN}β Removed: $expanded_file${NC}"
fi
done
# Step 4: SURGICAL Claude Code settings.json cleaning
echo ""
echo -e "${CYAN}Step 4: Surgically cleaning Claude Code settings...${NC}"
CLAUDE_SETTINGS="$HOME/.claude/settings.json"
if [ -f "$CLAUDE_SETTINGS" ]; then
backup_file "$CLAUDE_SETTINGS"
echo "Surgically removing ONLY claude-flow hooks and settings..."
if command -v jq >/dev/null 2>&1; then
# SURGICAL JQ APPROACH - Only removes claude-flow items
jq '
# Remove CLAUDE_FLOW_ environment variables
if .env then
.env |= with_entries(select(.key | startswith("CLAUDE_FLOW_") | not))
else . end |
# Remove claude-flow, ruv-swarm, and flow-nexus from MCP servers
if .enabledMcpjsonServers then
.enabledMcpjsonServers |= map(select(. != "claude-flow" and . != "ruv-swarm" and . != "flow-nexus"))
else . end |
# SURGICAL HOOK REMOVAL - only remove hooks containing claude-flow
if .hooks then
if .hooks.PreToolUse then
.hooks.PreToolUse |= map(
if .hooks then
.hooks |= map(select(.command // "" | contains("claude-flow") or contains("ruv-swarm") | not))
else . end |
select(.hooks and (.hooks | length > 0) or (.hooks | not))
)
else . end |
if .hooks.PostToolUse then
.hooks.PostToolUse |= map(
if .hooks then
.hooks |= map(select(.command // "" | contains("claude-flow") or contains("ruv-swarm") | not))
else . end |
select(.hooks and (.hooks | length > 0) or (.hooks | not))
)
else . end |
if .hooks.Stop then
.hooks.Stop |= map(
if .hooks then
.hooks |= map(select(.command // "" | contains("claude-flow") or contains("ruv-swarm") | not))
else . end |
select(.hooks and (.hooks | length > 0) or (.hooks | not))
)
else . end |
if .hooks.PreCompact then
.hooks.PreCompact |= map(
if .hooks then
.hooks |= map(select(.command // "" | contains("claude-flow") or contains("ruv-swarm") | not))
else . end |
select(.hooks and (.hooks | length > 0) or (.hooks | not))
)
else . end
else . end
' "$CLAUDE_SETTINGS" > "${CLAUDE_SETTINGS}.tmp"
if [ $? -eq 0 ]; then
mv "${CLAUDE_SETTINGS}.tmp" "$CLAUDE_SETTINGS"
echo -e "${GREEN}β Surgically cleaned Claude Code settings with jq${NC}"
else
echo -e "${YELLOW}β jq failed, falling back to sed...${NC}"
rm -f "${CLAUDE_SETTINGS}.tmp"
remove_claude_flow_lines "$CLAUDE_SETTINGS"
echo -e "${GREEN}β Cleaned Claude Code settings with sed${NC}"
fi
else
# SED FALLBACK - Line-by-line removal
echo "Using sed for surgical removal..."
remove_claude_flow_lines "$CLAUDE_SETTINGS"
echo -e "${GREEN}β Cleaned Claude Code settings with sed${NC}"
fi
else
echo -e "${YELLOW}β Claude Code settings not found${NC}"
fi
# Step 5: Clean package.json
echo ""
echo -e "${CYAN}Step 5: Checking project package.json...${NC}"
if [ -f "package.json" ]; then
if grep -q "claude-flow\|ruv-swarm\|flow-nexus" package.json; then
backup_file "package.json"
remove_claude_flow_lines "package.json"
echo -e "${GREEN}β Removed claude-flow from package.json${NC}"
else
echo -e "${GREEN}β No claude-flow found in package.json${NC}"
fi
fi
# Step 6: Clean Claude Desktop config
echo ""
echo -e "${CYAN}Step 6: Cleaning Claude Desktop config...${NC}"
if [[ "$MACHINE" == "Mac" ]]; then
CLAUDE_CONFIG="$HOME/Library/Application Support/Claude/claude_desktop_config.json"
else
CLAUDE_CONFIG="$HOME/.config/Claude/claude_desktop_config.json"
fi
if [ -f "$CLAUDE_CONFIG" ]; then
if grep -q "claude-flow\|ruv-swarm\|flow-nexus" "$CLAUDE_CONFIG"; then
backup_file "$CLAUDE_CONFIG"
if command -v jq >/dev/null 2>&1; then
jq 'del(.mcpServers."claude-flow") | del(.mcpServers."ruv-swarm") | del(.mcpServers."flow-nexus")' "$CLAUDE_CONFIG" > "${CLAUDE_CONFIG}.tmp"
mv "${CLAUDE_CONFIG}.tmp" "$CLAUDE_CONFIG"
else
remove_claude_flow_lines "$CLAUDE_CONFIG"
fi
echo -e "${GREEN}β Removed claude-flow from Claude Desktop config${NC}"
else
echo -e "${GREEN}β No claude-flow found in Claude Desktop config${NC}"
fi
else
echo -e "${YELLOW}β Claude Desktop config not found${NC}"
fi
# Step 7: Clean shell configs
echo ""
echo -e "${CYAN}Step 7: Cleaning shell configuration files...${NC}"
SHELL_FILES=(
"~/.bashrc"
"~/.zshrc"
"~/.profile"
"~/.bash_profile"
"~/.zprofile"
"~/.zshenv"
"~/.config/fish/config.fish"
)
for shell_file in "${SHELL_FILES[@]}"; do
expanded_file=$(eval echo "$shell_file")
if [ -f "$expanded_file" ]; then
if grep -q "claude-flow\|ruv-swarm\|flow-nexus\|CLAUDE_FLOW" "$expanded_file"; then
backup_file "$expanded_file"
remove_claude_flow_lines "$expanded_file"
echo -e "${GREEN}β Cleaned: $expanded_file${NC}"
fi
fi
done
# Step 8: Remove binaries from common PATH locations
echo ""
echo -e "${CYAN}Step 8: Checking common PATH locations for binaries...${NC}"
PATH_LOCATIONS=(
"/usr/local/bin"
"/usr/bin"
"$HOME/.local/bin"
"$HOME/bin"
)
for path_dir in "${PATH_LOCATIONS[@]}"; do
if [ -d "$path_dir" ]; then
if [ -f "$path_dir/claude-flow" ] || [ -L "$path_dir/claude-flow" ]; then
rm -f "$path_dir/claude-flow"
echo -e "${GREEN}β Removed claude-flow from $path_dir${NC}"
fi
if [ -f "$path_dir/ruv-swarm" ] || [ -L "$path_dir/ruv-swarm" ]; then
rm -f "$path_dir/ruv-swarm"
echo -e "${GREEN}β Removed ruv-swarm from $path_dir${NC}"
fi
if [ -f "$path_dir/flow-nexus" ] || [ -L "$path_dir/flow-nexus" ]; then
rm -f "$path_dir/flow-nexus"
echo -e "${GREEN}β Removed flow-nexus from $path_dir${NC}"
fi
fi
done
echo -e "${GREEN}β PATH locations checked${NC}"
# Step 9: Clear environment variables
echo ""
echo -e "${CYAN}Step 9: Clearing claude-flow environment variables...${NC}"
unset CLAUDE_FLOW_AUTO_COMMIT
unset CLAUDE_FLOW_AUTO_PUSH
unset CLAUDE_FLOW_HOOKS_ENABLED
unset CLAUDE_FLOW_TELEMETRY_ENABLED
unset CLAUDE_FLOW_REMOTE_EXECUTION
unset CLAUDE_FLOW_CHECKPOINTS_ENABLED
echo -e "${GREEN}β Claude Flow environment variables cleared${NC}"
# Step 10: Final verification
echo ""
echo -e "${CYAN}Step 10: Verification...${NC}"
sleep 1
# Check processes
if ps aux | grep -E "claude-flow|ruv-swarm|flow-nexus" | grep -v grep > /dev/null; then
echo -e "${RED}β WARNING: Processes still running!${NC}"
else
echo -e "${GREEN}β No claude-flow processes running${NC}"
fi
# Check packages
PACKAGES_FOUND=0
if command -v npm >/dev/null 2>&1 && npm list -g 2>/dev/null | grep -qE "claude-flow|ruv-swarm|flow-nexus"; then
echo -e "${RED}β WARNING: NPM packages still installed!${NC}"
PACKAGES_FOUND=1
fi
if command -v yarn >/dev/null 2>&1 && yarn global list 2>/dev/null | grep -qE "claude-flow|ruv-swarm|flow-nexus"; then
echo -e "${RED}β WARNING: Yarn packages still installed!${NC}"
PACKAGES_FOUND=1
fi
if command -v pnpm >/dev/null 2>&1 && pnpm list -g 2>/dev/null | grep -qE "claude-flow|ruv-swarm|flow-nexus"; then
echo -e "${RED}β WARNING: PNPM packages still installed!${NC}"
PACKAGES_FOUND=1
fi
if [ $PACKAGES_FOUND -eq 0 ]; then
echo -e "${GREEN}β All packages removed from all package managers${NC}"
fi
# Check settings file
if [ -f "$CLAUDE_SETTINGS" ] && grep -qE "claude-flow|ruv-swarm|flow-nexus" "$CLAUDE_SETTINGS"; then
echo -e "${YELLOW}β Some claude-flow references may remain in settings${NC}"
echo "Check: $CLAUDE_SETTINGS"
else
echo -e "${GREEN}β Settings cleaned${NC}"
fi
echo ""
echo -e "${GREEN}ββββββββββββββββββββββββββββββββββββββββββββββββββββ${NC}"
echo -e "${GREEN} SURGICAL CLEANUP COMPLETE!${NC}"
echo -e "${GREEN}ββββββββββββββββββββββββββββββββββββββββββββββββββββ${NC}"
echo ""
echo "β
SAFELY removed:"
echo " β’ Claude Flow/Swarm/Nexus processes"
echo " β’ All ecosystem packages (claude-flow, ruv-swarm, flow-nexus)"
echo " β’ Project directories (.claude, .swarm, .hive-mind, .claude-flow)"
echo " β’ Database files (memory.db, hive.db, token-usage.json)"
echo " β’ Claude Flow hooks (preserving other hooks)"
echo " β’ Claude Flow environment variables"
echo " β’ All MCP server references (claude-flow, ruv-swarm, flow-nexus)"
echo " β’ Binaries from all PATH locations"
echo " β’ Cache from NPM/Yarn/PNPM package managers"
echo ""
echo "β
PRESERVED:"
echo " β’ All other Claude Code hooks"
echo " β’ All other MCP servers"
echo " β’ All other environment variables"
echo " β’ All other packages (only removed claude-flow packages)"
echo " β’ General caches (only removed claude-flow related caches)"
echo ""
echo -e "${YELLOW}NEXT STEPS:${NC}"
echo "1. Restart terminal"
echo "2. Restart Claude Desktop"
echo "3. Test Claude Code - hooks error should be gone!"
echo ""
echo -e "${CYAN}If you need to restore settings:${NC}"
echo "All files were backed up with timestamps"
`
Thanks all for the scripts! Im not saying this out of spite, I honestly want to know, is this malware or not? If it is not intentionally malware, than just wow. After using this you wanna go full tinfoil and never download another dependency in your life.
Itβs open source. Look at code.
@rUv
On Thu, Nov 6, 2025 at 3:13β―PM plufz @.***> wrote:
plufz left a comment (ruvnet/claude-flow#670) https://github.com/ruvnet/claude-flow/issues/670#issuecomment-3499218444
Thanks all for the scripts! Im not saying this out of spite, I honestly want to know, is this malware or not? If it is not intentionally malware, than just wow. After using this you wanna go full tinfoil and never download another dependency in your life.
β Reply to this email directly, view it on GitHub https://github.com/ruvnet/claude-flow/issues/670#issuecomment-3499218444, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAWMM6VY6IWDWVV3PUNZN6L33OTYHAVCNFSM6AAAAACEGPBXJWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTIOJZGIYTQNBUGQ . You are receiving this because you were mentioned.Message ID: @.***>
I understand that this is not something you want to hear as an open source maintainer, and Im sure you have the best intentions. But honestly your project scared the sh*t out of me. I've been lsof:ing for funny processes etc for over an hour because of this. People made these uninstall scripts in August and you still havent addressed this. Why?
And yes its open source and that is great, but you have made over 3000 commits. It is a big job searching for a well hidden exploit in that volume. The open source community is built on trust, not just on everybodys ability to view the code.
Itβs open source. Look at code.
@ruv β¦
I hear you. Not sure what I can do. Itβs just a hobby and Iβm one guy..
@rUv
On Thu, Nov 6, 2025 at 3:38β―PM plufz @.***> wrote:
plufz left a comment (ruvnet/claude-flow#670) https://github.com/ruvnet/claude-flow/issues/670#issuecomment-3499302584
I understand that this is not something you want to hear as an open source maintainer, and Im sure you have the best intentions. But honestly your project scared the shit out of me. I've been lsof:ing for funny processes etc for over an hour because of this. People made these uninstall scripts in August and you still havent addressed this. Why?
And yes its open source and that is great, but you have made over 3000 commits. It is a big job searching for a well hidden exploit in that volume. The open source community is built on trust, not just on everybodys ability to view the code.
Itβs open source. Look at code.
@ruv https://github.com/ruv β¦ <#m_-2793306473222418731_m_666862658305244899_>
β Reply to this email directly, view it on GitHub https://github.com/ruvnet/claude-flow/issues/670#issuecomment-3499302584, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAWMM6WMONDY2IXB6QWHLSL33OWWDAVCNFSM6AAAAACEGPBXJWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTIOJZGMYDENJYGQ . You are receiving this because you were mentioned.Message ID: @.***>
I understand that, most repositories here are probably hobby projects as well. And it is a great hobby. I am obviously not a user anymore, so I'm not commenting for my own sake. My only 50 cent is to make this issue your top priority, so that your next pushed commit is an uninstaller. Good luck!
I hear you. Not sure what I can do. Itβs just a hobby and Iβm one guy..
@ruv β¦
For anyone reading this: Do not install claude-flow until there is a way to cleanly uninstall this again.