@memoryrelay/plugin-memoryrelay-ai 0.7.0 → 0.8.1
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/README.md +278 -5
- package/bin/memoryrelay-health.js +46 -0
- package/bin/memoryrelay-logs.js +48 -0
- package/bin/memoryrelay-metrics.js +57 -0
- package/bin/memoryrelay-test.js +46 -0
- package/index.ts +442 -20
- package/openclaw.plugin.json +21 -0
- package/package.json +9 -1
- package/src/debug-logger.test.ts +233 -0
- package/src/debug-logger.ts +187 -0
- package/src/status-reporter.test.ts +230 -0
- package/src/status-reporter.ts +284 -0
package/README.md
CHANGED
|
@@ -8,6 +8,8 @@ AI-powered long-term memory for OpenClaw agents. Gives your AI assistant persist
|
|
|
8
8
|
## Features
|
|
9
9
|
|
|
10
10
|
- **39 Tools** covering memories, entities, sessions, decisions, patterns, and projects
|
|
11
|
+
- **Debug & Monitoring** - Comprehensive logging, health checks, and performance metrics (v0.8.0+)
|
|
12
|
+
- **CLI Commands** - 4 commands for debugging and diagnostics (v0.8.0+)
|
|
11
13
|
- **Semantic Search** - Vector-based retrieval finds relevant context by meaning
|
|
12
14
|
- **Auto-Recall** - Automatically injects relevant memories into agent context
|
|
13
15
|
- **Project-First Workflow** - Agents receive workflow instructions to start with project context
|
|
@@ -64,6 +66,126 @@ openclaw gateway restart
|
|
|
64
66
|
| `recallLimit` | number | `5` | Max memories to inject per turn (1-20) |
|
|
65
67
|
| `recallThreshold` | number | `0.3` | Minimum similarity score for recall (0-1) |
|
|
66
68
|
| `excludeChannels` | string[] | `[]` | Channel IDs to skip auto-recall |
|
|
69
|
+
| `debug` | boolean | `false` | Enable debug logging of API calls (v0.8.0+) |
|
|
70
|
+
| `verbose` | boolean | `false` | Include request/response bodies in debug logs (v0.8.0+) |
|
|
71
|
+
| `logFile` | string | — | Optional file path for persistent debug logs (v0.8.0+) |
|
|
72
|
+
| `maxLogEntries` | number | `100` | Circular buffer size for in-memory logs (v0.8.0+) |
|
|
73
|
+
|
|
74
|
+
## Debug & Monitoring (v0.8.0+)
|
|
75
|
+
|
|
76
|
+
### Enable Debug Mode
|
|
77
|
+
|
|
78
|
+
```json
|
|
79
|
+
{
|
|
80
|
+
"plugins": {
|
|
81
|
+
"entries": {
|
|
82
|
+
"plugin-memoryrelay-ai": {
|
|
83
|
+
"enabled": true,
|
|
84
|
+
"config": {
|
|
85
|
+
"apiKey": "mem_prod_xxxxx",
|
|
86
|
+
"agentId": "your-agent",
|
|
87
|
+
"debug": true,
|
|
88
|
+
"verbose": false,
|
|
89
|
+
"maxLogEntries": 1000
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### CLI Commands
|
|
98
|
+
|
|
99
|
+
The plugin provides four CLI commands for debugging and monitoring:
|
|
100
|
+
|
|
101
|
+
#### View Debug Logs
|
|
102
|
+
```bash
|
|
103
|
+
# Last 20 logs
|
|
104
|
+
memoryrelay-logs
|
|
105
|
+
|
|
106
|
+
# Last 50 logs
|
|
107
|
+
memoryrelay-logs --limit=50
|
|
108
|
+
|
|
109
|
+
# Filter by tool
|
|
110
|
+
memoryrelay-logs --tool=memory_store --limit=20
|
|
111
|
+
|
|
112
|
+
# Show errors only
|
|
113
|
+
memoryrelay-logs --errors-only
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
#### Health Check
|
|
117
|
+
```bash
|
|
118
|
+
# Run comprehensive health check
|
|
119
|
+
memoryrelay-health
|
|
120
|
+
|
|
121
|
+
# Tests API connectivity, authentication, and core tools
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
#### Test Individual Tools
|
|
125
|
+
```bash
|
|
126
|
+
# Test specific tool
|
|
127
|
+
memoryrelay-test --tool=memory_store
|
|
128
|
+
memoryrelay-test --tool=memory_recall
|
|
129
|
+
memoryrelay-test --tool=project_list
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
#### View Performance Metrics
|
|
133
|
+
```bash
|
|
134
|
+
# Show performance statistics
|
|
135
|
+
memoryrelay-metrics
|
|
136
|
+
|
|
137
|
+
# Displays per-tool metrics:
|
|
138
|
+
# - Call count
|
|
139
|
+
# - Success rate
|
|
140
|
+
# - Average duration
|
|
141
|
+
# - p95/p99 latencies
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Gateway Method Calls
|
|
145
|
+
|
|
146
|
+
You can also call these commands via the OpenClaw gateway:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
openclaw gateway call memoryrelay.logs '{"limit": 20}'
|
|
150
|
+
openclaw gateway call memoryrelay.health
|
|
151
|
+
openclaw gateway call memoryrelay.test '{"tool": "memory_store"}'
|
|
152
|
+
openclaw gateway call memoryrelay.metrics
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Enhanced Status Reporting
|
|
156
|
+
|
|
157
|
+
The `memory.status` gateway method now provides comprehensive reports including:
|
|
158
|
+
|
|
159
|
+
- Connection status with response time
|
|
160
|
+
- Tool breakdown by category (39 tools across 8 groups)
|
|
161
|
+
- Recent API call history
|
|
162
|
+
- Known issues with affected tools
|
|
163
|
+
- Debug/verbose mode status
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
openclaw gateway call memory.status
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Debug Log Format
|
|
170
|
+
|
|
171
|
+
When debug mode is enabled, each API call is logged with:
|
|
172
|
+
|
|
173
|
+
```
|
|
174
|
+
TIMESTAMP TOOL DURATION STATUS ERROR
|
|
175
|
+
━━━━━━━━━━━━━━━━━ ━━━━━━━━━━━━━━━━━━━━━ ━━━━━━━━ ━━━━━━ ━━━━━━━━━━━━━━━━━━━
|
|
176
|
+
7:35:15 PM memory_store 142ms ✓
|
|
177
|
+
7:35:10 PM memory_recall 78ms ✓
|
|
178
|
+
7:35:05 PM memory_batch_store 245ms ✗ 500 Internal Server Error
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Verbose mode additionally captures request/response bodies for deep troubleshooting.
|
|
182
|
+
|
|
183
|
+
### Performance Impact
|
|
184
|
+
|
|
185
|
+
- **Debug disabled**: ~0ms overhead (no-op checks)
|
|
186
|
+
- **Debug enabled**: ~1-2ms per call (logging only)
|
|
187
|
+
- **Verbose enabled**: ~2-5ms per call (includes JSON serialization)
|
|
188
|
+
- **Memory usage**: ~10KB (default 100 entries) to ~100KB (1000 entries)
|
|
67
189
|
|
|
68
190
|
## Agent Workflow
|
|
69
191
|
|
|
@@ -225,21 +347,172 @@ openclaw memoryrelay export # Export all memories to JSON
|
|
|
225
347
|
|
|
226
348
|
### Plugin Not Loading
|
|
227
349
|
|
|
350
|
+
**Symptoms**: Plugin doesn't appear in `openclaw plugins list` or shows as "unavailable"
|
|
351
|
+
|
|
352
|
+
**Solutions**:
|
|
228
353
|
```bash
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
354
|
+
# Check if installed
|
|
355
|
+
npm list -g @memoryrelay/plugin-memoryrelay-ai
|
|
356
|
+
|
|
357
|
+
# Reinstall if needed
|
|
358
|
+
openclaw plugins install @memoryrelay/plugin-memoryrelay-ai --force
|
|
359
|
+
|
|
360
|
+
# Check config syntax
|
|
361
|
+
cat ~/.openclaw/openclaw.json | jq '.plugins.entries."plugin-memoryrelay-ai"'
|
|
362
|
+
|
|
363
|
+
# Restart gateway
|
|
364
|
+
openclaw gateway restart
|
|
365
|
+
|
|
366
|
+
# Check logs for errors
|
|
367
|
+
openclaw gateway logs | grep memoryrelay
|
|
232
368
|
```
|
|
233
369
|
|
|
234
370
|
### API Connection Issues
|
|
235
371
|
|
|
372
|
+
**Symptoms**: "Failed to connect" errors, timeouts, or "unhealthy" status
|
|
373
|
+
|
|
374
|
+
**Solutions**:
|
|
375
|
+
```bash
|
|
376
|
+
# Test API directly
|
|
377
|
+
curl -H "X-API-Key: YOUR_KEY" https://api.memoryrelay.net/v1/health
|
|
378
|
+
|
|
379
|
+
# Check gateway logs
|
|
380
|
+
openclaw gateway logs -f | grep memory-memoryrelay
|
|
381
|
+
|
|
382
|
+
# Verify API key format (should be mem_prod_xxxxx with 32 chars after prefix)
|
|
383
|
+
openclaw config get plugins.entries.plugin-memoryrelay-ai.config.apiKey
|
|
384
|
+
|
|
385
|
+
# Run health check
|
|
386
|
+
memoryrelay-health
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
### Auto-Recall Not Working
|
|
390
|
+
|
|
391
|
+
**Symptoms**: Memories not appearing in agent context
|
|
392
|
+
|
|
393
|
+
**Checks**:
|
|
394
|
+
1. Verify `autoRecall: true` in config
|
|
395
|
+
2. Check memories exist: `openclaw gateway call memory_list '{"limit": 10}'`
|
|
396
|
+
3. Lower `recallThreshold` (try 0.1) for more results
|
|
397
|
+
4. Review logs: `openclaw gateway logs | grep "injecting.*memories"`
|
|
398
|
+
5. Check channel not in `excludeChannels`
|
|
399
|
+
|
|
400
|
+
### Debug Mode Not Working
|
|
401
|
+
|
|
402
|
+
**Symptoms**: `memoryrelay-logs` shows "No logs" or debug commands fail
|
|
403
|
+
|
|
404
|
+
**Solutions**:
|
|
405
|
+
1. Verify `debug: true` in config
|
|
406
|
+
2. Restart gateway after config change: `openclaw gateway restart`
|
|
407
|
+
3. Use the plugin to generate logs
|
|
408
|
+
4. Check `maxLogEntries` isn't set too low (default: 100)
|
|
409
|
+
|
|
410
|
+
### Tool Not Found Errors
|
|
411
|
+
|
|
412
|
+
**Symptoms**: "Tool xxx not found" or "Tool not enabled"
|
|
413
|
+
|
|
414
|
+
**Solutions**:
|
|
415
|
+
1. Check `enabledTools` config (should be `"all"` or include the tool's group)
|
|
416
|
+
2. Verify tool name spelling matches exactly (e.g., `memory_store` not `memoryStore`)
|
|
417
|
+
3. Check plugin version: `npm list -g @memoryrelay/plugin-memoryrelay-ai`
|
|
418
|
+
4. Update to latest: `openclaw plugins install @memoryrelay/plugin-memoryrelay-ai@latest`
|
|
419
|
+
|
|
420
|
+
### Performance Issues
|
|
421
|
+
|
|
422
|
+
**Symptoms**: Slow API calls, timeouts, high latency
|
|
423
|
+
|
|
424
|
+
**Diagnosis**:
|
|
425
|
+
```bash
|
|
426
|
+
# Enable debug mode
|
|
427
|
+
openclaw config set plugins.entries.plugin-memoryrelay-ai.config.debug true
|
|
428
|
+
openclaw gateway restart
|
|
429
|
+
|
|
430
|
+
# View metrics
|
|
431
|
+
memoryrelay-metrics
|
|
432
|
+
|
|
433
|
+
# Check for slow tools (high avgDuration or p99)
|
|
434
|
+
# Check for failures (low successRate)
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
**Solutions**:
|
|
438
|
+
1. Check network latency to api.memoryrelay.net
|
|
439
|
+
2. Reduce `recallLimit` (fewer memories = faster)
|
|
440
|
+
3. Lower `recallThreshold` (fewer vector comparisons)
|
|
441
|
+
4. Check MemoryRelay API status at status.memoryrelay.ai
|
|
442
|
+
|
|
443
|
+
### Memory Storage Failures
|
|
444
|
+
|
|
445
|
+
**Symptoms**: `memory_store` returns 422 validation errors or 500 errors
|
|
446
|
+
|
|
447
|
+
**Common Causes**:
|
|
448
|
+
1. Content too long (max 50,000 characters)
|
|
449
|
+
2. Metadata too large (max 10KB when serialized)
|
|
450
|
+
3. Invalid project slug (use `project_list` to verify)
|
|
451
|
+
4. API rate limits exceeded (30 req/min for memory_store)
|
|
452
|
+
|
|
453
|
+
**Solutions**:
|
|
236
454
|
```bash
|
|
237
|
-
|
|
238
|
-
|
|
455
|
+
# Test with minimal memory
|
|
456
|
+
openclaw gateway call memory_store '{"content": "Test memory"}'
|
|
457
|
+
|
|
458
|
+
# Check recent errors
|
|
459
|
+
memoryrelay-logs --errors-only --limit=10
|
|
460
|
+
|
|
461
|
+
# Verify API key has write permissions
|
|
462
|
+
curl -X POST https://api.memoryrelay.net/v1/memories \
|
|
463
|
+
-H "X-API-Key: YOUR_KEY" \
|
|
464
|
+
-H "Content-Type: application/json" \
|
|
465
|
+
-d '{"content": "Test"}'
|
|
239
466
|
```
|
|
240
467
|
|
|
468
|
+
### Session Tracking Issues
|
|
469
|
+
|
|
470
|
+
**Symptoms**: `session_start` fails or `session_end` can't find session
|
|
471
|
+
|
|
472
|
+
**Solutions**:
|
|
473
|
+
1. Save session ID from `session_start` response
|
|
474
|
+
2. Verify project exists: `openclaw gateway call project_list`
|
|
475
|
+
3. Check for API validation errors in logs
|
|
476
|
+
4. Use `session_list` to find active sessions
|
|
477
|
+
|
|
478
|
+
### Known Limitations
|
|
479
|
+
|
|
480
|
+
**API Issues** (reported to MemoryRelay team):
|
|
481
|
+
- `memory_batch_store`: May return 500 errors (use individual `memory_store` as workaround)
|
|
482
|
+
- `memory_context`: Returns 405 Method Not Allowed (use `memory_recall` instead)
|
|
483
|
+
- `entity_create`: May fail with 422 validation errors
|
|
484
|
+
- `decision_record`: May fail with 422 validation errors
|
|
485
|
+
- `session_start`: May fail with 422 validation errors
|
|
486
|
+
|
|
487
|
+
**Workarounds**:
|
|
488
|
+
- Use alternative tools where available
|
|
489
|
+
- Check GitHub Issues for latest status
|
|
490
|
+
- Enable debug mode to capture full error details
|
|
491
|
+
|
|
241
492
|
## Changelog
|
|
242
493
|
|
|
494
|
+
### v0.8.0 (2026-03-05)
|
|
495
|
+
|
|
496
|
+
**🚀 Debug & Monitoring Release**
|
|
497
|
+
|
|
498
|
+
- **NEW**: Debug logging system with circular buffer (configurable maxLogEntries)
|
|
499
|
+
- **NEW**: DebugLogger class tracks all API calls with timing, status, errors
|
|
500
|
+
- **NEW**: StatusReporter class provides enhanced status reports
|
|
501
|
+
- **NEW**: 4 CLI commands: `memoryrelay-logs`, `memoryrelay-health`, `memoryrelay-test`, `memoryrelay-metrics`
|
|
502
|
+
- **NEW**: 4 gateway methods: `memoryrelay.logs`, `memoryrelay.health`, `memoryrelay.test`, `memoryrelay.metrics`
|
|
503
|
+
- **NEW**: Performance metrics with p95/p99 latency tracking
|
|
504
|
+
- **NEW**: Enhanced `memory.status` handler with comprehensive reports
|
|
505
|
+
- **NEW**: Debug config options: `debug`, `verbose`, `logFile`, `maxLogEntries`
|
|
506
|
+
- **NEW**: Tool failure tracking and recovery monitoring
|
|
507
|
+
- **NEW**: Request/response capture in verbose mode
|
|
508
|
+
- **NEW**: Persistent file logging option
|
|
509
|
+
- **TESTS**: 92 tests total (73 existing + 19 new for DebugLogger and StatusReporter)
|
|
510
|
+
- **DOCS**: CLI_COMMANDS.md with complete usage guide
|
|
511
|
+
- **DOCS**: Enhanced README with Debug & Monitoring section
|
|
512
|
+
- **DOCS**: Comprehensive troubleshooting guide
|
|
513
|
+
|
|
514
|
+
**Performance**: Minimal overhead when disabled (~0ms), 1-2ms when enabled, 2-5ms in verbose mode
|
|
515
|
+
|
|
243
516
|
### v0.7.0 (2026-03-05)
|
|
244
517
|
|
|
245
518
|
- **NEW**: 39 tools (up from 3) covering full MemoryRelay API surface
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* MemoryRelay CLI - Health Command
|
|
4
|
+
*
|
|
5
|
+
* Run comprehensive health check on MemoryRelay plugin
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* memoryrelay-health [--detailed]
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const detailed = process.argv.includes('--detailed');
|
|
12
|
+
|
|
13
|
+
console.log('MemoryRelay Health Check');
|
|
14
|
+
console.log('═'.repeat(50));
|
|
15
|
+
console.log();
|
|
16
|
+
console.log('Running comprehensive health check...');
|
|
17
|
+
console.log();
|
|
18
|
+
|
|
19
|
+
// Show instructions
|
|
20
|
+
console.log('To run health check:');
|
|
21
|
+
console.log(' openclaw gateway call memoryrelay.health');
|
|
22
|
+
console.log();
|
|
23
|
+
console.log('This will test:');
|
|
24
|
+
console.log(' ✓ API endpoint reachability');
|
|
25
|
+
console.log(' ✓ Authentication (API key validation)');
|
|
26
|
+
console.log(' ✓ Core tools (memory_store, memory_recall, memory_list)');
|
|
27
|
+
console.log(' ✓ Response times');
|
|
28
|
+
console.log();
|
|
29
|
+
console.log('Example output:');
|
|
30
|
+
console.log(JSON.stringify({
|
|
31
|
+
"api": {
|
|
32
|
+
"status": "healthy",
|
|
33
|
+
"endpoint": "https://api.memoryrelay.net",
|
|
34
|
+
"responseTime": 45,
|
|
35
|
+
"reachable": true
|
|
36
|
+
},
|
|
37
|
+
"authentication": {
|
|
38
|
+
"status": "valid"
|
|
39
|
+
},
|
|
40
|
+
"tools": {
|
|
41
|
+
"memory_store": { "status": "working", "duration": 142 },
|
|
42
|
+
"memory_recall": { "status": "working", "duration": 78 },
|
|
43
|
+
"memory_list": { "status": "working", "duration": 92 }
|
|
44
|
+
},
|
|
45
|
+
"overall": "healthy"
|
|
46
|
+
}, null, 2));
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* MemoryRelay CLI - Logs Command
|
|
4
|
+
*
|
|
5
|
+
* View debug logs from the MemoryRelay plugin
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* memoryrelay-logs [--limit N] [--tool NAME] [--errors-only]
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const args = process.argv.slice(2);
|
|
12
|
+
const limit = parseInt(args.find(a => a.startsWith('--limit='))?.split('=')[1] || '20');
|
|
13
|
+
const tool = args.find(a => a.startsWith('--tool='))?.split('=')[1];
|
|
14
|
+
const errorsOnly = args.includes('--errors-only');
|
|
15
|
+
|
|
16
|
+
console.log('MemoryRelay Debug Logs');
|
|
17
|
+
console.log('═'.repeat(50));
|
|
18
|
+
console.log();
|
|
19
|
+
|
|
20
|
+
if (tool) {
|
|
21
|
+
console.log(`Tool: ${tool}`);
|
|
22
|
+
}
|
|
23
|
+
if (errorsOnly) {
|
|
24
|
+
console.log('Filter: Errors only');
|
|
25
|
+
}
|
|
26
|
+
console.log(`Limit: ${limit}`);
|
|
27
|
+
console.log();
|
|
28
|
+
|
|
29
|
+
// In a real implementation, this would call the gateway method
|
|
30
|
+
// For now, show usage instructions
|
|
31
|
+
console.log('To use this command:');
|
|
32
|
+
console.log('1. Ensure debug mode is enabled in plugin config');
|
|
33
|
+
console.log('2. Run: openclaw gateway call memoryrelay.logs');
|
|
34
|
+
console.log();
|
|
35
|
+
console.log('Example config:');
|
|
36
|
+
console.log(JSON.stringify({
|
|
37
|
+
"plugins": {
|
|
38
|
+
"entries": {
|
|
39
|
+
"plugin-memoryrelay-ai": {
|
|
40
|
+
"config": {
|
|
41
|
+
"debug": true,
|
|
42
|
+
"verbose": false,
|
|
43
|
+
"maxLogEntries": 100
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}, null, 2));
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* MemoryRelay CLI - Metrics Command
|
|
4
|
+
*
|
|
5
|
+
* View performance metrics for MemoryRelay plugin
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* memoryrelay-metrics
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
console.log('MemoryRelay Performance Metrics');
|
|
12
|
+
console.log('═'.repeat(50));
|
|
13
|
+
console.log();
|
|
14
|
+
console.log('Collecting performance metrics...');
|
|
15
|
+
console.log();
|
|
16
|
+
|
|
17
|
+
console.log('To view metrics:');
|
|
18
|
+
console.log(' openclaw gateway call memoryrelay.metrics');
|
|
19
|
+
console.log();
|
|
20
|
+
console.log('Requirements:');
|
|
21
|
+
console.log(' • Debug mode must be enabled in plugin config');
|
|
22
|
+
console.log(' • Plugin must have processed API calls');
|
|
23
|
+
console.log();
|
|
24
|
+
console.log('Example output:');
|
|
25
|
+
console.log();
|
|
26
|
+
console.log('API CALLS');
|
|
27
|
+
console.log(' Total: 1,247');
|
|
28
|
+
console.log(' Successful: 1,198 (96.1%)');
|
|
29
|
+
console.log(' Failed: 49 (3.9%)');
|
|
30
|
+
console.log(' Avg Time: 132ms');
|
|
31
|
+
console.log();
|
|
32
|
+
console.log('TOP TOOLS (by call count)');
|
|
33
|
+
console.log(' memory_store: 456 calls, 98.2% success, 139ms avg');
|
|
34
|
+
console.log(' memory_recall: 387 calls, 100% success, 78ms avg');
|
|
35
|
+
console.log(' project_context: 142 calls, 100% success, 156ms avg');
|
|
36
|
+
console.log();
|
|
37
|
+
console.log('Full metrics structure:');
|
|
38
|
+
console.log(JSON.stringify({
|
|
39
|
+
"summary": {
|
|
40
|
+
"total": 1247,
|
|
41
|
+
"successful": 1198,
|
|
42
|
+
"failed": 49,
|
|
43
|
+
"successRate": 96.1,
|
|
44
|
+
"avgDuration": 132
|
|
45
|
+
},
|
|
46
|
+
"toolMetrics": {
|
|
47
|
+
"memory_store": {
|
|
48
|
+
"calls": 456,
|
|
49
|
+
"successes": 448,
|
|
50
|
+
"failures": 8,
|
|
51
|
+
"avgDuration": 139,
|
|
52
|
+
"successRate": 98,
|
|
53
|
+
"p95Duration": 289,
|
|
54
|
+
"p99Duration": 456
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}, null, 2));
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* MemoryRelay CLI - Test Command
|
|
4
|
+
*
|
|
5
|
+
* Test individual MemoryRelay tools
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* memoryrelay-test [--tool NAME]
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const args = process.argv.slice(2);
|
|
12
|
+
const tool = args.find(a => a.startsWith('--tool='))?.split('=')[1];
|
|
13
|
+
|
|
14
|
+
console.log('MemoryRelay Tool Test');
|
|
15
|
+
console.log('═'.repeat(50));
|
|
16
|
+
console.log();
|
|
17
|
+
|
|
18
|
+
if (!tool) {
|
|
19
|
+
console.log('Usage: memoryrelay-test --tool=NAME');
|
|
20
|
+
console.log();
|
|
21
|
+
console.log('Available tools to test:');
|
|
22
|
+
console.log(' • memory_store - Store and delete a test memory');
|
|
23
|
+
console.log(' • memory_recall - Search for memories');
|
|
24
|
+
console.log(' • memory_list - List recent memories');
|
|
25
|
+
console.log(' • project_list - List projects');
|
|
26
|
+
console.log(' • memory_health - Check API health');
|
|
27
|
+
console.log();
|
|
28
|
+
console.log('Example:');
|
|
29
|
+
console.log(' memoryrelay-test --tool=memory_store');
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
console.log(`Testing tool: ${tool}`);
|
|
34
|
+
console.log();
|
|
35
|
+
console.log('To run test:');
|
|
36
|
+
console.log(` openclaw gateway call memoryrelay.test '{"tool": "${tool}"}'`);
|
|
37
|
+
console.log();
|
|
38
|
+
console.log('Example output:');
|
|
39
|
+
console.log(JSON.stringify({
|
|
40
|
+
"tool": tool,
|
|
41
|
+
"duration": 142,
|
|
42
|
+
"result": {
|
|
43
|
+
"success": true,
|
|
44
|
+
"message": "Test completed successfully"
|
|
45
|
+
}
|
|
46
|
+
}, null, 2));
|