claude-flow 2.5.0-alpha.141 → 2.7.0-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/agents/reasoning/README.md +171 -0
- package/.claude/agents/reasoning/agent.md +816 -0
- package/.claude/agents/reasoning/example-reasoning-agent-template.md +362 -0
- package/.claude/agents/reasoning/goal-planner.md +73 -0
- package/.claude/commands/coordination/README.md +9 -0
- package/.claude/commands/memory/README.md +9 -0
- package/.claude/settings.json +3 -3
- package/.claude/sparc-modes.json +108 -0
- package/README.md +1 -6
- package/bin/claude-flow +1 -1
- package/dist/src/cli/command-registry.js +70 -6
- package/dist/src/cli/command-registry.js.map +1 -1
- package/dist/src/cli/help-formatter.js +0 -3
- package/dist/src/cli/help-formatter.js.map +1 -1
- package/dist/src/cli/help-text.js +53 -5
- package/dist/src/cli/help-text.js.map +1 -1
- package/dist/src/cli/simple-cli.js +182 -172
- package/dist/src/cli/simple-cli.js.map +1 -1
- package/dist/src/cli/simple-commands/agent-booster.js +415 -0
- package/dist/src/cli/simple-commands/agent-booster.js.map +1 -0
- package/dist/src/cli/simple-commands/agent.js +856 -13
- package/dist/src/cli/simple-commands/agent.js.map +1 -1
- package/dist/src/cli/simple-commands/env-template.js +180 -0
- package/dist/src/cli/simple-commands/env-template.js.map +1 -0
- package/dist/src/cli/simple-commands/init/help.js +23 -0
- package/dist/src/cli/simple-commands/init/help.js.map +1 -1
- package/dist/src/cli/simple-commands/init/index.js +63 -0
- package/dist/src/cli/simple-commands/init/index.js.map +1 -1
- package/dist/src/cli/simple-commands/memory.js +307 -16
- package/dist/src/cli/simple-commands/memory.js.map +1 -1
- package/dist/src/cli/simple-commands/proxy.js +304 -0
- package/dist/src/cli/simple-commands/proxy.js.map +1 -0
- package/dist/src/cli/simple-commands/sparc.js +16 -19
- package/dist/src/cli/simple-commands/sparc.js.map +1 -1
- package/dist/src/cli/validation-helper.js.map +1 -1
- package/dist/src/core/version.js +1 -1
- package/dist/src/execution/agent-executor.js +181 -0
- package/dist/src/execution/agent-executor.js.map +1 -0
- package/dist/src/execution/index.js +12 -0
- package/dist/src/execution/index.js.map +1 -0
- package/dist/src/execution/provider-manager.js +110 -0
- package/dist/src/execution/provider-manager.js.map +1 -0
- package/dist/src/hooks/redaction-hook.js +89 -0
- package/dist/src/hooks/redaction-hook.js.map +1 -0
- package/dist/src/memory/swarm-memory.js +340 -421
- package/dist/src/memory/swarm-memory.js.map +1 -1
- package/dist/src/utils/key-redactor.js +108 -0
- package/dist/src/utils/key-redactor.js.map +1 -0
- package/dist/src/utils/metrics-reader.js +37 -39
- package/dist/src/utils/metrics-reader.js.map +1 -1
- package/docs/AGENT-BOOSTER-INTEGRATION.md +407 -0
- package/docs/AGENTIC-FLOW-INTEGRATION-GUIDE.md +753 -0
- package/docs/AGENTIC_FLOW_EXECUTION_FIX_REPORT.md +474 -0
- package/docs/AGENTIC_FLOW_INTEGRATION_STATUS.md +143 -0
- package/docs/AGENTIC_FLOW_MVP_COMPLETE.md +367 -0
- package/docs/AGENTIC_FLOW_SECURITY_TEST_REPORT.md +369 -0
- package/docs/COMMAND-VERIFICATION-REPORT.md +441 -0
- package/docs/COMMIT_SUMMARY.md +247 -0
- package/docs/DEEP_REVIEW_COMPREHENSIVE_REPORT.md +922 -0
- package/docs/DOCKER-VALIDATION-REPORT.md +281 -0
- package/docs/ENV-SETUP-GUIDE.md +270 -0
- package/docs/FINAL_PRE_PUBLISH_VALIDATION.md +823 -0
- package/docs/FINAL_VALIDATION_REPORT.md +165 -0
- package/docs/HOOKS-V2-MODIFICATION.md +146 -0
- package/docs/INDEX.md +568 -0
- package/docs/INTEGRATION_COMPLETE.md +414 -0
- package/docs/MEMORY_REDACTION_TEST_REPORT.md +300 -0
- package/docs/PERFORMANCE-SYSTEMS-STATUS.md +340 -0
- package/docs/PRE_RELEASE_FIXES_REPORT.md +435 -0
- package/docs/README.md +35 -0
- package/docs/REASONING-AGENTS.md +482 -0
- package/docs/REASONINGBANK-AGENT-CREATION-GUIDE.md +813 -0
- package/docs/REASONINGBANK-ANALYSIS-COMPLETE.md +479 -0
- package/docs/REASONINGBANK-BENCHMARK-RESULTS.md +166 -0
- package/docs/REASONINGBANK-BENCHMARK.md +396 -0
- package/docs/REASONINGBANK-CLI-INTEGRATION.md +455 -0
- package/docs/REASONINGBANK-CORE-INTEGRATION.md +658 -0
- package/docs/REASONINGBANK-COST-OPTIMIZATION.md +329 -0
- package/docs/REASONINGBANK-DEMO.md +419 -0
- package/docs/REASONINGBANK-INTEGRATION-COMPLETE.md +249 -0
- package/docs/REASONINGBANK-VALIDATION.md +532 -0
- package/docs/REASONINGBANK_ARCHITECTURE.md +475 -0
- package/docs/REASONINGBANK_INTEGRATION_COMPLETE.md +558 -0
- package/docs/REASONINGBANK_INTEGRATION_PLAN.md +1188 -0
- package/docs/REGRESSION-ANALYSIS-REPORT.md +500 -0
- package/docs/RELEASE_v2.6.0-alpha.2.md +658 -0
- package/docs/api/API_DOCUMENTATION.md +721 -0
- package/docs/architecture/ARCHITECTURE.md +1690 -0
- package/docs/ci-cd/README.md +368 -0
- package/docs/development/DEPLOYMENT.md +2348 -0
- package/docs/development/DEVELOPMENT_WORKFLOW.md +1333 -0
- package/docs/development/build-analysis-report.md +252 -0
- package/docs/development/pair-optimization.md +156 -0
- package/docs/development/token-tracking-status.md +103 -0
- package/docs/development/training-pipeline-demo.md +163 -0
- package/docs/development/training-pipeline-real-only.md +196 -0
- package/docs/epic-sdk-integration.md +1269 -0
- package/docs/experimental/RIEMANN_HYPOTHESIS_PROOF.md +124 -0
- package/docs/experimental/computational_verification.py +436 -0
- package/docs/experimental/novel_approaches.md +560 -0
- package/docs/experimental/riemann_hypothesis_analysis.md +263 -0
- package/docs/experimental/riemann_proof_attempt.md +124 -0
- package/docs/experimental/riemann_synthesis.md +277 -0
- package/docs/experimental/verification_results.json +12 -0
- package/docs/experimental/visualization_insights.md +720 -0
- package/docs/guides/USER_GUIDE.md +1138 -0
- package/docs/guides/token-tracking-guide.md +291 -0
- package/docs/reference/AGENTS.md +1011 -0
- package/docs/reference/MCP_TOOLS.md +2188 -0
- package/docs/reference/SPARC.md +717 -0
- package/docs/reference/SWARM.md +2000 -0
- package/docs/sdk/CLAUDE-CODE-SDK-DEEP-ANALYSIS.md +649 -0
- package/docs/sdk/CLAUDE-FLOW-SDK-INTEGRATION-ANALYSIS.md +242 -0
- package/docs/sdk/INTEGRATION-ROADMAP.md +420 -0
- package/docs/sdk/MCP-TOOLS-UPDATE.md +270 -0
- package/docs/sdk/SDK-ADVANCED-FEATURES-INTEGRATION.md +723 -0
- package/docs/sdk/SDK-ALL-FEATURES-INTEGRATION-MATRIX.md +612 -0
- package/docs/sdk/SDK-INTEGRATION-COMPLETE.md +358 -0
- package/docs/sdk/SDK-INTEGRATION-PHASES-V2.5.md +750 -0
- package/docs/sdk/SDK-LEVERAGE-REAL-FEATURES.md +676 -0
- package/docs/sdk/SDK-VALIDATION-RESULTS.md +400 -0
- package/docs/sdk/epic-sdk-integration.md +1269 -0
- package/docs/setup/remote-setup.md +93 -0
- package/docs/validation/final-validation-summary.md +220 -0
- package/docs/validation/verification-integration.md +190 -0
- package/docs/validation/verification-validation.md +349 -0
- package/docs/wiki/background-commands.md +1213 -0
- package/docs/wiki/session-persistence.md +342 -0
- package/docs/wiki/stream-chain-command.md +537 -0
- package/package.json +4 -2
- package/src/cli/command-registry.js +70 -5
- package/src/cli/help-text.js +26 -5
- package/src/cli/simple-cli.ts +18 -7
- package/src/cli/simple-commands/agent-booster.js +515 -0
- package/src/cli/simple-commands/agent.js +1001 -12
- package/src/cli/simple-commands/agent.ts +137 -0
- package/src/cli/simple-commands/config.ts +127 -0
- package/src/cli/simple-commands/env-template.js +190 -0
- package/src/cli/simple-commands/init/help.js +23 -0
- package/src/cli/simple-commands/init/index.js +84 -6
- package/src/cli/simple-commands/memory.js +363 -16
- package/src/cli/simple-commands/proxy.js +384 -0
- package/src/cli/simple-commands/sparc.js +16 -19
- package/src/execution/agent-executor.ts +306 -0
- package/src/execution/index.ts +19 -0
- package/src/execution/provider-manager.ts +187 -0
- package/src/hooks/redaction-hook.ts +115 -0
- package/src/utils/key-redactor.js +178 -0
- package/src/utils/key-redactor.ts +184 -0
|
@@ -0,0 +1,658 @@
|
|
|
1
|
+
# ReasoningBank Core Memory Integration
|
|
2
|
+
|
|
3
|
+
## 🎯 Overview
|
|
4
|
+
|
|
5
|
+
Integrate ReasoningBank as an **optional enhanced mode** for `claude-flow memory` while maintaining full backward compatibility with existing installations.
|
|
6
|
+
|
|
7
|
+
## 📊 Current State
|
|
8
|
+
|
|
9
|
+
### Two Separate Systems
|
|
10
|
+
|
|
11
|
+
**Core Memory** (`claude-flow memory`)
|
|
12
|
+
- Basic key-value storage
|
|
13
|
+
- File-based (JSON): `./memory/memory-store.json`
|
|
14
|
+
- Commands: store, query, stats, export, import, clear, list
|
|
15
|
+
- No AI/learning capabilities
|
|
16
|
+
- Always available, no dependencies
|
|
17
|
+
|
|
18
|
+
**ReasoningBank** (`claude-flow agent memory`)
|
|
19
|
+
- AI-powered learning memory
|
|
20
|
+
- Database-based (SQLite): `.swarm/memory.db`
|
|
21
|
+
- Commands: init, status, list, demo, test, benchmark
|
|
22
|
+
- Learns from task execution patterns
|
|
23
|
+
- Requires initialization and API keys
|
|
24
|
+
|
|
25
|
+
## 🚀 Proposed Integration
|
|
26
|
+
|
|
27
|
+
### Unified Interface
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# Basic mode (current behavior - backward compatible)
|
|
31
|
+
claude-flow memory store api_key "sk-ant-xxx" --redact
|
|
32
|
+
claude-flow memory query research
|
|
33
|
+
|
|
34
|
+
# Enhanced mode (NEW - opt-in via flag)
|
|
35
|
+
claude-flow memory store api_key "sk-ant-xxx" --reasoningbank
|
|
36
|
+
claude-flow memory query research --reasoningbank
|
|
37
|
+
claude-flow memory status --reasoningbank
|
|
38
|
+
|
|
39
|
+
# Short form
|
|
40
|
+
claude-flow memory store api_key "sk-ant-xxx" --rb
|
|
41
|
+
claude-flow memory query research --rb
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Auto-Detection
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# Automatically detect which mode is appropriate
|
|
48
|
+
claude-flow memory query research --auto
|
|
49
|
+
|
|
50
|
+
# Check if ReasoningBank is available
|
|
51
|
+
claude-flow memory detect
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## 🏗️ Architecture
|
|
55
|
+
|
|
56
|
+
### Command Flow
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
┌─────────────────────────────────────────┐
|
|
60
|
+
│ claude-flow memory <cmd> [--rb|--auto] │
|
|
61
|
+
└────────────────┬────────────────────────┘
|
|
62
|
+
│
|
|
63
|
+
┌────────▼─────────┐
|
|
64
|
+
│ Parse Flags │
|
|
65
|
+
└────────┬─────────┘
|
|
66
|
+
│
|
|
67
|
+
┌───────────▼────────────┐
|
|
68
|
+
│ Mode Detection │
|
|
69
|
+
│ • No flag → Basic │
|
|
70
|
+
│ • --rb → ReasoningBank│
|
|
71
|
+
│ • --auto → Detect │
|
|
72
|
+
└───────────┬────────────┘
|
|
73
|
+
│
|
|
74
|
+
┌────────▼─────────┐
|
|
75
|
+
│ Execute Command │
|
|
76
|
+
└──────────────────┘
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Feature Matrix
|
|
80
|
+
|
|
81
|
+
| Command | Basic Mode | ReasoningBank Mode | Notes |
|
|
82
|
+
|----------|------------|-------------------|-------|
|
|
83
|
+
| `store` | JSON file | SQLite + embeddings | RB learns patterns |
|
|
84
|
+
| `query` | Exact/fuzzy match | Semantic search | RB uses embeddings |
|
|
85
|
+
| `stats` | File stats | AI metrics (confidence, usage) | RB shows learning stats |
|
|
86
|
+
| `export` | JSON export | JSON + embeddings | RB includes vectors |
|
|
87
|
+
| `import` | JSON import | JSON + rebuild vectors | RB regenerates embeddings |
|
|
88
|
+
| `clear` | Delete entries | Archive + clean | RB preserves learning |
|
|
89
|
+
| `list` | List keys | List with confidence scores | RB shows quality metrics |
|
|
90
|
+
|
|
91
|
+
### New Commands
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
# Initialize ReasoningBank (one-time setup)
|
|
95
|
+
claude-flow memory init --reasoningbank
|
|
96
|
+
|
|
97
|
+
# Check ReasoningBank status
|
|
98
|
+
claude-flow memory status --reasoningbank
|
|
99
|
+
|
|
100
|
+
# Show which mode is active
|
|
101
|
+
claude-flow memory mode
|
|
102
|
+
|
|
103
|
+
# Detect ReasoningBank availability
|
|
104
|
+
claude-flow memory detect
|
|
105
|
+
|
|
106
|
+
# Migrate basic → ReasoningBank
|
|
107
|
+
claude-flow memory migrate --to reasoningbank
|
|
108
|
+
|
|
109
|
+
# Consolidate/optimize ReasoningBank
|
|
110
|
+
claude-flow memory consolidate --reasoningbank
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## 🔄 Backward Compatibility
|
|
114
|
+
|
|
115
|
+
### Guaranteed Compatibility
|
|
116
|
+
|
|
117
|
+
1. **Existing commands work unchanged**
|
|
118
|
+
```bash
|
|
119
|
+
# These continue to work exactly as before
|
|
120
|
+
claude-flow memory store key value
|
|
121
|
+
claude-flow memory query search
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
2. **No breaking changes**
|
|
125
|
+
- Default behavior unchanged (uses basic mode)
|
|
126
|
+
- Existing JSON files untouched
|
|
127
|
+
- No forced migration
|
|
128
|
+
|
|
129
|
+
3. **Opt-in enhancement**
|
|
130
|
+
- Users must explicitly use `--reasoningbank` or `--rb`
|
|
131
|
+
- Or run `memory init --reasoningbank` first
|
|
132
|
+
- Then optionally set default mode
|
|
133
|
+
|
|
134
|
+
### Migration Path
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
# Step 1: Check current memory
|
|
138
|
+
claude-flow memory stats
|
|
139
|
+
# Shows: 150 entries in basic mode
|
|
140
|
+
|
|
141
|
+
# Step 2: Initialize ReasoningBank
|
|
142
|
+
claude-flow memory init --reasoningbank
|
|
143
|
+
# Creates .swarm/memory.db
|
|
144
|
+
|
|
145
|
+
# Step 3: (Optional) Migrate existing data
|
|
146
|
+
claude-flow memory migrate --to reasoningbank
|
|
147
|
+
# Imports all 150 entries + generates embeddings
|
|
148
|
+
|
|
149
|
+
# Step 4: Use ReasoningBank mode
|
|
150
|
+
claude-flow memory query api --reasoningbank
|
|
151
|
+
# Now uses semantic search with AI
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## 📝 Implementation Plan
|
|
155
|
+
|
|
156
|
+
### Phase 1: Core Integration (Week 1)
|
|
157
|
+
|
|
158
|
+
**File**: `src/cli/simple-commands/memory.js`
|
|
159
|
+
|
|
160
|
+
Add mode detection:
|
|
161
|
+
```javascript
|
|
162
|
+
export async function memoryCommand(subArgs, flags) {
|
|
163
|
+
const memorySubcommand = subArgs[0];
|
|
164
|
+
|
|
165
|
+
// NEW: Detect mode
|
|
166
|
+
const mode = detectMemoryMode(flags);
|
|
167
|
+
// Returns: 'basic' | 'reasoningbank' | 'auto'
|
|
168
|
+
|
|
169
|
+
if (mode === 'reasoningbank') {
|
|
170
|
+
// Delegate to ReasoningBank implementation
|
|
171
|
+
return await reasoningBankMemoryCommand(subArgs, flags);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// Existing basic implementation continues...
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Phase 2: Auto-Detection (Week 1)
|
|
179
|
+
|
|
180
|
+
Add intelligent detection:
|
|
181
|
+
```javascript
|
|
182
|
+
async function detectMemoryMode(flags) {
|
|
183
|
+
// Explicit flag takes precedence
|
|
184
|
+
if (flags.reasoningbank || flags.rb) {
|
|
185
|
+
return 'reasoningbank';
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// Auto mode: check if ReasoningBank is initialized
|
|
189
|
+
if (flags.auto) {
|
|
190
|
+
const rbAvailable = await isReasoningBankInitialized();
|
|
191
|
+
return rbAvailable ? 'reasoningbank' : 'basic';
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// Default: basic mode (backward compatible)
|
|
195
|
+
return 'basic';
|
|
196
|
+
}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### Phase 3: Enhanced Commands (Week 2)
|
|
200
|
+
|
|
201
|
+
Add ReasoningBank-specific features:
|
|
202
|
+
```javascript
|
|
203
|
+
// New commands available only in ReasoningBank mode
|
|
204
|
+
case 'init':
|
|
205
|
+
if (mode === 'reasoningbank') {
|
|
206
|
+
await initializeReasoningBank();
|
|
207
|
+
}
|
|
208
|
+
break;
|
|
209
|
+
|
|
210
|
+
case 'status':
|
|
211
|
+
if (mode === 'reasoningbank') {
|
|
212
|
+
await showReasoningBankStatus();
|
|
213
|
+
} else {
|
|
214
|
+
await showBasicMemoryStats();
|
|
215
|
+
}
|
|
216
|
+
break;
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Phase 4: Migration Tools (Week 2)
|
|
220
|
+
|
|
221
|
+
Add migration utilities:
|
|
222
|
+
```javascript
|
|
223
|
+
case 'migrate':
|
|
224
|
+
await migrateMemoryData(flags.to); // 'reasoningbank' or 'basic'
|
|
225
|
+
break;
|
|
226
|
+
|
|
227
|
+
case 'detect':
|
|
228
|
+
await detectAndShowAvailableModes();
|
|
229
|
+
break;
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## 🎯 User Experience
|
|
233
|
+
|
|
234
|
+
### First-Time User
|
|
235
|
+
|
|
236
|
+
```bash
|
|
237
|
+
# Install and use basic memory immediately
|
|
238
|
+
$ claude-flow memory store project "Started new API project"
|
|
239
|
+
✅ Stored: project
|
|
240
|
+
|
|
241
|
+
$ claude-flow memory query project
|
|
242
|
+
✅ Found 1 result:
|
|
243
|
+
project: Started new API project
|
|
244
|
+
|
|
245
|
+
# Later: Discover ReasoningBank
|
|
246
|
+
$ claude-flow memory detect
|
|
247
|
+
ℹ️ Memory Modes Available:
|
|
248
|
+
✅ Basic Mode (active)
|
|
249
|
+
⚠️ ReasoningBank (not initialized)
|
|
250
|
+
|
|
251
|
+
💡 To enable AI-powered memory:
|
|
252
|
+
claude-flow memory init --reasoningbank
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
### Existing User (Backward Compatible)
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
# Existing installation - everything works unchanged
|
|
259
|
+
$ claude-flow memory stats
|
|
260
|
+
📊 Memory Statistics:
|
|
261
|
+
Total entries: 247
|
|
262
|
+
Namespaces: 5
|
|
263
|
+
Size: 45.2 KB
|
|
264
|
+
Mode: Basic
|
|
265
|
+
|
|
266
|
+
# Opt-in to ReasoningBank
|
|
267
|
+
$ claude-flow memory init --reasoningbank
|
|
268
|
+
🧠 Initializing ReasoningBank...
|
|
269
|
+
✅ Created: .swarm/memory.db
|
|
270
|
+
✅ ReasoningBank ready!
|
|
271
|
+
|
|
272
|
+
# Migrate existing data (optional)
|
|
273
|
+
$ claude-flow memory migrate --to reasoningbank
|
|
274
|
+
📦 Migrating 247 entries...
|
|
275
|
+
⏳ Generating embeddings... (this may take a moment)
|
|
276
|
+
✅ Migrated successfully!
|
|
277
|
+
|
|
278
|
+
# Now use either mode
|
|
279
|
+
$ claude-flow memory query api
|
|
280
|
+
# Uses basic mode (default)
|
|
281
|
+
|
|
282
|
+
$ claude-flow memory query api --reasoningbank
|
|
283
|
+
# Uses ReasoningBank with semantic search
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
### Power User
|
|
287
|
+
|
|
288
|
+
```bash
|
|
289
|
+
# Set default mode via config
|
|
290
|
+
$ claude-flow config set memory.default_mode reasoningbank
|
|
291
|
+
✅ Default memory mode: ReasoningBank
|
|
292
|
+
|
|
293
|
+
# Now all commands use ReasoningBank by default
|
|
294
|
+
$ claude-flow memory query performance
|
|
295
|
+
# Automatically uses ReasoningBank
|
|
296
|
+
|
|
297
|
+
# Override to use basic mode
|
|
298
|
+
$ claude-flow memory query performance --basic
|
|
299
|
+
# Forces basic mode
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
## 🔐 Security & Privacy
|
|
303
|
+
|
|
304
|
+
### Data Separation
|
|
305
|
+
|
|
306
|
+
- Basic mode: `./memory/memory-store.json`
|
|
307
|
+
- ReasoningBank: `.swarm/memory.db`
|
|
308
|
+
- Both support `--redact` flag
|
|
309
|
+
- ReasoningBank embeddings never expose raw API keys
|
|
310
|
+
|
|
311
|
+
### Privacy Controls
|
|
312
|
+
|
|
313
|
+
```bash
|
|
314
|
+
# Redact sensitive data in both modes
|
|
315
|
+
claude-flow memory store api "sk-ant-xxx" --redact
|
|
316
|
+
|
|
317
|
+
# ReasoningBank with privacy-first local embeddings
|
|
318
|
+
claude-flow memory init --reasoningbank --local-embeddings
|
|
319
|
+
# Uses ONNX local models, no data sent to external APIs
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
## 📊 Performance Comparison
|
|
323
|
+
|
|
324
|
+
| Metric | Basic Mode | ReasoningBank | Improvement |
|
|
325
|
+
|--------|-----------|--------------|-------------|
|
|
326
|
+
| Query Speed | 2ms | 15ms | -6.5x slower |
|
|
327
|
+
| Query Accuracy | 60% | 88% | +46% better |
|
|
328
|
+
| Learning | No | Yes | ∞ better |
|
|
329
|
+
| Memory Usage | 1MB | 50MB | -49x more |
|
|
330
|
+
| Setup Time | 0s | 30s | -30s longer |
|
|
331
|
+
|
|
332
|
+
**Recommendation**: Use basic mode for simple key-value storage, ReasoningBank for AI-powered learning and semantic search.
|
|
333
|
+
|
|
334
|
+
## 🧪 Testing Strategy
|
|
335
|
+
|
|
336
|
+
### Backward Compatibility Tests
|
|
337
|
+
|
|
338
|
+
```bash
|
|
339
|
+
# Test 1: Existing commands work unchanged
|
|
340
|
+
claude-flow memory store test "value"
|
|
341
|
+
claude-flow memory query test
|
|
342
|
+
|
|
343
|
+
# Test 2: No forced migration
|
|
344
|
+
claude-flow memory stats
|
|
345
|
+
# Should show basic mode by default
|
|
346
|
+
|
|
347
|
+
# Test 3: Opt-in works
|
|
348
|
+
claude-flow memory query test --reasoningbank
|
|
349
|
+
# Should fail gracefully if not initialized
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
### Integration Tests
|
|
353
|
+
|
|
354
|
+
```bash
|
|
355
|
+
# Test 4: ReasoningBank initialization
|
|
356
|
+
claude-flow memory init --reasoningbank
|
|
357
|
+
claude-flow memory status --reasoningbank
|
|
358
|
+
|
|
359
|
+
# Test 5: Migration
|
|
360
|
+
claude-flow memory migrate --to reasoningbank
|
|
361
|
+
claude-flow memory stats --reasoningbank
|
|
362
|
+
|
|
363
|
+
# Test 6: Mode detection
|
|
364
|
+
claude-flow memory detect
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
## 📚 Documentation Updates
|
|
368
|
+
|
|
369
|
+
### Help Text Updates
|
|
370
|
+
|
|
371
|
+
```bash
|
|
372
|
+
$ claude-flow memory --help
|
|
373
|
+
|
|
374
|
+
Memory Management
|
|
375
|
+
|
|
376
|
+
USAGE:
|
|
377
|
+
claude-flow memory <command> [options]
|
|
378
|
+
|
|
379
|
+
MODES:
|
|
380
|
+
Basic Mode (default) Simple key-value storage in JSON file
|
|
381
|
+
ReasoningBank Mode AI-powered learning with semantic search
|
|
382
|
+
|
|
383
|
+
FLAGS:
|
|
384
|
+
--reasoningbank, --rb Use ReasoningBank mode (AI-powered)
|
|
385
|
+
--auto Auto-detect best mode
|
|
386
|
+
--basic Force basic mode
|
|
387
|
+
--redact Enable API key redaction
|
|
388
|
+
|
|
389
|
+
COMMANDS:
|
|
390
|
+
store <key> <value> Store a key-value pair
|
|
391
|
+
query <search> Search for entries
|
|
392
|
+
stats Show memory statistics
|
|
393
|
+
export [filename] Export memory to file
|
|
394
|
+
import <filename> Import memory from file
|
|
395
|
+
clear --namespace <ns> Clear a namespace
|
|
396
|
+
list List all namespaces
|
|
397
|
+
|
|
398
|
+
# ReasoningBank Commands (require --reasoningbank)
|
|
399
|
+
init --reasoningbank Initialize ReasoningBank system
|
|
400
|
+
status --reasoningbank Show ReasoningBank statistics
|
|
401
|
+
consolidate --rb Optimize ReasoningBank database
|
|
402
|
+
|
|
403
|
+
# Mode Management
|
|
404
|
+
detect Show available memory modes
|
|
405
|
+
migrate --to <mode> Migrate between basic/reasoningbank
|
|
406
|
+
mode Show current default mode
|
|
407
|
+
|
|
408
|
+
EXAMPLES:
|
|
409
|
+
# Basic mode (always works)
|
|
410
|
+
memory store api_key "sk-ant-xxx" --redact
|
|
411
|
+
memory query research
|
|
412
|
+
|
|
413
|
+
# ReasoningBank mode (requires init)
|
|
414
|
+
memory init --reasoningbank
|
|
415
|
+
memory store api_key "sk-ant-xxx" --reasoningbank
|
|
416
|
+
memory query research --reasoningbank
|
|
417
|
+
|
|
418
|
+
# Auto-detect (uses best available)
|
|
419
|
+
memory query research --auto
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
## 🚦 Rollout Plan
|
|
423
|
+
|
|
424
|
+
### Version 2.6.1 (Current)
|
|
425
|
+
|
|
426
|
+
- ✅ ReasoningBank available via `agent memory` commands
|
|
427
|
+
- ✅ Core memory works independently
|
|
428
|
+
|
|
429
|
+
### Version 2.7.0 (Next - This Integration)
|
|
430
|
+
|
|
431
|
+
- 🎯 Add `--reasoningbank` flag to `memory` command
|
|
432
|
+
- 🎯 Add mode detection and auto-selection
|
|
433
|
+
- 🎯 Add migration tools
|
|
434
|
+
- 🎯 Update help and documentation
|
|
435
|
+
- 🎯 Maintain full backward compatibility
|
|
436
|
+
|
|
437
|
+
### Version 2.8.0 (Future)
|
|
438
|
+
|
|
439
|
+
- 🔮 Add hybrid mode (both simultaneously)
|
|
440
|
+
- 🔮 Add sync between basic ↔ ReasoningBank
|
|
441
|
+
- 🔮 Add cloud ReasoningBank sync
|
|
442
|
+
|
|
443
|
+
## ✅ Benefits
|
|
444
|
+
|
|
445
|
+
### For Users
|
|
446
|
+
|
|
447
|
+
1. **Smooth upgrade path**: No forced changes
|
|
448
|
+
2. **Choose your mode**: Basic for simple, ReasoningBank for AI
|
|
449
|
+
3. **Gradual migration**: Try ReasoningBank without losing existing data
|
|
450
|
+
4. **Performance options**: Fast basic vs. smart ReasoningBank
|
|
451
|
+
|
|
452
|
+
### For Development
|
|
453
|
+
|
|
454
|
+
1. **Zero breaking changes**: Existing code continues to work
|
|
455
|
+
2. **Feature flag pattern**: Easy to enable/disable
|
|
456
|
+
3. **Independent testing**: Test each mode separately
|
|
457
|
+
4. **Clean architecture**: Clear separation of concerns
|
|
458
|
+
|
|
459
|
+
## 🔌 MCP Tools Integration
|
|
460
|
+
|
|
461
|
+
### Current MCP Tools
|
|
462
|
+
|
|
463
|
+
**Existing** (`mcp__claude-flow__memory_usage`)
|
|
464
|
+
```javascript
|
|
465
|
+
// Current implementation - basic mode only
|
|
466
|
+
mcp__claude-flow__memory_usage({
|
|
467
|
+
action: "store",
|
|
468
|
+
key: "api_config",
|
|
469
|
+
value: "some data"
|
|
470
|
+
})
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
### Enhanced MCP Tools
|
|
474
|
+
|
|
475
|
+
**Option 1: Add Mode Parameter**
|
|
476
|
+
```javascript
|
|
477
|
+
// Backward compatible - defaults to basic mode
|
|
478
|
+
mcp__claude-flow__memory_usage({
|
|
479
|
+
action: "store",
|
|
480
|
+
key: "api_config",
|
|
481
|
+
value: "some data",
|
|
482
|
+
mode: "basic" // NEW: optional, defaults to "basic"
|
|
483
|
+
})
|
|
484
|
+
|
|
485
|
+
// Opt-in to ReasoningBank
|
|
486
|
+
mcp__claude-flow__memory_usage({
|
|
487
|
+
action: "store",
|
|
488
|
+
key: "api_config",
|
|
489
|
+
value: "some data",
|
|
490
|
+
mode: "reasoningbank" // NEW: use AI-powered mode
|
|
491
|
+
})
|
|
492
|
+
|
|
493
|
+
// Auto-detect best mode
|
|
494
|
+
mcp__claude-flow__memory_usage({
|
|
495
|
+
action: "store",
|
|
496
|
+
key: "api_config",
|
|
497
|
+
value: "some data",
|
|
498
|
+
mode: "auto" // NEW: intelligent selection
|
|
499
|
+
})
|
|
500
|
+
```
|
|
501
|
+
|
|
502
|
+
**Option 2: Separate MCP Tools** (Recommended)
|
|
503
|
+
|
|
504
|
+
Keep backward compatibility and add new tools:
|
|
505
|
+
|
|
506
|
+
```javascript
|
|
507
|
+
// Existing tool - unchanged (basic mode)
|
|
508
|
+
mcp__claude-flow__memory_usage({
|
|
509
|
+
action: "store",
|
|
510
|
+
key: "api_config",
|
|
511
|
+
value: "some data"
|
|
512
|
+
})
|
|
513
|
+
|
|
514
|
+
// NEW tool - ReasoningBank
|
|
515
|
+
mcp__claude-flow__reasoningbank_memory({
|
|
516
|
+
action: "store",
|
|
517
|
+
key: "api_config",
|
|
518
|
+
value: "some data",
|
|
519
|
+
domain: "api", // NEW: semantic domain
|
|
520
|
+
confidence: 0.8 // NEW: learning confidence
|
|
521
|
+
})
|
|
522
|
+
|
|
523
|
+
// NEW tool - semantic query
|
|
524
|
+
mcp__claude-flow__reasoningbank_query({
|
|
525
|
+
query: "how to configure API",
|
|
526
|
+
k: 3, // Top-k results
|
|
527
|
+
min_confidence: 0.7 // Minimum confidence threshold
|
|
528
|
+
})
|
|
529
|
+
```
|
|
530
|
+
|
|
531
|
+
### MCP Tool Schema Updates
|
|
532
|
+
|
|
533
|
+
**Enhanced memory_usage tool**:
|
|
534
|
+
```json
|
|
535
|
+
{
|
|
536
|
+
"name": "mcp__claude-flow__memory_usage",
|
|
537
|
+
"description": "Store/retrieve memory with optional ReasoningBank mode",
|
|
538
|
+
"parameters": {
|
|
539
|
+
"action": {
|
|
540
|
+
"type": "string",
|
|
541
|
+
"enum": ["store", "retrieve", "list", "delete", "search"]
|
|
542
|
+
},
|
|
543
|
+
"key": { "type": "string" },
|
|
544
|
+
"value": { "type": "string" },
|
|
545
|
+
"namespace": { "type": "string" },
|
|
546
|
+
"mode": {
|
|
547
|
+
"type": "string",
|
|
548
|
+
"enum": ["basic", "reasoningbank", "auto"],
|
|
549
|
+
"default": "basic",
|
|
550
|
+
"description": "Memory mode: basic (JSON), reasoningbank (AI), auto (detect)"
|
|
551
|
+
},
|
|
552
|
+
"ttl": { "type": "number" }
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
**NEW ReasoningBank-specific tools**:
|
|
558
|
+
```json
|
|
559
|
+
{
|
|
560
|
+
"name": "mcp__claude-flow__reasoningbank_store",
|
|
561
|
+
"description": "Store memory with AI learning (ReasoningBank)",
|
|
562
|
+
"parameters": {
|
|
563
|
+
"key": { "type": "string" },
|
|
564
|
+
"value": { "type": "string" },
|
|
565
|
+
"domain": {
|
|
566
|
+
"type": "string",
|
|
567
|
+
"description": "Semantic domain (e.g., 'api', 'security', 'performance')"
|
|
568
|
+
},
|
|
569
|
+
"confidence": {
|
|
570
|
+
"type": "number",
|
|
571
|
+
"minimum": 0,
|
|
572
|
+
"maximum": 1,
|
|
573
|
+
"description": "Confidence score for this memory"
|
|
574
|
+
},
|
|
575
|
+
"metadata": {
|
|
576
|
+
"type": "object",
|
|
577
|
+
"description": "Additional metadata for learning"
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
```
|
|
582
|
+
|
|
583
|
+
### MCP Usage Examples
|
|
584
|
+
|
|
585
|
+
**Claude Desktop with ReasoningBank**:
|
|
586
|
+
```typescript
|
|
587
|
+
// In Claude Desktop conversation
|
|
588
|
+
"Store the API configuration I just learned"
|
|
589
|
+
|
|
590
|
+
// Claude Code MCP call (auto-detects mode):
|
|
591
|
+
await mcp__claude-flow__memory_usage({
|
|
592
|
+
action: "store",
|
|
593
|
+
key: "api_config_pattern",
|
|
594
|
+
value: "Always use environment variables for API keys",
|
|
595
|
+
mode: "auto" // Will use ReasoningBank if initialized
|
|
596
|
+
})
|
|
597
|
+
|
|
598
|
+
// Later, in a new conversation:
|
|
599
|
+
"What did I learn about API configuration?"
|
|
600
|
+
|
|
601
|
+
// Claude Code MCP call:
|
|
602
|
+
await mcp__claude-flow__reasoningbank_query({
|
|
603
|
+
query: "API configuration best practices",
|
|
604
|
+
k: 3
|
|
605
|
+
})
|
|
606
|
+
|
|
607
|
+
// Returns semantic matches with confidence scores:
|
|
608
|
+
// 1. [0.92] Always use environment variables for API keys
|
|
609
|
+
// 2. [0.85] API keys should be in .env files
|
|
610
|
+
// 3. [0.78] Never commit API keys to git
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
### MCP Integration Benefits
|
|
614
|
+
|
|
615
|
+
1. **Zero Breaking Changes**: Existing MCP calls work unchanged
|
|
616
|
+
2. **Opt-In Enhancement**: Add `mode` parameter to enable ReasoningBank
|
|
617
|
+
3. **Intelligent Defaults**: `mode: "auto"` detects best available
|
|
618
|
+
4. **Specialized Tools**: New tools for ReasoningBank-specific features
|
|
619
|
+
5. **Cross-Session Learning**: MCP tools persist across Claude Desktop sessions
|
|
620
|
+
|
|
621
|
+
### MCP Tool Migration Path
|
|
622
|
+
|
|
623
|
+
```typescript
|
|
624
|
+
// Phase 1: Current (v2.6.x)
|
|
625
|
+
mcp__claude-flow__memory_usage({ action: "store", ... })
|
|
626
|
+
// Always uses basic mode
|
|
627
|
+
|
|
628
|
+
// Phase 2: Enhanced (v2.7.0)
|
|
629
|
+
mcp__claude-flow__memory_usage({
|
|
630
|
+
action: "store",
|
|
631
|
+
mode: "auto", // NEW parameter (optional)
|
|
632
|
+
...
|
|
633
|
+
})
|
|
634
|
+
// Auto-detects ReasoningBank if available
|
|
635
|
+
|
|
636
|
+
// Phase 3: Specialized (v2.7.0)
|
|
637
|
+
mcp__claude-flow__reasoningbank_store({
|
|
638
|
+
key: "pattern",
|
|
639
|
+
value: "learned behavior",
|
|
640
|
+
domain: "coding",
|
|
641
|
+
confidence: 0.9
|
|
642
|
+
})
|
|
643
|
+
// ReasoningBank-specific tool with full features
|
|
644
|
+
```
|
|
645
|
+
|
|
646
|
+
## 🎉 Summary
|
|
647
|
+
|
|
648
|
+
This integration adds ReasoningBank as an **optional enhancement** to core memory:
|
|
649
|
+
|
|
650
|
+
✅ **Backward Compatible**: Existing installations work unchanged
|
|
651
|
+
✅ **Opt-In**: Users choose when to enable ReasoningBank
|
|
652
|
+
✅ **Auto-Detect**: Intelligent mode selection with `--auto`
|
|
653
|
+
✅ **Migration Tools**: Easy upgrade path from basic to ReasoningBank
|
|
654
|
+
✅ **Flexible**: Use basic, ReasoningBank, or both based on needs
|
|
655
|
+
✅ **Documented**: Clear help text showing both modes
|
|
656
|
+
✅ **MCP Integrated**: Claude Desktop can use both memory modes seamlessly
|
|
657
|
+
|
|
658
|
+
**Result**: Best of both worlds - simple JSON storage OR AI-powered learning memory! 🚀
|