agentic-flow 1.6.5 → 1.7.2
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 +5 -0
- package/.claude/settings.json +20 -19
- package/.claude/skills/.claude-flow/metrics/agent-metrics.json +1 -0
- package/.claude/skills/.claude-flow/metrics/performance.json +87 -0
- package/.claude/skills/.claude-flow/metrics/task-metrics.json +10 -0
- package/.claude/skills/agentdb-memory-patterns/SKILL.md +166 -0
- package/.claude/skills/agentdb-vector-search/SKILL.md +126 -0
- package/.claude/skills/agentic-flow/agentdb-memory-patterns/SKILL.md +166 -0
- package/.claude/skills/agentic-flow/agentdb-vector-search/SKILL.md +126 -0
- package/.claude/skills/agentic-flow/reasoningbank-intelligence/SKILL.md +201 -0
- package/.claude/skills/agentic-flow/swarm-orchestration/SKILL.md +179 -0
- package/.claude/skills/reasoningbank-intelligence/SKILL.md +201 -0
- package/.claude/skills/skill-builder/.claude-flow/metrics/agent-metrics.json +1 -0
- package/.claude/skills/skill-builder/.claude-flow/metrics/performance.json +87 -0
- package/.claude/skills/skill-builder/.claude-flow/metrics/task-metrics.json +10 -0
- package/.claude/skills/skill-builder/README.md +308 -0
- package/.claude/skills/skill-builder/SKILL.md +910 -0
- package/.claude/skills/skill-builder/docs/SPECIFICATION.md +358 -0
- package/.claude/skills/skill-builder/resources/schemas/skill-frontmatter.schema.json +41 -0
- package/.claude/skills/skill-builder/resources/templates/full-skill.template +118 -0
- package/.claude/skills/skill-builder/resources/templates/minimal-skill.template +38 -0
- package/.claude/skills/skill-builder/scripts/generate-skill.sh +334 -0
- package/.claude/skills/skill-builder/scripts/validate-skill.sh +198 -0
- package/.claude/skills/swarm-orchestration/SKILL.md +179 -0
- package/CHANGELOG.md +71 -0
- package/README.md +79 -1
- package/dist/cli/skills-manager.js +1295 -0
- package/dist/cli/update-message.js +175 -0
- package/dist/cli-proxy.js +8 -1
- package/dist/utils/cli.js +17 -0
- package/package.json +2 -2
- package/wasm/reasoningbank/reasoningbank_wasm_bg.js +2 -2
- package/wasm/reasoningbank/reasoningbank_wasm_bg.wasm +0 -0
- package/.claude/answer.md +0 -1
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "AgentDB Vector Search"
|
|
3
|
+
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."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# AgentDB Vector Search
|
|
7
|
+
|
|
8
|
+
## What This Skill Does
|
|
9
|
+
|
|
10
|
+
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.
|
|
11
|
+
|
|
12
|
+
## Prerequisites
|
|
13
|
+
|
|
14
|
+
- agentic-flow v1.5.11+ or agentdb v1.0.4+
|
|
15
|
+
- Node.js 18+
|
|
16
|
+
- OpenAI API key (for embeddings) or custom embedding model
|
|
17
|
+
|
|
18
|
+
## Quick Start
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
import { AgentDB } from 'agentdb';
|
|
22
|
+
|
|
23
|
+
// Initialize AgentDB with vector support
|
|
24
|
+
const db = new AgentDB({
|
|
25
|
+
persist: true,
|
|
26
|
+
vectorDimensions: 1536, // OpenAI ada-002 dimensions
|
|
27
|
+
enableVectorIndex: true
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
// Store documents with vectors
|
|
31
|
+
await db.storeMemory({
|
|
32
|
+
text: "The quantum computer achieved 100 qubits",
|
|
33
|
+
metadata: { category: "technology", date: "2025-01-15" },
|
|
34
|
+
embedding: await generateEmbedding(text) // Your embedding function
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
// Semantic search
|
|
38
|
+
const results = await db.searchSimilar(
|
|
39
|
+
queryEmbedding,
|
|
40
|
+
{ limit: 10, threshold: 0.7 }
|
|
41
|
+
);
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Core Features
|
|
45
|
+
|
|
46
|
+
### 1. Vector Storage
|
|
47
|
+
```typescript
|
|
48
|
+
// Store with automatic embedding
|
|
49
|
+
await db.storeWithEmbedding({
|
|
50
|
+
content: "Your document text",
|
|
51
|
+
metadata: { source: "docs", page: 42 }
|
|
52
|
+
});
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### 2. Similarity Search
|
|
56
|
+
```typescript
|
|
57
|
+
// Find similar documents
|
|
58
|
+
const similar = await db.findSimilar("quantum computing", {
|
|
59
|
+
limit: 5,
|
|
60
|
+
minScore: 0.75
|
|
61
|
+
});
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### 3. Hybrid Search (Vector + Metadata)
|
|
65
|
+
```typescript
|
|
66
|
+
// Combine vector similarity with metadata filtering
|
|
67
|
+
const results = await db.hybridSearch({
|
|
68
|
+
query: "machine learning models",
|
|
69
|
+
filters: {
|
|
70
|
+
category: "research",
|
|
71
|
+
date: { $gte: "2024-01-01" }
|
|
72
|
+
},
|
|
73
|
+
limit: 20
|
|
74
|
+
});
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Advanced Usage
|
|
78
|
+
|
|
79
|
+
### RAG (Retrieval Augmented Generation)
|
|
80
|
+
```typescript
|
|
81
|
+
// Build RAG pipeline
|
|
82
|
+
async function ragQuery(question: string) {
|
|
83
|
+
// 1. Get relevant context
|
|
84
|
+
const context = await db.searchSimilar(
|
|
85
|
+
await embed(question),
|
|
86
|
+
{ limit: 5, threshold: 0.7 }
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
// 2. Generate answer with context
|
|
90
|
+
const prompt = `Context: ${context.map(c => c.text).join('\n')}
|
|
91
|
+
Question: ${question}`;
|
|
92
|
+
|
|
93
|
+
return await llm.generate(prompt);
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Batch Operations
|
|
98
|
+
```typescript
|
|
99
|
+
// Efficient batch storage
|
|
100
|
+
await db.batchStore(documents.map(doc => ({
|
|
101
|
+
text: doc.content,
|
|
102
|
+
embedding: doc.vector,
|
|
103
|
+
metadata: doc.meta
|
|
104
|
+
})));
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Performance Tips
|
|
108
|
+
|
|
109
|
+
- **Indexing**: Enable vector index for 10-100x faster searches
|
|
110
|
+
- **Batch Size**: Use batch operations for 1000+ documents
|
|
111
|
+
- **Dimensions**: Match embedding model (1536 for OpenAI ada-002)
|
|
112
|
+
- **Threshold**: Start at 0.7 for quality results
|
|
113
|
+
|
|
114
|
+
## Troubleshooting
|
|
115
|
+
|
|
116
|
+
### Issue: Slow search performance
|
|
117
|
+
**Solution**: Enable vector index: `enableVectorIndex: true`
|
|
118
|
+
|
|
119
|
+
### Issue: Poor relevance
|
|
120
|
+
**Solution**: Adjust similarity threshold or use hybrid search
|
|
121
|
+
|
|
122
|
+
## Learn More
|
|
123
|
+
|
|
124
|
+
- AgentDB Docs: packages/agentdb/README.md
|
|
125
|
+
- Vector DB API: packages/agentdb/docs/vector-api.md
|
|
126
|
+
- Performance Guide: docs/agentdb/performance.md
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "ReasoningBank Intelligence"
|
|
3
|
+
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."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# ReasoningBank Intelligence
|
|
7
|
+
|
|
8
|
+
## What This Skill Does
|
|
9
|
+
|
|
10
|
+
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.
|
|
11
|
+
|
|
12
|
+
## Prerequisites
|
|
13
|
+
|
|
14
|
+
- agentic-flow v1.5.11+
|
|
15
|
+
- AgentDB v1.0.4+ (for persistence)
|
|
16
|
+
- Node.js 18+
|
|
17
|
+
|
|
18
|
+
## Quick Start
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
import { ReasoningBank } from 'agentic-flow/reasoningbank';
|
|
22
|
+
|
|
23
|
+
// Initialize ReasoningBank
|
|
24
|
+
const rb = new ReasoningBank({
|
|
25
|
+
persist: true,
|
|
26
|
+
learningRate: 0.1,
|
|
27
|
+
adapter: 'agentdb' // Use AgentDB for storage
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
// Record task outcome
|
|
31
|
+
await rb.recordExperience({
|
|
32
|
+
task: 'code_review',
|
|
33
|
+
approach: 'static_analysis_first',
|
|
34
|
+
outcome: {
|
|
35
|
+
success: true,
|
|
36
|
+
metrics: {
|
|
37
|
+
bugs_found: 5,
|
|
38
|
+
time_taken: 120,
|
|
39
|
+
false_positives: 1
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
context: {
|
|
43
|
+
language: 'typescript',
|
|
44
|
+
complexity: 'medium'
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// Get optimal strategy
|
|
49
|
+
const strategy = await rb.recommendStrategy('code_review', {
|
|
50
|
+
language: 'typescript',
|
|
51
|
+
complexity: 'high'
|
|
52
|
+
});
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Core Features
|
|
56
|
+
|
|
57
|
+
### 1. Pattern Recognition
|
|
58
|
+
```typescript
|
|
59
|
+
// Learn patterns from data
|
|
60
|
+
await rb.learnPattern({
|
|
61
|
+
pattern: 'api_errors_increase_after_deploy',
|
|
62
|
+
triggers: ['deployment', 'traffic_spike'],
|
|
63
|
+
actions: ['rollback', 'scale_up'],
|
|
64
|
+
confidence: 0.85
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
// Match patterns
|
|
68
|
+
const matches = await rb.matchPatterns(currentSituation);
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### 2. Strategy Optimization
|
|
72
|
+
```typescript
|
|
73
|
+
// Compare strategies
|
|
74
|
+
const comparison = await rb.compareStrategies('bug_fixing', [
|
|
75
|
+
'tdd_approach',
|
|
76
|
+
'debug_first',
|
|
77
|
+
'reproduce_then_fix'
|
|
78
|
+
]);
|
|
79
|
+
|
|
80
|
+
// Get best strategy
|
|
81
|
+
const best = comparison.strategies[0];
|
|
82
|
+
console.log(`Best: ${best.name} (score: ${best.score})`);
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### 3. Continuous Learning
|
|
86
|
+
```typescript
|
|
87
|
+
// Enable auto-learning from all tasks
|
|
88
|
+
await rb.enableAutoLearning({
|
|
89
|
+
threshold: 0.7, // Only learn from high-confidence outcomes
|
|
90
|
+
updateFrequency: 100 // Update models every 100 experiences
|
|
91
|
+
});
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Advanced Usage
|
|
95
|
+
|
|
96
|
+
### Meta-Learning
|
|
97
|
+
```typescript
|
|
98
|
+
// Learn about learning
|
|
99
|
+
await rb.metaLearn({
|
|
100
|
+
observation: 'parallel_execution_faster_for_independent_tasks',
|
|
101
|
+
confidence: 0.95,
|
|
102
|
+
applicability: {
|
|
103
|
+
task_types: ['batch_processing', 'data_transformation'],
|
|
104
|
+
conditions: ['tasks_independent', 'io_bound']
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Transfer Learning
|
|
110
|
+
```typescript
|
|
111
|
+
// Apply knowledge from one domain to another
|
|
112
|
+
await rb.transferKnowledge({
|
|
113
|
+
from: 'code_review_javascript',
|
|
114
|
+
to: 'code_review_typescript',
|
|
115
|
+
similarity: 0.8
|
|
116
|
+
});
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Adaptive Agents
|
|
120
|
+
```typescript
|
|
121
|
+
// Create self-improving agent
|
|
122
|
+
class AdaptiveAgent {
|
|
123
|
+
async execute(task: Task) {
|
|
124
|
+
// Get optimal strategy
|
|
125
|
+
const strategy = await rb.recommendStrategy(task.type, task.context);
|
|
126
|
+
|
|
127
|
+
// Execute with strategy
|
|
128
|
+
const result = await this.executeWithStrategy(task, strategy);
|
|
129
|
+
|
|
130
|
+
// Learn from outcome
|
|
131
|
+
await rb.recordExperience({
|
|
132
|
+
task: task.type,
|
|
133
|
+
approach: strategy.name,
|
|
134
|
+
outcome: result,
|
|
135
|
+
context: task.context
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
return result;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Integration with AgentDB
|
|
144
|
+
|
|
145
|
+
```typescript
|
|
146
|
+
// Persist ReasoningBank data
|
|
147
|
+
await rb.configure({
|
|
148
|
+
storage: {
|
|
149
|
+
type: 'agentdb',
|
|
150
|
+
options: {
|
|
151
|
+
database: './reasoning-bank.db',
|
|
152
|
+
enableVectorSearch: true
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
// Query learned patterns
|
|
158
|
+
const patterns = await rb.query({
|
|
159
|
+
category: 'optimization',
|
|
160
|
+
minConfidence: 0.8,
|
|
161
|
+
timeRange: { last: '30d' }
|
|
162
|
+
});
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## Performance Metrics
|
|
166
|
+
|
|
167
|
+
```typescript
|
|
168
|
+
// Track learning effectiveness
|
|
169
|
+
const metrics = await rb.getMetrics();
|
|
170
|
+
console.log(`
|
|
171
|
+
Total Experiences: ${metrics.totalExperiences}
|
|
172
|
+
Patterns Learned: ${metrics.patternsLearned}
|
|
173
|
+
Strategy Success Rate: ${metrics.strategySuccessRate}
|
|
174
|
+
Improvement Over Time: ${metrics.improvement}
|
|
175
|
+
`);
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## Best Practices
|
|
179
|
+
|
|
180
|
+
1. **Record consistently**: Log all task outcomes, not just successes
|
|
181
|
+
2. **Provide context**: Rich context improves pattern matching
|
|
182
|
+
3. **Set thresholds**: Filter low-confidence learnings
|
|
183
|
+
4. **Review periodically**: Audit learned patterns for quality
|
|
184
|
+
5. **Use vector search**: Enable semantic pattern matching
|
|
185
|
+
|
|
186
|
+
## Troubleshooting
|
|
187
|
+
|
|
188
|
+
### Issue: Poor recommendations
|
|
189
|
+
**Solution**: Ensure sufficient training data (100+ experiences per task type)
|
|
190
|
+
|
|
191
|
+
### Issue: Slow pattern matching
|
|
192
|
+
**Solution**: Enable vector indexing in AgentDB
|
|
193
|
+
|
|
194
|
+
### Issue: Memory growing large
|
|
195
|
+
**Solution**: Set TTL for old experiences or enable pruning
|
|
196
|
+
|
|
197
|
+
## Learn More
|
|
198
|
+
|
|
199
|
+
- ReasoningBank Guide: agentic-flow/src/reasoningbank/README.md
|
|
200
|
+
- AgentDB Integration: packages/agentdb/docs/reasoningbank.md
|
|
201
|
+
- Pattern Learning: docs/reasoning/patterns.md
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "Swarm Orchestration"
|
|
3
|
+
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."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Swarm Orchestration
|
|
7
|
+
|
|
8
|
+
## What This Skill Does
|
|
9
|
+
|
|
10
|
+
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.
|
|
11
|
+
|
|
12
|
+
## Prerequisites
|
|
13
|
+
|
|
14
|
+
- agentic-flow v1.5.11+
|
|
15
|
+
- Node.js 18+
|
|
16
|
+
- Understanding of distributed systems (helpful)
|
|
17
|
+
|
|
18
|
+
## Quick Start
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# Initialize swarm
|
|
22
|
+
npx agentic-flow hooks swarm-init --topology mesh --max-agents 5
|
|
23
|
+
|
|
24
|
+
# Spawn agents
|
|
25
|
+
npx agentic-flow hooks agent-spawn --type coder
|
|
26
|
+
npx agentic-flow hooks agent-spawn --type tester
|
|
27
|
+
npx agentic-flow hooks agent-spawn --type reviewer
|
|
28
|
+
|
|
29
|
+
# Orchestrate task
|
|
30
|
+
npx agentic-flow hooks task-orchestrate \
|
|
31
|
+
--task "Build REST API with tests" \
|
|
32
|
+
--mode parallel
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Topology Patterns
|
|
36
|
+
|
|
37
|
+
### 1. Mesh (Peer-to-Peer)
|
|
38
|
+
```typescript
|
|
39
|
+
// Equal peers, distributed decision-making
|
|
40
|
+
await swarm.init({
|
|
41
|
+
topology: 'mesh',
|
|
42
|
+
agents: ['coder', 'tester', 'reviewer'],
|
|
43
|
+
communication: 'broadcast'
|
|
44
|
+
});
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### 2. Hierarchical (Queen-Worker)
|
|
48
|
+
```typescript
|
|
49
|
+
// Centralized coordination, specialized workers
|
|
50
|
+
await swarm.init({
|
|
51
|
+
topology: 'hierarchical',
|
|
52
|
+
queen: 'architect',
|
|
53
|
+
workers: ['backend-dev', 'frontend-dev', 'db-designer']
|
|
54
|
+
});
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### 3. Adaptive (Dynamic)
|
|
58
|
+
```typescript
|
|
59
|
+
// Automatically switches topology based on task
|
|
60
|
+
await swarm.init({
|
|
61
|
+
topology: 'adaptive',
|
|
62
|
+
optimization: 'task-complexity'
|
|
63
|
+
});
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Task Orchestration
|
|
67
|
+
|
|
68
|
+
### Parallel Execution
|
|
69
|
+
```typescript
|
|
70
|
+
// Execute tasks concurrently
|
|
71
|
+
const results = await swarm.execute({
|
|
72
|
+
tasks: [
|
|
73
|
+
{ agent: 'coder', task: 'Implement API endpoints' },
|
|
74
|
+
{ agent: 'frontend', task: 'Build UI components' },
|
|
75
|
+
{ agent: 'tester', task: 'Write test suite' }
|
|
76
|
+
],
|
|
77
|
+
mode: 'parallel',
|
|
78
|
+
timeout: 300000 // 5 minutes
|
|
79
|
+
});
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Pipeline Execution
|
|
83
|
+
```typescript
|
|
84
|
+
// Sequential pipeline with dependencies
|
|
85
|
+
await swarm.pipeline([
|
|
86
|
+
{ stage: 'design', agent: 'architect' },
|
|
87
|
+
{ stage: 'implement', agent: 'coder', after: 'design' },
|
|
88
|
+
{ stage: 'test', agent: 'tester', after: 'implement' },
|
|
89
|
+
{ stage: 'review', agent: 'reviewer', after: 'test' }
|
|
90
|
+
]);
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Adaptive Execution
|
|
94
|
+
```typescript
|
|
95
|
+
// Let swarm decide execution strategy
|
|
96
|
+
await swarm.autoOrchestrate({
|
|
97
|
+
goal: 'Build production-ready API',
|
|
98
|
+
constraints: {
|
|
99
|
+
maxTime: 3600,
|
|
100
|
+
maxAgents: 8,
|
|
101
|
+
quality: 'high'
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Memory Coordination
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
// Share state across swarm
|
|
110
|
+
await swarm.memory.store('api-schema', {
|
|
111
|
+
endpoints: [...],
|
|
112
|
+
models: [...]
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
// Agents read shared memory
|
|
116
|
+
const schema = await swarm.memory.retrieve('api-schema');
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Advanced Features
|
|
120
|
+
|
|
121
|
+
### Load Balancing
|
|
122
|
+
```typescript
|
|
123
|
+
// Automatic work distribution
|
|
124
|
+
await swarm.enableLoadBalancing({
|
|
125
|
+
strategy: 'dynamic',
|
|
126
|
+
metrics: ['cpu', 'memory', 'task-queue']
|
|
127
|
+
});
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Fault Tolerance
|
|
131
|
+
```typescript
|
|
132
|
+
// Handle agent failures
|
|
133
|
+
await swarm.setResiliency({
|
|
134
|
+
retry: { maxAttempts: 3, backoff: 'exponential' },
|
|
135
|
+
fallback: 'reassign-task'
|
|
136
|
+
});
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Performance Monitoring
|
|
140
|
+
```typescript
|
|
141
|
+
// Track swarm metrics
|
|
142
|
+
const metrics = await swarm.getMetrics();
|
|
143
|
+
// { throughput, latency, success_rate, agent_utilization }
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Integration with Hooks
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
# Pre-task coordination
|
|
150
|
+
npx agentic-flow hooks pre-task --description "Build API"
|
|
151
|
+
|
|
152
|
+
# Post-task synchronization
|
|
153
|
+
npx agentic-flow hooks post-task --task-id "task-123"
|
|
154
|
+
|
|
155
|
+
# Session restore
|
|
156
|
+
npx agentic-flow hooks session-restore --session-id "swarm-001"
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Best Practices
|
|
160
|
+
|
|
161
|
+
1. **Start small**: Begin with 2-3 agents, scale up
|
|
162
|
+
2. **Use memory**: Share context through swarm memory
|
|
163
|
+
3. **Monitor metrics**: Track performance and bottlenecks
|
|
164
|
+
4. **Enable hooks**: Automatic coordination and sync
|
|
165
|
+
5. **Set timeouts**: Prevent hung tasks
|
|
166
|
+
|
|
167
|
+
## Troubleshooting
|
|
168
|
+
|
|
169
|
+
### Issue: Agents not coordinating
|
|
170
|
+
**Solution**: Verify memory access and enable hooks
|
|
171
|
+
|
|
172
|
+
### Issue: Poor performance
|
|
173
|
+
**Solution**: Check topology (use adaptive) and enable load balancing
|
|
174
|
+
|
|
175
|
+
## Learn More
|
|
176
|
+
|
|
177
|
+
- Swarm Guide: docs/swarm/orchestration.md
|
|
178
|
+
- Topology Patterns: docs/swarm/topologies.md
|
|
179
|
+
- Hooks Integration: docs/hooks/coordination.md
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "ReasoningBank Intelligence"
|
|
3
|
+
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."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# ReasoningBank Intelligence
|
|
7
|
+
|
|
8
|
+
## What This Skill Does
|
|
9
|
+
|
|
10
|
+
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.
|
|
11
|
+
|
|
12
|
+
## Prerequisites
|
|
13
|
+
|
|
14
|
+
- agentic-flow v1.5.11+
|
|
15
|
+
- AgentDB v1.0.4+ (for persistence)
|
|
16
|
+
- Node.js 18+
|
|
17
|
+
|
|
18
|
+
## Quick Start
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
import { ReasoningBank } from 'agentic-flow/reasoningbank';
|
|
22
|
+
|
|
23
|
+
// Initialize ReasoningBank
|
|
24
|
+
const rb = new ReasoningBank({
|
|
25
|
+
persist: true,
|
|
26
|
+
learningRate: 0.1,
|
|
27
|
+
adapter: 'agentdb' // Use AgentDB for storage
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
// Record task outcome
|
|
31
|
+
await rb.recordExperience({
|
|
32
|
+
task: 'code_review',
|
|
33
|
+
approach: 'static_analysis_first',
|
|
34
|
+
outcome: {
|
|
35
|
+
success: true,
|
|
36
|
+
metrics: {
|
|
37
|
+
bugs_found: 5,
|
|
38
|
+
time_taken: 120,
|
|
39
|
+
false_positives: 1
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
context: {
|
|
43
|
+
language: 'typescript',
|
|
44
|
+
complexity: 'medium'
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// Get optimal strategy
|
|
49
|
+
const strategy = await rb.recommendStrategy('code_review', {
|
|
50
|
+
language: 'typescript',
|
|
51
|
+
complexity: 'high'
|
|
52
|
+
});
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Core Features
|
|
56
|
+
|
|
57
|
+
### 1. Pattern Recognition
|
|
58
|
+
```typescript
|
|
59
|
+
// Learn patterns from data
|
|
60
|
+
await rb.learnPattern({
|
|
61
|
+
pattern: 'api_errors_increase_after_deploy',
|
|
62
|
+
triggers: ['deployment', 'traffic_spike'],
|
|
63
|
+
actions: ['rollback', 'scale_up'],
|
|
64
|
+
confidence: 0.85
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
// Match patterns
|
|
68
|
+
const matches = await rb.matchPatterns(currentSituation);
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### 2. Strategy Optimization
|
|
72
|
+
```typescript
|
|
73
|
+
// Compare strategies
|
|
74
|
+
const comparison = await rb.compareStrategies('bug_fixing', [
|
|
75
|
+
'tdd_approach',
|
|
76
|
+
'debug_first',
|
|
77
|
+
'reproduce_then_fix'
|
|
78
|
+
]);
|
|
79
|
+
|
|
80
|
+
// Get best strategy
|
|
81
|
+
const best = comparison.strategies[0];
|
|
82
|
+
console.log(`Best: ${best.name} (score: ${best.score})`);
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### 3. Continuous Learning
|
|
86
|
+
```typescript
|
|
87
|
+
// Enable auto-learning from all tasks
|
|
88
|
+
await rb.enableAutoLearning({
|
|
89
|
+
threshold: 0.7, // Only learn from high-confidence outcomes
|
|
90
|
+
updateFrequency: 100 // Update models every 100 experiences
|
|
91
|
+
});
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Advanced Usage
|
|
95
|
+
|
|
96
|
+
### Meta-Learning
|
|
97
|
+
```typescript
|
|
98
|
+
// Learn about learning
|
|
99
|
+
await rb.metaLearn({
|
|
100
|
+
observation: 'parallel_execution_faster_for_independent_tasks',
|
|
101
|
+
confidence: 0.95,
|
|
102
|
+
applicability: {
|
|
103
|
+
task_types: ['batch_processing', 'data_transformation'],
|
|
104
|
+
conditions: ['tasks_independent', 'io_bound']
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Transfer Learning
|
|
110
|
+
```typescript
|
|
111
|
+
// Apply knowledge from one domain to another
|
|
112
|
+
await rb.transferKnowledge({
|
|
113
|
+
from: 'code_review_javascript',
|
|
114
|
+
to: 'code_review_typescript',
|
|
115
|
+
similarity: 0.8
|
|
116
|
+
});
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Adaptive Agents
|
|
120
|
+
```typescript
|
|
121
|
+
// Create self-improving agent
|
|
122
|
+
class AdaptiveAgent {
|
|
123
|
+
async execute(task: Task) {
|
|
124
|
+
// Get optimal strategy
|
|
125
|
+
const strategy = await rb.recommendStrategy(task.type, task.context);
|
|
126
|
+
|
|
127
|
+
// Execute with strategy
|
|
128
|
+
const result = await this.executeWithStrategy(task, strategy);
|
|
129
|
+
|
|
130
|
+
// Learn from outcome
|
|
131
|
+
await rb.recordExperience({
|
|
132
|
+
task: task.type,
|
|
133
|
+
approach: strategy.name,
|
|
134
|
+
outcome: result,
|
|
135
|
+
context: task.context
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
return result;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Integration with AgentDB
|
|
144
|
+
|
|
145
|
+
```typescript
|
|
146
|
+
// Persist ReasoningBank data
|
|
147
|
+
await rb.configure({
|
|
148
|
+
storage: {
|
|
149
|
+
type: 'agentdb',
|
|
150
|
+
options: {
|
|
151
|
+
database: './reasoning-bank.db',
|
|
152
|
+
enableVectorSearch: true
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
// Query learned patterns
|
|
158
|
+
const patterns = await rb.query({
|
|
159
|
+
category: 'optimization',
|
|
160
|
+
minConfidence: 0.8,
|
|
161
|
+
timeRange: { last: '30d' }
|
|
162
|
+
});
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## Performance Metrics
|
|
166
|
+
|
|
167
|
+
```typescript
|
|
168
|
+
// Track learning effectiveness
|
|
169
|
+
const metrics = await rb.getMetrics();
|
|
170
|
+
console.log(`
|
|
171
|
+
Total Experiences: ${metrics.totalExperiences}
|
|
172
|
+
Patterns Learned: ${metrics.patternsLearned}
|
|
173
|
+
Strategy Success Rate: ${metrics.strategySuccessRate}
|
|
174
|
+
Improvement Over Time: ${metrics.improvement}
|
|
175
|
+
`);
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## Best Practices
|
|
179
|
+
|
|
180
|
+
1. **Record consistently**: Log all task outcomes, not just successes
|
|
181
|
+
2. **Provide context**: Rich context improves pattern matching
|
|
182
|
+
3. **Set thresholds**: Filter low-confidence learnings
|
|
183
|
+
4. **Review periodically**: Audit learned patterns for quality
|
|
184
|
+
5. **Use vector search**: Enable semantic pattern matching
|
|
185
|
+
|
|
186
|
+
## Troubleshooting
|
|
187
|
+
|
|
188
|
+
### Issue: Poor recommendations
|
|
189
|
+
**Solution**: Ensure sufficient training data (100+ experiences per task type)
|
|
190
|
+
|
|
191
|
+
### Issue: Slow pattern matching
|
|
192
|
+
**Solution**: Enable vector indexing in AgentDB
|
|
193
|
+
|
|
194
|
+
### Issue: Memory growing large
|
|
195
|
+
**Solution**: Set TTL for old experiences or enable pruning
|
|
196
|
+
|
|
197
|
+
## Learn More
|
|
198
|
+
|
|
199
|
+
- ReasoningBank Guide: agentic-flow/src/reasoningbank/README.md
|
|
200
|
+
- AgentDB Integration: packages/agentdb/docs/reasoningbank.md
|
|
201
|
+
- Pattern Learning: docs/reasoning/patterns.md
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|