Deprecated: Function get_magic_quotes_gpc() is deprecated in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 99

Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 619

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1169

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176
10BC0 Fix/mcp reasoningbank integration by dshep · Pull Request #818 · ruvnet/claude-flow · GitHub
Nothing Special   »   [go: up one dir, main page]

Skip to content

Conversation

dshep
Copy link
@dshep dshep commented Oct 16, 2025

🔗 Unify MCP and CLI Memory Storage with ReasoningBank Integration

Fixes #812

Summary

MCP memory tools (memory_usage, memory_search) and CLI memory commands previously used separate storage
systems
, preventing MCP users from accessing ReasoningBank's semantic search capabilities. This PR unifies
both interfaces to share the same storage backend with automatic ReasoningBank detection.

Problem

Before this fix:

  • ❌ CLI commands used ReasoningBank (.swarm/memory.db) with semantic search
  • ❌ MCP tools used separate database with no semantic search
  • ❌ Data stored via CLI was invisible to MCP (and vice versa)
  • memory_search MCP tool returned success but no actual results
  • ❌ MCP users forced to use CLI via Bash workarounds

Example of broken behavior:

# Store via CLI - goes to ReasoningBank
$ claude-flow memory store "auth-pattern" "Use JWT with RS256"
✅ Stored successfully in ReasoningBank

# Try to retrieve via MCP - different database!
await mcp__claude_flow__memory_usage({
  action: "retrieve",
  key: "auth-pattern"
});
// ❌ Returns: { found: false, value: null }

Solution: UnifiedMemoryManager

Created a unified memory layer that both CLI and MCP use:

Priority-based Storage System:
1. 🧠 ReasoningBank (.swarm/memory.db) - AI-powered semantic search
2. 🗄️ SQLite (unified-memory.db) - Fast SQL queries
3. 📄 JSON (memory-store.json) - Always-available fallback

Features:
- ✅ Auto-Detection: Checks for .swarm/memory.db existence
- ✅ Lazy Loading: Imports ReasoningBank adapter only when needed
- ✅ Graceful Fallback: Falls back to JSON if ReasoningBank unavailable
- ✅ Semantic Search: Query by meaning, not keywords
- ✅ Similarity Scores: Ranked results (0-100%)

Changes

1. Core Integration (src/memory/unified-memory-manager.js)

- Added ReasoningBank detection and integration
- Implemented priority-based storage selection
- Enhanced methods: store(), query(), get(), getStats()

2. MCP Server (src/mcp/mcp-server.js)

- Replaced fallback-store with UnifiedMemoryManager
- Added memory_search case statement (was missing!)
- Enhanced responses with storage_type and semantic_search metadata


Test Results ✅

CLI → MCP Interoperability (Semantic Search):
# Store via CLI
$ claude-flow memory store "authentication-best-practices" \
    "Always use environment variables for API keys..." \
    --namespace security
✅ Stored in ReasoningBank

# Query via MCP with DIFFERENT words
await memoryManager.query("How should I store API credentials?");

# Result: Found with 31.0% similarity! ✨
{
  key: "authentication-best-practices",
  score: 0.310,
  confidence: 0.80,
  mode: "reasoningbank"
}

Semantic matching works:
- Query: "How should I store API credentials?"
- Found: "Always use environment variables for API keys"
- System understands: "store credentials""environment variables"

Impact

For MCP Users:
- 🧠 Semantic search now accessible via MCP tools
- 📊 Similarity scores in search results
- 🔄 Can read data stored via CLI
- ⚡ Auto-detection, no config needed
- 🛡️ Graceful fallback to JSON mode

For CLI Users:
- 🔗 Data now accessible via MCP tools
- ✅ No breaking changes
- 📈 Enhanced MCP response metadata

Backward Compatibility ✅

- 100% Compatible: No breaking changes to existing APIs
- JSON Fallback: Works without ReasoningBank
- Existing Data: All previous data remains accessible
- Same Signatures: No changes to MCP tool parameters

Files Changed

- src/memory/unified-memory-manager.js - ReasoningBank integration
- src/mcp/mcp-server.js - UnifiedMemoryManager adoption + missing case fix


Testing

# 1. Store via CLI
./bin/claude-flow memory store "test-key" "semantic test value" --namespace test

# 2. Query via MCP with different words
# UnifiedMemoryManager returns results with similarity scores

# 3. Verify storage type
./bin/claude-flow memory mode
# Should show: "ReasoningBank Mode: Initialized ✅"

---
Ready for review! 🎉 Full interoperability between CLI and MCP memory interfaces with semantic search
capabilities.

dshep and others added 2 commits October 16, 2025 01:01
Resolves issue #7 by integrating MCP memory tools with UnifiedMemoryManager
and ReasoningBank backend, enabling semantic search for MCP users.

- Added ReasoningBank detection and auto-initialization
- Implemented priority-based storage: ReasoningBank → SQLite → JSON
- Added semantic search routing for query operations
- Updated get(), getStats(), delete(), clearNamespace() for ReasoningBank
- Added storeReasoningBank() and queryReasoningBank() methods
- Enhanced getStorageInfo() to report ReasoningBank capabilities

- Replaced fallback-store with UnifiedMemoryManager
- Updated handleMemoryUsage() to use new UnifiedMemoryManager API
- Updated handleMemorySearch() for semantic search support
- Fixed swarm storage operations to use unified memory
- Added storage_type and semantic_search flags t
94FC
o responses

- Comprehensive solution documentation
- Test results and verification
- CLI-MCP interoperability confirmation

✅ Semantic search for MCP users when ReasoningBank initialized
✅ CLI-MCP data interoperability (shared ReasoningBank backend)
✅ Auto-detection with graceful JSON fallback
✅ Storage type reporting in MCP responses
✅ 100% backward compatible

- ✅ ReasoningBank detection works correctly
- ✅ CLI stores data accessible via MCP
- ✅ MCP stores data accessible via CLI
- ✅ Semantic search returns similarity scores
- ✅ Stats show correct storage type

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@dshep
Copy link
Author
dshep commented Oct 21, 2025

the PR is compatable with v2.7.0-alpha.14 - verified the issue still exists in v2.7.0-alpha.14 and this fixes it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP memory tools (memory_usage, memory_search) don't use ReasoningBank semantic search despite initialization

1 participant

0