mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-24 06:06:02 +09:00
- Reorganize v3/ into implementation/ subfolders: - planning/, architecture/, migration/, integration/ - security/, adrs/, research/, swarm-plans/ - Add 15-agent concurrent swarm implementation plans: - SWARM-OVERVIEW.md: Hierarchical mesh topology, 4 phases - AGENT-SPECIFICATIONS.md: 15 agent configs with capabilities - TDD-LONDON-SCHOOL-PLAN.md: Mock-first TDD methodology - BENCHMARK-OPTIMIZATION.md: Performance targets (2.49x-7.47x) - DEPLOYMENT-PLAN.md: Release strategy, CI/CD, rollback - GITHUB-ISSUE-TRACKING.md: Issue workflow with agent replies - Update .claude/settings.json with proper hooks format - Add bash aliases for claude --dangerously-skip-permissions 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
6.3 KiB
6.3 KiB
Memory Command Fix - better-sqlite3 / onnxruntime-node Errors
Issue: npx claude-flow@alpha memory commands fail with dependency errors
Status: ✅ FIXED (Automatic Fallback in v2.7.15)
Date: 2025-10-25
Problem
Error 1: better-sqlite3 (ReasoningBank)
$ npx claude-flow@alpha memory store "api" "REST"
❌ Error: BetterSqlite3 is not a constructor
Migration error: TypeError: BetterSqlite3 is not a constructor
Error 2: onnxruntime-node (ONNX inference)
$ npx claude-flow@alpha memory status
❌ Error: Cannot find package 'onnxruntime-node'
Root Cause:
better-sqlite3andonnxruntime-nodeare optional dependenciesnpxcreates a temporary directory that doesn't include optional dependencies- ReasoningBank requires better-sqlite3 for SQLite storage
- ONNX inference requires onnxruntime-node for local models
✅ v2.7.15 Fix: Automatic Fallback
Memory commands now automatically fall back to JSON when SQLite isn't available:
$ npx claude-flow@alpha memory store "api" "REST"
⚠️ NPX LIMITATION DETECTED
ReasoningBank requires better-sqlite3, not available in npx temp directories.
📚 Solutions:
1. LOCAL INSTALL (Recommended):
npm install && node_modules/.bin/claude-flow memory store "key" "value"
2. USE MCP TOOLS instead:
mcp__claude-flow__memory_usage({ action: "store", key: "test", value: "data" })
3. USE JSON FALLBACK:
npx claude-flow@alpha memory store "key" "value" --basic
✅ Automatically using JSON fallback for this command
✅ Stored: api = REST (namespace: default)
Key improvements:
- ✅ Detects npx usage automatically
- ✅ Falls back to JSON storage (memory/memory-store.json)
- ✅ Shows clear error message with solutions
- ✅ Command completes successfully despite missing dependencies
- ✅ No manual flags required (but --basic can force JSON mode)
Solutions
Option 1: Use Local Installation ✅ RECOMMENDED
# Install locally first
npm install
# Use local binary (NOT npx)
node_modules/.bin/claude-flow memory stats
# Or add to package.json scripts
npm run memory:stats # if you add the script
Result:
✅ Memory Bank Statistics:
Total Entries: 0
Namespaces: 0
Size: 0.00 KB
Option 2: Install Optional Dependency
# Install onnxruntime-node (may fail on some platforms)
npm install onnxruntime-node --save-optional --legacy-peer-deps
# Then npx should work
npx claude-flow@alpha memory status
Status: ⚠️ Installed but npx still has issues due to temp directory
Option 3: Add NPM Script (RECOMMENDED)
// package.json
{
"scripts": {
"memory:stats": "claude-flow memory stats",
"memory:list": "claude-flow memory list",
"memory:store": "claude-flow memory store",
"memory:query": "claude-flow memory query"
}
}
Usage:
npm run memory:stats
npm run memory:list
npm run memory:query -- "search term"
Memory Commands Available
All Commands ✅ WORKING
# Statistics
node_modules/.bin/claude-flow memory stats
# Store key-value
node_modules/.bin/claude-flow memory store "key" "value"
node_modules/.bin/claude-flow memory store "key" "value" --namespace "project"
# Query/Search
node_modules/.bin/claude-flow memory query "search term"
node_modules/.bin/claude-flow memory query "search" --namespace "sparc"
# List namespaces
node_modules/.bin/claude-flow memory list
# Export/Import
node_modules/.bin/claude-flow memory export backup.json
node_modules/.bin/claude-flow memory import backup.json
# Clear namespace
node_modules/.bin/claude-flow memory clear --namespace "temp"
Verification
✅ Test Results
$ node_modules/.bin/claude-flow memory stats
✅ Memory Bank Statistics:
Total Entries: 0
Namespaces: 0
Size: 0.00 KB
$ node_modules/.bin/claude-flow memory list
⚠️ No namespaces found
$ node_modules/.bin/claude-flow memory store "test" "value"
✅ Stored: test = value (namespace: default)
$ node_modules/.bin/claude-flow memory stats
✅ Memory Bank Statistics:
Total Entries: 1
Namespaces: 1
Size: 0.05 KB
$ node_modules/.bin/claude-flow memory query "test"
✅ Found 1 result(s):
test = value (namespace: default)
Why npx Fails
npx behavior:
- Creates temp directory:
/home/user/.npm/_npx/{hash}/ - Installs package in temp directory
- Runs binary from temp directory
- Problem: Temp install doesn't include optional dependencies
Local install behavior:
- Installs to
./node_modules/ - Respects
optionalDependenciesin package.json - Binary has access to all dependencies
- Works: All dependencies available
Recommended Workflow
For Development
# Initial setup
npm install
# Create aliases (add to .bashrc or .zshrc)
alias cfmem="node_modules/.bin/claude-flow memory"
# Usage
cfmem stats
cfmem store "api-pattern" "REST with JWT auth"
cfmem query "authentication"
For CI/CD
// package.json
{
"scripts": {
"memory:export": "claude-flow memory export .memory-backup.json",
"memory:import": "claude-flow memory import .memory-backup.json",
"memory:clear": "claude-flow memory clear --namespace temp"
}
}
Alternative: Use MCP Tools Instead
Best Option: Use MCP tools which don't have this issue
// Via Claude Code (MCP tools)
mcp__claude-flow__memory_usage({
action: "store",
key: "test-key",
value: "test-value",
namespace: "default"
})
mcp__claude-flow__memory_usage({
action: "retrieve",
key: "test-key",
namespace: "default"
})
mcp__claude-flow__memory_search({
pattern: "test",
namespace: "default",
limit: 10
})
Benefits:
- ✅ No npx issues
- ✅ No optional dependency issues
- ✅ Works in Claude Code / Claude Desktop
- ✅ Better integration with workflows
Summary
Problem: npx + optional dependencies = failure Solution: Use local installation instead of npx Best Practice: Use MCP tools for memory operations
Quick Fix:
# Instead of:
npx claude-flow@alpha memory status ❌
# Use:
node_modules/.bin/claude-flow memory stats ✅
# Or (best):
mcp__claude-flow__memory_usage({ action: "retrieve" }) ✅
Status: ✅ RESOLVED Date Fixed: 2025-10-25 Installed: onnxruntime-node@1.23.0 (local node_modules) Workaround: Use local binary, not npx