claude-flow 2.7.0-alpha.7 → 2.7.0-alpha.9
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/bin/claude-flow +1 -1
- package/dist/src/cli/help-formatter.js +5 -0
- package/dist/src/cli/simple-commands/memory.js +22 -15
- package/dist/src/cli/simple-commands/memory.js.map +1 -1
- package/dist/src/cli/simple-commands/performance-metrics.js +231 -1
- package/dist/src/cli/simple-commands/performance-metrics.js.map +1 -1
- package/dist/src/cli/validation-helper.js.map +1 -1
- package/dist/src/core/version.js.map +1 -1
- 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.map +1 -1
- package/dist/src/utils/metrics-reader.js +37 -39
- package/dist/src/utils/metrics-reader.js.map +1 -1
- package/docker-test/.claude-flow/metrics/agent-metrics.json +1 -0
- package/docker-test/.claude-flow/metrics/performance.json +87 -0
- package/docker-test/.claude-flow/metrics/task-metrics.json +10 -0
- package/docker-test/Dockerfile.reasoningbank-test +21 -0
- package/docker-test/reasoningbank-validation.mjs +201 -0
- package/docs/.claude-flow/metrics/performance.json +1 -1
- package/docs/.claude-flow/metrics/task-metrics.json +3 -3
- package/docs/PERFORMANCE-JSON-IMPROVEMENTS.md +277 -0
- package/docs/PERFORMANCE-METRICS-GUIDE.md +259 -0
- package/docs/integrations/agentic-flow/AGENTIC_FLOW_SECURITY_TEST_REPORT.md +7 -7
- package/docs/integrations/reasoningbank/MIGRATION-v1.5.13.md +189 -0
- package/docs/reports/REASONINGBANK_STATUS_UPDATE_v2_7_0_alpha_7.md +366 -0
- package/docs/reports/validation/DOCKER_SQL_FALLBACK_VALIDATION.md +398 -0
- package/docs/reports/validation/MEMORY_REDACTION_TEST_REPORT.md +7 -7
- package/docs/reports/validation/REASONINGBANK-v1.5.13-VALIDATION.md +235 -0
- package/docs/reports/validation/SQL_FALLBACK_VALIDATION_REPORT.md +405 -0
- package/docs/setup/MCP-SETUP-GUIDE.md +154 -0
- package/package.json +5 -6
- package/src/cli/simple-commands/memory.js +48 -18
- package/src/cli/simple-commands/performance-metrics.js +268 -2
- package/src/reasoningbank/reasoningbank-adapter.js +204 -132
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
# Performance Metrics Enhancement Guide
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
The `performance.json` file has been enhanced with comprehensive metrics for tracking memory operations, mode usage, and ReasoningBank-specific performance.
|
|
6
|
+
|
|
7
|
+
## Enhanced Structure
|
|
8
|
+
|
|
9
|
+
### Session Information
|
|
10
|
+
```json
|
|
11
|
+
{
|
|
12
|
+
"startTime": 1234567890,
|
|
13
|
+
"sessionId": "session-1234567890",
|
|
14
|
+
"lastActivity": 1234567890,
|
|
15
|
+
"sessionDuration": 12345
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
Tracks when the session started, unique session ID, last activity timestamp, and total session duration in milliseconds.
|
|
19
|
+
|
|
20
|
+
### Memory Mode Tracking
|
|
21
|
+
```json
|
|
22
|
+
{
|
|
23
|
+
"memoryMode": {
|
|
24
|
+
"reasoningbankOperations": 45,
|
|
25
|
+
"basicOperations": 12,
|
|
26
|
+
"autoModeSelections": 50,
|
|
27
|
+
"modeOverrides": 7,
|
|
28
|
+
"currentMode": "auto"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
Tracks which memory mode (ReasoningBank vs Basic/JSON) is being used, how often AUTO MODE selects each, and manual overrides.
|
|
33
|
+
|
|
34
|
+
### Operation Type Breakdown
|
|
35
|
+
```json
|
|
36
|
+
{
|
|
37
|
+
"operations": {
|
|
38
|
+
"store": { "count": 20, "totalDuration": 1234, "errors": 0 },
|
|
39
|
+
"retrieve": { "count": 45, "totalDuration": 2345, "errors": 1 },
|
|
40
|
+
"query": { "count": 30, "totalDuration": 15000, "errors": 0 },
|
|
41
|
+
"list": { "count": 10, "totalDuration": 500, "errors": 0 },
|
|
42
|
+
"delete": { "count": 3, "totalDuration": 200, "errors": 0 },
|
|
43
|
+
"search": { "count": 25, "totalDuration": 12000, "errors": 0 },
|
|
44
|
+
"init": { "count": 1, "totalDuration": 500, "errors": 0 }
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
Detailed breakdown of each operation type with count, total duration, and error count.
|
|
49
|
+
|
|
50
|
+
### Performance Statistics
|
|
51
|
+
```json
|
|
52
|
+
{
|
|
53
|
+
"performance": {
|
|
54
|
+
"avgOperationDuration": 450.5,
|
|
55
|
+
"minOperationDuration": 10,
|
|
56
|
+
"maxOperationDuration": 5000,
|
|
57
|
+
"slowOperations": 3,
|
|
58
|
+
"fastOperations": 100,
|
|
59
|
+
"totalOperationTime": 45050
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
- `avgOperationDuration`: Average time per operation (ms)
|
|
64
|
+
- `minOperationDuration`: Fastest operation time (ms)
|
|
65
|
+
- `maxOperationDuration`: Slowest operation time (ms)
|
|
66
|
+
- `slowOperations`: Count of operations > 5000ms
|
|
67
|
+
- `fastOperations`: Count of operations < 100ms
|
|
68
|
+
- `totalOperationTime`: Cumulative time for all operations (ms)
|
|
69
|
+
|
|
70
|
+
### Storage Statistics
|
|
71
|
+
```json
|
|
72
|
+
{
|
|
73
|
+
"storage": {
|
|
74
|
+
"totalEntries": 150,
|
|
75
|
+
"reasoningbankEntries": 120,
|
|
76
|
+
"basicEntries": 30,
|
|
77
|
+
"databaseSize": 2048000,
|
|
78
|
+
"lastBackup": 1234567890,
|
|
79
|
+
"growthRate": 12.5
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
- `totalEntries`: Total memory entries across all modes
|
|
84
|
+
- `reasoningbankEntries`: Entries in ReasoningBank database
|
|
85
|
+
- `basicEntries`: Entries in JSON storage
|
|
86
|
+
- `databaseSize`: Database file size in bytes
|
|
87
|
+
- `lastBackup`: Timestamp of last backup
|
|
88
|
+
- `growthRate`: Entries per hour growth rate
|
|
89
|
+
|
|
90
|
+
### Error Tracking
|
|
91
|
+
```json
|
|
92
|
+
{
|
|
93
|
+
"errors": {
|
|
94
|
+
"total": 5,
|
|
95
|
+
"byType": {
|
|
96
|
+
"timeout": 2,
|
|
97
|
+
"connection": 1,
|
|
98
|
+
"validation": 2
|
|
99
|
+
},
|
|
100
|
+
"byOperation": {
|
|
101
|
+
"query": 3,
|
|
102
|
+
"store": 2
|
|
103
|
+
},
|
|
104
|
+
"recent": [
|
|
105
|
+
{
|
|
106
|
+
"operation": "query",
|
|
107
|
+
"type": "timeout",
|
|
108
|
+
"timestamp": 1234567890,
|
|
109
|
+
"mode": "reasoningbank"
|
|
110
|
+
}
|
|
111
|
+
]
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
Comprehensive error tracking by type, operation, and recent error history.
|
|
116
|
+
|
|
117
|
+
### ReasoningBank Specific Metrics
|
|
118
|
+
```json
|
|
119
|
+
{
|
|
120
|
+
"reasoningbank": {
|
|
121
|
+
"semanticSearches": 45,
|
|
122
|
+
"sqlFallbacks": 12,
|
|
123
|
+
"embeddingGenerated": 40,
|
|
124
|
+
"consolidations": 3,
|
|
125
|
+
"avgQueryTime": 450.5,
|
|
126
|
+
"cacheHits": 25,
|
|
127
|
+
"cacheMisses": 20
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
- `semanticSearches`: Number of semantic vector searches
|
|
132
|
+
- `sqlFallbacks`: Number of SQL fallback queries (when semantic returns empty)
|
|
133
|
+
- `embeddingGenerated`: Number of text embeddings created
|
|
134
|
+
- `consolidations`: Number of memory consolidation runs
|
|
135
|
+
- `avgQueryTime`: Average query execution time (ms)
|
|
136
|
+
- `cacheHits`: Successful cache retrievals
|
|
137
|
+
- `cacheMisses`: Cache misses requiring computation
|
|
138
|
+
|
|
139
|
+
## Usage Examples
|
|
140
|
+
|
|
141
|
+
### Tracking Memory Operations
|
|
142
|
+
|
|
143
|
+
```javascript
|
|
144
|
+
import { trackMemoryOperation } from './performance-metrics.js';
|
|
145
|
+
|
|
146
|
+
// Track a successful query
|
|
147
|
+
const startTime = Date.now();
|
|
148
|
+
const result = await queryMemory('search term');
|
|
149
|
+
const duration = Date.now() - startTime;
|
|
150
|
+
|
|
151
|
+
await trackMemoryOperation('query', 'reasoningbank', duration, true);
|
|
152
|
+
|
|
153
|
+
// Track a failed operation with error
|
|
154
|
+
try {
|
|
155
|
+
await storeMemory(data);
|
|
156
|
+
} catch (error) {
|
|
157
|
+
const duration = Date.now() - startTime;
|
|
158
|
+
await trackMemoryOperation('store', 'basic', duration, false, 'validation_error');
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Tracking Mode Selection
|
|
163
|
+
|
|
164
|
+
```javascript
|
|
165
|
+
import { trackModeSelection } from './performance-metrics.js';
|
|
166
|
+
|
|
167
|
+
// AUTO MODE selection
|
|
168
|
+
const mode = await detectMemoryMode();
|
|
169
|
+
await trackModeSelection(mode, true); // true = automatic selection
|
|
170
|
+
|
|
171
|
+
// Manual override
|
|
172
|
+
if (flags.reasoningbank) {
|
|
173
|
+
await trackModeSelection('reasoningbank', false); // false = manual override
|
|
174
|
+
}
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Tracking ReasoningBank Operations
|
|
178
|
+
|
|
179
|
+
```javascript
|
|
180
|
+
import { trackReasoningBankOperation } from './performance-metrics.js';
|
|
181
|
+
|
|
182
|
+
// Track semantic search
|
|
183
|
+
const startTime = Date.now();
|
|
184
|
+
const results = await semanticSearch(query);
|
|
185
|
+
const duration = Date.now() - startTime;
|
|
186
|
+
|
|
187
|
+
if (results.length === 0) {
|
|
188
|
+
// Semantic search returned empty, using SQL fallback
|
|
189
|
+
await trackReasoningBankOperation('sql_fallback', duration);
|
|
190
|
+
} else {
|
|
191
|
+
await trackReasoningBankOperation('semantic_search', duration);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// Track cache hits/misses
|
|
195
|
+
if (cacheHit) {
|
|
196
|
+
await trackReasoningBankOperation('cache_hit', 0);
|
|
197
|
+
} else {
|
|
198
|
+
await trackReasoningBankOperation('cache_miss', duration);
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Getting Performance Summary
|
|
203
|
+
|
|
204
|
+
```javascript
|
|
205
|
+
import { getMemoryPerformanceSummary } from './performance-metrics.js';
|
|
206
|
+
|
|
207
|
+
const summary = await getMemoryPerformanceSummary();
|
|
208
|
+
|
|
209
|
+
console.log('Session:', summary.session);
|
|
210
|
+
console.log('Mode Usage:', summary.mode);
|
|
211
|
+
console.log('Operations:', summary.operations);
|
|
212
|
+
console.log('Performance:', summary.performance);
|
|
213
|
+
console.log('Storage:', summary.storage);
|
|
214
|
+
console.log('ReasoningBank:', summary.reasoningbank);
|
|
215
|
+
console.log('Errors:', summary.errors);
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
The summary includes calculated metrics like:
|
|
219
|
+
- Error rate percentage
|
|
220
|
+
- SQL fallback rate (percentage of semantic searches that fell back to SQL)
|
|
221
|
+
- Cache hit rate (percentage of successful cache retrievals)
|
|
222
|
+
|
|
223
|
+
## Integration Points
|
|
224
|
+
|
|
225
|
+
These tracking functions should be integrated into:
|
|
226
|
+
|
|
227
|
+
1. **Memory Command** (`src/cli/simple-commands/memory.js`)
|
|
228
|
+
- Track all store, retrieve, query, list, delete operations
|
|
229
|
+
- Track mode detection and selection
|
|
230
|
+
|
|
231
|
+
2. **ReasoningBank Adapter** (`src/reasoningbank/reasoningbank-adapter.js`)
|
|
232
|
+
- Track semantic searches
|
|
233
|
+
- Track SQL fallbacks
|
|
234
|
+
- Track embedding generation
|
|
235
|
+
- Track cache hits/misses
|
|
236
|
+
|
|
237
|
+
3. **Session Hooks** (hooks system)
|
|
238
|
+
- Initialize metrics at session start
|
|
239
|
+
- Export metrics at session end
|
|
240
|
+
- Update storage stats periodically
|
|
241
|
+
|
|
242
|
+
## Benefits
|
|
243
|
+
|
|
244
|
+
1. **Visibility**: Understand how AUTO MODE performs in real-world usage
|
|
245
|
+
2. **Performance Tuning**: Identify slow operations and bottlenecks
|
|
246
|
+
3. **Error Analysis**: Track error patterns and frequency
|
|
247
|
+
4. **Mode Optimization**: See which mode performs better for different workloads
|
|
248
|
+
5. **Resource Planning**: Monitor growth rates and storage usage
|
|
249
|
+
6. **Cache Effectiveness**: Measure cache hit rates for optimization
|
|
250
|
+
|
|
251
|
+
## Future Enhancements
|
|
252
|
+
|
|
253
|
+
Potential additions:
|
|
254
|
+
- Query pattern analysis (most common queries)
|
|
255
|
+
- Operation frequency heatmaps
|
|
256
|
+
- Performance degradation alerts
|
|
257
|
+
- Automatic recommendation system
|
|
258
|
+
- Export to time-series database for long-term analysis
|
|
259
|
+
- Real-time dashboards
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
|
|
30
30
|
**Features:**
|
|
31
31
|
- Comprehensive API key pattern matching
|
|
32
|
-
- Anthropic keys: `
|
|
33
|
-
- OpenRouter keys: `
|
|
32
|
+
- Anthropic keys: `$ANTHROPIC_API_KEY`
|
|
33
|
+
- OpenRouter keys: `$OPENROUTER_API_KEY`
|
|
34
34
|
- Google/Gemini keys: `AIza...`
|
|
35
35
|
- Bearer tokens
|
|
36
36
|
- Environment variables
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
|
|
42
42
|
**Test Results:**
|
|
43
43
|
```
|
|
44
|
-
✅ API keys redacted in text (
|
|
44
|
+
✅ API keys redacted in text ($ANTHROPIC_API_KEY)
|
|
45
45
|
✅ Environment variables sanitized
|
|
46
46
|
✅ Objects with sensitive fields protected
|
|
47
47
|
✅ Validation detects unredacted keys
|
|
@@ -96,8 +96,8 @@ grep -E "^[A-Z_]+=" .env | cut -d'=' -f1
|
|
|
96
96
|
npx tsx test-redaction.ts
|
|
97
97
|
|
|
98
98
|
# Results
|
|
99
|
-
✅ Anthropic API Key:
|
|
100
|
-
✅ OpenRouter API Key:
|
|
99
|
+
✅ Anthropic API Key: $ANTHROPIC_API_KEY
|
|
100
|
+
✅ OpenRouter API Key: $OPENROUTER_API_KEY
|
|
101
101
|
✅ Environment Variables: ANTHROPI...[REDACTED]
|
|
102
102
|
✅ Object Redaction: { apiKey: [REDACTED], model: "claude-3-sonnet" }
|
|
103
103
|
✅ Validation: Detects unredacted keys
|
|
@@ -203,8 +203,8 @@ npx agentic-flow agent list
|
|
|
203
203
|
|
|
204
204
|
**Present in `.env`:**
|
|
205
205
|
```
|
|
206
|
-
ANTHROPIC_API_KEY
|
|
207
|
-
OPENROUTER_API_KEY
|
|
206
|
+
ANTHROPIC_API_KEY=***REDACTED***
|
|
207
|
+
OPENROUTER_API_KEY=***REDACTED***
|
|
208
208
|
GOOGLE_GEMINI_API_KEY=AIza...[REDACTED]
|
|
209
209
|
HUGGINGFACE_API_KEY=hf_...[REDACTED]
|
|
210
210
|
PERPLEXITY_API_KEY=pplx...[REDACTED]
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
# ReasoningBank Migration Guide: v1.5.12 → v1.5.13
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Claude-Flow has been updated to use **agentic-flow@1.5.13** with the **Node.js backend** for ReasoningBank, replacing the previous WASM adapter approach.
|
|
6
|
+
|
|
7
|
+
## Key Changes
|
|
8
|
+
|
|
9
|
+
### Backend Migration: WASM → Node.js SQLite
|
|
10
|
+
|
|
11
|
+
**Before (v1.5.12 - WASM)**:
|
|
12
|
+
- Ephemeral in-memory storage (Node.js) or IndexedDB (browser)
|
|
13
|
+
- Direct WASM module imports
|
|
14
|
+
- Ultra-fast but non-persistent
|
|
15
|
+
|
|
16
|
+
**After (v1.5.13 - Node.js)**:
|
|
17
|
+
- **Persistent SQLite database** at `.swarm/memory.db`
|
|
18
|
+
- Full embedding support for semantic search
|
|
19
|
+
- Memory consolidation and trajectory tracking
|
|
20
|
+
- Recommended backend for Node.js environments
|
|
21
|
+
|
|
22
|
+
### API Compatibility
|
|
23
|
+
|
|
24
|
+
✅ **No breaking changes to external API** - All claude-flow memory functions remain the same:
|
|
25
|
+
- `storeMemory(key, value, options)`
|
|
26
|
+
- `queryMemories(searchQuery, options)`
|
|
27
|
+
- `listMemories(options)`
|
|
28
|
+
- `getStatus()`
|
|
29
|
+
- `initializeReasoningBank()`
|
|
30
|
+
|
|
31
|
+
### Internal Implementation Changes
|
|
32
|
+
|
|
33
|
+
**Storage**:
|
|
34
|
+
```javascript
|
|
35
|
+
// Old (WASM)
|
|
36
|
+
pattern = { task_description, task_category, strategy, success_score }
|
|
37
|
+
await wasm.storePattern(pattern)
|
|
38
|
+
|
|
39
|
+
// New (Node.js)
|
|
40
|
+
memory = { type: 'reasoning_memory', pattern_data: { title, content, domain } }
|
|
41
|
+
ReasoningBank.db.upsertMemory(memory)
|
|
42
|
+
await ReasoningBank.computeEmbedding(content) // Generate embeddings
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
**Retrieval**:
|
|
46
|
+
```javascript
|
|
47
|
+
// Old (WASM)
|
|
48
|
+
results = await wasm.findSimilar(query, category, limit)
|
|
49
|
+
|
|
50
|
+
// New (Node.js)
|
|
51
|
+
results = await ReasoningBank.retrieveMemories(query, {
|
|
52
|
+
domain, agent, k: limit, minConfidence
|
|
53
|
+
})
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Database Schema
|
|
57
|
+
|
|
58
|
+
**Location**: `.swarm/memory.db`
|
|
59
|
+
|
|
60
|
+
**Tables**:
|
|
61
|
+
- `patterns` - Reasoning memories with confidence scores
|
|
62
|
+
- `pattern_embeddings` - Vector embeddings for semantic search
|
|
63
|
+
- `pattern_links` - Memory relationships and contradictions
|
|
64
|
+
- `task_trajectories` - Task execution history
|
|
65
|
+
- `matts_runs` - MaTTS algorithm runs
|
|
66
|
+
- `consolidation_runs` - Memory consolidation history
|
|
67
|
+
|
|
68
|
+
## Migration Steps
|
|
69
|
+
|
|
70
|
+
### Automatic Migration
|
|
71
|
+
|
|
72
|
+
When you upgrade to v2.7.0-alpha.7+, ReasoningBank will automatically:
|
|
73
|
+
|
|
74
|
+
1. Initialize Node.js backend on first use
|
|
75
|
+
2. Create SQLite database at `.swarm/memory.db`
|
|
76
|
+
3. Run database migrations (create tables)
|
|
77
|
+
4. Generate embeddings for new memories
|
|
78
|
+
|
|
79
|
+
**No manual migration needed!** Old WASM data was ephemeral and not persisted.
|
|
80
|
+
|
|
81
|
+
### Environment Variables
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
# Optional: Custom database path
|
|
85
|
+
export CLAUDE_FLOW_DB_PATH="/path/to/memory.db"
|
|
86
|
+
|
|
87
|
+
# Optional: Disable ReasoningBank
|
|
88
|
+
export REASONINGBANK_ENABLED=false
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Feature Comparison
|
|
92
|
+
|
|
93
|
+
| Feature | WASM (v1.5.12) | Node.js (v1.5.13) |
|
|
94
|
+
|---------|----------------|-------------------|
|
|
95
|
+
| **Storage** | Ephemeral (in-memory) | Persistent (SQLite) |
|
|
96
|
+
| **Semantic Search** | Basic similarity | Embeddings + MMR ranking |
|
|
97
|
+
| **Domain Filtering** | Category-based | Full JSON query support |
|
|
98
|
+
| **Memory Consolidation** | ❌ Not available | ✅ Built-in |
|
|
99
|
+
| **Trajectory Tracking** | ❌ Not available | ✅ Full history |
|
|
100
|
+
| **Cross-session Memory** | ❌ Lost on restart | ✅ Persistent |
|
|
101
|
+
| **Performance** | 0.04ms/op (WASM) | 1-2ms/op (SQLite + embeddings) |
|
|
102
|
+
| **Database Size** | ~0 MB (memory) | Grows with data (~41MB for 100 patterns) |
|
|
103
|
+
|
|
104
|
+
## Performance
|
|
105
|
+
|
|
106
|
+
**Benchmarks** (100 memories, semantic search):
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
Storage: 1-2ms per memory (includes embedding generation)
|
|
110
|
+
Query: 1-3ms per semantic search query
|
|
111
|
+
Cached: <1ms for cached queries
|
|
112
|
+
List: <1ms for database queries
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
**Memory Usage**:
|
|
116
|
+
- SQLite database: ~400KB per memory (with embedding)
|
|
117
|
+
- RAM: Minimal (SQLite handles paging)
|
|
118
|
+
|
|
119
|
+
## Verification
|
|
120
|
+
|
|
121
|
+
Test your ReasoningBank integration:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
# Run comprehensive test
|
|
125
|
+
node tests/test-semantic-search.mjs
|
|
126
|
+
|
|
127
|
+
# Expected output:
|
|
128
|
+
# ✅ Initialized successfully
|
|
129
|
+
# ✅ Stored 5 test memories
|
|
130
|
+
# ✅ Semantic search returning results
|
|
131
|
+
# ✅ Query caching working
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Troubleshooting
|
|
135
|
+
|
|
136
|
+
### Issue: "Database not found"
|
|
137
|
+
```bash
|
|
138
|
+
# Ensure initialization ran
|
|
139
|
+
npx claude-flow@alpha memory status
|
|
140
|
+
|
|
141
|
+
# Manually initialize if needed
|
|
142
|
+
npx claude-flow@alpha memory init
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Issue: "No results from semantic search"
|
|
146
|
+
```bash
|
|
147
|
+
# Check embeddings are being generated
|
|
148
|
+
# Look for warnings: "[ReasoningBank] Failed to generate embedding"
|
|
149
|
+
|
|
150
|
+
# Verify database has embeddings:
|
|
151
|
+
sqlite3 .swarm/memory.db "SELECT COUNT(*) FROM pattern_embeddings;"
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Issue: "Embeddings not generating"
|
|
155
|
+
```bash
|
|
156
|
+
# Ensure API key is set (if using Claude embeddings)
|
|
157
|
+
export ANTHROPIC_API_KEY="your-key"
|
|
158
|
+
|
|
159
|
+
# Or configure alternative embedding provider in .reasoningbank.json
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## Benefits of Node.js Backend
|
|
163
|
+
|
|
164
|
+
✅ **Persistent Memory** - Survives process restarts
|
|
165
|
+
✅ **Semantic Search** - True embedding-based similarity
|
|
166
|
+
✅ **Memory Consolidation** - Deduplicate and prune old memories
|
|
167
|
+
✅ **Trajectory Tracking** - Full task execution history
|
|
168
|
+
✅ **Production-Ready** - Battle-tested SQLite backend
|
|
169
|
+
|
|
170
|
+
## Rollback (Not Recommended)
|
|
171
|
+
|
|
172
|
+
If you need to temporarily rollback to v1.5.12:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
npm install agentic-flow@1.5.12 --legacy-peer-deps
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
**Note**: This will lose Node.js backend features and return to ephemeral storage.
|
|
179
|
+
|
|
180
|
+
## Support
|
|
181
|
+
|
|
182
|
+
For issues or questions:
|
|
183
|
+
- GitHub Issues: https://github.com/ruvnet/claude-code-flow/issues
|
|
184
|
+
- Documentation: `/docs/integrations/reasoningbank/`
|
|
185
|
+
- Test Suite: `/tests/test-semantic-search.mjs`
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
**Migration completed**: Claude-Flow v2.7.0-alpha.7 with agentic-flow@1.5.13 Node.js backend ✅
|