agentic-flow 1.7.3 → 1.7.5
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/test-neural.md +0 -5
- package/.claude/answer.md +1 -0
- package/.claude/settings.json +19 -20
- package/CHANGELOG.md +0 -117
- package/README.md +17 -81
- package/dist/agentdb/benchmarks/comprehensive-benchmark.js +664 -0
- package/dist/agentdb/benchmarks/frontier-benchmark.js +419 -0
- package/dist/agentdb/benchmarks/reflexion-benchmark.js +370 -0
- package/dist/agentdb/cli/agentdb-cli.js +717 -0
- package/dist/agentdb/controllers/CausalMemoryGraph.js +322 -0
- package/dist/agentdb/controllers/CausalRecall.js +281 -0
- package/dist/agentdb/controllers/EmbeddingService.js +118 -0
- package/dist/agentdb/controllers/ExplainableRecall.js +387 -0
- package/dist/agentdb/controllers/NightlyLearner.js +382 -0
- package/dist/agentdb/controllers/ReflexionMemory.js +239 -0
- package/dist/agentdb/controllers/SkillLibrary.js +276 -0
- package/dist/agentdb/controllers/frontier-index.js +9 -0
- package/dist/agentdb/controllers/index.js +8 -0
- package/dist/agentdb/index.js +32 -0
- package/dist/agentdb/optimizations/BatchOperations.js +198 -0
- package/dist/agentdb/optimizations/QueryOptimizer.js +225 -0
- package/dist/agentdb/optimizations/index.js +7 -0
- package/dist/agentdb/tests/frontier-features.test.js +665 -0
- package/dist/cli-proxy.js +2 -33
- package/dist/index.js +2 -0
- package/dist/mcp/standalone-stdio.js +200 -4
- package/dist/memory/SharedMemoryPool.js +211 -0
- package/dist/memory/index.js +6 -0
- package/dist/reasoningbank/AdvancedMemory.js +239 -0
- package/dist/reasoningbank/HybridBackend.js +305 -0
- package/dist/reasoningbank/index-new.js +87 -0
- package/dist/reasoningbank/index.js +25 -44
- package/dist/utils/agentdb-runtime-patch.js +170 -0
- package/dist/utils/cli.js +0 -22
- package/docs/AGENTDB_TESTING.md +411 -0
- package/docs/v1.7.1-QUICK-START.md +399 -0
- package/package.json +4 -4
- package/scripts/run-validation.sh +165 -0
- package/scripts/test-agentdb.sh +153 -0
- package/.claude/skills/agentdb-memory-patterns/SKILL.md +0 -166
- package/.claude/skills/agentdb-vector-search/SKILL.md +0 -126
- package/.claude/skills/agentic-flow/agentdb-memory-patterns/SKILL.md +0 -166
- package/.claude/skills/agentic-flow/agentdb-vector-search/SKILL.md +0 -126
- package/.claude/skills/agentic-flow/reasoningbank-intelligence/SKILL.md +0 -201
- package/.claude/skills/agentic-flow/swarm-orchestration/SKILL.md +0 -179
- package/.claude/skills/reasoningbank-intelligence/SKILL.md +0 -201
- package/.claude/skills/skill-builder/README.md +0 -308
- package/.claude/skills/skill-builder/SKILL.md +0 -910
- package/.claude/skills/skill-builder/docs/SPECIFICATION.md +0 -358
- package/.claude/skills/skill-builder/resources/schemas/skill-frontmatter.schema.json +0 -41
- package/.claude/skills/skill-builder/resources/templates/full-skill.template +0 -118
- package/.claude/skills/skill-builder/resources/templates/minimal-skill.template +0 -38
- package/.claude/skills/skill-builder/scripts/generate-skill.sh +0 -334
- package/.claude/skills/skill-builder/scripts/validate-skill.sh +0 -198
- package/.claude/skills/swarm-orchestration/SKILL.md +0 -179
- package/docs/AGENTDB_INTEGRATION.md +0 -379
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
# AgentDB CLI - Local Testing Guide
|
|
2
|
+
|
|
3
|
+
## Quick Start
|
|
4
|
+
|
|
5
|
+
### Option 1: Run the Full Test Suite (Recommended)
|
|
6
|
+
```bash
|
|
7
|
+
# From the project root: /workspaces/agentic-flow/agentic-flow
|
|
8
|
+
./scripts/test-agentdb.sh
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
This will run 13 comprehensive tests covering all CLI features!
|
|
12
|
+
|
|
13
|
+
### Option 2: Manual Testing
|
|
14
|
+
|
|
15
|
+
#### 1. Ensure you're in the correct directory
|
|
16
|
+
```bash
|
|
17
|
+
cd /workspaces/agentic-flow/agentic-flow
|
|
18
|
+
pwd # Should show: /workspaces/agentic-flow/agentic-flow
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
#### 2. Build the Project (if not already built)
|
|
22
|
+
```bash
|
|
23
|
+
npm run build
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
#### 3. Test the CLI Directly
|
|
27
|
+
```bash
|
|
28
|
+
# Show help (all 17 commands)
|
|
29
|
+
node dist/agentdb/cli/agentdb-cli.js --help
|
|
30
|
+
|
|
31
|
+
# Or use npx (if globally installed)
|
|
32
|
+
npx agentdb --help
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### 3. Create a Test Database
|
|
36
|
+
```bash
|
|
37
|
+
# Set database path
|
|
38
|
+
export AGENTDB_PATH=./test-agentdb.db
|
|
39
|
+
|
|
40
|
+
# Or specify inline for each command
|
|
41
|
+
AGENTDB_PATH=./test-agentdb.db node dist/agentdb/cli/agentdb-cli.js db stats
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Test Each Command Category
|
|
45
|
+
|
|
46
|
+
### 🧠 Reflexion Memory (Episodic Replay)
|
|
47
|
+
```bash
|
|
48
|
+
# Store an episode with self-critique
|
|
49
|
+
node dist/agentdb/cli/agentdb-cli.js reflexion store \
|
|
50
|
+
"session-1" \
|
|
51
|
+
"implement_authentication" \
|
|
52
|
+
0.95 \
|
|
53
|
+
true \
|
|
54
|
+
"Successfully used OAuth2 with JWT tokens" \
|
|
55
|
+
"User login requirement" \
|
|
56
|
+
"Working auth system" \
|
|
57
|
+
1200 \
|
|
58
|
+
5000
|
|
59
|
+
|
|
60
|
+
# Store a failed episode
|
|
61
|
+
node dist/agentdb/cli/agentdb-cli.js reflexion store \
|
|
62
|
+
"session-1" \
|
|
63
|
+
"implement_authentication" \
|
|
64
|
+
0.3 \
|
|
65
|
+
false \
|
|
66
|
+
"Forgot to validate tokens properly" \
|
|
67
|
+
"User login requirement" \
|
|
68
|
+
"Insecure auth" \
|
|
69
|
+
800 \
|
|
70
|
+
3000
|
|
71
|
+
|
|
72
|
+
# Retrieve relevant episodes
|
|
73
|
+
node dist/agentdb/cli/agentdb-cli.js reflexion retrieve \
|
|
74
|
+
"authentication" \
|
|
75
|
+
5 \
|
|
76
|
+
0.5
|
|
77
|
+
|
|
78
|
+
# Get critique summary from failures
|
|
79
|
+
node dist/agentdb/cli/agentdb-cli.js reflexion critique-summary \
|
|
80
|
+
"authentication" \
|
|
81
|
+
true
|
|
82
|
+
|
|
83
|
+
# Prune old episodes
|
|
84
|
+
node dist/agentdb/cli/agentdb-cli.js reflexion prune 30 0.2
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### 🛠️ Skill Library (Lifelong Learning)
|
|
88
|
+
```bash
|
|
89
|
+
# Create a skill manually
|
|
90
|
+
node dist/agentdb/cli/agentdb-cli.js skill create \
|
|
91
|
+
"jwt_authentication" \
|
|
92
|
+
"Generate and validate JWT tokens for user authentication" \
|
|
93
|
+
"function generateJWT(payload) { return jwt.sign(payload, secret); }"
|
|
94
|
+
|
|
95
|
+
# Search for skills
|
|
96
|
+
node dist/agentdb/cli/agentdb-cli.js skill search \
|
|
97
|
+
"authentication tokens" \
|
|
98
|
+
5
|
|
99
|
+
|
|
100
|
+
# Auto-consolidate episodes into skills
|
|
101
|
+
node dist/agentdb/cli/agentdb-cli.js skill consolidate \
|
|
102
|
+
3 \
|
|
103
|
+
0.7 \
|
|
104
|
+
7
|
|
105
|
+
|
|
106
|
+
# Prune underperforming skills
|
|
107
|
+
node dist/agentdb/cli/agentdb-cli.js skill prune \
|
|
108
|
+
3 \
|
|
109
|
+
0.4 \
|
|
110
|
+
60
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### 🔗 Causal Memory Graph (Intervention-Based)
|
|
114
|
+
```bash
|
|
115
|
+
# Add a causal edge manually
|
|
116
|
+
node dist/agentdb/cli/agentdb-cli.js causal add-edge \
|
|
117
|
+
"add_unit_tests" \
|
|
118
|
+
"code_quality_score" \
|
|
119
|
+
0.25 \
|
|
120
|
+
0.95 \
|
|
121
|
+
100
|
|
122
|
+
|
|
123
|
+
# Create an A/B experiment
|
|
124
|
+
node dist/agentdb/cli/agentdb-cli.js causal experiment create \
|
|
125
|
+
"test-coverage-vs-bugs" \
|
|
126
|
+
"test_coverage" \
|
|
127
|
+
"bug_rate"
|
|
128
|
+
|
|
129
|
+
# Add observations (treatment group)
|
|
130
|
+
node dist/agentdb/cli/agentdb-cli.js causal experiment add-observation \
|
|
131
|
+
1 \
|
|
132
|
+
true \
|
|
133
|
+
0.15 \
|
|
134
|
+
'{"coverage": 0.85}'
|
|
135
|
+
|
|
136
|
+
# Add observations (control group)
|
|
137
|
+
node dist/agentdb/cli/agentdb-cli.js causal experiment add-observation \
|
|
138
|
+
1 \
|
|
139
|
+
false \
|
|
140
|
+
0.35 \
|
|
141
|
+
'{"coverage": 0.45}'
|
|
142
|
+
|
|
143
|
+
# Calculate uplift
|
|
144
|
+
node dist/agentdb/cli/agentdb-cli.js causal experiment calculate 1
|
|
145
|
+
|
|
146
|
+
# Query causal edges
|
|
147
|
+
node dist/agentdb/cli/agentdb-cli.js causal query \
|
|
148
|
+
"test" \
|
|
149
|
+
"quality" \
|
|
150
|
+
0.6 \
|
|
151
|
+
0.1 \
|
|
152
|
+
10
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### 🔍 Causal Recall (Utility-Based Reranking)
|
|
156
|
+
```bash
|
|
157
|
+
# Retrieve with causal utility and provenance certificate
|
|
158
|
+
node dist/agentdb/cli/agentdb-cli.js recall with-certificate \
|
|
159
|
+
"implement secure authentication" \
|
|
160
|
+
10 \
|
|
161
|
+
0.7 \
|
|
162
|
+
0.2 \
|
|
163
|
+
0.1
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### 🌙 Nightly Learner (Automated Discovery)
|
|
167
|
+
```bash
|
|
168
|
+
# Discover causal edges from patterns (dry run)
|
|
169
|
+
node dist/agentdb/cli/agentdb-cli.js learner run \
|
|
170
|
+
3 \
|
|
171
|
+
0.6 \
|
|
172
|
+
0.7 \
|
|
173
|
+
true
|
|
174
|
+
|
|
175
|
+
# Discover and save edges
|
|
176
|
+
node dist/agentdb/cli/agentdb-cli.js learner run \
|
|
177
|
+
3 \
|
|
178
|
+
0.6 \
|
|
179
|
+
0.7 \
|
|
180
|
+
false
|
|
181
|
+
|
|
182
|
+
# Prune low-quality edges
|
|
183
|
+
node dist/agentdb/cli/agentdb-cli.js learner prune \
|
|
184
|
+
0.5 \
|
|
185
|
+
0.05 \
|
|
186
|
+
90
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### 📊 Database Stats
|
|
190
|
+
```bash
|
|
191
|
+
# Get comprehensive database statistics
|
|
192
|
+
node dist/agentdb/cli/agentdb-cli.js db stats
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## Full Workflow Example
|
|
196
|
+
|
|
197
|
+
### Scenario: Learning from Authentication Implementation
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
#!/bin/bash
|
|
201
|
+
|
|
202
|
+
# Set up test database
|
|
203
|
+
export AGENTDB_PATH=./auth-learning.db
|
|
204
|
+
|
|
205
|
+
# 1. Store successful attempts
|
|
206
|
+
node dist/agentdb/cli/agentdb-cli.js reflexion store \
|
|
207
|
+
"session-auth-1" "oauth2_implementation" 0.95 true \
|
|
208
|
+
"Used industry-standard OAuth2 flow" \
|
|
209
|
+
"Implement secure login" "Working OAuth2 system" 1500 6000
|
|
210
|
+
|
|
211
|
+
node dist/agentdb/cli/agentdb-cli.js reflexion store \
|
|
212
|
+
"session-auth-2" "jwt_tokens" 0.90 true \
|
|
213
|
+
"JWT with proper expiration and refresh tokens" \
|
|
214
|
+
"Token management" "Secure JWT system" 1200 5500
|
|
215
|
+
|
|
216
|
+
# 2. Store failed attempts
|
|
217
|
+
node dist/agentdb/cli/agentdb-cli.js reflexion store \
|
|
218
|
+
"session-auth-3" "session_storage" 0.35 false \
|
|
219
|
+
"Insecure session storage in localStorage" \
|
|
220
|
+
"Session management" "Security vulnerability" 800 3000
|
|
221
|
+
|
|
222
|
+
# 3. Create a skill from successful pattern
|
|
223
|
+
node dist/agentdb/cli/agentdb-cli.js skill create \
|
|
224
|
+
"secure_oauth2_jwt" \
|
|
225
|
+
"OAuth2 flow with JWT token management" \
|
|
226
|
+
"const auth = { oauth2: true, jwt: true, refresh: true }"
|
|
227
|
+
|
|
228
|
+
# 4. Add causal edge
|
|
229
|
+
node dist/agentdb/cli/agentdb-cli.js causal add-edge \
|
|
230
|
+
"add_token_refresh" "session_security" 0.40 0.92 50
|
|
231
|
+
|
|
232
|
+
# 5. Query for authentication guidance
|
|
233
|
+
node dist/agentdb/cli/agentdb-cli.js reflexion retrieve \
|
|
234
|
+
"secure authentication" 5 0.8
|
|
235
|
+
|
|
236
|
+
# 6. Get critique summary of what NOT to do
|
|
237
|
+
node dist/agentdb/cli/agentdb-cli.js reflexion critique-summary \
|
|
238
|
+
"authentication" true
|
|
239
|
+
|
|
240
|
+
# 7. Search for applicable skills
|
|
241
|
+
node dist/agentdb/cli/agentdb-cli.js skill search \
|
|
242
|
+
"oauth jwt tokens" 3
|
|
243
|
+
|
|
244
|
+
# 8. Check database stats
|
|
245
|
+
node dist/agentdb/cli/agentdb-cli.js db stats
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
## Verify Installation
|
|
249
|
+
|
|
250
|
+
### Check Binary Links
|
|
251
|
+
```bash
|
|
252
|
+
# Should show the CLI binary path
|
|
253
|
+
which agentdb
|
|
254
|
+
|
|
255
|
+
# Or check npm bin
|
|
256
|
+
npm bin agentdb
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### Run from Package
|
|
260
|
+
```bash
|
|
261
|
+
# If you've run npm install -g or npm link
|
|
262
|
+
agentdb --help
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
## Environment Variables
|
|
266
|
+
|
|
267
|
+
```bash
|
|
268
|
+
# Database path (default: ./agentdb.db)
|
|
269
|
+
export AGENTDB_PATH=/path/to/your/database.db
|
|
270
|
+
|
|
271
|
+
# Example with custom path
|
|
272
|
+
AGENTDB_PATH=~/my-agent-memory.db node dist/agentdb/cli/agentdb-cli.js db stats
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
## Expected Output Examples
|
|
276
|
+
|
|
277
|
+
### Successful Episode Storage
|
|
278
|
+
```
|
|
279
|
+
✓ Stored episode #1 (session: session-1, task: implement_authentication)
|
|
280
|
+
Reward: 0.95 | Success: true | Latency: 1200ms | Tokens: 5000
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
### Skill Search Results
|
|
284
|
+
```
|
|
285
|
+
🔍 Found 3 skills for "authentication"
|
|
286
|
+
|
|
287
|
+
#1: jwt_authentication (success rate: 0.90, uses: 5)
|
|
288
|
+
Generate and validate JWT tokens for user authentication
|
|
289
|
+
|
|
290
|
+
#2: oauth2_flow (success rate: 0.85, uses: 3)
|
|
291
|
+
Complete OAuth2 authorization code flow
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
### Database Stats
|
|
295
|
+
```
|
|
296
|
+
AgentDB Statistics
|
|
297
|
+
|
|
298
|
+
Episodes: 15
|
|
299
|
+
Skills: 8
|
|
300
|
+
Causal Edges: 12
|
|
301
|
+
Experiments: 3
|
|
302
|
+
Certificates: 5
|
|
303
|
+
|
|
304
|
+
Total Size: 2.4 MB
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
## Troubleshooting
|
|
308
|
+
|
|
309
|
+
### Issue: "Cannot find module"
|
|
310
|
+
```bash
|
|
311
|
+
# Rebuild the project
|
|
312
|
+
npm run build
|
|
313
|
+
|
|
314
|
+
# Check dist folder exists
|
|
315
|
+
ls dist/agentdb/cli/agentdb-cli.js
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
### Issue: "Database is locked"
|
|
319
|
+
```bash
|
|
320
|
+
# Close any open database connections
|
|
321
|
+
# Or use a different database path
|
|
322
|
+
export AGENTDB_PATH=./test2-agentdb.db
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
### Issue: "Permission denied"
|
|
326
|
+
```bash
|
|
327
|
+
# Make CLI executable
|
|
328
|
+
chmod +x dist/agentdb/cli/agentdb-cli.js
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
## Advanced Testing
|
|
332
|
+
|
|
333
|
+
### Test with Programmatic API
|
|
334
|
+
```typescript
|
|
335
|
+
import { AgentDBCLI } from './dist/agentdb/cli/agentdb-cli.js';
|
|
336
|
+
|
|
337
|
+
const cli = new AgentDBCLI('./test.db');
|
|
338
|
+
|
|
339
|
+
// Store episode
|
|
340
|
+
await cli.reflexionStore({
|
|
341
|
+
sessionId: 'test-1',
|
|
342
|
+
task: 'example',
|
|
343
|
+
reward: 0.9,
|
|
344
|
+
success: true,
|
|
345
|
+
critique: 'Good approach'
|
|
346
|
+
});
|
|
347
|
+
|
|
348
|
+
// Retrieve episodes
|
|
349
|
+
await cli.reflexionRetrieve({
|
|
350
|
+
task: 'example',
|
|
351
|
+
k: 5
|
|
352
|
+
});
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
### Integration with Your Project
|
|
356
|
+
```typescript
|
|
357
|
+
// In your agent code
|
|
358
|
+
import { AgentDBCLI } from 'agentic-flow/agentdb';
|
|
359
|
+
|
|
360
|
+
const memory = new AgentDBCLI();
|
|
361
|
+
|
|
362
|
+
// Learn from task outcomes
|
|
363
|
+
async function learnFromTask(task, outcome) {
|
|
364
|
+
await memory.reflexionStore({
|
|
365
|
+
sessionId: getCurrentSession(),
|
|
366
|
+
task: task.name,
|
|
367
|
+
reward: outcome.score,
|
|
368
|
+
success: outcome.passed,
|
|
369
|
+
critique: outcome.feedback,
|
|
370
|
+
input: task.input,
|
|
371
|
+
output: outcome.result,
|
|
372
|
+
latencyMs: outcome.duration,
|
|
373
|
+
tokensUsed: outcome.tokens
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
// Retrieve similar past experiences
|
|
378
|
+
async function recallSimilar(task) {
|
|
379
|
+
return await memory.reflexionRetrieve({
|
|
380
|
+
task: task.name,
|
|
381
|
+
k: 5,
|
|
382
|
+
minReward: 0.7
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
## Performance Benchmarks
|
|
388
|
+
|
|
389
|
+
```bash
|
|
390
|
+
# Time a full workflow
|
|
391
|
+
time bash full-workflow-example.sh
|
|
392
|
+
|
|
393
|
+
# Check database performance
|
|
394
|
+
node dist/agentdb/cli/agentdb-cli.js db stats
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
## Next Steps
|
|
398
|
+
|
|
399
|
+
1. ✅ Test basic commands (reflexion, skill)
|
|
400
|
+
2. ✅ Test causal features (edges, experiments)
|
|
401
|
+
3. ✅ Run nightly learner for discovery
|
|
402
|
+
4. ✅ Verify causal recall with certificates
|
|
403
|
+
5. ✅ Check database stats
|
|
404
|
+
6. 🚀 Integrate into your agent workflows
|
|
405
|
+
|
|
406
|
+
## Resources
|
|
407
|
+
|
|
408
|
+
- **AgentDB Controllers**: `/src/agentdb/controllers/`
|
|
409
|
+
- **CLI Source**: `/src/agentdb/cli/agentdb-cli.ts`
|
|
410
|
+
- **Tests**: `/src/agentdb/tests/frontier-features.test.ts`
|
|
411
|
+
- **Binary**: `/dist/agentdb/cli/agentdb-cli.js`
|