Bug: ReasoningBank Query Broken in NPX Environment
Bug Report: ReasoningBank Query Broken in NPX Environment
Environment
- Package:
claude-flow@alpha(v2.7.26) - Node.js: v22.19.0
- npm: v10.9.4
- OS: Linux 6.14.0-34-generic
- Installation:
npx claude-flow@alpha(not global install)
Summary
ReasoningBank's semantic search is completely non-functional when using npx installation method. Memory storage works, listing works, but queries return 0 results even with hash-based fallback. Additionally, global installation is blocked by a dependency version conflict.
Problem 1: Dependency Conflict Blocks Global Install
Steps to Reproduce
npm install -g claude-flow@alpha
Error Output
npm error code ETARGET
npm error notarget No matching version found for @xenova/transformers@^3.2.0.
npm error notarget In most cases you or one of your dependencies are requesting
npm error notarget a package version that doesn't exist.
Root Cause
package.jsonrequires@xenova/transformers@^3.2.0- Latest available version on npm is 2.17.2
- Version 3.x does not exist
Verification
npm view @xenova/transformers versions --json | tail -10
# Shows: "2.17.0", "2.17.1", "2.17.2"
Proposed Fix
Update package.json:
- "@xenova/transformers": "^3.2.0"
+ "@xenova/transformers": "^2.17.0"
Problem 2: ReasoningBank Query Returns 0 Results
Steps to Reproduce
# 1. Store memory (WORKS)
npx claude-flow@alpha memory store "project/patterns/FEATURE-001" \
"Multi-model consensus caught 2 CRITICAL bugs during code review" \
--reasoningbank
# Output: â
Stored successfully
# Memory ID: 04ba8d79-a5dd-479f-a8e2-e8e4956c63de
# 2. List memories (WORKS)
npx claude-flow@alpha memory list --reasoningbank
# Output:
# â
ReasoningBank memories (3 shown):
# đ project/patterns/FEATURE-001
# Value: Multi-model consensus caught 2 CRITICAL bugs during code review...
# Confidence: 80.0% | Usage: 0
# 3. Query by keyword (FAILS)
npx claude-flow@alpha memory query "consensus" --reasoningbank
# Output: â ī¸ No results found
npx claude-flow@alpha memory query "FEATURE-001" --reasoningbank
# Output: â ī¸ No results found
npx claude-flow@alpha memory query "CRITICAL bugs" --reasoningbank
# Output: â ī¸ No results found
Actual Output
âšī¸ đ§ Using ReasoningBank mode...
[ReasoningBank] Initializing...
[ReasoningBank] Database: .swarm/memory.db
[ReasoningBank] Initialization complete
[INFO] Retrieving memories for query: consensus...
[Embeddings] NPX environment detected - using hash-based embeddings
[Embeddings] For semantic search, install globally: npm install -g claude-flow
[INFO] No memory candidates found
â ī¸ No results found
[ReasoningBank] Semantic search returned 0 results, trying database fallback
Expected Behavior
Query should return stored memories matching keywords, even with hash-based fallback
Actual Behavior
- Hash-based fallback does NOT search content
- Database fallback returns 0 results
- Data IS in database (verified via
listcommand)
Problem 3: Basic Mode Works Perfectly (Workaround)
Proof That Query Logic Can Work
# Store in basic mode
npx claude-flow@alpha memory store "test-pattern" \
"This is test data with searchable keywords" \
--basic
# Query in basic mode (WORKS!)
npx claude-flow@alpha memory query "searchable" --basic
# Output:
# â
Found 1 results:
# đ test-pattern
# Value: This is test data with searchable keywords
This proves:
- Query infrastructure works
- Keyword matching works
- Only ReasoningBank query is broken
Root Cause Analysis
Suspected Issues
-
Hash-based embeddings not generated during storage
[Embeddings] NPX environment detected - using hash-based embeddingsMay be showing warning but not actually creating hashes
-
Database fallback not querying content field
[INFO] No memory candidates found [ReasoningBank] Semantic search returned 0 results, trying database fallbackFallback triggers but finds nothing - likely only searching
titlenotcontent -
Query matching requires exact key match
- Basic mode searches content fields
- ReasoningBank may only search titles/keys
Debugging Needed
// In ReasoningBank query function:
// 1. Check if embeddings are generated during store()
// 2. Verify fallback queries the content column:
// SELECT * FROM reasoning_memories WHERE content LIKE '%query%'
// 3. Test if hash comparison logic is working
Impact
Severity: High
ReasoningBank is a key feature but completely unusable in standard npx workflow:
- â Users expect
npxto work (standard Node.js convention) - â Documentation examples fail silently
- â No clear error message explaining limitation
- â Global install blocked by dependency conflict
- â Basic mode works but lacks semantic search
Current State:
- ReasoningBank storage: â Works
- ReasoningBank list: â Works
- ReasoningBank query: â Completely broken
Proposed Solutions
Option A: Quick Fix (Recommended)
- Fix
@xenova/transformersdependency version - Make hash-based fallback actually search content field for keywords
- Add warning: "Semantic search requires global install, using keyword search"
Option B: Complete Fix
- Fix dependency version
- Implement working hash-based embeddings in npx environment
- Add comprehensive error messages
- Test coverage for npx vs global behavior
Workaround for Users
Use basic mode instead of ReasoningBank:
# Works correctly
npx claude-flow@alpha memory store "key" "content" --basic
npx claude-flow@alpha memory query "search-term" --basic
Limitation: No semantic search, only keyword matching (but that's better than 0 results!)
Additional Context
Database Structure (from working list command)
đ project/patterns/FEATURE-001
Value: Multi-model consensus caught 2 CRITICAL bugs during code review...
Confidence: 80.0% | Usage: 0
đ project/decisions/architecture
Value: Architecture decision with cost analysis and migration path...
Confidence: 80.0% | Usage: 0
Data IS in database, queries just can't find it.
System Info
$ node --version
v22.19.0
$ npm --version
10.9.4
$ npx claude-flow@alpha --version
2.7.26
Testing Checklist for Fix
- [ ]
npm install -g claude-flow@alphacompletes successfully - [ ]
npx claude-flow@alpha memory query "keyword" --reasoningbankreturns stored results - [ ] Hash-based fallback actually searches content field
- [ ] Error messages explain semantic search limitations clearly
- [ ] Documentation updated with npx limitations
- [ ] Add test coverage for npx environment behavior
Related Files:
src/memory/reasoningbank.js(or equivalent)package.json(dependency versions)- Database schema for
reasoning_memoriestable
Logs Available: Full debug logs available if needed for investigation.