agentic-flow 1.6.6 → 1.7.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.
Files changed (44) hide show
  1. package/.claude/skills/.claude-flow/metrics/agent-metrics.json +1 -0
  2. package/.claude/skills/.claude-flow/metrics/performance.json +87 -0
  3. package/.claude/skills/.claude-flow/metrics/task-metrics.json +10 -0
  4. package/.claude/skills/skill-builder/.claude-flow/metrics/agent-metrics.json +1 -0
  5. package/.claude/skills/skill-builder/.claude-flow/metrics/performance.json +87 -0
  6. package/.claude/skills/skill-builder/.claude-flow/metrics/task-metrics.json +10 -0
  7. package/CHANGELOG.md +0 -30
  8. package/README.md +16 -2
  9. package/dist/agentdb/benchmarks/comprehensive-benchmark.js +664 -0
  10. package/dist/agentdb/benchmarks/frontier-benchmark.js +419 -0
  11. package/dist/agentdb/benchmarks/reflexion-benchmark.js +370 -0
  12. package/dist/agentdb/cli/agentdb-cli.js +717 -0
  13. package/dist/agentdb/controllers/CausalMemoryGraph.js +322 -0
  14. package/dist/agentdb/controllers/CausalRecall.js +281 -0
  15. package/dist/agentdb/controllers/EmbeddingService.js +118 -0
  16. package/dist/agentdb/controllers/ExplainableRecall.js +387 -0
  17. package/dist/agentdb/controllers/NightlyLearner.js +382 -0
  18. package/dist/agentdb/controllers/ReflexionMemory.js +239 -0
  19. package/dist/agentdb/controllers/SkillLibrary.js +276 -0
  20. package/dist/agentdb/controllers/frontier-index.js +9 -0
  21. package/dist/agentdb/controllers/index.js +8 -0
  22. package/dist/agentdb/index.js +32 -0
  23. package/dist/agentdb/optimizations/BatchOperations.js +198 -0
  24. package/dist/agentdb/optimizations/QueryOptimizer.js +225 -0
  25. package/dist/agentdb/optimizations/index.js +7 -0
  26. package/dist/agentdb/tests/frontier-features.test.js +665 -0
  27. package/dist/cli/skills-manager.js +1297 -0
  28. package/dist/cli/update-message.js +175 -0
  29. package/dist/cli-proxy.js +2 -26
  30. package/dist/mcp/standalone-stdio.js +200 -4
  31. package/dist/memory/SharedMemoryPool.js +211 -0
  32. package/dist/memory/index.js +6 -0
  33. package/dist/reasoningbank/AdvancedMemory.js +239 -0
  34. package/dist/reasoningbank/HybridBackend.js +305 -0
  35. package/dist/reasoningbank/index-new.js +87 -0
  36. package/dist/reasoningbank/index.js +0 -4
  37. package/dist/utils/cli.js +0 -5
  38. package/docs/AGENTDB_TESTING.md +411 -0
  39. package/package.json +4 -4
  40. package/scripts/run-validation.sh +165 -0
  41. package/scripts/test-agentdb.sh +153 -0
  42. package/wasm/reasoningbank/reasoningbank_wasm_bg.js +2 -2
  43. package/wasm/reasoningbank/reasoningbank_wasm_bg.wasm +0 -0
  44. package/docs/AGENTDB_INTEGRATION.md +0 -379
