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

feat: v3.5.45-3.5.48 security, P1 fixes, WASM CLI (#1442)

rUvc07ff8f4869c
diff --git a/package-lock.json b/package-lock.json
index 6a610e0b17..b2118ef0a5 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "claude-flow",
- "version": "3.5.28",
+ "version": "3.5.46",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "claude-flow",
- "version": "3.5.28",
+ "version": "3.5.46",
"license": "MIT",
"dependencies": {
"@ruvector/ruvllm-wasm": "^2.0.0",
diff --git a/package.json b/package.json
index 4e7832ad87..d13abba45b 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "claude-flow",
- "version": "3.5.44",
+ "version": "3.5.48",
"description": "Ruflo - Enterprise AI agent orchestration for Claude Code. Deploy 60+ specialized agents in coordinated swarms with self-learning, fault-tolerant consensus, vector memory, and MCP integration",
"main": "dist/index.js",
"type": "module",
diff --git a/ruflo/package.json b/ruflo/package.json
index 0115ab4b13..6b4a5f998a 100644
--- a/ruflo/package.json
+++ b/ruflo/package.json
@@ -1,6 +1,6 @@
{
"name": "ruflo",
- "version": "3.5.44",
+ "version": "3.5.48",
"description": "Ruflo - Enterprise AI agent orchestration platform. Deploy 60+ specialized agents in coordinated swarms with self-learning, fault-tolerant consensus, vector memory, and MCP integration",
"main": "bin/ruflo.js",
"type": "module",
diff --git a/v3/@claude-flow/cli/README.md b/v3/@claude-flow/cli/README.md
index 0225f244c7..6e5c31691e 100644
--- a/v3/@claude-flow/cli/README.md
+++ b/v3/@claude-flow/cli/README.md
@@ -152,10 +152,10 @@ npx ruflo@latest hooks intelligence --status
```bash
# One-line install (recommended)
-curl -fsSL https://cdn.jsdelivr.net/gh/ruvnet/claude-flow@main/scripts/install.sh | bash
+curl -fsSL https://cdn.jsdelivr.net/gh/ruvnet/ruflo@main/scripts/install.sh | bash
# Or full setup with MCP + diagnostics
-curl -fsSL https://cdn.jsdelivr.net/gh/ruvnet/claude-flow@main/scripts/install.sh | bash -s -- --full
+curl -fsSL https://cdn.jsdelivr.net/gh/ruvnet/ruflo@main/scripts/install.sh | bash -s -- --full
# Or via npx
npx ruflo@latest init --wizard
@@ -438,10 +438,10 @@ claude --dangerously-skip-permissions
```bash
# curl-style installer with progress display
-curl -fsSL https://cdn.jsdelivr.net/gh/ruvnet/claude-flow@main/scripts/install.sh | bash
+curl -fsSL https://cdn.jsdelivr.net/gh/ruvnet/ruflo@main/scripts/install.sh | bash
# Full setup (global + MCP + diagnostics)
-curl -fsSL https://cdn.jsdelivr.net/gh/ruvnet/claude-flow@main/scripts/install.sh | bash -s -- --full
+curl -fsSL https://cdn.jsdelivr.net/gh/ruvnet/ruflo@main/scripts/install.sh | bash -s -- --full
```
<details>
@@ -668,21 +668,24 @@ npx ruflo@latest init
# Start MCP server for Claude Code integration
npx ruflo@latest mcp start
-# Run a task with agents
-npx ruflo@latest --agent coder --task "Implement user authentication"
+# Spawn a coding agent
+npx ruflo@latest agent spawn -t coder --name my-coder
-# List available agents
-npx ruflo@latest --list
+# Launch a hive-mind swarm with an objective
+npx ruflo@latest hive-mind spawn "Implement user authentication"
+
+# List available agent types
+npx ruflo@latest agent list
```
### Upgrading
```bash
# Update helpers and statusline (preserves your data)
-npx ruflo@v3alpha init upgrade
+npx ruflo@latest init upgrade
# Update AND add any missing skills/agents/commands
-npx ruflo@v3alpha init upgrade --add-missing
+npx ruflo@latest init upgrade --add-missing
```
The `--add-missing` flag automatically detects and installs new skills, agents, and commands that were added in newer versions, without overwriting your existing customizations.
@@ -838,7 +841,7 @@ Complex projects fail when implementation drifts from the original plan. Ruflo s
| Feature | Description |
|---------|-------------|
-| **Architecture Decision Records** | 10 ADRs defining system behavior, integration patterns, and security requirements |
+| **Architecture Decision Records** | 70+ ADRs defining system behavior, integration patterns, and security requirements |
| **Domain-Driven Design** | 5 bounded contexts with clean interfaces preventing cross-domain pollution |
| **Automated Spec Generation** | Agents create specs from requirements using SPARC methodology |
| **Drift Detection** | Continuous monitoring flags when code diverges from spec |
@@ -1183,7 +1186,7 @@ Ruflo runs as an MCP (Model Context Protocol) server, allowing you to connect it
```bash
# Start Ruflo MCP server in any environment
-npx ruflo@v3alpha mcp start
+npx ruflo@latest mcp start
```
<details open>
@@ -1200,7 +1203,7 @@ npx ruflo@v3alpha mcp start
"mcpServers": {
"ruflo": {
"command": "npx",
- "args": ["ruflo@v3alpha", "mcp", "start"],
+ "args": ["ruflo@latest", "mcp", "start"],
"env": {
"ANTHROPIC_API_KEY": "sk-ant-..."
}
@@ -1220,12 +1223,12 @@ Restart Claude Desktop after saving. Look for the MCP indicator (hammer icon) in
```bash
# Add via CLI (recommended)
-claude mcp add ruflo -- npx ruflo@v3alpha mcp start
+claude mcp add ruflo -- npx ruflo@latest mcp start
# Or add with environment variables
claude mcp add ruflo \
--env ANTHROPIC_API_KEY=sk-ant-... \
- -- npx ruflo@v3alpha mcp start
+ -- npx ruflo@latest mcp start
# Verify installation
claude mcp list
@@ -1254,7 +1257,7 @@ Create `.vscode/mcp.json` in your project:
"mcpServers": {
"ruflo": {
"command": "npx",
- "args": ["ruflo@v3alpha", "mcp", "start"],
+ "args": ["ruflo@latest", "mcp", "start"],
"env": {
"ANTHROPIC_API_KEY": "sk-ant-..."
}
@@ -1281,7 +1284,7 @@ Create `.cursor/mcp.json` in your project (or global config):
"mcpServers": {
"ruflo": {
"command": "npx",
- "args": ["ruflo@v3alpha", "mcp", "start"],
+ "args": ["ruflo@latest", "mcp", "start"],
"env": {
"ANTHROPIC_API_KEY": "sk-ant-..."
}
@@ -1308,7 +1311,7 @@ Create `.cursor/mcp.json` in your project (or global config):
"mcpServers": {
"ruflo": {
"command": "npx",
- "args": ["ruflo@v3alpha", "mcp", "start"],
+ "args": ["ruflo@latest", "mcp", "start"],
"env": {
"ANTHROPIC_API_KEY": "sk-ant-..."
}
@@ -1339,7 +1342,7 @@ For ChatGPT, you need a remote MCP server (not local stdio). Deploy ruflo to a s
```bash
# Start with HTTP transport
-npx ruflo@v3alpha mcp start --transport http --port 3000
+npx ruflo@latest mcp start --transport http --port 3000
```
Then add the server URL in ChatGPT Connectors settings.
@@ -1370,7 +1373,7 @@ const mcpConfig = {
servers: [{
name: 'ruflo',
command: 'npx',
- args: ['ruflo@v3alpha', 'mcp', 'start']
+ args: ['ruflo@latest', 'mcp', 'start']
}]
};
```
@@ -1393,7 +1396,7 @@ JetBrains AI Assistant supports MCP for IntelliJ IDEA, PyCharm, WebStorm, and ot
{
"name": "ruflo",
"command": "npx",
- "args": ["ruflo@v3alpha", "mcp", "start"]
+ "args": ["ruflo@latest", "mcp", "start"]
}
```
@@ -1707,7 +1710,7 @@ npx ruflo@latest hooks task-completed --task-id <id> --train-patterns
</details>
<details>
-<summary>πŸ”§ <strong>MCP Tools & Integration</strong> β€” 31+ tools across 7 categories</summary>
+<summary>πŸ”§ <strong>MCP Tools & Integration</strong> β€” 259 tools across 7 categories</summary>
Full MCP server with tools for coordination, monitoring, memory, and GitHub integration.
@@ -2041,8 +2044,8 @@ Workers run automatically based on context, or dispatch manually via MCP tools.
| **TestGaps** | `testgaps` | Test coverage analysis | Code changes without tests |
```bash
-npx ruflo@v3alpha worker dispatch --trigger audit --context "./src"
-npx ruflo@v3alpha worker status
+npx ruflo@latest worker dispatch --trigger audit --context "./src"
+npx ruflo@latest worker status
```
</details>
@@ -2580,19 +2583,19 @@ Cross-platform TypeScript-based daemon service with auto-scheduling:
**Commands:**
```bash
# Start daemon (auto-runs on SessionStart hooks)
-npx ruflo@v3alpha daemon start
+npx ruflo@latest daemon start
# Check status with worker history
-npx ruflo@v3alpha daemon status
+npx ruflo@latest daemon status
# Manually trigger a worker
-npx ruflo@v3alpha daemon trigger map
+npx ruflo@latest daemon trigger map
# Enable/disable workers
-npx ruflo@v3alpha daemon enable map audit optimize
+npx ruflo@latest daemon enable map audit optimize
# Stop daemon
-npx ruflo@v3alpha daemon stop
+npx ruflo@latest daemon stop
```
**Daemon Status Output:**
@@ -2708,25 +2711,25 @@ Complete command-line interface for all Ruflo operations.
```bash
# Initialize project with wizard
-npx ruflo@v3alpha init --wizard
+npx ruflo@latest init --wizard
# Start daemon with background workers
-npx ruflo@v3alpha daemon start
+npx ruflo@latest daemon start
# Spawn an agent with specific type
-npx ruflo@v3alpha agent spawn -t coder --name my-coder
+npx ruflo@latest agent spawn -t coder --name my-coder
# Initialize swarm with V3 mode
-npx ruflo@v3alpha swarm init --v3-mode
+npx ruflo@latest swarm init --v3-mode
# Search memory (HNSW-indexed, 150x faster)
-npx ruflo@v3alpha memory search -q "authentication patterns"
+npx ruflo@latest memory search -q "authentication patterns"
# Run security scan
-npx ruflo@v3alpha security scan --depth full
+npx ruflo@latest security scan --depth full
# Performance benchmark
-npx ruflo@v3alpha performance benchmark --suite all
+npx ruflo@latest performance benchmark --suite all
```
</details>
@@ -2734,7 +2737,7 @@ npx ruflo@v3alpha performance benchmark --suite all
<details>
<summary>🩺 <strong>Doctor Health Checks</strong> β€” System diagnostics with auto-fix</summary>
-Run `npx ruflo@v3alpha doctor` to diagnose and fix common issues.
+Run `npx ruflo@latest doctor` to diagnose and fix common issues.
**Health Checks Performed:**
@@ -2755,22 +2758,22 @@ Run `npx ruflo@v3alpha doctor` to diagnose and fix common issues.
```bash
# Run full diagnostics
-npx ruflo@v3alpha doctor
+npx ruflo@latest doctor
# Run diagnostics with auto-fix
-npx ruflo@v3alpha doctor --fix
+npx ruflo@latest doctor --fix
# Check specific component
-npx ruflo@v3alpha doctor --component memory
+npx ruflo@latest doctor --component memory
# Verbose output
-npx ruflo@v3alpha doctor --verbose
+npx ruflo@latest doctor --verbose
```
**Output Example:**
```
-🩺 Ruflo Doctor v3.0.0-alpha
+🩺 Ruflo Doctor v3.5
βœ… Node.js 20.11.0 (required: 20+)
βœ… npm 10.2.4 (required: 9+)
@@ -2814,16 +2817,16 @@ The embeddings package (v3.0.0-alpha.12) provides high-performance vector embedd
```bash
# Initialize embeddings system
-npx ruflo@v3alpha embeddings init
+npx ruflo@latest embeddings init
# Generate embedding for text
-npx ruflo@v3alpha embeddings embed "authentication patterns"
+npx ruflo@latest embeddings embed "authentication patterns"
# Batch embed multiple texts
-npx ruflo@v3alpha embeddings batch --file texts.txt
+npx ruflo@latest embeddings batch --file texts.txt
# Search with semantic similarity
-npx ruflo@v3alpha embeddings search "login flow" --top-k 5
+npx ruflo@latest embeddings search "login flow" --top-k 5
```
**Programmatic:**
@@ -2860,59 +2863,59 @@ Real-world scenarios and pre-built workflows for common tasks.
| Scenario | What It Solves | How To Do It |
|----------|----------------|--------------|
-| **Code Review** | Get thorough reviews with security, performance, and style checks | `npx ruflo@v3alpha --agent reviewer --task "Review PR #123"` |
-| **Test Generation** | Auto-generate unit, integration, and e2e tests for existing code | `npx ruflo@v3alpha --agent tester --task "Write tests for auth module"` |
-| **Refactoring** | Safely restructure code while maintaining behavior | `npx ruflo@v3alpha --agent coder --task "Refactor user service to use repository pattern"` |
-| **Bug Fixing** | Diagnose and fix bugs with full context analysis | `npx ruflo@v3alpha --agent coder --task "Fix race condition in checkout flow"` |
+| **Code Review** | Get thorough reviews with security, performance, and style checks | `npx ruflo@latest agent spawn -t reviewer --name pr-review` |
+| **Test Generation** | Auto-generate unit, integration, and e2e tests for existing code | `npx ruflo@latest agent spawn -t tester --name test-gen` |
+| **Refactoring** | Safely restructure code while maintaining behavior | `npx ruflo@latest hive-mind spawn "Refactor user service to repository pattern"` |
+| **Bug Fixing** | Diagnose and fix bugs with full context analysis | `npx ruflo@latest hive-mind spawn "Fix race condition in checkout flow"` |
### πŸ”’ Security & Compliance
| Scenario | What It Solves | How To Do It |
|----------|----------------|--------------|
-| **Security Audit** | Find vulnerabilities before attackers do | `npx ruflo@v3alpha --agent security-architect --task "Audit for OWASP Top 10"` |
-| **Dependency Scan** | Identify vulnerable packages and suggest upgrades | `npx ruflo@v3alpha security scan --depth full` |
-| **Compliance Check** | Ensure code meets security standards | `npx ruflo@v3alpha --agent security-architect --task "Check PCI-DSS compliance"` |
+| **Security Audit** | Find vulnerabilities before attackers do | `npx ruflo@latest security scan --depth full` |
+| **Dependency Scan** | Identify vulnerable packages and suggest upgrades | `npx ruflo@latest security cve --check` |
+| **Compliance Check** | Ensure code meets security standards | `npx ruflo@latest security audit` |
### 🐝 Multi-Agent Swarms
| Scenario | What It Solves | How To Do It |
|----------|----------------|--------------|
-| **Feature Development** | Coordinate multiple agents on complex features | `npx ruflo@v3alpha swarm init --topology hierarchical && npx ruflo@v3alpha task orchestrate "Build user dashboard"` |
-| **Large Refactors** | Parallel refactoring across many files without conflicts | `npx ruflo@v3alpha swarm init --topology mesh --max-agents 8` |
-| **Codebase Migration** | Migrate frameworks, languages, or patterns systematically | `npx ruflo@v3alpha task orchestrate "Migrate from Express to Fastify" --strategy adaptive` |
+| **Feature Development** | Coordinate multiple agents on complex features | `npx ruflo@latest swarm init --topology hierarchical && npx ruflo@latest task orchestrate "Build user dashboard"` |
+| **Large Refactors** | Parallel refactoring across many files without conflicts | `npx ruflo@latest swarm init --topology mesh --max-agents 8` |
+| **Codebase Migration** | Migrate frameworks, languages, or patterns systematically | `npx ruflo@latest task orchestrate "Migrate from Express to Fastify" --strategy adaptive` |
### πŸ“Š Performance & Optimization
| Scenario | What It Solves | How To Do It |
|----------|----------------|--------------|
-| **Performance Profiling** | Find and fix bottlenecks in your application | `npx ruflo@v3alpha --agent perf-analyzer --task "Profile API endpoints"` |
-| **Query Optimization** | Speed up slow database queries | `npx ruflo@v3alpha hooks route "Optimize database queries"` |
-| **Memory Analysis** | Reduce memory usage and fix leaks | `npx ruflo@v3alpha --agent perf-analyzer --task "Analyze memory usage patterns"` |
+| **Performance Profiling** | Find and fix bottlenecks in your application | `npx ruflo@latest performance profile --target src/` |
+| **Query Optimization** | Speed up slow database queries | `npx ruflo@latest performance benchmark --suite all` |
+| **Memory Analysis** | Reduce memory usage and fix leaks | `npx ruflo@latest performance metrics` |
### πŸ”„ GitHub & DevOps
| Scenario | What It Solves | How To Do It |
|----------|----------------|--------------|
-| **PR Management** | Review, approve, and merge PRs efficiently | `npx ruflo@v3alpha --agent pr-manager --task "Review open PRs"` |
-| **Issue Triage** | Categorize, prioritize, and assign issues automatically | `npx ruflo@v3alpha --agent issue-tracker --task "Triage new issues"` |
-| **Release Management** | Coordinate releases with changelogs and versioning | `npx ruflo@v3alpha --agent release-manager --task "Prepare v2.0 release"` |
-| **CI/CD Optimization** | Speed up pipelines and reduce flaky tests | `npx ruflo@v3alpha --agent cicd-engineer --task "Optimize GitHub Actions workflow"` |
+| **PR Management** | Review, approve, and merge PRs efficiently | `npx ruflo@latest hive-mind spawn "Review open PRs"` |
+| **Issue Triage** | Categorize, prioritize, and assign issues automatically | `npx ruflo@latest hive-mind spawn "Triage new issues"` |
+| **Release Management** | Coordinate releases with changelogs and versioning | `npx ruflo@latest hive-mind spawn "Prepare v2.0 release"` |
+| **CI/CD Optimization** | Speed up pipelines and reduce flaky tests | `npx ruflo@latest hive-mind spawn "Optimize GitHub Actions workflow"` |
### πŸ“‹ Spec-Driven Development
| Scenario | What It Solves | How To Do It |
|----------|----------------|--------------|
-| **Generate Specs** | Create complete specifications before coding | `npx ruflo@v3alpha --agent architect --task "Create ADR for authentication system"` |
-| **Validate Implementation** | Ensure code matches specifications | `npx ruflo@v3alpha hooks progress --detailed` |
-| **Track Compliance** | Monitor spec adherence across the team | `npx ruflo@v3alpha progress sync` |
+| **Generate Specs** | Create complete specifications before coding | `npx ruflo@latest hive-mind spawn "Create ADR for authentication system"` |
+| **Validate Implementation** | Ensure code matches specifications | `npx ruflo@latest hooks progress --detailed` |
+| **Track Compliance** | Monitor spec adherence across the team | `npx ruflo@latest progress sync` |
### 🧠 Learning & Intelligence
| Scenario | What It Solves | How To Do It |
|----------|----------------|--------------|
-| **Bootstrap Intelligence** | Train the system on your codebase patterns | `npx ruflo@v3alpha hooks pretrain --depth deep` |
-| **Optimize Routing** | Improve task-to-agent matching over time | `npx ruflo@v3alpha hooks route "<task>" --include-explanation` |
-| **Transfer Learning** | Apply patterns learned from other projects | `npx ruflo@v3alpha hooks transfer <sourceProject>` |
+| **Bootstrap Intelligence** | Train the system on your codebase patterns | `npx ruflo@latest hooks pretrain --depth deep` |
+| **Optimize Routing** | Improve task-to-agent matching over time | `npx ruflo@latest hooks route "<task>" --include-explanation` |
+| **Transfer Learning** | Apply patterns learned from other projects | `npx ruflo@latest hooks transfer <sourceProject>` |
</details>
@@ -3214,7 +3217,7 @@ When hooks run, they emit signals that guide routing decisions. Watch for these
**Example Hook Output:**
```bash
-$ npx ruflo@v3alpha hooks pre-task --description "convert var to const in utils.ts"
+$ npx ruflo@latest hooks pre-task --description "convert var to const in utils.ts"
[AGENT_BOOSTER_AVAILABLE] Intent: var-to-const
Recommendation: Use Edit tool directly
@@ -3332,8 +3335,8 @@ The stats command shows:
```bash
# Example: Edit with pattern learning
-npx ruflo@v3alpha hooks pre-edit ./src/auth.ts
-npx ruflo@v3alpha hooks post-edit ./src/auth.ts --success true --train-patterns
+npx ruflo@latest hooks pre-edit ./src/auth.ts
+npx ruflo@latest hooks post-edit ./src/auth.ts --success true --train-patterns
```
#### 🧠 Intelligence & Routing Hooks (8 hooks)
@@ -3351,10 +3354,10 @@ npx ruflo@v3alpha hooks post-edit ./src/auth.ts --success true --train-patterns
```bash
# Route a task with explanation
-npx ruflo@v3alpha hooks route "refactor authentication to use JWT" --include-explanation
+npx ruflo@latest hooks route "refactor authentication to use JWT" --include-explanation
# Bootstrap intelligence from your codebase
-npx ruflo@v3alpha hooks pretrain --depth deep --model-type moe
+npx ruflo@latest hooks pretrain --depth deep --model-type moe
```
#### πŸ“… Session Management Hooks (4 hooks)
@@ -3368,10 +3371,10 @@ npx ruflo@v3alpha hooks pretrain --depth deep --model-type moe
```bash
# Start session with auto-daemon
-npx ruflo@v3alpha hooks session-start --session-id "feature-auth" --start-daemon
+npx ruflo@latest hooks session-start --session-id "feature-auth" --start-daemon
# End session and export learnings
-npx ruflo@v3alpha hooks session-end --export-metrics --persist-patterns
+npx ruflo@latest hooks session-end --export-metrics --persist-patterns
```
#### πŸ€– Intelligence System Hooks (9 hooks)
@@ -3390,13 +3393,13 @@ npx ruflo@v3alpha hooks session-end --export-metrics --persist-patterns
```bash
# Start trajectory for complex task
-npx ruflo@v3alpha hooks intelligence trajectory-start --task "implement OAuth2"
+npx ruflo@latest hooks intelligence trajectory-start --task "implement OAuth2"
# Record successful action
-npx ruflo@v3alpha hooks intelligence trajectory-step --action "created token service" --quality 0.9
+npx ruflo@latest hooks intelligence trajectory-step --action "created token service" --quality 0.9
# End trajectory and trigger learning
-npx ruflo@v3alpha hooks intelligence trajectory-end --success true
+npx ruflo@latest hooks intelligence trajectory-end --success true
# View intelligence diagnostics and improvement trends (ADR-050)
node .claude/helpers/hook-handler.cjs stats
@@ -3424,13 +3427,13 @@ Workers run automatically based on context, or dispatch manually.
```bash
# List all workers
-npx ruflo@v3alpha hooks worker list
+npx ruflo@latest hooks worker list
# Manually dispatch security audit
-npx ruflo@v3alpha hooks worker dispatch --trigger audit --context "./src/auth"
+npx ruflo@latest hooks worker dispatch --trigger audit --context "./src/auth"
# Check worker status
-npx ruflo@v3alpha hooks worker status
+npx ruflo@latest hooks worker status
```
### Model Routing Hooks (3 hooks)
@@ -3445,10 +3448,10 @@ Automatically selects haiku/sonnet/opus based on task complexity.
```bash
# Get model recommendation
-npx ruflo@v3alpha hooks model-route --task "fix typo in README"
+npx ruflo@latest hooks model-route --task "fix typo in README"
# β†’ Recommends: haiku (simple task, low complexity)
-npx ruflo@v3alpha hooks model-route --task "design distributed consensus system"
+npx ruflo@latest hooks model-route --task "design distributed consensus system"
# β†’ Recommends: opus (complex architecture, high reasoning)
```
@@ -3469,15 +3472,15 @@ npx ruflo@v3alpha hooks model-route --task "design distributed consensus system"
# ══════════════════════════════════════════════════════════════════
# Route task to best agent (with intelligence context injection)
-npx ruflo@v3alpha hooks route "<task>" --include-explanation
+npx ruflo@latest hooks route "<task>" --include-explanation
# Start/end session with learning
-npx ruflo@v3alpha hooks session-start --start-daemon
-npx ruflo@v3alpha hooks session-end --persist-patterns
+npx ruflo@latest hooks session-start --start-daemon
+npx ruflo@latest hooks session-end --persist-patterns
# View what the system has learned
-npx ruflo@v3alpha hooks metrics
-npx ruflo@v3alpha hooks intelligence stats
+npx ruflo@latest hooks metrics
+npx ruflo@latest hooks intelligence stats
# Intelligence diagnostics β€” see if intelligence is improving
node .claude/helpers/hook-handler.cjs stats # Human-readable
@@ -3485,10 +3488,10 @@ node .claude/helpers/hook-handler.cjs stats --json # JSON for scripting
node .claude/helpers/intelligence.cjs stats # Direct access
# Bootstrap on new project
-npx ruflo@v3alpha hooks pretrain --depth deep
+npx ruflo@latest hooks pretrain --depth deep
# Dispatch background worker
-npx ruflo@v3alpha hooks worker dispatch --trigger audit
+npx ruflo@latest hooks worker dispatch --trigger audit
```
</details>
@@ -3514,38 +3517,38 @@ Share learned patterns across projects, teams, and the community via the decentr
```bash
# Export learned patterns to file
-npx ruflo@v3alpha memory export --format json --output ./patterns.json
+npx ruflo@latest memory export --format json --output ./patterns.json
# Export specific namespace
-npx ruflo@v3alpha memory export --namespace "security" --output ./security-patterns.json
+npx ruflo@latest memory export --namespace "security" --output ./security-patterns.json
# Export with embeddings (larger file, faster import)
-npx ruflo@v3alpha memory export --include-embeddings --output ./full-export.json
+npx ruflo@latest memory export --include-embeddings --output ./full-export.json
# Export agent configurations
-npx ruflo@v3alpha config export --scope project --output ./agent-configs.json
+npx ruflo@latest config export --scope project --output ./agent-configs.json
# Export session state
-npx ruflo@v3alpha session export --session-id "my-session" --output ./session.json
+npx ruflo@latest session export --session-id "my-session" --output ./session.json
```
### Import Commands
```bash
# Import patterns from file
-npx ruflo@v3alpha memory import --input ./patterns.json
+npx ruflo@latest memory import --input ./patterns.json
# Import and merge with existing (don't overwrite)
-npx ruflo@v3alpha memory import --input ./patterns.json --merge
+npx ruflo@latest memory import --input ./patterns.json --merge
# Import from another project
-npx ruflo@v3alpha hooks transfer --source-path ../other-project
+npx ruflo@latest hooks transfer --source-path ../other-project
# Import agent configurations
-npx ruflo@v3alpha config import --input ./agent-configs.json --scope project
+npx ruflo@latest config import --input ./agent-configs.json --scope project
# Restore session
-npx ruflo@v3alpha session restore --session-id "my-session"
+npx ruflo@latest session restore --session-id "my-session"
```
### Pattern Store (IPFS Marketplace)
@@ -3563,13 +3566,13 @@ Decentralized pattern marketplace for sharing and discovering community patterns
```bash
# Search for authentication patterns
-npx ruflo@v3alpha transfer-store search --query "authentication" --min-rating 4.0
+npx ruflo@latest transfer-store search --query "authentication" --min-rating 4.0
# Download a pattern
-npx ruflo@v3alpha transfer-store download --id "auth-jwt-patterns-v2" --verify
+npx ruflo@latest transfer-store download --id "auth-jwt-patterns-v2" --verify
# Publish your patterns
-npx ruflo@v3alpha transfer-store publish --input ./my-patterns.json --category "security"
+npx ruflo@latest transfer-store publish --input ./my-patterns.json --category "security"
```
### Plugin Store
@@ -3587,22 +3590,22 @@ Discover and install community plugins from the **live IPFS registry** with 19 o
```bash
# List plugins with live ratings from Cloud Function
-npx ruflo@v3alpha plugins list
+npx ruflo@latest plugins list
# Filter by type
-npx ruflo@v3alpha plugins list --type integration
+npx ruflo@latest plugins list --type integration
# Rate a plugin
-npx ruflo@v3alpha plugins rate --name @claude-flow/embeddings --rating 5
+npx ruflo@latest plugins rate --name @claude-flow/embeddings --rating 5
# Search for MCP tool plugins
-npx ruflo@v3alpha transfer plugin-search --type "mcp-tool" --verified
+npx ruflo@latest transfer plugin-search --type "mcp-tool" --verified
# Get plugin info
-npx ruflo@v3alpha transfer plugin-info --name "semantic-code-search"
+npx ruflo@latest transfer plugin-info --name "semantic-code-search"
# List official plugins
-npx ruflo@v3alpha transfer plugin-official
+npx ruflo@latest transfer plugin-official
```
#### Live IPFS Plugin Registry
@@ -3635,10 +3638,10 @@ Patterns and models are distributed via IPFS for decentralization and integrity.
```bash
# Resolve IPNS name to CID
-npx ruflo@v3alpha transfer ipfs-resolve --name "/ipns/patterns.ruflo.io"
+npx ruflo@latest transfer ipfs-resolve --name "/ipns/patterns.ruflo.io"
# Detect PII before publishing
-npx ruflo@v3alpha transfer detect-pii --content "$(cat ./patterns.json)"
+npx ruflo@latest transfer detect-pii --content "$(cat ./patterns.json)"
```
### Model & Learning Pattern Import/Export
@@ -3703,13 +3706,13 @@ Import pre-trained learning patterns for common tasks. **90.5% average accuracy*
curl -s "https://gateway.pinata.cloud/ipfs/QmNr1yYMKi7YBaL8JSztQyuB5ZUaTdRMLxJC1pBpGbjsTc" | jq '.models[].name'
# Import all models
-npx ruflo@v3alpha transfer import --cid QmNr1yYMKi7YBaL8JSztQyuB5ZUaTdRMLxJC1pBpGbjsTc
+npx ruflo@latest transfer import --cid QmNr1yYMKi7YBaL8JSztQyuB5ZUaTdRMLxJC1pBpGbjsTc
# Import specific category
-npx ruflo@v3alpha neural import --model security-review-patterns --source ipfs
+npx ruflo@latest neural import --model security-review-patterns --source ipfs
# Use patterns in routing
-npx ruflo@v3alpha hooks route --task "review authentication code" --use-patterns
+npx ruflo@latest hooks route --task "review authentication code" --use-patterns
```
#### Benefits vs Fresh Install
@@ -3734,7 +3737,7 @@ npx ruflo@v3alpha hooks route --task "review authentication code" --use-patterns
```bash
# Install a pattern pack
-npx ruflo@v3alpha transfer-store download --id "security-essentials" --apply
+npx ruflo@latest transfer-store download --id "security-essentials" --apply
```
### RuVector WASM Neural Training
@@ -3752,25 +3755,25 @@ Real WASM-accelerated neural training using `@ruvector/learning-wasm` and `@ruve
```bash
# List available pre-trained models from IPFS registry
-npx ruflo@v3alpha neural list
+npx ruflo@latest neural list
# List models by category
-npx ruflo@v3alpha neural list --category security
+npx ruflo@latest neural list --category security
# Train with WASM acceleration
-npx ruflo@v3alpha neural train -p coordination -e 100 --wasm --flash --contrastive
+npx ruflo@latest neural train -p coordination -e 100 --wasm --flash --contrastive
# Train security patterns
-npx ruflo@v3alpha neural train -p security --wasm --contrastive
+npx ruflo@latest neural train -p security --wasm --contrastive
# Benchmark WASM performance
-npx ruflo@v3alpha neural benchmark -d 256 -i 1000
+npx ruflo@latest neural benchmark -d 256 -i 1000
# Import pre-trained models
-npx ruflo@v3alpha neural import --cid QmNr1yYMKi7YBaL8JSztQyuB5ZUaTdRMLxJC1pBpGbjsTc
+npx ruflo@latest neural import --cid QmNr1yYMKi7YBaL8JSztQyuB5ZUaTdRMLxJC1pBpGbjsTc
# Export trained patterns to IPFS
-npx ruflo@v3alpha neural export --ipfs --sign
+npx ruflo@latest neural export --ipfs --sign
```
#### Benchmark Results
@@ -4109,9 +4112,9 @@ Skills are **reusable workflows** that combine agents, hooks, and patterns into
/v3-security-overhaul
# Via CLI
-npx ruflo@v3alpha skill run github-code-review
-npx ruflo@v3alpha skill list
-npx ruflo@v3alpha skill info sparc-methodology
+npx ruflo@latest skill run github-code-review
+npx ruflo@latest skill list
+npx ruflo@latest skill info sparc-methodology
```
### Creating Custom Skills
@@ -4168,21 +4171,21 @@ The Claims system manages **who is working on what** β€” whether human or agent.
| Command | What It Does | Example |
|---------|--------------|---------|
-| `issues list` | See all issues and their status | `npx ruflo@v3alpha issues list` |
-| `issues claim` | Claim an issue for yourself/agent | `npx ruflo@v3alpha issues claim #123 --as coder-1` |
-| `issues release` | Release your claim | `npx ruflo@v3alpha issues release #123` |
-| `issues handoff` | Hand off to another worker | `npx ruflo@v3alpha issues handoff #123 --to reviewer` |
-| `issues status` | Update progress on claimed work | `npx ruflo@v3alpha issues status #123 --progress 75` |
-| `issues stealable` | List abandoned/stuck issues | `npx ruflo@v3alpha issues stealable` |
-| `issues steal` | Take over stealable issue | `npx ruflo@v3alpha issues steal #123` |
-| `issues load` | View agent workloads | `npx ruflo@v3alpha issues load` |
-| `issues rebalance` | Redistribute work evenly | `npx ruflo@v3alpha issues rebalance --dry-run` |
-| `issues board` | Visual board view | `npx ruflo@v3alpha issues board` |
+| `issues list` | See all issues and their status | `npx ruflo@latest issues list` |
+| `issues claim` | Claim an issue for yourself/agent | `npx ruflo@latest issues claim #123 --as coder-1` |
+| `issues release` | Release your claim | `npx ruflo@latest issues release #123` |
+| `issues handoff` | Hand off to another worker | `npx ruflo@latest issues handoff #123 --to reviewer` |
+| `issues status` | Update progress on claimed work | `npx ruflo@latest issues status #123 --progress 75` |
+| `issues stealable` | List abandoned/stuck issues | `npx ruflo@latest issues stealable` |
+| `issues steal` | Take over stealable issue | `npx ruflo@latest issues steal #123` |
+| `issues load` | View agent workloads | `npx ruflo@latest issues load` |
+| `issues rebalance` | Redistribute work evenly | `npx ruflo@latest issues rebalance --dry-run` |
+| `issues board` | Visual board view | `npx ruflo@latest issues board` |
### Visual Board View
```bash
-npx ruflo@v3alpha issues board
+npx ruflo@latest issues board
```
```
@@ -4204,13 +4207,13 @@ When you need to pass work to someone else:
```bash
# 1. Request handoff with context
-npx ruflo@v3alpha issues handoff #123 \
+npx ruflo@latest issues handoff #123 \
--to security-architect \
--reason "Needs security review" \
--progress 80
# 2. Target accepts handoff
-npx ruflo@v3alpha issues accept #123 --as security-architect
+npx ruflo@latest issues accept #123 --as security-architect
# 3. Work continues with full context
```
@@ -4219,7 +4222,7 @@ npx ruflo@v3alpha issues accept #123 --as security-architect
```bash
# View current load
-npx ruflo@v3alpha issues load
+npx ruflo@latest issues load
# Output:
# Agent | Claims | Load | Status
@@ -4230,7 +4233,7 @@ npx ruflo@v3alpha issues load
# security-arch | 0 | 0% | 🟒 Available
# Auto-rebalance
-npx ruflo@v3alpha issues rebalance
+npx ruflo@latest issues rebalance
```
### MCP Tools
@@ -4291,14 +4294,14 @@ The Route system uses **Q-Learning** to automatically assign tasks to the best a
| Command | What It Does | Example |
|---------|--------------|---------|
-| `route task` | Get agent recommendation | `npx ruflo@v3alpha route task "implement OAuth2"` |
-| `route explain` | Understand routing decision | `npx ruflo@v3alpha route explain "task"` |
-| `route coverage` | Route based on test coverage | `npx ruflo@v3alpha route coverage` |
+| `route task` | Get agent recommendation | `npx ruflo@latest route task "implement OAuth2"` |
+| `route explain` | Understand routing decision | `npx ruflo@latest route explain "task"` |
+| `route coverage` | Route based on test coverage | `npx ruflo@latest route coverage` |
### Example: Route a Task
```bash
-npx ruflo@v3alpha route task "refactor authentication to use JWT"
+npx ruflo@latest route task "refactor authentication to use JWT"
# Output:
# ╔══════════════════════════════════════════════════════════════╗
@@ -4325,7 +4328,7 @@ npx ruflo@v3alpha route task "refactor authentication to use JWT"
Routes tasks to agents based on **test coverage gaps**:
```bash
-npx ruflo@v3alpha route coverage
+npx ruflo@latest route coverage
# Finds untested code and routes to tester agent:
# β€’ src/auth/jwt.ts - 23% coverage β†’ tester
@@ -4337,10 +4340,10 @@ npx ruflo@v3alpha route coverage
```bash
# Route via hooks (preferred)
-npx ruflo@v3alpha hooks route "implement caching layer" --include-explanation
+npx ruflo@latest hooks route "implement caching layer" --include-explanation
# Record outcome for learning
-npx ruflo@v3alpha hooks post-task --task-id "task-123" --success true --agent coder
+npx ruflo@latest hooks post-task --task-id "task-123" --success true --agent coder
```
### How Q-Learning Improves Over Time
@@ -4374,7 +4377,7 @@ Use Ruflo packages directly in your TypeScript/JavaScript applications.
npm install @claude-flow/cli @claude-flow/memory @claude-flow/swarm
# Or install everything
-npm install ruflo@v3alpha
+npm install ruflo@latest
```
### Quick Examples
@@ -5685,7 +5688,7 @@ Flow Nexus is a **cloud platform** for deploying and scaling Ruflo beyond your l
/flow-nexus-swarm
# Or via CLI
-npx ruflo@v3alpha nexus swarm deploy \
+npx ruflo@latest nexus swarm deploy \
--topology hierarchical \
--max-agents 50 \
--region us-east-1
@@ -5697,13 +5700,13 @@ Isolated execution environments for running untrusted code:
```bash
# Create sandbox
-npx ruflo@v3alpha nexus sandbox create --language python
+npx ruflo@latest nexus sandbox create --language python
# Execute code safely
-npx ruflo@v3alpha nexus sandbox exec --code "print('Hello')"
+npx ruflo@latest nexus sandbox exec --code "print('Hello')"
# Cleanup
-npx ruflo@v3alpha nexus sandbox destroy
+npx ruflo@latest nexus sandbox destroy
```
### Event-Driven Workflows
@@ -5729,10 +5732,10 @@ steps:
# 1. Sign up at flow-nexus.io
# 2. Get API key
# 3. Configure
-npx ruflo@v3alpha nexus configure --api-key <key>
+npx ruflo@latest nexus configure --api-key <key>
# 4. Deploy
-npx ruflo@v3alpha nexus swarm deploy
+npx ruflo@latest nexus swarm deploy
```
</details>
@@ -5766,7 +5769,7 @@ Stream-Chain enables **sequential processing** where the output of one agent bec
/stream-chain
# Define pipeline
-npx ruflo@v3alpha stream-chain create \
+npx ruflo@latest stream-chain create \
--name "feature-pipeline" \
--stages "researcher,architect,coder,tester,reviewer"
```
@@ -5808,11 +5811,11 @@ stages:
```bash
# Run the pipeline
-npx ruflo@v3alpha stream-chain run feature-pipeline \
+npx ruflo@latest stream-chain run feature-pipeline \
--input '{"requirements": "Add user dashboard with analytics"}'
# Monitor progress
-npx ruflo@v3alpha stream-chain status feature-pipeline
+npx ruflo@latest stream-chain status feature-pipeline
```
### Use Cases
@@ -5852,7 +5855,7 @@ The Pair Programming skill provides **human-AI collaborative coding** with role
/pair-programming --mode tdd
# Via CLI
-npx ruflo@v3alpha pair start --mode navigator
+npx ruflo@latest pair start --mode navigator
```
### TDD Mode Workflow
@@ -5892,16 +5895,16 @@ npx ruflo@v3alpha pair start --mode navigator
```bash
# Switch roles mid-session
-npx ruflo@v3alpha pair switch
+npx ruflo@latest pair switch
# Get AI explanation
-npx ruflo@v3alpha pair explain
+npx ruflo@latest pair explain
# Run tests
-npx ruflo@v3alpha pair test
+npx ruflo@latest pair test
# End session with summary
-npx ruflo@v3alpha pair end
+npx ruflo@latest pair end
```
</details>
@@ -5958,22 +5961,22 @@ Detection Time: 0.04ms | 50+ Patterns | Self-Learning | HNSW Vector Search
```bash
# Basic threat scan
-npx ruflo@v3alpha security defend -i "ignore previous instructions"
+npx ruflo@latest security defend -i "ignore previous instructions"
# Scan a file
-npx ruflo@v3alpha security defend -f ./user-prompts.txt
+npx ruflo@latest security defend -f ./user-prompts.txt
# Quick scan (faster)
-npx ruflo@v3alpha security defend -i "some text" --quick
+npx ruflo@latest security defend -i "some text" --quick
# JSON output
-npx ruflo@v3alpha security defend -i "test" -o json
+npx ruflo@latest security defend -i "test" -o json
# View statistics
-npx ruflo@v3alpha security defend --stats
+npx ruflo@latest security defend --stats
# Full security audit
-npx ruflo@v3alpha security scan --depth full
+npx ruflo@latest security scan --depth full
```
### MCP Tools
@@ -6564,10 +6567,10 @@ npm run bench:attention
npm run bench:startup
# Performance report
-npx ruflo@v3alpha performance report
+npx ruflo@latest performance report
# Benchmark specific suite
-npx ruflo@v3alpha performance benchmark --suite memory
+npx ruflo@latest performance benchmark --suite memory
```
</details>
@@ -7244,25 +7247,25 @@ Ruflo looks for configuration in this order:
```bash
# View current configuration
-npx ruflo@v3alpha config list
+npx ruflo@latest config list
# Get specific value
-npx ruflo@v3alpha config get --key memory.type
+npx ruflo@latest config get --key memory.type
# Set configuration value
-npx ruflo@v3alpha config set --key swarm.maxAgents --value 10
+npx ruflo@latest config set --key swarm.maxAgents --value 10
# Export configuration
-npx ruflo@v3alpha config export > my-config.json
+npx ruflo@latest config export > my-config.json
# Import configuration
-npx ruflo@v3alpha config import --file my-config.json
+npx ruflo@latest config import --file my-config.json
# Reset to defaults
-npx ruflo@v3alpha config reset --key swarm
+npx ruflo@latest config reset --key swarm
# Initialize with wizard
-npx ruflo@v3alpha init --wizard
+npx ruflo@latest init --wizard
```
</details>
@@ -7286,7 +7289,7 @@ lsof -i :3000
# Kill existing process
kill -9 <PID>
# Restart MCP server
-npx ruflo@v3alpha mcp start
+npx ruflo@latest mcp start
```
**Agent spawn failures**
@@ -7300,9 +7303,9 @@ export CLAUDE_FLOW_MAX_AGENTS=5
**Pattern search returning no results**
```bash
# Verify patterns are stored
-npx ruflo@v3alpha hooks metrics
+npx ruflo@latest hooks metrics
# Re-run pretraining if empty
-npx ruflo@v3alpha hooks pretrain
+npx ruflo@latest hooks pretrain
```
**Windows path issues**
@@ -7370,20 +7373,20 @@ cp -r ./data ./data-backup-v2
cp -r ./.ruflo ./.ruflo-backup-v2
# STEP 2: Check migration status
-npx ruflo@v3alpha migrate status
+npx ruflo@latest migrate status
# STEP 3: Run migration with dry-run first
-npx ruflo@v3alpha migrate run --dry-run
+npx ruflo@latest migrate run --dry-run
# STEP 4: Execute migration
-npx ruflo@v3alpha migrate run --from v2
+npx ruflo@latest migrate run --from v2
# STEP 5: Verify migration
-npx ruflo@v3alpha migrate verify
+npx ruflo@latest migrate verify
# STEP 6: Initialize V3 learning
-npx ruflo@v3alpha hooks pretrain
-npx ruflo@v3alpha doctor --fix
+npx ruflo@latest hooks pretrain
+npx ruflo@latest doctor --fix
```
### Command Changes Reference
@@ -7450,10 +7453,10 @@ If migration fails, you can rollback:
```bash
# Check rollback options
-npx ruflo@v3alpha migrate rollback --list
+npx ruflo@latest migrate rollback --list
# Rollback to V2
-npx ruflo@v3alpha migrate rollback --to v2
+npx ruflo@latest migrate rollback --to v2
# Restore backup manually if needed
rm -rf ./data
@@ -7462,12 +7465,12 @@ cp -r ./data-backup-v2 ./data
### Post-Migration Checklist
-- [ ] Verify all agents spawn correctly: `npx ruflo@v3alpha agent list`
-- [ ] Check memory search works: `npx ruflo@v3alpha memory search -q "test"`
-- [ ] Confirm MCP server starts: `npx ruflo@v3alpha mcp start`
-- [ ] Run doctor diagnostics: `npx ruflo@v3alpha doctor`
-- [ ] Test a simple swarm: `npx ruflo@v3alpha swarm init --topology mesh`
-- [ ] Bootstrap learning: `npx ruflo@v3alpha hooks pretrain`
+- [ ] Verify all agents spawn correctly: `npx ruflo@latest agent list`
+- [ ] Check memory search works: `npx ruflo@latest memory search -q "test"`
+- [ ] Confirm MCP server starts: `npx ruflo@latest mcp start`
+- [ ] Run doctor diagnostics: `npx ruflo@latest doctor`
+- [ ] Test a simple swarm: `npx ruflo@latest swarm init --topology mesh`
+- [ ] Bootstrap learning: `npx ruflo@latest hooks pretrain`
### Common Migration Issues
@@ -7511,7 +7514,7 @@ cp -r ./data-backup-v2 ./data
### Additional Resources
- [V2 Documentation](./v2/README.md)
-- [Architecture Decisions (ADRs)](./v3/docs/adr/)
+- [Architecture Decisions (ADRs)](./v3/implementation/adrs/)
- [API Reference](./v2/docs/technical/)
- [Examples](./v2/examples/)
diff --git a/v3/@claude-flow/cli/__tests__/ruvector/ruvllm-wasm.test.ts b/v3/@claude-flow/cli/__tests__/ruvector/ruvllm-wasm.test.ts
index 6d653ad6d9..12bb506a79 100644
--- a/v3/@claude-flow/cli/__tests__/ruvector/ruvllm-wasm.test.ts
+++ b/v3/@claude-flow/cli/__tests__/ruvector/ruvllm-wasm.test.ts
@@ -101,25 +101,75 @@ const mockChatTemplate = {
name: 'llama3',
};
+// Use class syntax for mocks that are invoked with `new` β€” vi.fn().mockImplementation(() => ...)
+// returns an arrow function which is NOT constructable and throws "is not a constructor".
vi.mock('@ruvector/ruvllm-wasm', () => ({
default: vi.fn(),
initSync: vi.fn(),
- RuvLLMWasm: vi.fn().mockImplementation(() => ({
- initialize: vi.fn(),
- isInitialized: true,
- getPoolStats: vi.fn().mockReturnValue('{}'),
- reset: vi.fn(),
- })),
- HnswRouterWasm: vi.fn().mockImplementation(() => mockHnswRouter),
- SonaConfigWasm: vi.fn().mockImplementation(() => ({ ...mockSonaConfig })),
- SonaInstantWasm: vi.fn().mockImplementation(() => mockSonaInstant),
- MicroLoraConfigWasm: vi.fn().mockImplementation(() => ({ ...mockLoraConfig })),
- AdaptFeedbackWasm: vi.fn().mockImplementation(() => ({ ...mockAdaptFeedback })),
- MicroLoraWasm: vi.fn().mockImplementation(() => mockLora),
- KvCacheConfigWasm: vi.fn().mockImplementation(() => ({ ...mockKvCacheConfig })),
- KvCacheWasm: Object.assign(vi.fn().mockImplementation(() => mockKvCache), {
- withDefaults: vi.fn().mockReturnValue(mockKvCache),
- }),
+ RuvLLMWasm: class {
+ initialize = vi.fn();
+ isInitialized = true;
+ getPoolStats = vi.fn().mockReturnValue('{}');
+ reset = vi.fn();
+ },
+ HnswRouterWasm: class {
+ addPattern = mockHnswRouter.addPattern;
+ route = mockHnswRouter.route;
+ setEfSearch = mockHnswRouter.setEfSearch;
+ clear = mockHnswRouter.clear;
+ toJson = mockHnswRouter.toJson;
+ dimensions = 64;
+ constructor(..._args: unknown[]) { /* accept any ctor args */ }
+ },
+ SonaConfigWasm: class {
+ hiddenDim = 64;
+ learningRate = 0.01;
+ emaDecay = 0.99;
+ ewcLambda = 0.01;
+ microLoraRank = 2;
+ patternCapacity = 100;
+ },
+ SonaInstantWasm: class {
+ instantAdapt = mockSonaInstant.instantAdapt;
+ recordPattern = mockSonaInstant.recordPattern;
+ suggestAction = mockSonaInstant.suggestAction;
+ stats = mockSonaInstant.stats;
+ toJson = mockSonaInstant.toJson;
+ reset = mockSonaInstant.reset;
+ constructor(..._args: unknown[]) { /* accept SonaConfigWasm */ }
+ },
+ MicroLoraConfigWasm: class {
+ inputDim = 64;
+ outputDim = 32;
+ rank = 2;
+ alpha = 1.0;
+ },
+ AdaptFeedbackWasm: class {
+ quality = 0;
+ learningRate = 0;
+ success = true;
+ },
+ MicroLoraWasm: class {
+ apply = mockLora.apply;
+ adapt = mockLora.adapt;
+ applyUpdates = mockLora.applyUpdates;
+ stats = mockLora.stats;
+ reset = mockLora.reset;
+ toJson = mockLora.toJson;
+ getConfig = mockLora.getConfig;
+ pendingUpdates = mockLora.pendingUpdates;
+ constructor(..._args: unknown[]) { /* accept MicroLoraConfigWasm */ }
+ },
+ KvCacheConfigWasm: class {
+ tailLength = 4;
+ maxTokens = 2048;
+ numKvHeads = 8;
+ headDim = 64;
+ },
+ KvCacheWasm: Object.assign(
+ class { append = mockKvCache.append; stats = mockKvCache.stats; clear = mockKvCache.clear; tokenCount = 0; },
+ { withDefaults: vi.fn().mockReturnValue(mockKvCache) },
+ ),
GenerateConfig: class {
maxTokens = 100;
temperature = 0.7;
@@ -131,9 +181,10 @@ vi.mock('@ruvector/ruvllm-wasm', () => ({
toJson = mockGenerateConfig.toJson;
},
BufferPoolWasm: { withCapacity: vi.fn().mockReturnValue(mockBufferPool) },
- InferenceArenaWasm: Object.assign(vi.fn().mockImplementation(() => mockInferenceArena), {
- forModel: vi.fn().mockReturnValue(mockInferenceArena),
- }),
+ InferenceArenaWasm: Object.assign(
+ class { reset = mockInferenceArena.reset; used = 1024; capacity = 8192; remaining = 7168; },
+ { forModel: vi.fn().mockReturnValue(mockInferenceArena) },
+ ),
ChatMessageWasm: mockChatMessage,
ChatTemplateWasm: {
llama3: vi.fn().mockReturnValue(mockChatTemplate),
diff --git a/v3/@claude-flow/cli/package.json b/v3/@claude-flow/cli/package.json
index 6c1ba5b195..5750fb8039 100644
--- a/v3/@claude-flow/cli/package.json
+++ b/v3/@claude-flow/cli/package.json
@@ -1,6 +1,6 @@
{
"name": "@claude-flow/cli",
- "version": "3.5.44",
+ "version": "3.5.48",
"type": "module",
"description": "Ruflo CLI - Enterprise AI agent orchestration with 60+ specialized agents, swarm coordination, MCP server, self-learning hooks, and vector memory for Claude Code",
"main": "dist/src/index.js",
@@ -94,7 +94,7 @@
"@claude-flow/codex": "^3.0.0-alpha.8",
"@claude-flow/embeddings": "^3.0.0-alpha.12",
"@claude-flow/guidance": "^3.0.0-alpha.1",
- "@claude-flow/memory": "^3.0.0-alpha.11",
+ "@claude-flow/memory": "^3.0.0-alpha.12",
"@claude-flow/plugin-gastown-bridge": "^0.1.3",
"agentic-flow": "^3.0.0-alpha.1",
"@ruvector/attention": "^0.1.4",
diff --git a/v3/@claude-flow/cli/src/autopilot-state.ts b/v3/@claude-flow/cli/src/autopilot-state.ts
new file mode 100644
index 0000000000..c73f16af9d
--- /dev/null
+++ b/v3/@claude-flow/cli/src/autopilot-state.ts
@@ -0,0 +1,324 @@
+/**
+ * Autopilot Shared State Module
+ *
+ * Centralizes state management, validation, and task discovery
+ * for both CLI command and MCP tools. Eliminates code duplication.
+ *
+ * ADR-072: Autopilot Integration
+ * Security: Addresses prototype pollution, NaN bypass, input validation
+ */
+
+// ── Constants ─────────────────────────────────────────────────
+
+export const STATE_DIR = '.claude-flow/data';
+export const STATE_FILE = `${STATE_DIR}/autopilot-state.json`;
+export const LOG_FILE = `${STATE_DIR}/autopilot-log.json`;
+
+/** Maximum entries kept in state.history (prevents unbounded growth) */
+const MAX_HISTORY_ENTRIES = 50;
+
+/** Maximum entries kept in the event log */
+const MAX_LOG_ENTRIES = 1000;
+
+/** Allowlist for valid task sources */
+export const VALID_TASK_SOURCES = new Set(['team-tasks', 'swarm-tasks', 'file-checklist']);
+
+/** Terminal task statuses */
+export const TERMINAL_STATUSES = new Set(['completed', 'done', 'cancelled', 'skipped', 'failed']);
+
+// ── Types ─────────────────────────────────────────────────────
+
+export interface AutopilotState {
+ sessionId: string;
+ enabled: boolean;
+ startTime: number;
+ iterations: number;
+ maxIterations: number;
+ timeoutMinutes: number;
+ taskSources: string[];
+ lastCheck: number | null;
+ history: Array<{ ts: number; iteration: number; completed: number; total: number }>;
+}
+
+export interface AutopilotLogEntry {
+ ts: number;
+ event: string;
+ [key: string]: unknown;
+}
+
+export interface TaskInfo {
+ id: string;
+ subject: string;
+ status: string;
+ source: string;
+}
+
+export interface TaskProgress {
+ completed: number;
+ total: number;
+ percent: number;
+ incomplete: TaskInfo[];
+}
+
+// ── Validation Helpers ────────────────────────────────────────
+
+/**
+ * Sanitize a parsed JSON object to prevent prototype pollution.
+ * Removes __proto__, constructor, and prototype keys recursively.
+ */
+function sanitizeObject(obj: unknown): unknown {
+ if (obj === null || typeof obj !== 'object') return obj;
+ if (Array.isArray(obj)) return obj.map(sanitizeObject);
+
+ const clean: Record<string, unknown> = {};
+ for (const key of Object.keys(obj as Record<string, unknown>)) {
+ if (key === '__proto__' || key === 'constructor' || key === 'prototype') continue;
+ clean[key] = sanitizeObject((obj as Record<string, unknown>)[key]);
+ }
+ return clean;
+}
+
+/**
+ * Safe JSON.parse that prevents prototype pollution.
+ */
+export function safeJsonParse<T>(raw: string): T {
+ return sanitizeObject(JSON.parse(raw)) as T;
+}
+
+/**
+ * Validate and coerce a numeric parameter. Returns the default if
+ * the input is NaN, undefined, or outside the allowed range.
+ */
+export function validateNumber(value: unknown, min: number, max: number, defaultValue: number): number {
+ if (value === undefined || value === null) return defaultValue;
+ const num = Number(value);
+ if (!Number.isFinite(num)) return defaultValue;
+ return Math.min(Math.max(min, Math.round(num)), max);
+}
+
+/**
+ * Validate task sources against the allowlist.
+ * Returns only valid sources; falls back to defaults if none are valid.
+ */
+export function validateTaskSources(sources: unknown): string[] {
+ const defaults = ['team-tasks', 'swarm-tasks', 'file-checklist'];
+ if (!Array.isArray(sources)) return defaults;
+ const valid = sources
+ .filter((s): s is string => typeof s === 'string')
+ .map(s => s.trim())
+ .filter(s => VALID_TASK_SOURCES.has(s));
+ return valid.length > 0 ? valid : defaults;
+}
+
+// ── State Management ──────────────────────────────────────────
+
+export function getDefaultState(): AutopilotState {
+ const crypto = require('crypto') as typeof import('crypto');
+ return {
+ sessionId: crypto.randomUUID(),
+ enabled: false,
+ startTime: Date.now(),
+ iterations: 0,
+ maxIterations: 50,
+ timeoutMinutes: 240,
+ taskSources: ['team-tasks', 'swarm-tasks', 'file-checklist'],
+ lastCheck: null,
+ history: [],
+ };
+}
+
+export function loadState(): AutopilotState {
+ const fs = require('fs') as typeof import('fs');
+ const path = require('path') as typeof import('path');
+ const filePath = path.resolve(STATE_FILE);
+ const defaults = getDefaultState();
+ try {
+ if (fs.existsSync(filePath)) {
+ const raw = safeJsonParse<Partial<AutopilotState>>(fs.readFileSync(filePath, 'utf-8'));
+ const merged = { ...defaults, ...raw };
+ // Re-validate fields that could be tampered with
+ merged.maxIterations = validateNumber(merged.maxIterations, 1, 1000, 50);
+ merged.timeoutMinutes = validateNumber(merged.timeoutMinutes, 1, 1440, 240);
+ merged.iterations = validateNumber(merged.iterations, 0, 1000, 0);
+ merged.taskSources = validateTaskSources(merged.taskSources);
+ // Cap history to prevent unbounded growth
+ if (Array.isArray(merged.history) && merged.history.length > MAX_HISTORY_ENTRIES) {
+ merged.history = merged.history.slice(-MAX_HISTORY_ENTRIES);
+ }
+ return merged;
+ }
+ } catch {
+ // Corrupted state file β€” return defaults
+ }
+ return defaults;
+}
+
+export function saveState(state: AutopilotState): void {
+ const fs = require('fs') as typeof import('fs');
+ const path = require('path') as typeof import('path');
+ const dir = path.resolve(STATE_DIR);
+ if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
+ // Cap history before saving
+ if (state.history.length > MAX_HISTORY_ENTRIES) {
+ state.history = state.history.slice(-MAX_HISTORY_ENTRIES);
+ }
+ const tmpFile = path.resolve(STATE_FILE) + '.tmp';
+ fs.writeFileSync(tmpFile, JSON.stringify(state, null, 2));
+ fs.renameSync(tmpFile, path.resolve(STATE_FILE));
+}
+
+export function appendLog(entry: AutopilotLogEntry): void {
+ const fs = require('fs') as typeof import('fs');
+ const path = require('path') as typeof import('path');
+ const filePath = path.resolve(LOG_FILE);
+ const dir = path.resolve(STATE_DIR);
+ if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
+ let log: AutopilotLogEntry[] = [];
+ try {
+ if (fs.existsSync(filePath)) {
+ log = safeJsonParse<AutopilotLogEntry[]>(fs.readFileSync(filePath, 'utf-8'));
+ if (!Array.isArray(log)) log = [];
+ }
+ } catch {
+ log = [];
+ }
+ log.push(entry);
+ if (log.length > MAX_LOG_ENTRIES) log = log.slice(-MAX_LOG_ENTRIES);
+ const tmpFile = filePath + '.tmp';
+ fs.writeFileSync(tmpFile, JSON.stringify(log, null, 2));
+ fs.renameSync(tmpFile, filePath);
+}
+
+export function loadLog(): AutopilotLogEntry[] {
+ const fs = require('fs') as typeof import('fs');
+ const path = require('path') as typeof import('path');
+ const filePath = path.resolve(LOG_FILE);
+ try {
+ if (fs.existsSync(filePath)) {
+ const result = safeJsonParse<AutopilotLogEntry[]>(fs.readFileSync(filePath, 'utf-8'));
+ return Array.isArray(result) ? result : [];
+ }
+ } catch {
+ // Corrupted log β€” return empty
+ }
+ return [];
+}
+
+// ── Task Discovery ────────────────────────────────────────────
+
+export function discoverTasks(sources: string[]): TaskInfo[] {
+ const fs = require('fs') as typeof import('fs');
+ const path = require('path') as typeof import('path');
+ const os = require('os') as typeof import('os');
+ const tasks: TaskInfo[] = [];
+
+ // Only process valid sources
+ const validSources = sources.filter(s => VALID_TASK_SOURCES.has(s));
+
+ for (const source of validSources) {
+ if (source === 'team-tasks') {
+ const tasksDir = path.join(os.homedir(), '.claude', 'tasks');
+ try {
+ if (fs.existsSync(tasksDir)) {
+ const teams = fs.readdirSync(tasksDir, { withFileTypes: true });
+ for (const team of teams) {
+ if (!team.isDirectory()) continue;
+ const teamDir = path.join(tasksDir, team.name);
+ const files = fs.readdirSync(teamDir).filter((f: string) => f.endsWith('.json'));
+ for (const file of files) {
+ try {
+ const data = safeJsonParse<Record<string, unknown>>(fs.readFileSync(path.join(teamDir, file), 'utf-8'));
+ tasks.push({
+ id: String(data.id || file.replace('.json', '')),
+ subject: String(data.subject || data.title || file),
+ status: String(data.status || 'unknown'),
+ source: 'team-tasks',
+ });
+ } catch { /* skip individual file */ }
+ }
+ }
+ }
+ } catch { /* skip source */ }
+ }
+
+ if (source === 'swarm-tasks') {
+ const swarmFile = path.resolve('.claude-flow/swarm-tasks.json');
+ try {
+ if (fs.existsSync(swarmFile)) {
+ const data = safeJsonParse<Record<string, unknown> | unknown[]>(fs.readFileSync(swarmFile, 'utf-8'));
+ const swarmTasks = Array.isArray(data) ? data : ((data as Record<string, unknown>).tasks as unknown[] || []);
+ for (const t of swarmTasks) {
+ if (t && typeof t === 'object') {
+ const task = t as Record<string, unknown>;
+ tasks.push({
+ id: String(task.id || task.taskId || `swarm-${tasks.length}`),
+ subject: String(task.subject || task.description || task.name || 'Unnamed task'),
+ status: String(task.status || 'unknown'),
+ source: 'swarm-tasks',
+ });
+ }
+ }
+ }
+ } catch { /* skip source */ }
+ }
+
+ if (source === 'file-checklist') {
+ const checklistFile = path.resolve('.claude-flow/data/checklist.json');
+ try {
+ if (fs.existsSync(checklistFile)) {
+ const data = safeJsonParse<Record<string, unknown> | unknown[]>(fs.readFileSync(checklistFile, 'utf-8'));
+ const items = Array.isArray(data) ? data : ((data as Record<string, unknown>).items as unknown[] || []);
+ for (const item of items) {
+ if (item && typeof item === 'object') {
+ const i = item as Record<string, unknown>;
+ tasks.push({
+ id: String(i.id || `check-${tasks.length}`),
+ subject: String(i.subject || i.text || i.description || 'Unnamed item'),
+ status: String(i.status || (i.done ? 'completed' : 'pending')),
+ source: 'file-checklist',
+ });
+ }
+ }
+ }
+ } catch { /* skip source */ }
+ }
+ }
+
+ return tasks;
+}
+
+// ── Progress Helpers ──────────────────────────────────────────
+
+export function isTerminal(status: string): boolean {
+ return TERMINAL_STATUSES.has(status.toLowerCase());
+}
+
+export function getProgress(tasks: TaskInfo[]): TaskProgress {
+ const completed = tasks.filter(t => isTerminal(t.status)).length;
+ const total = tasks.length;
+ const percent = total === 0 ? 100 : Math.round((completed / total) * 100);
+ const incomplete = tasks.filter(t => !isTerminal(t.status));
+ return { completed, total, percent, incomplete };
+}
+
+// ── Reward Calculation ────────────────────────────────────────
+
+export function calculateReward(iterations: number, durationMs: number): number {
+ const iterFactor = (1 - iterations / (iterations + 10)) * 0.6;
+ const timeFactor = (1 - Math.min(durationMs / 3600000, 1)) * 0.4;
+ return Math.round((iterFactor + timeFactor) * 100) / 100;
+}
+
+// ── Learning Integration ──────────────────────────────────────
+
+export async function tryLoadLearning(): Promise<{ initialize: () => Promise<boolean>; [key: string]: unknown } | null> {
+ try {
+ const modPath = 'agentic-flow/dist/coordination/autopilot-learning.js';
+ const mod = await import(/* webpackIgnore: true */ modPath).catch(() => null);
+ if (mod?.AutopilotLearning) {
+ const instance = new mod.AutopilotLearning();
+ if (await instance.initialize()) return instance;
+ }
+ } catch { /* not available */ }
+ return null;
+}
diff --git a/v3/@claude-flow/cli/src/commands/agent-wasm.ts b/v3/@claude-flow/cli/src/commands/agent-wasm.ts
new file mode 100644
index 0000000000..a3ceed412b
--- /dev/null
+++ b/v3/@claude-flow/cli/src/commands/agent-wasm.ts
@@ -0,0 +1,367 @@
+/**
+ * WASM Agent CLI Subcommands
+ *
+ * Exposes @ruvector/rvagent-wasm operations via the `agent` CLI command.
+ * Wraps functions from ruvector/agent-wasm.ts for CLI usage.
+ */
+
+import type { Command, CommandContext, CommandResult } from '../types.js';
+import { output } from '../output.js';
+
+const WASM_NOT_AVAILABLE_MSG =
+ '@ruvector/rvagent-wasm is not installed.\n' +
+ 'Install it with: npm install @ruvector/rvagent-wasm';
+
+async function loadWasm() {
+ const mod = await import('../ruvector/agent-wasm.js');
+ return mod;
+}
+
+// agent wasm-status
+export const wasmStatusCommand: Command = {
+ name: 'wasm-status',
+ description: 'Check rvagent-wasm availability, version, and capabilities',
+ options: [],
+ examples: [
+ { command: 'claude-flow agent wasm-status', description: 'Check WASM agent runtime status' },
+ ],
+ action: async (ctx: CommandContext): Promise<CommandResult> => {
+ try {
+ const wasm = await loadWasm();
+ const available = await wasm.isAgentWasmAvailable();
+
+ if (!available) {
+ output.writeln();
+ output.printWarning(WASM_NOT_AVAILABLE_MSG);
+ if (ctx.flags.format === 'json') {
+ output.printJson({ available: false });
+ }
+ return { success: true, data: { available: false } };
+ }
+
+ // Init to get full status
+ await wasm.initAgentWasm();
+
+ const agents = wasm.listWasmAgents();
+ let galleryCount = 0;
+ let categories: Record<string, number> = {};
+ try {
+ galleryCount = await wasm.getGalleryCount();
+ categories = await wasm.getGalleryCategories();
+ } catch {
+ // Gallery may not be available in all builds
+ }
+
+ const statusData = {
+ available: true,
+ activeAgents: agents.length,
+ gallery: {
+ templates: galleryCount,
+ categories,
+ },
+ tools: ['read_file', 'write_file', 'edit_file', 'write_todos', 'list_files'],
+ features: ['sandboxed-execution', 'virtual-filesystem', 'gallery-templates', 'rvf-containers', 'mcp-bridge'],
+ };
+
+ if (ctx.flags.format === 'json') {
+ output.printJson(statusData);
+ return { success: true, data: statusData };
+ }
+
+ output.writeln();
+ output.writeln(output.bold('WASM Agent Runtime'));
+ output.writeln();
+ output.printTable({
+ columns: [
+ { key: 'property', header: 'Property', width: 20 },
+ { key: 'value', header: 'Value', width: 40 },
+ ],
+ data: [
+ { property: 'Available', value: output.success('yes') },
+ { property: 'Active Agents', value: String(agents.length) },
+ { property: 'Gallery Templates', value: String(galleryCount) },
+ { property: 'Sandbox Tools', value: statusData.tools.join(', ') },
+ { property: 'Features', value: statusData.features.join(', ') },
+ ],
+ });
+
+ if (Object.keys(categories).length > 0) {
+ output.writeln();
+ output.writeln(output.bold('Gallery Categories'));
+ output.printTable({
+ columns: [
+ { key: 'category', header: 'Category', width: 20 },
+ { key: 'count', header: 'Templates', width: 10, align: 'right' },
+ ],
+ data: Object.entries(categories).map(([category, count]) => ({ category, count })),
+ });
+ }
+
+ return { success: true, data: statusData };
+ } catch (error) {
+ output.printError(`WASM status check failed: ${String(error)}`);
+ return { success: false, exitCode: 1 };
+ }
+ },
+};
+
+// agent wasm-create
+export const wasmCreateCommand: Command = {
+ name: 'wasm-create',
+ description: 'Create a WASM-sandboxed agent',
+ options: [
+ {
+ name: 'template',
+ short: 't',
+ description: 'Gallery template (coder, researcher, tester, reviewer, security, swarm)',
+ type: 'string',
+ },
+ {
+ name: 'model',
+ short: 'm',
+ description: 'Model identifier (default: anthropic:claude-sonnet-4-20250514)',
+ type: 'string',
+ },
+ {
+ name: 'instructions',
+ short: 'i',
+ description: 'System instructions for the agent',
+ type: 'string',
+ },
+ {
+ name: 'max-turns',
+ description: 'Maximum conversation turns (default: 50)',
+ type: 'number',
+ default: 50,
+ },
+ ],
+ examples: [
+ { command: 'claude-flow agent wasm-create', description: 'Create a default WASM agent' },
+ { command: 'claude-flow agent wasm-create -t coder', description: 'Create from gallery template' },
+ { command: 'claude-flow agent wasm-create -m "anthropic:claude-sonnet-4-20250514" -i "You are a security auditor"', description: 'Create with custom config' },
+ ],
+ action: async (ctx: CommandContext): Promise<CommandResult> => {
+ try {
+ const wasm = await loadWasm();
+ const available = await wasm.isAgentWasmAvailable();
+ if (!available) {
+ output.printError(WASM_NOT_AVAILABLE_MSG);
+ return { success: false, exitCode: 1 };
+ }
+
+ const template = ctx.flags.template as string | undefined;
+ let info;
+
+ if (template) {
+ output.printInfo(`Creating WASM agent from template: ${output.highlight(template)}`);
+ info = await wasm.createAgentFromTemplate(template);
+ } else {
+ output.printInfo('Creating WASM agent...');
+ info = await wasm.createWasmAgent({
+ model: ctx.flags.model as string | undefined,
+ instructions: ctx.flags.instructions as string | undefined,
+ maxTurns: ctx.flags['max-turns'] as number | undefined,
+ });
+ }
+
+ if (ctx.flags.format === 'json') {
+ output.printJson({ success: true, agent: info, source: template ? 'gallery' : 'custom' });
+ return { success: true, data: info };
+ }
+
+ output.writeln();
+ output.printTable({
+ columns: [
+ { key: 'property', header: 'Property', width: 15 },
+ { key: 'value', header: 'Value', width: 45 },
+ ],
+ data: [
+ { property: 'ID', value: info.id },
+ { property: 'State', value: info.state },
+ { property: 'Model', value: info.model },
+ { property: 'Turn Count', value: String(info.turnCount) },
+ { property: 'File Count', value: String(info.fileCount) },
+ { property: 'Created', value: info.createdAt },
+ ...(template ? [{ property: 'Template', value: template }] : []),
+ ],
+ });
+
+ output.writeln();
+ output.printSuccess(`WASM agent created: ${info.id}`);
+
+ return { success: true, data: info };
+ } catch (error) {
+ output.printError(`Failed to create WASM agent: ${String(error)}`);
+ return { success: false, exitCode: 1 };
+ }
+ },
+};
+
+// agent wasm-prompt
+export const wasmPromptCommand: Command = {
+ name: 'wasm-prompt',
+ description: 'Send a prompt to a WASM agent',
+ options: [
+ {
+ name: 'agent-id',
+ short: 'a',
+ description: 'WASM agent ID (required)',
+ type: 'string',
+ },
+ {
+ name: 'input',
+ short: 'i',
+ description: 'Prompt text to send',
+ type: 'string',
+ },
+ ],
+ examples: [
+ { command: 'claude-flow agent wasm-prompt -a wasm-agent-1-abc -i "Write a hello world"', description: 'Send prompt to WASM agent' },
+ ],
+ action: async (ctx: CommandContext): Promise<CommandResult> => {
+ const agentId = ctx.flags['agent-id'] as string || ctx.args[0];
+ const promptInput = ctx.flags.input as string || ctx.args[1];
+
+ if (!agentId) {
+ output.printError('Agent ID is required. Use --agent-id or -a');
+ return { success: false, exitCode: 1 };
+ }
+ if (!promptInput) {
+ output.printError('Prompt input is required. Use --input or -i');
+ return { success: false, exitCode: 1 };
+ }
+
+ try {
+ const wasm = await loadWasm();
+ const available = await wasm.isAgentWasmAvailable();
+ if (!available) {
+ output.printError(WASM_NOT_AVAILABLE_MSG);
+ return { success: false, exitCode: 1 };
+ }
+
+ output.printInfo(`Sending prompt to ${output.highlight(agentId)}...`);
+ const result = await wasm.promptWasmAgent(agentId, promptInput);
+
+ if (ctx.flags.format === 'json') {
+ output.printJson({ agentId, response: result });
+ return { success: true, data: { agentId, response: result } };
+ }
+
+ output.writeln();
+ output.writeln(output.bold('Response'));
+ output.writeln();
+ output.writeln(result);
+
+ // Show updated agent info
+ const info = wasm.getWasmAgent(agentId);
+ if (info) {
+ output.writeln();
+ output.writeln(output.dim(`[turns: ${info.turnCount}, files: ${info.fileCount}, state: ${info.state}]`));
+ }
+
+ return { success: true, data: { agentId, response: result } };
+ } catch (error) {
+ output.printError(`Prompt failed: ${String(error)}`);
+ return { success: false, exitCode: 1 };
+ }
+ },
+};
+
+// agent wasm-gallery
+export const wasmGalleryCommand: Command = {
+ name: 'wasm-gallery',
+ description: 'List available WASM agent gallery templates',
+ options: [
+ {
+ name: 'search',
+ short: 's',
+ description: 'Search templates by query',
+ type: 'string',
+ },
+ {
+ name: 'category',
+ short: 'c',
+ description: 'Filter by category',
+ type: 'string',
+ },
+ ],
+ examples: [
+ { command: 'claude-flow agent wasm-gallery', description: 'List all gallery templates' },
+ { command: 'claude-flow agent wasm-gallery -s coder', description: 'Search gallery templates' },
+ ],
+ action: async (ctx: CommandContext): Promise<CommandResult> => {
+ try {
+ const wasm = await loadWasm();
+ const available = await wasm.isAgentWasmAvailable();
+ if (!available) {
+ output.printError(WASM_NOT_AVAILABLE_MSG);
+ return { success: false, exitCode: 1 };
+ }
+
+ const searchQuery = ctx.flags.search as string | undefined;
+ const category = ctx.flags.category as string | undefined;
+
+ let templates;
+ if (searchQuery) {
+ output.printInfo(`Searching gallery for: ${output.highlight(searchQuery)}`);
+ templates = await wasm.searchGalleryTemplates(searchQuery);
+ } else {
+ templates = await wasm.listGalleryTemplates();
+ }
+
+ // Filter by category if specified
+ if (category) {
+ templates = templates.filter((t: { category: string }) =>
+ t.category.toLowerCase() === category.toLowerCase()
+ );
+ }
+
+ if (ctx.flags.format === 'json') {
+ output.printJson({ templates, count: templates.length });
+ return { success: true, data: { templates, count: templates.length } };
+ }
+
+ output.writeln();
+ output.writeln(output.bold('WASM Agent Gallery'));
+ output.writeln();
+
+ if (templates.length === 0) {
+ output.printInfo('No templates found matching criteria');
+ return { success: true, data: { templates: [], count: 0 } };
+ }
+
+ output.printTable({
+ columns: [
+ { key: 'id', header: 'ID', width: 20 },
+ { key: 'name', header: 'Name', width: 18 },
+ { key: 'category', header: 'Category', width: 12 },
+ { key: 'description', header: 'Description', width: 35 },
+ { key: 'version', header: 'Version', width: 10 },
+ ],
+ data: templates.map((t: { id: string; name: string; category: string; description: string; version: string }) => ({
+ id: t.id,
+ name: t.name,
+ category: t.category,
+ description: t.description.length > 35 ? t.description.slice(0, 32) + '...' : t.description,
+ version: t.version,
+ })),
+ });
+
+ output.writeln();
+ output.printInfo(`${templates.length} template(s) found. Create with: agent wasm-create -t <id>`);
+
+ return { success: true, data: { templates, count: templates.length } };
+ } catch (error) {
+ output.printError(`Gallery listing failed: ${String(error)}`);
+ return { success: false, exitCode: 1 };
+ }
+ },
+};
+
+/** All WASM subcommands for the agent command */
+export const wasmSubcommands: Command[] = [
+ wasmStatusCommand,
+ wasmCreateCommand,
+ wasmPromptCommand,
+ wasmGalleryCommand,
+];
diff --git a/v3/@claude-flow/cli/src/commands/agent.ts b/v3/@claude-flow/cli/src/commands/agent.ts
index 82806b7c6a..a6d410bccb 100644
--- a/v3/@claude-flow/cli/src/commands/agent.ts
+++ b/v3/@claude-flow/cli/src/commands/agent.ts
@@ -7,6 +7,7 @@ import type { Command, CommandContext, CommandResult } from '../types.js';
import { output } from '../output.js';
import { select, confirm, input } from '../prompt.js';
import { callMCPTool, MCPClientError } from '../mcp-client.js';
+import { wasmSubcommands } from './agent-wasm.js';
import * as fs from 'fs';
import * as path from 'path';
@@ -994,7 +995,7 @@ function formatLogLevel(level: string): string {
export const agentCommand: Command = {
name: 'agent',
description: 'Agent management commands',
- subcommands: [spawnCommand, listCommand, statusCommand, stopCommand, metricsCommand, poolCommand, healthCommand, logsCommand],
+ subcommands: [spawnCommand, listCommand, statusCommand, stopCommand, metricsCommand, poolCommand, healthCommand, logsCommand, ...wasmSubcommands],
options: [],
examples: [
{ command: 'claude-flow agent spawn -t coder', description: 'Spawn a coder agent' },
@@ -1010,11 +1011,18 @@ export const agentCommand: Command = {
output.writeln();
output.writeln('Subcommands:');
output.printList([
- `${output.highlight('spawn')} - Spawn a new agent`,
- `${output.highlight('list')} - List all active agents`,
- `${output.highlight('status')} - Show detailed agent status`,
- `${output.highlight('stop')} - Stop a running agent`,
- `${output.highlight('metrics')} - Show agent metrics`
+ `${output.highlight('spawn')} - Spawn a new agent`,
+ `${output.highlight('list')} - List all active agents`,
+ `${output.highlight('status')} - Show detailed agent status`,
+ `${output.highlight('stop')} - Stop a running agent`,
+ `${output.highlight('metrics')} - Show agent metrics`,
+ `${output.highlight('pool')} - Manage agent pool`,
+ `${output.highlight('health')} - Show agent health`,
+ `${output.highlight('logs')} - Show agent logs`,
+ `${output.highlight('wasm-status')} - Check WASM runtime availability`,
+ `${output.highlight('wasm-create')} - Create a WASM-sandboxed agent`,
+ `${output.highlight('wasm-prompt')} - Send a prompt to a WASM agent`,
+ `${output.highlight('wasm-gallery')} - List WASM agent gallery templates`,
]);
output.writeln();
output.writeln('Run "claude-flow agent <subcommand> --help" for subcommand help');
diff --git a/v3/@claude-flow/cli/src/commands/autopilot.ts b/v3/@claude-flow/cli/src/commands/autopilot.ts
index 1b02670de4..d6a8efea12 100644
--- a/v3/@claude-flow/cli/src/commands/autopilot.ts
+++ b/v3/@claude-flow/cli/src/commands/autopilot.ts
@@ -7,212 +7,11 @@
import type { Command, CommandContext, CommandResult } from '../types.js';
import { output } from '../output.js';
-
-// ── State Management ──────────────────────────────────────────
-
-const STATE_DIR = '.claude-flow/data';
-const STATE_FILE = `${STATE_DIR}/autopilot-state.json`;
-const LOG_FILE = `${STATE_DIR}/autopilot-log.json`;
-
-interface AutopilotState {
- sessionId: string;
- enabled: boolean;
- startTime: number;
- iterations: number;
- maxIterations: number;
- timeoutMinutes: number;
- taskSources: string[];
- lastCheck: number | null;
- history: Array<{ ts: number; iteration: number; completed: number; total: number }>;
-}
-
-interface AutopilotLogEntry {
- ts: number;
- event: string;
- [key: string]: unknown;
-}
-
-interface TaskInfo {
- id: string;
- subject: string;
- status: string;
- source: string;
-}
-
-function getDefaultState(): AutopilotState {
- const crypto = require('crypto') as typeof import('crypto');
- return {
- sessionId: crypto.randomUUID(),
- enabled: false,
- startTime: Date.now(),
- iterations: 0,
- maxIterations: 50,
- timeoutMinutes: 240,
- taskSources: ['team-tasks', 'swarm-tasks', 'file-checklist'],
- lastCheck: null,
- history: [],
- };
-}
-
-function loadState(): AutopilotState {
- const fs = require('fs') as typeof import('fs');
- const path = require('path') as typeof import('path');
- const filePath = path.resolve(STATE_FILE);
- try {
- if (fs.existsSync(filePath)) {
- return { ...getDefaultState(), ...JSON.parse(fs.readFileSync(filePath, 'utf-8')) };
- }
- } catch { /* ignore */ }
- return getDefaultState();
-}
-
-function saveState(state: AutopilotState): void {
- const fs = require('fs') as typeof import('fs');
- const path = require('path') as typeof import('path');
- const dir = path.resolve(STATE_DIR);
- if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
- fs.writeFileSync(path.resolve(STATE_FILE), JSON.stringify(state, null, 2));
-}
-
-function appendLog(entry: AutopilotLogEntry): void {
- const fs = require('fs') as typeof import('fs');
- const path = require('path') as typeof import('path');
- const filePath = path.resolve(LOG_FILE);
- const dir = path.resolve(STATE_DIR);
- if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
- let log: AutopilotLogEntry[] = [];
- try {
- if (fs.existsSync(filePath)) {
- log = JSON.parse(fs.readFileSync(filePath, 'utf-8'));
- }
- } catch { /* ignore */ }
- log.push(entry);
- if (log.length > 1000) log = log.slice(-1000);
- fs.writeFileSync(filePath, JSON.stringify(log, null, 2));
-}
-
-function loadLog(): AutopilotLogEntry[] {
- const fs = require('fs') as typeof import('fs');
- const path = require('path') as typeof import('path');
- const filePath = path.resolve(LOG_FILE);
- try {
- if (fs.existsSync(filePath)) {
- return JSON.parse(fs.readFileSync(filePath, 'utf-8'));
- }
- } catch { /* ignore */ }
- return [];
-}
-
-// ── Task Discovery ────────────────────────────────────────────
-
-export function discoverTasks(sources: string[]): TaskInfo[] {
- const fs = require('fs') as typeof import('fs');
- const path = require('path') as typeof import('path');
- const os = require('os') as typeof import('os');
- const tasks: TaskInfo[] = [];
-
- for (const source of sources) {
- if (source === 'team-tasks') {
- const tasksDir = path.join(os.homedir(), '.claude', 'tasks');
- try {
- if (fs.existsSync(tasksDir)) {
- const teams = fs.readdirSync(tasksDir, { withFileTypes: true });
- for (const team of teams) {
- if (!team.isDirectory()) continue;
- const teamDir = path.join(tasksDir, team.name);
- const files = fs.readdirSync(teamDir).filter((f: string) => f.endsWith('.json'));
- for (const file of files) {
- try {
- const data = JSON.parse(fs.readFileSync(path.join(teamDir, file), 'utf-8'));
- tasks.push({
- id: data.id || file.replace('.json', ''),
- subject: data.subject || data.title || file,
- status: data.status || 'unknown',
- source: 'team-tasks',
- });
- } catch { /* skip */ }
- }
- }
- }
- } catch { /* ignore */ }
- }
-
- if (source === 'swarm-tasks') {
- const swarmFile = path.resolve('.claude-flow/swarm-tasks.json');
- try {
- if (fs.existsSync(swarmFile)) {
- const data = JSON.parse(fs.readFileSync(swarmFile, 'utf-8'));
- const swarmTasks = Array.isArray(data) ? data : (data.tasks || []);
- for (const t of swarmTasks) {
- tasks.push({
- id: t.id || t.taskId || `swarm-${tasks.length}`,
- subject: t.subject || t.description || t.name || 'Unnamed task',
- status: t.status || 'unknown',
- source: 'swarm-tasks',
- });
- }
- }
- } catch { /* ignore */ }
- }
-
- if (source === 'file-checklist') {
- const checklistFile = path.resolve('.claude-flow/data/checklist.json');
- try {
- if (fs.existsSync(checklistFile)) {
- const data = JSON.parse(fs.readFileSync(checklistFile, 'utf-8'));
- const items = Array.isArray(data) ? data : (data.items || []);
- for (const item of items) {
- tasks.push({
- id: item.id || `check-${tasks.length}`,
- subject: item.subject || item.text || item.description || 'Unnamed item',
- status: item.status || (item.done ? 'completed' : 'pending'),
- source: 'file-checklist',
- });
- }
- }
- } catch { /* ignore */ }
- }
- }
-
- return tasks;
-}
-
-const TERMINAL_STATUSES = new Set(['completed', 'done', 'cancelled', 'skipped', 'failed']);
-
-function isTerminal(status: string): boolean {
- return TERMINAL_STATUSES.has(status.toLowerCase());
-}
-
-function getProgress(tasks: TaskInfo[]): { completed: number; total: number; percent: number; incomplete: TaskInfo[] } {
- const completed = tasks.filter(t => isTerminal(t.status)).length;
- const total = tasks.length;
- const percent = total === 0 ? 100 : Math.round((completed / total) * 100);
- const incomplete = tasks.filter(t => !isTerminal(t.status));
- return { completed, total, percent, incomplete };
-}
-
-// ── Reward Calculation ────────────────────────────────────────
-
-function calculateReward(iterations: number, durationMs: number): number {
- const iterFactor = (1 - iterations / (iterations + 10)) * 0.6;
- const timeFactor = (1 - Math.min(durationMs / 3600000, 1)) * 0.4;
- return Math.round((iterFactor + timeFactor) * 100) / 100;
-}
-
-// ── Learning Integration (graceful degradation) ───────────────
-
-async function tryLoadLearning(): Promise<{ initialize: () => Promise<boolean>; [key: string]: unknown } | null> {
- try {
- // Dynamic import β€” won't fail at compile time
- const modPath = 'agentic-flow/dist/coordination/autopilot-learning.js';
- const mod = await import(/* webpackIgnore: true */ modPath).catch(() => null);
- if (mod?.AutopilotLearning) {
- const instance = new mod.AutopilotLearning();
- if (await instance.initialize()) return instance;
- }
- } catch { /* not available */ }
- return null;
-}
+import {
+ loadState, saveState, appendLog, loadLog, discoverTasks,
+ getProgress, calculateReward, tryLoadLearning, validateNumber,
+ validateTaskSources, LOG_FILE,
+} from '../autopilot-state.js';
// ── Check Handler (for Stop hook) ─────────────────────────────
@@ -376,9 +175,9 @@ const configCommand: Command = {
const timeout = ctx.flags?.timeout as string | undefined;
const sources = ctx.flags?.['task-sources'] as string | undefined;
- if (maxIter) state.maxIterations = Math.min(Math.max(1, parseInt(maxIter, 10) || 50), 1000);
- if (timeout) state.timeoutMinutes = Math.min(Math.max(1, parseInt(timeout, 10) || 240), 1440);
- if (sources) state.taskSources = sources.split(',').map(s => s.trim()).filter(Boolean);
+ if (maxIter) state.maxIterations = validateNumber(maxIter, 1, 1000, state.maxIterations);
+ if (timeout) state.timeoutMinutes = validateNumber(timeout, 1, 1440, state.timeoutMinutes);
+ if (sources) state.taskSources = validateTaskSources(sources.split(',').map(s => s.trim()).filter(Boolean));
saveState(state);
appendLog({ ts: Date.now(), event: 'config-updated', maxIterations: state.maxIterations, timeoutMinutes: state.timeoutMinutes, taskSources: state.taskSources });
@@ -421,7 +220,8 @@ const logCommand: Command = {
}
const log = loadLog();
- const last = ctx.flags?.last ? parseInt(ctx.flags.last as string, 10) : undefined;
+ const lastRaw = ctx.flags?.last as string | undefined;
+ const last = lastRaw ? validateNumber(lastRaw, 1, 10000, 50) : undefined;
const entries = last ? log.slice(-last) : log;
if (ctx.flags?.json) {
@@ -486,7 +286,7 @@ const historyCommand: Command = {
],
action: async (ctx: CommandContext): Promise<CommandResult> => {
const query = (ctx.flags?.query || '') as string;
- const limit = parseInt((ctx.flags?.limit || '10') as string, 10);
+ const limit = validateNumber(ctx.flags?.limit, 1, 100, 10);
if (!query) {
output.writeln('Usage: autopilot history --query "search terms" [--limit N]');
diff --git a/v3/@claude-flow/cli/src/init/settings-generator.ts b/v3/@claude-flow/cli/src/init/settings-generator.ts
index 7241393c1a..364b56bfed 100644
--- a/v3/@claude-flow/cli/src/init/settings-generator.ts
+++ b/v3/@claude-flow/cli/src/init/settings-generator.ts
@@ -110,26 +110,15 @@ export function generateSettings(options: InitOptions): object {
enabled: options.runtime.enableNeural,
},
daemon: {
- autoStart: true,
+ autoStart: false, // Opt-in only β€” prevents unintended token consumption (#1427, #1330)
workers: [
'map', // Codebase mapping
'audit', // Security auditing (critical priority)
'optimize', // Performance optimization (high priority)
- 'consolidate', // Memory consolidation
- 'testgaps', // Test coverage gaps
- 'ultralearn', // Deep knowledge acquisition
- 'deepdive', // Deep code analysis
- 'document', // Auto-documentation for ADRs
- 'refactor', // Refactoring suggestions (DDD alignment)
- 'benchmark', // Performance benchmarking
],
schedules: {
- audit: { interval: '1h', priority: 'critical' },
- optimize: { interval: '30m', priority: 'high' },
- consolidate: { interval: '2h', priority: 'low' },
- document: { interval: '1h', priority: 'normal', triggers: ['adr-update', 'api-change'] },
- deepdive: { interval: '4h', priority: 'normal', triggers: ['complex-change'] },
- ultralearn: { interval: '1h', priority: 'normal' },
+ audit: { interval: '4h', priority: 'critical' },
+ optimize: { interval: '2h', priority: 'high' },
},
},
learning: {
diff --git a/v3/@claude-flow/cli/src/mcp-tools/autopilot-tools.ts b/v3/@claude-flow/cli/src/mcp-tools/autopilot-tools.ts
index d0cd4a91ff..65ceb6a4ba 100644
--- a/v3/@claude-flow/cli/src/mcp-tools/autopilot-tools.ts
+++ b/v3/@claude-flow/cli/src/mcp-tools/autopilot-tools.ts
@@ -9,133 +9,12 @@
*/
import type { MCPTool } from './types.js';
-import { autopilotCheck } from '../commands/autopilot.js';
-
-// ── State Helpers (shared with CLI command) ───────────────────
-
-const STATE_DIR = '.claude-flow/data';
-const STATE_FILE = `${STATE_DIR}/autopilot-state.json`;
-const LOG_FILE = `${STATE_DIR}/autopilot-log.json`;
-
-interface AutopilotState {
- sessionId: string;
- enabled: boolean;
- startTime: number;
- iterations: number;
- maxIterations: number;
- timeoutMinutes: number;
- taskSources: string[];
- lastCheck: number | null;
- history: Array<{ ts: number; iteration: number; completed: number; total: number }>;
-}
-
-function loadState(): AutopilotState {
- const fs = require('fs') as typeof import('fs');
- const path = require('path') as typeof import('path');
- const crypto = require('crypto') as typeof import('crypto');
- const filePath = path.resolve(STATE_FILE);
- const defaults: AutopilotState = {
- sessionId: crypto.randomUUID(),
- enabled: false,
- startTime: Date.now(),
- iterations: 0,
- maxIterations: 50,
- timeoutMinutes: 240,
- taskSources: ['team-tasks', 'swarm-tasks', 'file-checklist'],
- lastCheck: null,
- history: [],
- };
- try {
- if (fs.existsSync(filePath)) {
- return { ...defaults, ...JSON.parse(fs.readFileSync(filePath, 'utf-8')) };
- }
- } catch { /* ignore */ }
- return defaults;
-}
-
-function saveState(state: AutopilotState): void {
- const fs = require('fs') as typeof import('fs');
- const path = require('path') as typeof import('path');
- const dir = path.resolve(STATE_DIR);
- if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
- fs.writeFileSync(path.resolve(STATE_FILE), JSON.stringify(state, null, 2));
-}
-
-function appendLog(entry: Record<string, unknown>): void {
- const fs = require('fs') as typeof import('fs');
- const path = require('path') as typeof import('path');
- const filePath = path.resolve(LOG_FILE);
- const dir = path.resolve(STATE_DIR);
- if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
- let log: Record<string, unknown>[] = [];
- try {
- if (fs.existsSync(filePath)) log = JSON.parse(fs.readFileSync(filePath, 'utf-8'));
- } catch { /* ignore */ }
- log.push(entry);
- if (log.length > 1000) log = log.slice(-1000);
- fs.writeFileSync(filePath, JSON.stringify(log, null, 2));
-}
-
-function loadLog(): Record<string, unknown>[] {
- const fs = require('fs') as typeof import('fs');
- const path = require('path') as typeof import('path');
- const filePath = path.resolve(LOG_FILE);
- try {
- if (fs.existsSync(filePath)) return JSON.parse(fs.readFileSync(filePath, 'utf-8'));
- } catch { /* ignore */ }
- return [];
-}
-
-// Reuse the same task discovery from CLI
-function discoverTasks(sources: string[]): Array<{ id: string; subject: string; status: string; source: string }> {
- const fs = require('fs') as typeof import('fs');
- const path = require('path') as typeof import('path');
- const os = require('os') as typeof import('os');
- const tasks: Array<{ id: string; subject: string; status: string; source: string }> = [];
- const TERMINAL = new Set(['completed', 'done', 'cancelled', 'skipped', 'failed']);
-
- for (const source of sources) {
- if (source === 'team-tasks') {
- const dir = path.join(os.homedir(), '.claude', 'tasks');
- try {
- if (fs.existsSync(dir)) {
- for (const team of fs.readdirSync(dir, { withFileTypes: true })) {
- if (!team.isDirectory()) continue;
- for (const f of fs.readdirSync(path.join(dir, team.name)).filter((n: string) => n.endsWith('.json'))) {
- try {
- const d = JSON.parse(fs.readFileSync(path.join(dir, team.name, f), 'utf-8'));
- tasks.push({ id: d.id || f, subject: d.subject || f, status: d.status || 'unknown', source: 'team-tasks' });
- } catch { /* skip */ }
- }
- }
- }
- } catch { /* ignore */ }
- }
- if (source === 'swarm-tasks') {
- try {
- const f = path.resolve('.claude-flow/swarm-tasks.json');
- if (fs.existsSync(f)) {
- const d = JSON.parse(fs.readFileSync(f, 'utf-8'));
- for (const t of (Array.isArray(d) ? d : d.tasks || [])) {
- tasks.push({ id: t.id || `swarm-${tasks.length}`, subject: t.subject || t.description || 'Unnamed', status: t.status || 'unknown', source: 'swarm-tasks' });
- }
- }
- } catch { /* ignore */ }
- }
- if (source === 'file-checklist') {
- try {
- const f = path.resolve('.claude-flow/data/checklist.json');
- if (fs.existsSync(f)) {
- const d = JSON.parse(fs.readFileSync(f, 'utf-8'));
- for (const item of (Array.isArray(d) ? d : d.items || [])) {
- tasks.push({ id: item.id || `check-${tasks.length}`, subject: item.subject || item.text || 'Unnamed', status: item.status || (item.done ? 'completed' : 'pending'), source: 'file-checklist' });
- }
- }
- } catch { /* ignore */ }
- }
- }
- return tasks;
-}
+import {
+ loadState, saveState, appendLog, loadLog, discoverTasks,
+ isTerminal, tryLoadLearning,
+ validateNumber, validateTaskSources,
+ VALID_TASK_SOURCES,
+} from '../autopilot-state.js';
function ok(data: unknown) {
return { content: [{ type: 'text' as const, text: JSON.stringify(data, null, 2) }] };
@@ -151,7 +30,7 @@ const autopilotStatus: MCPTool = {
handler: async () => {
const state = loadState();
const tasks = discoverTasks(state.taskSources);
- const completed = tasks.filter(t => ['completed', 'done', 'cancelled', 'skipped', 'failed'].includes(t.status.toLowerCase())).length;
+ const completed = tasks.filter(t => isTerminal(t.status)).length;
return ok({
enabled: state.enabled,
sessionId: state.sessionId,
@@ -204,14 +83,20 @@ const autopilotConfig: MCPTool = {
properties: {
maxIterations: { type: 'number', description: 'Max re-engagement iterations (1-1000)' },
timeoutMinutes: { type: 'number', description: 'Timeout in minutes (1-1440)' },
- taskSources: { type: 'array', items: { type: 'string' }, description: 'Task sources: team-tasks, swarm-tasks, file-checklist' },
+ taskSources: { type: 'array', items: { type: 'string' }, description: `Task sources: ${[...VALID_TASK_SOURCES].join(', ')}` },
},
},
handler: async (params: Record<string, unknown>) => {
const state = loadState();
- if (params.maxIterations !== undefined) state.maxIterations = Math.min(Math.max(1, params.maxIterations as number), 1000);
- if (params.timeoutMinutes !== undefined) state.timeoutMinutes = Math.min(Math.max(1, params.timeoutMinutes as number), 1440);
- if (params.taskSources) state.taskSources = params.taskSources as string[];
+ if (params.maxIterations !== undefined) {
+ state.maxIterations = validateNumber(params.maxIterations, 1, 1000, state.maxIterations);
+ }
+ if (params.timeoutMinutes !== undefined) {
+ state.timeoutMinutes = validateNumber(params.timeoutMinutes, 1, 1440, state.timeoutMinutes);
+ }
+ if (params.taskSources !== undefined) {
+ state.taskSources = validateTaskSources(params.taskSources);
+ }
saveState(state);
return ok({ maxIterations: state.maxIterations, timeoutMinutes: state.timeoutMinutes, taskSources: state.taskSources });
},
@@ -246,8 +131,8 @@ const autopilotLog: MCPTool = {
},
handler: async (params: Record<string, unknown>) => {
const log = loadLog();
- const last = params.last as number | undefined;
- return ok(last ? log.slice(-last) : log);
+ const last = validateNumber(params.last, 1, 10000, 0);
+ return ok(last > 0 ? log.slice(-last) : log);
},
};
@@ -264,13 +149,13 @@ const autopilotProgress: MCPTool = {
for (const t of tasks) {
if (!bySource[t.source]) bySource[t.source] = { completed: 0, total: 0, tasks: [] };
bySource[t.source].total++;
- if (['completed', 'done', 'cancelled', 'skipped', 'failed'].includes(t.status.toLowerCase())) {
+ if (isTerminal(t.status)) {
bySource[t.source].completed++;
}
bySource[t.source].tasks.push(t);
}
- const completed = tasks.filter(t => ['completed', 'done', 'cancelled', 'skipped', 'failed'].includes(t.status.toLowerCase())).length;
+ const completed = tasks.filter(t => isTerminal(t.status)).length;
return ok({
overall: { completed, total: tasks.length, percent: tasks.length === 0 ? 100 : Math.round((completed / tasks.length) * 100) },
bySource,
@@ -284,17 +169,14 @@ const autopilotLearn: MCPTool = {
category: 'autopilot',
inputSchema: { type: 'object', properties: {} },
handler: async () => {
- try {
- const modPath = 'agentic-flow/dist/coordination/autopilot-learning.js';
- const mod = await import(/* webpackIgnore: true */ modPath).catch(() => null);
- if (mod?.AutopilotLearning) {
- const learning = new mod.AutopilotLearning();
- if (await learning.initialize()) {
- const [metrics, patterns] = await Promise.all([learning.getMetrics(), learning.discoverSuccessPatterns()]);
- return ok({ metrics, patterns });
- }
- }
- } catch { /* not available */ }
+ const learning = await tryLoadLearning();
+ if (learning) {
+ const [metrics, patterns] = await Promise.all([
+ (learning as any).getMetrics(),
+ (learning as any).discoverSuccessPatterns(),
+ ]);
+ return ok({ metrics, patterns });
+ }
return ok({ available: false, reason: 'AgentDB/AutopilotLearning not initialized', patterns: [] });
},
};
@@ -312,19 +194,13 @@ const autopilotHistory: MCPTool = {
required: ['query'],
},
handler: async (params: Record<string, unknown>) => {
- const query = params.query as string;
- const limit = (params.limit as number) || 10;
- try {
- const modPath = 'agentic-flow/dist/coordination/autopilot-learning.js';
- const mod = await import(/* webpackIgnore: true */ modPath).catch(() => null);
- if (mod?.AutopilotLearning) {
- const learning = new mod.AutopilotLearning();
- if (await learning.initialize()) {
- const results = await learning.recallSimilarTasks(query, limit);
- return ok({ query, results });
- }
- }
- } catch { /* not available */ }
+ const query = String(params.query || '');
+ const limit = validateNumber(params.limit, 1, 100, 10);
+ const learning = await tryLoadLearning();
+ if (learning) {
+ const results = await (learning as any).recallSimilarTasks(query, limit);
+ return ok({ query, results });
+ }
return ok({ query, results: [], available: false });
},
};
@@ -336,21 +212,15 @@ const autopilotPredict: MCPTool = {
inputSchema: { type: 'object', properties: {} },
handler: async () => {
const state = loadState();
- try {
- const modPath = 'agentic-flow/dist/coordination/autopilot-learning.js';
- const mod = await import(/* webpackIgnore: true */ modPath).catch(() => null);
- if (mod?.AutopilotLearning) {
- const learning = new mod.AutopilotLearning();
- if (await learning.initialize()) {
- const prediction = await learning.predictNextAction(state);
- return ok(prediction);
- }
- }
- } catch { /* not available */ }
+ const learning = await tryLoadLearning();
+ if (learning) {
+ const prediction = await (learning as any).predictNextAction(state);
+ return ok(prediction);
+ }
// Heuristic fallback
const tasks = discoverTasks(state.taskSources);
- const incomplete = tasks.filter(t => !['completed', 'done', 'cancelled', 'skipped', 'failed'].includes(t.status.toLowerCase()));
+ const incomplete = tasks.filter(t => !isTerminal(t.status));
if (incomplete.length === 0) {
return ok({ action: 'none', confidence: 1.0, reason: 'All tasks complete' });
}
diff --git a/v3/@claude-flow/cli/src/mcp-tools/hooks-tools.ts b/v3/@claude-flow/cli/src/mcp-tools/hooks-tools.ts
index d50ea1051e..4870e4f0f8 100644
--- a/v3/@claude-flow/cli/src/mcp-tools/hooks-tools.ts
+++ b/v3/@claude-flow/cli/src/mcp-tools/hooks-tools.ts
@@ -1556,13 +1556,13 @@ export const hooksSessionStart: MCPTool = {
properties: {
sessionId: { type: 'string', description: 'Optional session ID' },
restoreLatest: { type: 'boolean', description: 'Restore latest session state' },
- startDaemon: { type: 'boolean', description: 'Auto-start worker daemon (default: true)' },
+ startDaemon: { type: 'boolean', description: 'Start worker daemon (default: false β€” opt-in to prevent unintended token usage)' },
},
},
handler: async (params: Record<string, unknown>) => {
const sessionId = (params.sessionId as string) || `session-${Date.now()}`;
const restoreLatest = params.restoreLatest as boolean;
- const shouldStartDaemon = params.startDaemon !== false;
+ const shouldStartDaemon = params.startDaemon === true;
// Auto-start daemon if enabled
let daemonStatus: { started: boolean; pid?: number; error?: string } = { started: false };
diff --git a/v3/@claude-flow/cli/src/memory/memory-initializer.ts b/v3/@claude-flow/cli/src/memory/memory-initializer.ts
index e98c647241..afea04fd29 100644
--- a/v3/@claude-flow/cli/src/memory/memory-initializer.ts
+++ b/v3/@claude-flow/cli/src/memory/memory-initializer.ts
@@ -2595,7 +2595,22 @@ export async function deleteEntry(options: {
const bridge = await getBridge();
if (bridge) {
const bridgeResult = await bridge.bridgeDeleteEntry(options);
- if (bridgeResult) return bridgeResult;
+ if (bridgeResult) {
+ // #1122: Bridge path must also invalidate the in-memory HNSW index.
+ // Without this, deleted vectors remain as ghost entries in search results.
+ if (bridgeResult.deleted && hnswIndex?.entries) {
+ // Remove the entry from the HNSW entries map by key+namespace composite
+ for (const [id, entry] of hnswIndex.entries) {
+ if ((entry as any)?.key === options.key && ((entry as any)?.namespace ?? 'default') === (options.namespace ?? 'default')) {
+ hnswIndex.entries.delete(id);
+ break;
+ }
+ }
+ saveHNSWMetadata();
+ rebuildSearchIndex();
+ }
+ return bridgeResult;
+ }
}
// Fallback: raw sql.js
diff --git a/v3/@claude-flow/cli/src/services/worker-daemon.ts b/v3/@claude-flow/cli/src/services/worker-daemon.ts
index 75e74b06ca..f6b8784cbc 100644
--- a/v3/@claude-flow/cli/src/services/worker-daemon.ts
+++ b/v3/@claude-flow/cli/src/services/worker-daemon.ts
@@ -103,8 +103,9 @@ const DEFAULT_WORKERS: WorkerConfigInternal[] = [
{ type: 'document', intervalMs: 60 * 60 * 1000, offsetMs: 0, priority: 'low', description: 'Auto-documentation', enabled: false },
];
-// Worker timeout (5 minutes max per worker)
-const DEFAULT_WORKER_TIMEOUT_MS = 5 * 60 * 1000;
+// Worker timeout β€” must exceed the longest per-worker headless timeout (15 min for audit/refactor).
+// Previously 5 min, which caused orphan processes when daemon timeout fired before executor timeout (#1117).
+const DEFAULT_WORKER_TIMEOUT_MS = 16 * 60 * 1000;
/**
* Worker Daemon - Manages background workers with Node.js
diff --git a/v3/implementation/adrs/ADR-067-ruvector-wasm-utilization.md b/v3/implementation/adrs/ADR-067-ruvector-wasm-utilization.md
new file mode 100644
index 0000000000..634b36a4b7
--- /dev/null
+++ b/v3/implementation/adrs/ADR-067-ruvector-wasm-utilization.md
@@ -0,0 +1,91 @@
+---
+# ADR-067: RuVector WASM Utilization Improvement Plan
+
+**Status**: Proposed
+**Date**: 2026-03-26
+**Author**: RuvNet
+
+## Context
+
+The CLI declares 6 `@ruvector` WASM packages in `optionalDependencies`, promising significant performance improvements (Flash Attention 2.49x-7.47x, SONA <0.05ms adaptation, HNSW 150x-12,500x search). A utilization audit revealed that most of these packages are either dead code, permanently falling back to JS implementations, or only reachable through MCP tools rather than the CLI surface.
+
+Key audit findings:
+
+- **@ruvector/router** is dead code: imported but never called, all routing falls back to JS logic
+- **@ruvector/learning-wasm** falls back to the JS implementation 100% of the time
+- **@ruvector/attention** is only exercised in benchmark paths, never in production request flows
+- **@ruvector/sona** engine is created but rarely invoked for actual pattern learning
+- **@ruvector/rvagent-wasm** and **@ruvector/ruvllm-wasm** are properly integrated but only exposed via MCP tools, not the CLI
+- All WASM-dependent tests use mocks -- 0% real WASM coverage
+- Declared performance targets are not verifiable in production because the WASM paths are never reached
+
+## Decision
+
+Adopt a tiered remediation plan to close the gap between declared capabilities and actual utilization.
+
+### Tier 1 -- Immediate (dead code removal)
+
+Remove `@ruvector/router` from `optionalDependencies` and delete the unused import, OR integrate it into the `hooks route` command so the WASM router is actually invoked when available. Prefer integration if the package is functional; prefer removal if it is not.
+
+### Tier 2 -- Short-term (CLI exposure)
+
+Expose `rvagent-wasm` and `ruvllm-wasm` capabilities through CLI commands so they are not locked behind MCP-only access:
+
+- `agent wasm-create` -- create an agent backed by the WASM runtime
+- `agent wasm-prompt` -- send a prompt to a WASM-backed agent
+- `neural wasm-infer` -- run inference through ruvllm-wasm
+
+### Tier 3 -- Medium-term (WASM-first fallback inversion)
+
+Invert the current pattern where WASM is optional and JS is default. For `learning-wasm`, `sona`, and `attention`:
+
+1. Attempt WASM load first
+2. Log a warning when falling back to JS
+3. Surface fallback status in `doctor` health checks
+4. Wire `attention` into production memory-search paths (not just benchmarks)
+
+### Tier 4 -- Validation (real test coverage)
+
+- Replace mocked WASM tests with integration tests that load actual WASM binaries
+- Add a CI benchmark suite that runs on each release to verify performance claims
+- Gate performance target claims in documentation on passing CI benchmarks
+
+## Utilization Matrix
+
+| Package | Current State | Utilization | Target State | Target Utilization |
+|---------|--------------|-------------|--------------|-------------------|
+| `@ruvector/router` | Imported, never called | 0% | Integrated into `hooks route` or removed | 100% or removed |
+| `@ruvector/learning-wasm` | Always falls back to JS | 0% (WASM) | WASM-first with JS fallback + warning | 80%+ (WASM) |
+| `@ruvector/attention` | Benchmark-only | ~5% | Production memory-search + benchmark | 60%+ |
+| `@ruvector/sona` | Engine created, rarely invoked | ~10% | Active in `hooks pretrain`, `neural train` | 70%+ |
+| `@ruvector/rvagent-wasm` | MCP-only | 40% | MCP + CLI (`agent wasm-*`) | 90%+ |
+| `@ruvector/ruvllm-wasm` | MCP-only | 40% | MCP + CLI (`neural wasm-infer`) | 90%+ |
+
+## Consequences
+
+### Positive
+
+- Actually achieve declared performance targets (Flash Attention, SONA adaptation times)
+- Remove dead code that inflates package size and confuses contributors
+- Expose hidden capabilities to CLI users who do not use MCP
+- Real test coverage prevents regressions in WASM integration
+- CI benchmarks make performance claims auditable
+
+### Negative
+
+- Increases the effective dependency surface from optional to semi-required
+- WASM binaries add to package size (~2-5 MB per package)
+- More complex initialization logic with WASM-first loading
+
+### Risks
+
+- WASM packages may not load on all platforms (Alpine, older Node, constrained CI). JS fallback must remain available.
+- WASM binary updates may lag behind JS implementation changes, requiring coordinated releases.
+- CI benchmark results may vary across runner hardware, requiring tolerance bands.
+
+## Related
+
+- ADR-066: v3.5.24 Audit Remediation (prior audit cycle)
+- `v3/@claude-flow/cli/package.json` -- optionalDependencies declarations
+- `v3/@claude-flow/cli/src/hooks/` -- hooks route command
+- `v3/@claude-flow/cli/src/mcp/tools/` -- MCP tool definitions for rvagent and ruvllm
diff --git a/v3/package-lock.json b/v3/package-lock.json
index c10621d0d1..856eb6e33d 100644
--- a/v3/package-lock.json
+++ b/v3/package-lock.json
@@ -1789,12 +1789,11 @@
}
},
"@claude-flow/cli": {
- "version": "3.5.28",
- "hasInstallScript": true,
+ "version": "3.5.46",
"license": "MIT",
"dependencies": {
"@claude-flow/mcp": "^3.0.0-alpha.8",
- "@claude-flow/shared": "^3.0.0-alpha.1",
+ "@claude-flow/shared": "^3.0.0-alpha.7",
"@noble/ed25519": "^2.1.0",
"semver": "^7.6.0"
},
@@ -1812,7 +1811,7 @@
"@claude-flow/codex": "^3.0.0-alpha.8",
"@claude-flow/embeddings": "^3.0.0-alpha.12",
"@claude-flow/guidance": "^3.0.0-alpha.1",
- "@claude-flow/memory": "^3.0.0-alpha.11",
+ "@claude-flow/memory": "^3.0.0-alpha.12",
"@claude-flow/plugin-gastown-bridge": "^0.1.3",
"@ruvector/attention": "^0.1.4",
"@ruvector/learning-wasm": "^0.1.29",
@@ -1820,8 +1819,7 @@
"@ruvector/ruvllm-wasm": "^2.0.2",
"@ruvector/rvagent-wasm": "^0.1.0",
"@ruvector/sona": "^0.1.5",
- "agentic-flow": "^3.0.0-alpha.1",
- "ruvector": "^0.2.16"
+ "agentic-flow": "^3.0.0-alpha.1"
}
},
"@claude-flow/cli/node_modules/@ruvector/graph-node": {
@@ -1921,50 +1919,6 @@
"node": ">=18.0.0"
}
},
- "@claude-flow/cli/node_modules/@ruvector/ruvllm": {
- "version": "2.5.2",
- "resolved": "https://registry.npmjs.org/@ruvector/ruvllm/-/ruvllm-2.5.2.tgz",
- "integrity": "sha512-ZyQD0ZMOZ5XqiFR+v2zQMZ9R9qc+H5qmYzegSH3CpGks4qRAv1ry/fHckXIFpg6iSRZrNd32D3aMRYSUGU+z/g==",
- "license": "MIT OR Apache-2.0",
- "optional": true,
- "peer": true,
- "dependencies": {
- "chalk": "^4.1.2",
- "commander": "^12.0.0",
- "ora": "^5.4.1"
- },
- "bin": {
- "ruvllm": "bin/cli.js"
- },
- "engines": {
- "node": ">= 18"
- },
- "optionalDependencies": {
- "@ruvector/ruvllm-darwin-arm64": "2.3.0",
- "@ruvector/ruvllm-darwin-x64": "2.3.0",
- "@ruvector/ruvllm-linux-arm64-gnu": "2.3.0",
- "@ruvector/ruvllm-linux-x64-gnu": "2.3.0",
- "@ruvector/ruvllm-win32-x64-msvc": "2.3.0"
- }
- },
- "@claude-flow/cli/node_modules/@ruvector/ruvllm/node_modules/chalk": {
- "version": "4.1.2",
- "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
- "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
- "license": "MIT",
- "optional": true,
- "peer": true,
- "dependencies": {
- "ansi-styles": "^4.1.0",
- "supports-color": "^7.1.0"
- },
- "engines": {
- "node": ">=10"
- },
- "funding": {
- "url": "https://github.com/chalk/chalk?sponsor=1"
- }
- },
"@claude-flow/cli/node_modules/accepts": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz",
@@ -2044,18 +1998,6 @@
"node": ">=18.0.0"
}
},
- "@claude-flow/cli/node_modules/bl": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz",
- "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==",
- "license": "MIT",
- "optional": true,
- "dependencies": {
- "buffer": "^5.5.0",
- "inherits": "^2.0.4",
- "readable-stream": "^3.4.0"
- }
- },
"@claude-flow/cli/node_modules/body-parser": {
"version": "2.2.2",
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.2.2.tgz",
@@ -2081,54 +2023,6 @@
"url": "https://opencollective.com/express"
}
},
- "@claude-flow/cli/node_modules/brace-expansion": {
- "version": "2.0.2",
- "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz",
- "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==",
- "license": "MIT",
- "optional": true,
- "dependencies": {
- "balanced-match": "^1.0.0"
- }
- },
- "@claude-flow/cli/node_modules/buffer": {
- "version": "5.7.1",
- "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",
- "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==",
- "funding": [
- {
- "type": "github",
- "url": "https://github.com/sponsors/feross"
- },
- {
- "type": "patreon",
- "url": "https://www.patreon.com/feross"
- },
- {
- "type": "consulting",
- "url": "https://feross.org/support"
- }
- ],
- "license": "MIT",
- "optional": true,
- "dependencies": {
- "base64-js": "^1.3.1",
- "ieee754": "^1.1.13"
- }
- },
- "@claude-flow/cli/node_modules/cli-cursor": {
- "version": "3.1.0",
- "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz",
- "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==",
- "license": "MIT",
- "optional": true,
- "dependencies": {
- "restore-cursor": "^3.1.0"
- },
- "engines": {
- "node": ">=8"
- }
- },
"@claude-flow/cli/node_modules/content-disposition": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-1.0.1.tgz",
@@ -2229,28 +2123,6 @@
"node": ">= 0.8"
}
},
- "@claude-flow/cli/node_modules/glob": {
- "version": "10.5.0",
- "resolved": "https://registry.npmjs.org/glob/-/glob-10.5.0.tgz",
- "integrity": "sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg==",
- "deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting [email protected]",
- "license": "ISC",
- "optional": true,
- "dependencies": {
- "foreground-child": "^3.1.0",
- "jackspeak": "^3.1.2",
- "minimatch": "^9.0.4",
- "minipass": "^7.1.2",
- "package-json-from-dist": "^1.0.0",
- "path-scurry": "^1.11.1"
- },
- "bin": {
- "glob": "dist/esm/bin.mjs"
- },
- "funding": {
- "url": "https://github.com/sponsors/isaacs"
- }
- },
"@claude-flow/cli/node_modules/iconv-lite": {
"version": "0.7.2",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.2.tgz",
@@ -2268,63 +2140,6 @@
"url": "https://opencollective.com/express"
}
},
- "@claude-flow/cli/node_modules/is-interactive": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-1.0.0.tgz",
- "integrity": "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==",
- "license": "MIT",
- "optional": true,
- "engines": {
- "node": ">=8"
- }
- },
- "@claude-flow/cli/node_modules/is-unicode-supported": {
- "version": "0.1.0",
- "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz",
- "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==",
- "license": "MIT",
- "optional": true,
- "engines": {
- "node": ">=10"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
- "@claude-flow/cli/node_modules/log-symbols": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz",
- "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==",
- "license": "MIT",
- "optional": true,
- "dependencies": {
- "chalk": "^4.1.0",
- "is-unicode-supported": "^0.1.0"
- },
- "engines": {
- "node": ">=10"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
- "@claude-flow/cli/node_modules/log-symbols/node_modules/chalk": {
- "version": "4.1.2",
- "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
- "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
- "license": "MIT",
- "optional": true,
- "dependencies": {
- "ansi-styles": "^4.1.0",
- "supports-color": "^7.1.0"
- },
- "engines": {
- "node": ">=10"
- },
- "funding": {
- "url": "https://github.com/chalk/chalk?sponsor=1"
- }
- },
"@claude-flow/cli/node_modules/media-typer": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.0.tgz",
@@ -2375,42 +2190,6 @@
"url": "https://opencollective.com/express"
}
},
- "@claude-flow/cli/node_modules/mimic-fn": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz",
- "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==",
- "license": "MIT",
- "optional": true,
- "engines": {
- "node": ">=6"
- }
- },
- "@claude-flow/cli/node_modules/minimatch": {
- "version": "9.0.9",
- "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.9.tgz",
- "integrity": "sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg==",
- "license": "ISC",
- "optional": true,
- "dependencies": {
- "brace-expansion": "^2.0.2"
- },
- "engines": {
- "node": ">=16 || 14 >=14.17"
- },
- "funding": {
- "url": "https://github.com/sponsors/isaacs"
- }
- },
- "@claude-flow/cli/node_modules/minipass": {
- "version": "7.1.3",
- "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.3.tgz",
- "integrity": "sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==",
- "license": "BlueOak-1.0.0",
- "optional": true,
- "engines": {
- "node": ">=16 || 14 >=14.17"
- }
- },
"@claude-flow/cli/node_modules/negotiator": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz",
@@ -2421,143 +2200,6 @@
"node": ">= 0.6"
}
},
- "@claude-flow/cli/node_modules/onetime": {
- "version": "5.1.2",
- "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz",
- "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==",
- "license": "MIT",
- "optional": true,
- "dependencies": {
- "mimic-fn": "^2.1.0"
- },
- "engines": {
- "node": ">=6"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
- "@claude-flow/cli/node_modules/ora": {
- "version": "5.4.1",
- "resolved": "https://registry.npmjs.org/ora/-/ora-5.4.1.tgz",
- "integrity": "sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ==",
- "license": "MIT",
- "optional": true,
- "dependencies": {
- "bl": "^4.1.0",
- "chalk": "^4.1.0",
- "cli-cursor": "^3.1.0",
- "cli-spinners": "^2.5.0",
- "is-interactive": "^1.0.0",
- "is-unicode-supported": "^0.1.0",
- "log-symbols": "^4.1.0",
- "strip-ansi": "^6.0.0",
- "wcwidth": "^1.0.1"
- },
- "engines": {
- "node": ">=10"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
- "@claude-flow/cli/node_modules/ora/node_modules/chalk": {
- "version": "4.1.2",
- "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
- "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
- "license": "MIT",
- "optional": true,
- "dependencies": {
- "ansi-styles": "^4.1.0",
- "supports-color": "^7.1.0"
- },
- "engines": {
- "node": ">=10"
- },
- "funding": {
- "url": "https://github.com/chalk/chalk?sponsor=1"
- }
- },
- "@claude-flow/cli/node_modules/restore-cursor": {
- "version": "3.1.0",
- "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz",
- "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==",
- "license": "MIT",
- "optional": true,
- "dependencies": {
- "onetime": "^5.1.0",
- "signal-exit": "^3.0.2"
- },
- "engines": {
- "node": ">=8"
- }
- },
- "@claude-flow/cli/node_modules/ruvector": {
- "version": "0.2.16",
- "resolved": "https://registry.npmjs.org/ruvector/-/ruvector-0.2.16.tgz",
- "integrity": "sha512-hTaFjQ1YSgksL1K3+od3fd+geMAWaAwHdi+cHTds8anPCkEOxvHsBj3Wiy1psM6+Q1ZbcrJVG8ek8utHHafiOw==",
- "license": "MIT",
- "optional": true,
- "dependencies": {
- "@modelcontextprotocol/sdk": "^1.0.0",
- "@ruvector/attention": "^0.1.3",
- "@ruvector/core": "^0.1.25",
- "@ruvector/gnn": "^0.1.22",
- "@ruvector/sona": "^0.1.4",
- "chalk": "^4.1.2",
- "commander": "^11.1.0",
- "glob": "^10.3.10",
- "ora": "^5.4.1"
- },
- "bin": {
- "ruvector": "bin/cli.js"
- },
- "engines": {
- "node": ">=18.0.0"
- },
- "optionalDependencies": {
- "@ruvector/rvf": "^0.1.0"
- },
- "peerDependencies": {
- "@ruvector/router": ">=0.1.0",
- "@ruvector/ruvllm": ">=2.0.0"
- },
- "peerDependenciesMeta": {
- "@ruvector/router": {
- "optional": true
- },
- "@ruvector/ruvllm": {
- "optional": true
- }
- }
- },
- "@claude-flow/cli/node_modules/ruvector/node_modules/chalk": {
- "version": "4.1.2",
- "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
- "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
- "license": "MIT",
- "optional": true,
- "dependencies": {
- "ansi-styles": "^4.1.0",
- "supports-color": "^7.1.0"
- },
- "engines": {
- "node": ">=10"
- },
- "funding": {
- "url": "https://github.com/chalk/chalk?sponsor=1"
- }
- },
- "@claude-flow/cli/node_modules/ruvector/node_modules/commander": {
- "version": "11.1.0",
- "resolved": "https://registry.npmjs.org/commander/-/commander-11.1.0.tgz",
- "integrity": "sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==",
- "license": "MIT",
- "optional": true,
- "engines": {
- "node": ">=16"
- }
- },
"@claude-flow/cli/node_modules/send": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/send/-/send-1.2.1.tgz",
@@ -3967,7 +3609,7 @@
}
},
"@claude-flow/shared": {
- "version": "3.0.0-alpha.6",
+ "version": "3.0.0-alpha.7",
"dependencies": {
"sql.js": "^1.10.3"
},