@@ -0,0 +1,1297 @@
1
+ /**
2
+ * Skills Manager for agentic-flow
3
+ * Creates and manages Claude Code Skills in proper locations
4
+ */
5
+ import { existsSync, mkdirSync, writeFileSync, readdirSync, readFileSync } from 'fs';
6
+ import { join, dirname } from 'path';
7
+ import { homedir } from 'os';
8
+ import { fileURLToPath } from 'url';
9
+ import chalk from 'chalk';
10
+ // Get __dirname equivalent in ESM
11
+ const __filename = fileURLToPath(import.meta.url);
12
+ const __dirname = dirname(__filename);
13
+ /**
14
+ * Get skills directory paths
15
+ */
16
+ export function getSkillsPaths() {
17
+ return {
18
+ personal: join(homedir(), '.claude', 'skills'),
19
+ project: join(process.cwd(), '.claude', 'skills'),
20
+ };
21
+ }
22
+ /**
23
+ * Initialize skills directories
24
+ */
25
+ export function initSkillsDirectories(location = 'both') {
26
+ const paths = getSkillsPaths();
27
+ if (location === 'personal' || location === 'both') {
28
+ if (!existsSync(paths.personal)) {
29
+ mkdirSync(paths.personal, { recursive: true });
30
+ console.log(chalk.green('✓') + ` Created personal skills directory: ${chalk.cyan(paths.personal)}`);
31
+ }
32
+ else {
33
+ console.log(chalk.yellow('→') + ` Personal skills directory exists: ${chalk.cyan(paths.personal)}`);
34
+ }
35
+ }
36
+ if (location === 'project' || location === 'both') {
37
+ if (!existsSync(paths.project)) {
38
+ mkdirSync(paths.project, { recursive: true });
39
+ console.log(chalk.green('✓') + ` Created project skills directory: ${chalk.cyan(paths.project)}`);
40
+ }
41
+ else {
42
+ console.log(chalk.yellow('→') + ` Project skills directory exists: ${chalk.cyan(paths.project)}`);
43
+ }
44
+ }
45
+ }
46
+ /**
47
+ * Create a skill from template
48
+ */
49
+ export function createSkill(template, location = 'personal') {
50
+ const paths = getSkillsPaths();
51
+ const baseDir = location === 'personal' ? paths.personal : paths.project;
52
+ // Claude Code requires skills at top level ~/.claude/skills/[skill-name]
53
+ const skillDir = join(baseDir, template.name);
54
+ // Create skill directory
55
+ if (!existsSync(skillDir)) {
56
+ mkdirSync(skillDir, { recursive: true });
57
+ }
58
+ // Create SKILL.md
59
+ const skillMdPath = join(skillDir, 'SKILL.md');
60
+ writeFileSync(skillMdPath, template.content, 'utf-8');
61
+ console.log(chalk.green('✓') + ` Created SKILL.md: ${chalk.cyan(skillMdPath)}`);
62
+ // Create scripts
63
+ if (template.scripts) {
64
+ const scriptsDir = join(skillDir, 'scripts');
65
+ if (!existsSync(scriptsDir)) {
66
+ mkdirSync(scriptsDir, { recursive: true });
67
+ }
68
+ for (const [filename, content] of Object.entries(template.scripts)) {
69
+ const scriptPath = join(scriptsDir, filename);
70
+ writeFileSync(scriptPath, content, 'utf-8');
71
+ console.log(chalk.green('✓') + ` Created script: ${chalk.cyan(scriptPath)}`);
72
+ }
73
+ }
74
+ // Create resources
75
+ if (template.resources) {
76
+ const resourcesDir = join(skillDir, 'resources');
77
+ if (!existsSync(resourcesDir)) {
78
+ mkdirSync(resourcesDir, { recursive: true });
79
+ }
80
+ for (const [filename, content] of Object.entries(template.resources)) {
81
+ const resourcePath = join(resourcesDir, filename);
82
+ writeFileSync(resourcePath, content, 'utf-8');
83
+ console.log(chalk.green('✓') + ` Created resource: ${chalk.cyan(resourcePath)}`);
84
+ }
85
+ }
86
+ console.log('');
87
+ console.log(chalk.bold.green('✨ Skill created successfully!'));
88
+ console.log('');
89
+ console.log(chalk.white('Location: ') + chalk.cyan(skillDir));
90
+ console.log(chalk.white('Category: ') + chalk.yellow(template.category));
91
+ console.log(chalk.white('Difficulty: ') + chalk.yellow(template.difficulty));
92
+ console.log(chalk.white('Est. Time: ') + chalk.yellow(template.estimatedTime));
93
+ console.log('');
94
+ }
95
+ /**
96
+ * List installed skills
97
+ */
98
+ export function listSkills() {
99
+ const paths = getSkillsPaths();
100
+ console.log('');
101
+ console.log(chalk.bold.white('📚 Installed Claude Code Skills'));
102
+ console.log(chalk.gray('═══════════════════════════════════════════════════════════════'));
103
+ console.log('');
104
+ // Personal skills
105
+ if (existsSync(paths.personal)) {
106
+ const personalSkills = findSkills(paths.personal);
107
+ if (personalSkills.length > 0) {
108
+ console.log(chalk.bold.cyan('Personal Skills') + chalk.gray(' (~/.claude/skills/)'));
109
+ personalSkills.forEach(skill => {
110
+ console.log(chalk.green(' •') + ' ' + chalk.white(skill.name));
111
+ console.log(chalk.gray(' ' + skill.description.slice(0, 80) + '...'));
112
+ });
113
+ console.log('');
114
+ }
115
+ }
116
+ // Project skills
117
+ if (existsSync(paths.project)) {
118
+ const projectSkills = findSkills(paths.project);
119
+ if (projectSkills.length > 0) {
120
+ console.log(chalk.bold.cyan('Project Skills') + chalk.gray(' (.claude/skills/)'));
121
+ projectSkills.forEach(skill => {
122
+ console.log(chalk.green(' •') + ' ' + chalk.white(skill.name));
123
+ console.log(chalk.gray(' ' + skill.description.slice(0, 80) + '...'));
124
+ });
125
+ console.log('');
126
+ }
127
+ }
128
+ console.log(chalk.gray('═══════════════════════════════════════════════════════════════'));
129
+ console.log('');
130
+ }
131
+ /**
132
+ * Find all skills in a directory
133
+ */
134
+ function findSkills(dir) {
135
+ const skills = [];
136
+ function scanDir(currentDir) {
137
+ if (!existsSync(currentDir))
138
+ return;
139
+ const entries = readdirSync(currentDir, { withFileTypes: true });
140
+ for (const entry of entries) {
141
+ if (entry.isDirectory()) {
142
+ const skillMdPath = join(currentDir, entry.name, 'SKILL.md');
143
+ if (existsSync(skillMdPath)) {
144
+ const content = readFileSync(skillMdPath, 'utf-8');
145
+ const match = content.match(/---\n([\s\S]*?)\n---/);
146
+ if (match) {
147
+ const yaml = match[1];
148
+ const nameMatch = yaml.match(/name:\s*["']?([^"'\n]+)["']?/);
149
+ const descMatch = yaml.match(/description:\s*["']?([^"'\n]+)["']?/);
150
+ if (nameMatch && descMatch) {
151
+ skills.push({
152
+ name: nameMatch[1],
153
+ description: descMatch[1],
154
+ path: join(currentDir, entry.name),
155
+ });
156
+ }
157
+ }
158
+ }
159
+ else {
160
+ // Recurse into subdirectories
161
+ scanDir(join(currentDir, entry.name));
162
+ }
163
+ }
164
+ }
165
+ }
166
+ scanDir(dir);
167
+ return skills;
168
+ }
169
+ /**
170
+ * Generate skill template
171
+ */
172
+ export function generateSkillTemplate(name, description, category) {
173
+ const skillName = name.toLowerCase().replace(/\s+/g, '-');
174
+ return {
175
+ name: skillName,
176
+ description,
177
+ category,
178
+ difficulty: 'beginner',
179
+ estimatedTime: '5 minutes',
180
+ content: `---
181
+ name: "${name}"
182
+ description: "${description}"
183
+ ---
184
+
185
+ # ${name}
186
+
187
+ ## What This Skill Does
188
+
189
+ ${description}
190
+
191
+ ## Prerequisites
192
+
193
+ - agentic-flow installed (\`npm install -g agentic-flow@latest\`)
194
+ - Node.js 18+
195
+
196
+ ## Quick Start
197
+
198
+ \`\`\`bash
199
+ npx agentic-flow ${skillName}
200
+ \`\`\`
201
+
202
+ ## Step-by-Step Guide
203
+
204
+ 1. **Step 1**: First action
205
+ \`\`\`bash
206
+ npx agentic-flow ${skillName} --option value
207
+ \`\`\`
208
+
209
+ 2. **Step 2**: Second action
210
+ - Details about this step
211
+
212
+ 3. **Step 3**: Final action
213
+ - Verification steps
214
+
215
+ ## Expected Output
216
+
217
+ \`\`\`
218
+ ✓ Operation completed successfully
219
+ → Results: [details]
220
+ \`\`\`
221
+
222
+ ## Advanced Options
223
+
224
+ ### Option 1: Advanced Feature
225
+ \`\`\`bash
226
+ npx agentic-flow ${skillName} --advanced
227
+ \`\`\`
228
+
229
+ ### Option 2: Custom Configuration
230
+ \`\`\`bash
231
+ npx agentic-flow ${skillName} --config path/to/config.json
232
+ \`\`\`
233
+
234
+ ## Troubleshooting
235
+
236
+ ### Issue: Common Problem
237
+ **Solution**: How to resolve
238
+
239
+ ### Issue: Another Problem
240
+ **Solution**: Resolution steps
241
+
242
+ ## Learn More
243
+
244
+ - Documentation: \`docs/${category}/${skillName}.md\`
245
+ - Examples: \`examples/${skillName}/\`
246
+ - Related Skills: [list related skills]
247
+
248
+ ## Resources
249
+
250
+ - [Resource 1]
251
+ - [Resource 2]
252
+ `,
253
+ };
254
+ }
255
+ /**
256
+ * Initialize agentic-flow skills
257
+ */
258
+ export async function handleSkillsCommand(args) {
259
+ const command = args[0];
260
+ if (!command || command === 'help') {
261
+ printSkillsHelp();
262
+ return;
263
+ }
264
+ switch (command) {
265
+ case 'init':
266
+ await handleSkillsInit(args.slice(1));
267
+ break;
268
+ case 'list':
269
+ listSkills();
270
+ break;
271
+ case 'create':
272
+ await handleSkillsCreate(args.slice(1));
273
+ break;
274
+ case 'init-builder':
275
+ await handleSkillBuilderInit(args.slice(1));
276
+ break;
277
+ default:
278
+ console.log(chalk.red('Unknown command: ' + command));
279
+ printSkillsHelp();
280
+ }
281
+ }
282
+ /**
283
+ * Handle skills init command
284
+ */
285
+ async function handleSkillsInit(args) {
286
+ const location = args[0] || 'both';
287
+ const includeBuilder = args.includes('--with-builder');
288
+ console.log('');
289
+ console.log(chalk.bold.cyan('🎨 Initializing agentic-flow Skills'));
290
+ console.log(chalk.gray('═══════════════════════════════════════════════════════════════'));
291
+ console.log('');
292
+ initSkillsDirectories(location);
293
+ if (includeBuilder) {
294
+ console.log('');
295
+ console.log(chalk.yellow('→') + ' Installing Skill Builder...');
296
+ await installSkillBuilder(location);
297
+ }
298
+ console.log('');
299
+ console.log(chalk.bold.green('✓ Skills directories initialized!'));
300
+ console.log('');
301
+ console.log(chalk.white('Next steps:'));
302
+ if (includeBuilder) {
303
+ console.log(chalk.gray(' 1. List skills: ') + chalk.cyan('npx agentic-flow skills list'));
304
+ console.log(chalk.gray(' 2. Create a skill: ') + chalk.cyan('Use Claude Code with "skill-builder" skill'));
305
+ console.log(chalk.gray(' 3. Create example: ') + chalk.cyan('npx agentic-flow skills create'));
306
+ }
307
+ else {
308
+ console.log(chalk.gray(' 1. Install builder:') + chalk.cyan('npx agentic-flow skills init-builder'));
309
+ console.log(chalk.gray(' 2. Create a skill: ') + chalk.cyan('npx agentic-flow skills create'));
310
+ console.log(chalk.gray(' 3. List skills: ') + chalk.cyan('npx agentic-flow skills list'));
311
+ }
312
+ console.log(chalk.gray(' 4. Learn more: ') + chalk.cyan('docs/plans/skills/SKILLS_PLAN.md'));
313
+ console.log('');
314
+ }
315
+ /**
316
+ * Handle skill-builder init command
317
+ */
318
+ async function handleSkillBuilderInit(args) {
319
+ const location = args[0] || 'project';
320
+ console.log('');
321
+ console.log(chalk.bold.cyan('🎨 Installing Skill Builder Framework'));
322
+ console.log(chalk.gray('═══════════════════════════════════════════════════════════════'));
323
+ console.log('');
324
+ await installSkillBuilder(location);
325
+ console.log('');
326
+ console.log(chalk.bold.green('✓ Skill Builder installed successfully!'));
327
+ console.log('');
328
+ console.log(chalk.white('Usage:'));
329
+ console.log(chalk.gray(' • Ask Claude: ') + chalk.cyan('"I want to create a new skill for [task]"'));
330
+ console.log(chalk.gray(' • Use script: ') + chalk.cyan('.claude/skills/skill-builder/scripts/generate-skill.sh'));
331
+ console.log(chalk.gray(' • Validate: ') + chalk.cyan('.claude/skills/skill-builder/scripts/validate-skill.sh <path>'));
332
+ console.log('');
333
+ console.log(chalk.white('Documentation:'));
334
+ console.log(chalk.gray(' • README: ') + chalk.cyan('.claude/skills/skill-builder/README.md'));
335
+ console.log(chalk.gray(' • Spec: ') + chalk.cyan('.claude/skills/skill-builder/docs/SPECIFICATION.md'));
336
+ console.log('');
337
+ }
338
+ /**
339
+ * Install skill-builder framework
340
+ */
341
+ async function installSkillBuilder(location) {
342
+ const paths = getSkillsPaths();
343
+ const locations = location === 'both' ? ['personal', 'project'] : [location];
344
+ for (const loc of locations) {
345
+ const baseDir = loc === 'personal' ? paths.personal : paths.project;
346
+ // Claude Code requires skills at top level, NOT in namespaces
347
+ const builderDir = join(baseDir, 'skill-builder');
348
+ // Create directory structure
349
+ mkdirSync(join(builderDir, 'scripts'), { recursive: true });
350
+ mkdirSync(join(builderDir, 'resources', 'templates'), { recursive: true });
351
+ mkdirSync(join(builderDir, 'resources', 'schemas'), { recursive: true });
352
+ mkdirSync(join(builderDir, 'docs'), { recursive: true });
353
+ // Try multiple source locations
354
+ const possibleSources = [
355
+ join(process.cwd(), '.claude', 'skills', 'skill-builder'), // Project root
356
+ join(__dirname, '..', '..', '.claude', 'skills', 'skill-builder'), // Package dist
357
+ join(__dirname, '..', '..', '..', '.claude', 'skills', 'skill-builder'), // Monorepo root
358
+ ];
359
+ let sourceDir = null;
360
+ for (const src of possibleSources) {
361
+ if (existsSync(src) && existsSync(join(src, 'SKILL.md'))) {
362
+ sourceDir = src;
363
+ break;
364
+ }
365
+ }
366
+ if (sourceDir) {
367
+ // Copy all files recursively
368
+ copyRecursive(sourceDir, builderDir);
369
+ console.log(chalk.green('✓') + ` Installed skill-builder to ${chalk.cyan(loc)} location`);
370
+ }
371
+ else {
372
+ // Create from templates if source doesn't exist
373
+ createSkillBuilderFromTemplate(builderDir);
374
+ console.log(chalk.green('✓') + ` Created skill-builder in ${chalk.cyan(loc)} location`);
375
+ }
376
+ }
377
+ }
378
+ /**
379
+ * Copy directory recursively
380
+ */
381
+ function copyRecursive(src, dest) {
382
+ const entries = readdirSync(src, { withFileTypes: true });
383
+ for (const entry of entries) {
384
+ const srcPath = join(src, entry.name);
385
+ const destPath = join(dest, entry.name);
386
+ if (entry.isDirectory()) {
387
+ mkdirSync(destPath, { recursive: true });
388
+ copyRecursive(srcPath, destPath);
389
+ }
390
+ else {
391
+ const content = readFileSync(srcPath, 'utf-8');
392
+ writeFileSync(destPath, content, 'utf-8');
393
+ }
394
+ }
395
+ }
396
+ /**
397
+ * Create skill-builder from template (fallback)
398
+ */
399
+ function createSkillBuilderFromTemplate(builderDir) {
400
+ // Create minimal SKILL.md
401
+ const skillMd = `---
402
+ name: "Skill Builder"
403
+ description: "Create new Claude Code Skills with proper YAML frontmatter, progressive disclosure structure, and complete directory organization. Use when you need to build custom skills for specific workflows, generate skill templates, or understand the Claude Skills specification."
404
+ ---
405
+
406
+ # Skill Builder
407
+
408
+ ## What This Skill Does
409
+
410
+ Creates production-ready Claude Code Skills with proper YAML frontmatter, progressive disclosure architecture, and complete file/folder structure.
411
+
412
+ ## Prerequisites
413
+
414
+ - Claude Code 2.0+ or Claude.ai with Skills support
415
+ - Basic understanding of Markdown and YAML
416
+ - Text editor or IDE
417
+
418
+ ## Quick Start
419
+
420
+ ### Creating Your First Skill
421
+
422
+ \`\`\`bash
423
+ # 1. Create skill directory (MUST be at top level!)
424
+ mkdir -p ~/.claude/skills/my-first-skill
425
+
426
+ # 2. Create SKILL.md with proper format
427
+ cat > ~/.claude/skills/my-first-skill/SKILL.md << 'EOF'
428
+ ---
429
+ name: "My First Skill"
430
+ description: "Brief description of what this skill does and when Claude should use it."
431
+ ---
432
+
433
+ # My First Skill
434
+
435
+ ## What This Skill Does
436
+ [Your instructions here]
437
+
438
+ ## Quick Start
439
+ [Basic usage]
440
+ EOF
441
+ \`\`\`
442
+
443
+ ## Complete Specification
444
+
445
+ ### YAML Frontmatter (REQUIRED)
446
+
447
+ Every SKILL.md must start with YAML frontmatter:
448
+
449
+ \`\`\`yaml
450
+ ---
451
+ name: "Skill Name" # REQUIRED: Max 64 chars
452
+ description: "What this skill does # REQUIRED: Max 1024 chars
453
+ and when Claude should use it." # Include BOTH what & when
454
+ ---
455
+ \`\`\`
456
+
457
+ For complete documentation, see: .claude/skills/skill-builder/docs/SPECIFICATION.md
458
+ `;
459
+ writeFileSync(join(builderDir, 'SKILL.md'), skillMd, 'utf-8');
460
+ // Create minimal README
461
+ const readme = `# Skill Builder
462
+
463
+ Meta-skill for creating Claude Code Skills with proper formatting and structure.
464
+
465
+ ## Usage
466
+
467
+ Ask Claude Code: "I want to create a new skill for [task]"
468
+
469
+ ## Documentation
470
+
471
+ - Full specification: docs/SPECIFICATION.md
472
+ - Templates: resources/templates/
473
+ - Scripts: scripts/
474
+
475
+ ## Quick Reference
476
+
477
+ - Max name length: 64 characters
478
+ - Max description: 1024 characters
479
+ - Description must include "what" and "when"
480
+ - Only name and description are required in YAML
481
+ `;
482
+ writeFileSync(join(builderDir, 'README.md'), readme, 'utf-8');
483
+ }
484
+ /**
485
+ * Handle skills create command
486
+ */
487
+ async function handleSkillsCreate(args) {
488
+ console.log('');
489
+ console.log(chalk.bold.cyan('🎨 Creating agentic-flow Skills'));
490
+ console.log(chalk.gray('═══════════════════════════════════════════════════════════════'));
491
+ console.log('');
492
+ // Ensure directories exist
493
+ initSkillsDirectories('project');
494
+ const paths = getSkillsPaths();
495
+ const projectSkillsDir = paths.project;
496
+ // Create 4 agentic-flow specific skills
497
+ const skills = [
498
+ createAgentDBVectorSearchSkill(),
499
+ createAgentDBMemoryPatternsSkill(),
500
+ createSwarmOrchestrationSkill(),
501
+ createReasoningBankSkill()
502
+ ];
503
+ let count = 0;
504
+ for (const skillContent of skills) {
505
+ const skillName = extractSkillName(skillContent);
506
+ // Claude Code requires skills at TOP LEVEL: .claude/skills/[skill-name]/
507
+ // NOT in subdirectories: .claude/skills/namespace/[skill-name]/
508
+ const skillDir = join(projectSkillsDir, skillName);
509
+ mkdirSync(skillDir, { recursive: true });
510
+ writeFileSync(join(skillDir, 'SKILL.md'), skillContent, 'utf-8');
511
+ count++;
512
+ console.log(chalk.green(` ${count}. ✓`) + ` Created ${chalk.cyan(skillName)} skill`);
513
+ }
514
+ console.log('');
515
+ console.log(chalk.gray('═══════════════════════════════════════════════════════════════'));
516
+ console.log('');
517
+ console.log(chalk.bold.green(`✓ Created ${count} agentic-flow skills!`));
518
+ console.log('');
519
+ console.log(chalk.white('Skills installed:'));
520
+ console.log(chalk.gray(' • AgentDB Vector Search ') + chalk.dim('- Semantic search with vector embeddings'));
521
+ console.log(chalk.gray(' • AgentDB Memory Patterns ') + chalk.dim('- Memory management & persistence'));
522
+ console.log(chalk.gray(' • Swarm Orchestration ') + chalk.dim('- Multi-agent coordination'));
523
+ console.log(chalk.gray(' • ReasoningBank Intelligence') + chalk.dim('- Pattern learning & adaptation'));
524
+ console.log('');
525
+ console.log(chalk.white('Next: ') + chalk.cyan('npx agentic-flow skills list') + chalk.gray(' to see all skills'));
526
+ console.log('');
527
+ }
528
+ /**
529
+ * Extract skill name from YAML frontmatter
530
+ */
531
+ function extractSkillName(content) {
532
+ const match = content.match(/name:\s*["']([^"']+)["']/);
533
+ if (match) {
534
+ return match[1].toLowerCase().replace(/\s+/g, '-');
535
+ }
536
+ return 'unknown-skill';
537
+ }
538
+ /**
539
+ * Create AgentDB Vector Search skill
540
+ */
541
+ function createAgentDBVectorSearchSkill() {
542
+ return `---
543
+ name: "AgentDB Vector Search"
544
+ description: "Implement semantic vector search with AgentDB for intelligent document retrieval, similarity matching, and context-aware querying. Use when building RAG systems, semantic search engines, or intelligent knowledge bases."
545
+ ---
546
+
547
+ # AgentDB Vector Search
548
+
549
+ ## What This Skill Does
550
+
551
+ Implements vector-based semantic search using AgentDB's high-performance vector database with 150x-12,500x faster operations than traditional solutions. Enables similarity search, hybrid search (vector + metadata), and real-time embedding generation.
552
+
553
+ ## Prerequisites
554
+
555
+ - agentic-flow v1.5.11+ or agentdb v1.0.4+
556
+ - Node.js 18+
557
+ - OpenAI API key (for embeddings) or custom embedding model
558
+
559
+ ## Quick Start
560
+
561
+ \`\`\`typescript
562
+ import { AgentDB } from 'agentdb';
563
+
564
+ // Initialize AgentDB with vector support
565
+ const db = new AgentDB({
566
+ persist: true,
567
+ vectorDimensions: 1536, // OpenAI ada-002 dimensions
568
+ enableVectorIndex: true
569
+ });
570
+
571
+ // Store documents with vectors
572
+ await db.storeMemory({
573
+ text: "The quantum computer achieved 100 qubits",
574
+ metadata: { category: "technology", date: "2025-01-15" },
575
+ embedding: await generateEmbedding(text) // Your embedding function
576
+ });
577
+
578
+ // Semantic search
579
+ const results = await db.searchSimilar(
580
+ queryEmbedding,
581
+ { limit: 10, threshold: 0.7 }
582
+ );
583
+ \`\`\`
584
+
585
+ ## Core Features
586
+
587
+ ### 1. Vector Storage
588
+ \`\`\`typescript
589
+ // Store with automatic embedding
590
+ await db.storeWithEmbedding({
591
+ content: "Your document text",
592
+ metadata: { source: "docs", page: 42 }
593
+ });
594
+ \`\`\`
595
+
596
+ ### 2. Similarity Search
597
+ \`\`\`typescript
598
+ // Find similar documents
599
+ const similar = await db.findSimilar("quantum computing", {
600
+ limit: 5,
601
+ minScore: 0.75
602
+ });
603
+ \`\`\`
604
+
605
+ ### 3. Hybrid Search (Vector + Metadata)
606
+ \`\`\`typescript
607
+ // Combine vector similarity with metadata filtering
608
+ const results = await db.hybridSearch({
609
+ query: "machine learning models",
610
+ filters: {
611
+ category: "research",
612
+ date: { $gte: "2024-01-01" }
613
+ },
614
+ limit: 20
615
+ });
616
+ \`\`\`
617
+
618
+ ## Advanced Usage
619
+
620
+ ### RAG (Retrieval Augmented Generation)
621
+ \`\`\`typescript
622
+ // Build RAG pipeline
623
+ async function ragQuery(question: string) {
624
+ // 1. Get relevant context
625
+ const context = await db.searchSimilar(
626
+ await embed(question),
627
+ { limit: 5, threshold: 0.7 }
628
+ );
629
+
630
+ // 2. Generate answer with context
631
+ const prompt = \`Context: \${context.map(c => c.text).join('\\n')}
632
+ Question: \${question}\`;
633
+
634
+ return await llm.generate(prompt);
635
+ }
636
+ \`\`\`
637
+
638
+ ### Batch Operations
639
+ \`\`\`typescript
640
+ // Efficient batch storage
641
+ await db.batchStore(documents.map(doc => ({
642
+ text: doc.content,
643
+ embedding: doc.vector,
644
+ metadata: doc.meta
645
+ })));
646
+ \`\`\`
647
+
648
+ ## Performance Tips
649
+
650
+ - **Indexing**: Enable vector index for 10-100x faster searches
651
+ - **Batch Size**: Use batch operations for 1000+ documents
652
+ - **Dimensions**: Match embedding model (1536 for OpenAI ada-002)
653
+ - **Threshold**: Start at 0.7 for quality results
654
+
655
+ ## Troubleshooting
656
+
657
+ ### Issue: Slow search performance
658
+ **Solution**: Enable vector index: \`enableVectorIndex: true\`
659
+
660
+ ### Issue: Poor relevance
661
+ **Solution**: Adjust similarity threshold or use hybrid search
662
+
663
+ ## Learn More
664
+
665
+ - AgentDB Docs: packages/agentdb/README.md
666
+ - Vector DB API: packages/agentdb/docs/vector-api.md
667
+ - Performance Guide: docs/agentdb/performance.md
668
+ `;
669
+ }
670
+ /**
671
+ * Create AgentDB Memory Patterns skill
672
+ */
673
+ function createAgentDBMemoryPatternsSkill() {
674
+ return `---
675
+ name: "AgentDB Memory Patterns"
676
+ description: "Implement persistent memory patterns for AI agents using AgentDB. Includes session memory, long-term storage, pattern learning, and context management. Use when building stateful agents, chat systems, or intelligent assistants."
677
+ ---
678
+
679
+ # AgentDB Memory Patterns
680
+
681
+ ## What This Skill Does
682
+
683
+ Provides memory management patterns for AI agents using AgentDB's persistent storage and ReasoningBank integration. Enables agents to remember conversations, learn from interactions, and maintain context across sessions.
684
+
685
+ ## Prerequisites
686
+
687
+ - agentic-flow v1.5.11+ or agentdb v1.0.4+
688
+ - Node.js 18+
689
+ - Understanding of agent architectures
690
+
691
+ ## Quick Start
692
+
693
+ \`\`\`typescript
694
+ import { AgentDB, MemoryManager } from 'agentdb';
695
+
696
+ // Initialize memory system
697
+ const memory = new MemoryManager({
698
+ agentId: 'assistant-001',
699
+ persist: true,
700
+ ttl: 3600 * 24 * 30 // 30 days
701
+ });
702
+
703
+ // Store interaction
704
+ await memory.store({
705
+ role: 'user',
706
+ content: 'What is the capital of France?',
707
+ timestamp: Date.now()
708
+ });
709
+
710
+ await memory.store({
711
+ role: 'assistant',
712
+ content: 'The capital of France is Paris.',
713
+ timestamp: Date.now()
714
+ });
715
+
716
+ // Retrieve context
717
+ const context = await memory.getRecentContext({ limit: 10 });
718
+ \`\`\`
719
+
720
+ ## Memory Patterns
721
+
722
+ ### 1. Session Memory
723
+ \`\`\`typescript
724
+ class SessionMemory {
725
+ async storeMessage(role: string, content: string) {
726
+ return await db.storeMemory({
727
+ sessionId: this.sessionId,
728
+ role,
729
+ content,
730
+ timestamp: Date.now()
731
+ });
732
+ }
733
+
734
+ async getSessionHistory(limit = 20) {
735
+ return await db.query({
736
+ filters: { sessionId: this.sessionId },
737
+ orderBy: 'timestamp',
738
+ limit
739
+ });
740
+ }
741
+ }
742
+ \`\`\`
743
+
744
+ ### 2. Long-Term Memory
745
+ \`\`\`typescript
746
+ // Store important facts
747
+ await db.storeFact({
748
+ category: 'user_preference',
749
+ key: 'language',
750
+ value: 'English',
751
+ confidence: 1.0,
752
+ source: 'explicit'
753
+ });
754
+
755
+ // Retrieve facts
756
+ const prefs = await db.getFacts({
757
+ category: 'user_preference'
758
+ });
759
+ \`\`\`
760
+
761
+ ### 3. Pattern Learning
762
+ \`\`\`typescript
763
+ // Learn from successful interactions
764
+ await db.storePattern({
765
+ trigger: 'user_asks_time',
766
+ response: 'provide_formatted_time',
767
+ success: true,
768
+ context: { timezone: 'UTC' }
769
+ });
770
+
771
+ // Apply learned patterns
772
+ const pattern = await db.matchPattern(currentContext);
773
+ \`\`\`
774
+
775
+ ## Advanced Patterns
776
+
777
+ ### Hierarchical Memory
778
+ \`\`\`typescript
779
+ // Organize memory in hierarchy
780
+ await memory.organize({
781
+ immediate: recentMessages, // Last 10 messages
782
+ shortTerm: sessionContext, // Current session
783
+ longTerm: importantFacts, // Persistent facts
784
+ semantic: embeddedKnowledge // Vector search
785
+ });
786
+ \`\`\`
787
+
788
+ ### Memory Consolidation
789
+ \`\`\`typescript
790
+ // Periodically consolidate memories
791
+ await memory.consolidate({
792
+ strategy: 'importance', // Keep important memories
793
+ maxSize: 10000, // Size limit
794
+ minScore: 0.5 // Relevance threshold
795
+ });
796
+ \`\`\`
797
+
798
+ ## Integration with ReasoningBank
799
+
800
+ \`\`\`typescript
801
+ import { ReasoningBank } from 'agentic-flow/reasoningbank';
802
+
803
+ // Connect memory to reasoning
804
+ const rb = new ReasoningBank({
805
+ memory: memory,
806
+ learningRate: 0.1
807
+ });
808
+
809
+ // Learn from outcomes
810
+ await rb.recordOutcome({
811
+ task: 'summarize_document',
812
+ approach: 'extractive',
813
+ success: true,
814
+ metrics: { accuracy: 0.95 }
815
+ });
816
+
817
+ // Get optimal strategy
818
+ const strategy = await rb.getOptimalStrategy('summarize_document');
819
+ \`\`\`
820
+
821
+ ## Best Practices
822
+
823
+ 1. **Prune regularly**: Remove outdated or low-value memories
824
+ 2. **Use TTL**: Set time-to-live for ephemeral data
825
+ 3. **Index metadata**: Enable fast filtering by sessionId, userId
826
+ 4. **Compress old data**: Archive infrequently accessed memories
827
+
828
+ ## Troubleshooting
829
+
830
+ ### Issue: Memory growing too large
831
+ **Solution**: Enable auto-pruning or set TTL values
832
+
833
+ ### Issue: Context not relevant
834
+ **Solution**: Use vector search for semantic memory retrieval
835
+
836
+ ## Learn More
837
+
838
+ - Memory API: packages/agentdb/docs/memory-api.md
839
+ - ReasoningBank: agentic-flow/src/reasoningbank/README.md
840
+ `;
841
+ }
842
+ /**
843
+ * Create Swarm Orchestration skill
844
+ */
845
+ function createSwarmOrchestrationSkill() {
846
+ return `---
847
+ name: "Swarm Orchestration"
848
+ description: "Orchestrate multi-agent swarms with agentic-flow for parallel task execution, dynamic topology, and intelligent coordination. Use when scaling beyond single agents, implementing complex workflows, or building distributed AI systems."
849
+ ---
850
+
851
+ # Swarm Orchestration
852
+
853
+ ## What This Skill Does
854
+
855
+ Orchestrates multi-agent swarms using agentic-flow's advanced coordination system. Supports mesh, hierarchical, and adaptive topologies with automatic task distribution, load balancing, and fault tolerance.
856
+
857
+ ## Prerequisites
858
+
859
+ - agentic-flow v1.5.11+
860
+ - Node.js 18+
861
+ - Understanding of distributed systems (helpful)
862
+
863
+ ## Quick Start
864
+
865
+ \`\`\`bash
866
+ # Initialize swarm
867
+ npx agentic-flow hooks swarm-init --topology mesh --max-agents 5
868
+
869
+ # Spawn agents
870
+ npx agentic-flow hooks agent-spawn --type coder
871
+ npx agentic-flow hooks agent-spawn --type tester
872
+ npx agentic-flow hooks agent-spawn --type reviewer
873
+
874
+ # Orchestrate task
875
+ npx agentic-flow hooks task-orchestrate \\
876
+ --task "Build REST API with tests" \\
877
+ --mode parallel
878
+ \`\`\`
879
+
880
+ ## Topology Patterns
881
+
882
+ ### 1. Mesh (Peer-to-Peer)
883
+ \`\`\`typescript
884
+ // Equal peers, distributed decision-making
885
+ await swarm.init({
886
+ topology: 'mesh',
887
+ agents: ['coder', 'tester', 'reviewer'],
888
+ communication: 'broadcast'
889
+ });
890
+ \`\`\`
891
+
892
+ ### 2. Hierarchical (Queen-Worker)
893
+ \`\`\`typescript
894
+ // Centralized coordination, specialized workers
895
+ await swarm.init({
896
+ topology: 'hierarchical',
897
+ queen: 'architect',
898
+ workers: ['backend-dev', 'frontend-dev', 'db-designer']
899
+ });
900
+ \`\`\`
901
+
902
+ ### 3. Adaptive (Dynamic)
903
+ \`\`\`typescript
904
+ // Automatically switches topology based on task
905
+ await swarm.init({
906
+ topology: 'adaptive',
907
+ optimization: 'task-complexity'
908
+ });
909
+ \`\`\`
910
+
911
+ ## Task Orchestration
912
+
913
+ ### Parallel Execution
914
+ \`\`\`typescript
915
+ // Execute tasks concurrently
916
+ const results = await swarm.execute({
917
+ tasks: [
918
+ { agent: 'coder', task: 'Implement API endpoints' },
919
+ { agent: 'frontend', task: 'Build UI components' },
920
+ { agent: 'tester', task: 'Write test suite' }
921
+ ],
922
+ mode: 'parallel',
923
+ timeout: 300000 // 5 minutes
924
+ });
925
+ \`\`\`
926
+
927
+ ### Pipeline Execution
928
+ \`\`\`typescript
929
+ // Sequential pipeline with dependencies
930
+ await swarm.pipeline([
931
+ { stage: 'design', agent: 'architect' },
932
+ { stage: 'implement', agent: 'coder', after: 'design' },
933
+ { stage: 'test', agent: 'tester', after: 'implement' },
934
+ { stage: 'review', agent: 'reviewer', after: 'test' }
935
+ ]);
936
+ \`\`\`
937
+
938
+ ### Adaptive Execution
939
+ \`\`\`typescript
940
+ // Let swarm decide execution strategy
941
+ await swarm.autoOrchestrate({
942
+ goal: 'Build production-ready API',
943
+ constraints: {
944
+ maxTime: 3600,
945
+ maxAgents: 8,
946
+ quality: 'high'
947
+ }
948
+ });
949
+ \`\`\`
950
+
951
+ ## Memory Coordination
952
+
953
+ \`\`\`typescript
954
+ // Share state across swarm
955
+ await swarm.memory.store('api-schema', {
956
+ endpoints: [...],
957
+ models: [...]
958
+ });
959
+
960
+ // Agents read shared memory
961
+ const schema = await swarm.memory.retrieve('api-schema');
962
+ \`\`\`
963
+
964
+ ## Advanced Features
965
+
966
+ ### Load Balancing
967
+ \`\`\`typescript
968
+ // Automatic work distribution
969
+ await swarm.enableLoadBalancing({
970
+ strategy: 'dynamic',
971
+ metrics: ['cpu', 'memory', 'task-queue']
972
+ });
973
+ \`\`\`
974
+
975
+ ### Fault Tolerance
976
+ \`\`\`typescript
977
+ // Handle agent failures
978
+ await swarm.setResiliency({
979
+ retry: { maxAttempts: 3, backoff: 'exponential' },
980
+ fallback: 'reassign-task'
981
+ });
982
+ \`\`\`
983
+
984
+ ### Performance Monitoring
985
+ \`\`\`typescript
986
+ // Track swarm metrics
987
+ const metrics = await swarm.getMetrics();
988
+ // { throughput, latency, success_rate, agent_utilization }
989
+ \`\`\`
990
+
991
+ ## Integration with Hooks
992
+
993
+ \`\`\`bash
994
+ # Pre-task coordination
995
+ npx agentic-flow hooks pre-task --description "Build API"
996
+
997
+ # Post-task synchronization
998
+ npx agentic-flow hooks post-task --task-id "task-123"
999
+
1000
+ # Session restore
1001
+ npx agentic-flow hooks session-restore --session-id "swarm-001"
1002
+ \`\`\`
1003
+
1004
+ ## Best Practices
1005
+
1006
+ 1. **Start small**: Begin with 2-3 agents, scale up
1007
+ 2. **Use memory**: Share context through swarm memory
1008
+ 3. **Monitor metrics**: Track performance and bottlenecks
1009
+ 4. **Enable hooks**: Automatic coordination and sync
1010
+ 5. **Set timeouts**: Prevent hung tasks
1011
+
1012
+ ## Troubleshooting
1013
+
1014
+ ### Issue: Agents not coordinating
1015
+ **Solution**: Verify memory access and enable hooks
1016
+
1017
+ ### Issue: Poor performance
1018
+ **Solution**: Check topology (use adaptive) and enable load balancing
1019
+
1020
+ ## Learn More
1021
+
1022
+ - Swarm Guide: docs/swarm/orchestration.md
1023
+ - Topology Patterns: docs/swarm/topologies.md
1024
+ - Hooks Integration: docs/hooks/coordination.md
1025
+ `;
1026
+ }
1027
+ /**
1028
+ * Create ReasoningBank skill
1029
+ */
1030
+ function createReasoningBankSkill() {
1031
+ return `---
1032
+ name: "ReasoningBank Intelligence"
1033
+ description: "Implement adaptive learning with ReasoningBank for pattern recognition, strategy optimization, and continuous improvement. Use when building self-learning agents, optimizing workflows, or implementing meta-cognitive systems."
1034
+ ---
1035
+
1036
+ # ReasoningBank Intelligence
1037
+
1038
+ ## What This Skill Does
1039
+
1040
+ Implements ReasoningBank's adaptive learning system for AI agents to learn from experience, recognize patterns, and optimize strategies over time. Enables meta-cognitive capabilities and continuous improvement.
1041
+
1042
+ ## Prerequisites
1043
+
1044
+ - agentic-flow v1.5.11+
1045
+ - AgentDB v1.0.4+ (for persistence)
1046
+ - Node.js 18+
1047
+
1048
+ ## Quick Start
1049
+
1050
+ \`\`\`typescript
1051
+ import { ReasoningBank } from 'agentic-flow/reasoningbank';
1052
+
1053
+ // Initialize ReasoningBank
1054
+ const rb = new ReasoningBank({
1055
+ persist: true,
1056
+ learningRate: 0.1,
1057
+ adapter: 'agentdb' // Use AgentDB for storage
1058
+ });
1059
+
1060
+ // Record task outcome
1061
+ await rb.recordExperience({
1062
+ task: 'code_review',
1063
+ approach: 'static_analysis_first',
1064
+ outcome: {
1065
+ success: true,
1066
+ metrics: {
1067
+ bugs_found: 5,
1068
+ time_taken: 120,
1069
+ false_positives: 1
1070
+ }
1071
+ },
1072
+ context: {
1073
+ language: 'typescript',
1074
+ complexity: 'medium'
1075
+ }
1076
+ });
1077
+
1078
+ // Get optimal strategy
1079
+ const strategy = await rb.recommendStrategy('code_review', {
1080
+ language: 'typescript',
1081
+ complexity: 'high'
1082
+ });
1083
+ \`\`\`
1084
+
1085
+ ## Core Features
1086
+
1087
+ ### 1. Pattern Recognition
1088
+ \`\`\`typescript
1089
+ // Learn patterns from data
1090
+ await rb.learnPattern({
1091
+ pattern: 'api_errors_increase_after_deploy',
1092
+ triggers: ['deployment', 'traffic_spike'],
1093
+ actions: ['rollback', 'scale_up'],
1094
+ confidence: 0.85
1095
+ });
1096
+
1097
+ // Match patterns
1098
+ const matches = await rb.matchPatterns(currentSituation);
1099
+ \`\`\`
1100
+
1101
+ ### 2. Strategy Optimization
1102
+ \`\`\`typescript
1103
+ // Compare strategies
1104
+ const comparison = await rb.compareStrategies('bug_fixing', [
1105
+ 'tdd_approach',
1106
+ 'debug_first',
1107
+ 'reproduce_then_fix'
1108
+ ]);
1109
+
1110
+ // Get best strategy
1111
+ const best = comparison.strategies[0];
1112
+ console.log(\`Best: \${best.name} (score: \${best.score})\`);
1113
+ \`\`\`
1114
+
1115
+ ### 3. Continuous Learning
1116
+ \`\`\`typescript
1117
+ // Enable auto-learning from all tasks
1118
+ await rb.enableAutoLearning({
1119
+ threshold: 0.7, // Only learn from high-confidence outcomes
1120
+ updateFrequency: 100 // Update models every 100 experiences
1121
+ });
1122
+ \`\`\`
1123
+
1124
+ ## Advanced Usage
1125
+
1126
+ ### Meta-Learning
1127
+ \`\`\`typescript
1128
+ // Learn about learning
1129
+ await rb.metaLearn({
1130
+ observation: 'parallel_execution_faster_for_independent_tasks',
1131
+ confidence: 0.95,
1132
+ applicability: {
1133
+ task_types: ['batch_processing', 'data_transformation'],
1134
+ conditions: ['tasks_independent', 'io_bound']
1135
+ }
1136
+ });
1137
+ \`\`\`
1138
+
1139
+ ### Transfer Learning
1140
+ \`\`\`typescript
1141
+ // Apply knowledge from one domain to another
1142
+ await rb.transferKnowledge({
1143
+ from: 'code_review_javascript',
1144
+ to: 'code_review_typescript',
1145
+ similarity: 0.8
1146
+ });
1147
+ \`\`\`
1148
+
1149
+ ### Adaptive Agents
1150
+ \`\`\`typescript
1151
+ // Create self-improving agent
1152
+ class AdaptiveAgent {
1153
+ async execute(task: Task) {
1154
+ // Get optimal strategy
1155
+ const strategy = await rb.recommendStrategy(task.type, task.context);
1156
+
1157
+ // Execute with strategy
1158
+ const result = await this.executeWithStrategy(task, strategy);
1159
+
1160
+ // Learn from outcome
1161
+ await rb.recordExperience({
1162
+ task: task.type,
1163
+ approach: strategy.name,
1164
+ outcome: result,
1165
+ context: task.context
1166
+ });
1167
+
1168
+ return result;
1169
+ }
1170
+ }
1171
+ \`\`\`
1172
+
1173
+ ## Integration with AgentDB
1174
+
1175
+ \`\`\`typescript
1176
+ // Persist ReasoningBank data
1177
+ await rb.configure({
1178
+ storage: {
1179
+ type: 'agentdb',
1180
+ options: {
1181
+ database: './reasoning-bank.db',
1182
+ enableVectorSearch: true
1183
+ }
1184
+ }
1185
+ });
1186
+
1187
+ // Query learned patterns
1188
+ const patterns = await rb.query({
1189
+ category: 'optimization',
1190
+ minConfidence: 0.8,
1191
+ timeRange: { last: '30d' }
1192
+ });
1193
+ \`\`\`
1194
+
1195
+ ## Performance Metrics
1196
+
1197
+ \`\`\`typescript
1198
+ // Track learning effectiveness
1199
+ const metrics = await rb.getMetrics();
1200
+ console.log(\`
1201
+ Total Experiences: \${metrics.totalExperiences}
1202
+ Patterns Learned: \${metrics.patternsLearned}
1203
+ Strategy Success Rate: \${metrics.strategySuccessRate}
1204
+ Improvement Over Time: \${metrics.improvement}
1205
+ \`);
1206
+ \`\`\`
1207
+
1208
+ ## Best Practices
1209
+
1210
+ 1. **Record consistently**: Log all task outcomes, not just successes
1211
+ 2. **Provide context**: Rich context improves pattern matching
1212
+ 3. **Set thresholds**: Filter low-confidence learnings
1213
+ 4. **Review periodically**: Audit learned patterns for quality
1214
+ 5. **Use vector search**: Enable semantic pattern matching
1215
+
1216
+ ## Troubleshooting
1217
+
1218
+ ### Issue: Poor recommendations
1219
+ **Solution**: Ensure sufficient training data (100+ experiences per task type)
1220
+
1221
+ ### Issue: Slow pattern matching
1222
+ **Solution**: Enable vector indexing in AgentDB
1223
+
1224
+ ### Issue: Memory growing large
1225
+ **Solution**: Set TTL for old experiences or enable pruning
1226
+
1227
+ ## Learn More
1228
+
1229
+ - ReasoningBank Guide: agentic-flow/src/reasoningbank/README.md
1230
+ - AgentDB Integration: packages/agentdb/docs/reasoningbank.md
1231
+ - Pattern Learning: docs/reasoning/patterns.md
1232
+ `;
1233
+ }
1234
+ /**
1235
+ * Print skills help
1236
+ */
1237
+ function printSkillsHelp() {
1238
+ console.log(`
1239
+ ${chalk.bold.cyan('🎨 agentic-flow Skills Manager')}
1240
+
1241
+ ${chalk.white('USAGE:')}
1242
+ npx agentic-flow skills <command> [options]
1243
+
1244
+ ${chalk.white('COMMANDS:')}
1245
+ ${chalk.cyan('init')} [location] [--with-builder]
1246
+ Initialize skills directories
1247
+ location: personal | project | both (default: both)
1248
+ --with-builder: Also install skill-builder framework
1249
+
1250
+ ${chalk.cyan('init-builder')} [location]
1251
+ Install skill-builder framework only
1252
+ location: personal | project | both (default: project)
1253
+
1254
+ ${chalk.cyan('list')} List all installed skills
1255
+
1256
+ ${chalk.cyan('create')} Create example agentic-flow skills
1257
+ (AgentDB, swarm orchestration, reasoning bank)
1258
+
1259
+ ${chalk.cyan('help')} Show this help message
1260
+
1261
+ ${chalk.white('SKILLS LOCATIONS:')}
1262
+ ${chalk.gray('Personal:')} ~/.claude/skills/ (Available across all projects)
1263
+ ${chalk.gray('Project:')} <project>/.claude/skills/ (Team-shared, version controlled)
1264
+
1265
+ ${chalk.white('EXAMPLES:')}
1266
+ # Initialize with skill-builder
1267
+ npx agentic-flow skills init --with-builder
1268
+
1269
+ # Install skill-builder only
1270
+ npx agentic-flow skills init-builder
1271
+
1272
+ # Create agentic-flow specific skills
1273
+ npx agentic-flow skills create
1274
+
1275
+ # List all installed skills
1276
+ npx agentic-flow skills list
1277
+
1278
+ ${chalk.white('SKILL-BUILDER FEATURES:')}
1279
+ • Complete Claude Code Skills specification
1280
+ • Interactive skill generator script
1281
+ • 10-step validation script
1282
+ • Templates (minimal + full-featured)
1283
+ • JSON schema for validation
1284
+ • Official Anthropic docs included
1285
+
1286
+ ${chalk.white('DOCUMENTATION:')}
1287
+ Plan: docs/plans/skills/SKILLS_PLAN.md
1288
+ Roadmap: docs/plans/skills/IMPLEMENTATION_ROADMAP.md
1289
+ Builder: .claude/skills/skill-builder/README.md
1290
+
1291
+ ${chalk.white('HOW IT WORKS:')}
1292
+ 1. Skills are auto-detected by Claude Code on startup
1293
+ 2. Claude loads name + description into system prompt
1294
+ 3. When triggered, Claude reads SKILL.md from filesystem
1295
+ 4. Only active skill enters context (zero penalty for 100+ skills)
1296
+ `);
1297
+ }