agentic-flow 2.0.14 → 2.1.0
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/CHANGELOG.md +87 -0
- package/README.md +376 -186
- package/dist/.tsbuildinfo +1 -1
- package/dist/agent-booster/index.d.ts +14 -0
- package/dist/agent-booster/index.d.ts.map +1 -0
- package/dist/agent-booster/index.js +25 -0
- package/dist/agent-booster/index.js.map +1 -0
- package/dist/harness/provenance.d.ts +72 -0
- package/dist/harness/provenance.d.ts.map +1 -0
- package/dist/harness/provenance.js +92 -0
- package/dist/harness/provenance.js.map +1 -0
- package/dist/mcp/standalone-stdio.js +4 -0
- package/dist/mcp/standalone-stdio.js.map +1 -1
- package/dist/mcp/tools/harness-tools.d.ts +28 -0
- package/dist/mcp/tools/harness-tools.d.ts.map +1 -0
- package/dist/mcp/tools/harness-tools.js +90 -0
- package/dist/mcp/tools/harness-tools.js.map +1 -0
- package/dist/optimizations/configuration-tuning.d.ts +1 -1
- package/dist/repair/cli.d.ts +24 -0
- package/dist/repair/cli.d.ts.map +1 -0
- package/dist/repair/cli.js +69 -0
- package/dist/repair/cli.js.map +1 -0
- package/dist/repair/darwin-repair.d.ts +80 -0
- package/dist/repair/darwin-repair.d.ts.map +1 -0
- package/dist/repair/darwin-repair.js +81 -0
- package/dist/repair/darwin-repair.js.map +1 -0
- package/dist/router/cost-optimal-router.d.ts +89 -0
- package/dist/router/cost-optimal-router.d.ts.map +1 -0
- package/dist/router/cost-optimal-router.js +94 -0
- package/dist/router/cost-optimal-router.js.map +1 -0
- package/dist/router/router.d.ts +29 -0
- package/dist/router/router.d.ts.map +1 -1
- package/dist/router/router.js +83 -0
- package/dist/router/router.js.map +1 -1
- package/dist/router/types.d.ts +1 -1
- package/dist/router/types.d.ts.map +1 -1
- package/dist/router/types.js.map +1 -1
- package/dist/transport/quic-loader.d.ts +33 -0
- package/dist/transport/quic-loader.d.ts.map +1 -1
- package/dist/transport/quic-loader.js +95 -0
- package/dist/transport/quic-loader.js.map +1 -1
- package/package.json +17 -3
package/README.md
CHANGED
|
@@ -1,12 +1,23 @@
|
|
|
1
|
-
# 🚀 Agentic-Flow v2
|
|
1
|
+
# 🚀 Agentic-Flow v2 — the Agentic Meta-Harness
|
|
2
2
|
|
|
3
|
-
> **
|
|
3
|
+
> **Freeze the model, evolve the harness.** Agentic-Flow is an open _agentic meta-harness_: a runtime whose product is the **harness around a model**, not the model. It routes each query to the cost-optimal model, evolves its own harness and autonomously repairs code, then orchestrates 66 self-learning agents, 213 MCP tools, and multi-agent swarms on top.
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/agentic-flow)
|
|
6
6
|
[](https://opensource.org/licenses/MIT)
|
|
7
7
|
[](https://www.typescriptlang.org/)
|
|
8
8
|
[](https://nodejs.org/)
|
|
9
9
|
|
|
10
|
+
### The four pillars of the meta-harness
|
|
11
|
+
|
|
12
|
+
| Pillar | What it does | Powered by |
|
|
13
|
+
| ------------------ | --------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
|
|
14
|
+
| 🧭 **Route** | Send each query to the _cheapest model predicted to clear a quality bar_, learned from eval logs | `@metaharness/router` ([ADR-073](docs/adr/ADR-073-metaharness-router-cost-optimal-model-routing.md)) |
|
|
15
|
+
| 🧬 **Evolve** | Improve the harness itself (planner/context/reviewer/retry/tool/memory/score) and autonomously repair code — same model, better results | `@metaharness/darwin` ([ADR-074](docs/adr/ADR-074-metaharness-darwin-test-driven-repair.md)) |
|
|
16
|
+
| 🤝 **Orchestrate** | Run 66 agents, 213 MCP tools, ReasoningBank memory, and multi-agent swarms | Claude Agent SDK + AgentDB |
|
|
17
|
+
| 🔏 **Verify** | Frozen scorer + safety gate on every harness change; signed harness provenance | Darwin safety gate ([ADR-075](docs/adr/ADR-075-metaharness-harness-evolution-and-provenance.md)) |
|
|
18
|
+
|
|
19
|
+
> **Why a meta-harness?** The measured lever in modern agentic systems is the _harness_, not a bigger model: a cheap model in a well-built, self-improving harness matches a frontier model at a fraction of the cost (see the [DRACO/Darwin](https://github.com/ruvnet/agent-harness-generator) findings). Agentic-Flow is the open runtime that operates that harness.
|
|
20
|
+
|
|
10
21
|
---
|
|
11
22
|
|
|
12
23
|
## ⚡ Quick Start (60 seconds)
|
|
@@ -23,6 +34,7 @@ claude
|
|
|
23
34
|
```
|
|
24
35
|
|
|
25
36
|
That's it! Your project now has:
|
|
37
|
+
|
|
26
38
|
- 🧠 **Self-learning hooks** that improve agent routing over time
|
|
27
39
|
- 🤖 **80+ specialized agents** (coder, tester, reviewer, architect, etc.)
|
|
28
40
|
- ⚡ **Background workers** triggered by keywords (ultralearn, optimize, audit)
|
|
@@ -47,13 +59,13 @@ npx agentic-flow mcp start
|
|
|
47
59
|
### Use in Code
|
|
48
60
|
|
|
49
61
|
```typescript
|
|
50
|
-
import { AgenticFlow } from
|
|
62
|
+
import { AgenticFlow } from "agentic-flow";
|
|
51
63
|
|
|
52
64
|
const flow = new AgenticFlow();
|
|
53
65
|
await flow.initialize();
|
|
54
66
|
|
|
55
67
|
// Route task to best agent
|
|
56
|
-
const result = await flow.route(
|
|
68
|
+
const result = await flow.route("Fix the login bug");
|
|
57
69
|
console.log(`Best agent: ${result.agent} (${result.confidence}% confidence)`);
|
|
58
70
|
```
|
|
59
71
|
|
|
@@ -64,14 +76,14 @@ Build systems, IDEs, and CI can drive orchestration **in-process** without spawn
|
|
|
64
76
|
**Generic client** (recommended for build agents — stable input/output: task description, memory seed, paths, provenance):
|
|
65
77
|
|
|
66
78
|
```ts
|
|
67
|
-
import { createOrchestrationClient } from
|
|
79
|
+
import { createOrchestrationClient } from "agentic-flow/orchestration";
|
|
68
80
|
|
|
69
|
-
const client = createOrchestrationClient({ config: { backend:
|
|
81
|
+
const client = createOrchestrationClient({ config: { backend: "safe-exec" } });
|
|
70
82
|
const { runId } = await client.startRun({
|
|
71
|
-
taskDescription:
|
|
72
|
-
acceptanceCriteria: [
|
|
73
|
-
allowedPaths: [
|
|
74
|
-
provenance: { runId:
|
|
83
|
+
taskDescription: "Your task",
|
|
84
|
+
acceptanceCriteria: ["Tests pass"],
|
|
85
|
+
allowedPaths: ["src/"],
|
|
86
|
+
provenance: { runId: "build-1", cardId: "card-42" },
|
|
75
87
|
});
|
|
76
88
|
const status = await client.getStatus(runId);
|
|
77
89
|
```
|
|
@@ -105,6 +117,75 @@ Agentic-Flow v2 now includes **ALL** advanced vector/graph, GNN, and attention c
|
|
|
105
117
|
|
|
106
118
|
**Performance Grade: A+ (100% Pass Rate)**
|
|
107
119
|
|
|
120
|
+
### **Cost-Optimal Model Routing (ADR-073)** 💰
|
|
121
|
+
|
|
122
|
+
Route each query to the **cheapest model predicted to clear a quality bar**, learned
|
|
123
|
+
from your own eval logs — the productized [DRACO](https://github.com/ruvnet/agent-harness-generator)
|
|
124
|
+
finding, powered by [`@metaharness/router`](https://www.npmjs.com/package/@metaharness/router)
|
|
125
|
+
(dependency-free k-NN / kernel-ridge, optional native FastGRNN via the already-bundled
|
|
126
|
+
`@ruvector/tiny-dancer`). This is **additive** to the existing config-rule routing — it
|
|
127
|
+
selects a _model_ by predicted cost-quality rather than a provider by static rule, and
|
|
128
|
+
degrades gracefully to best-predicted on a cold start.
|
|
129
|
+
|
|
130
|
+
```ts
|
|
131
|
+
import { ModelRouter } from "agentic-flow";
|
|
132
|
+
import { CostOptimalRouter } from "agentic-flow/router/cost-optimal";
|
|
133
|
+
|
|
134
|
+
// Build from your eval logs: rows of (query embedding → quality each model achieved)
|
|
135
|
+
const router = CostOptimalRouter.fromDataset(
|
|
136
|
+
rows,
|
|
137
|
+
{
|
|
138
|
+
"anthropic/claude-haiku-4.5": 1, // $/Mtok
|
|
139
|
+
"anthropic/claude-sonnet-4.5": 3,
|
|
140
|
+
"anthropic/claude-opus-4": 15,
|
|
141
|
+
},
|
|
142
|
+
{ qualityBar: 0.8 },
|
|
143
|
+
);
|
|
144
|
+
|
|
145
|
+
const model = new ModelRouter();
|
|
146
|
+
model.enableCostOptimalRouting({ router, embed: yourEmbedder });
|
|
147
|
+
// chat() now routes each query to the cheapest model predicted to clear 0.8.
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
**Measured** (`node benchmarks/cost-optimal-router-benchmark.mjs`, 3-tier lineup,
|
|
151
|
+
1000-query held-out test, bar=0.8):
|
|
152
|
+
|
|
153
|
+
| Strategy | avg $/query | mean quality | % ≥ bar |
|
|
154
|
+
| ---------------- | ----------- | ------------ | --------- |
|
|
155
|
+
| always-haiku | 1.00 | 0.412 | 14.1% |
|
|
156
|
+
| always-opus | 15.00 | 0.930 | 100% |
|
|
157
|
+
| **cost-optimal** | **10.73** | **0.895** | **98.1%** |
|
|
158
|
+
|
|
159
|
+
→ **28.5% cheaper than always-opus** while holding **98.1%** of queries at/above the bar.
|
|
160
|
+
Routing decision latency: **p50 73µs · p99 125µs**.
|
|
161
|
+
|
|
162
|
+
### **Autonomous Repair — Darwin Mode (ADR-074)** 🔧
|
|
163
|
+
|
|
164
|
+
Freeze the model, **evolve the harness**: `@metaharness/darwin` mutates one policy
|
|
165
|
+
surface at a time (planner / context / reviewer / retry / tool / memory / score),
|
|
166
|
+
tests each in a **shell-free, env-scrubbed sandbox**, and keeps only what
|
|
167
|
+
_measurably_ improves under a frozen scorer + safety gate. Exposed as a typed
|
|
168
|
+
`repair()` wrapper and the `agentic-flow-repair` CLI:
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
# Test-Driven Repair: the repo's own tests gate every promotion
|
|
172
|
+
npx agentic-flow-repair ./my-repo --generations 3
|
|
173
|
+
# Deterministic, Docker-free smoke run
|
|
174
|
+
npx agentic-flow-repair ./my-repo --mock
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
```ts
|
|
178
|
+
import { repair } from "agentic-flow/repair";
|
|
179
|
+
const result = await repair({ repoRoot: "./my-repo", generations: 3 }); // sandbox 'real'
|
|
180
|
+
// → { improved, winnerId, winnerLineage, baselineScore, winnerScore, deltaOverBaseline }
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
The sandbox is consistent with the repo's CWE-78 hardening (test command run via
|
|
184
|
+
`execFile`, never a shell; only `PATH` + identifying vars reach a variant). The
|
|
185
|
+
headline SWE-bench-Lite TDR _product_ (≈68.3% with-test, ~$0.01–0.08/instance)
|
|
186
|
+
additionally needs the official `swebench` Docker harness — see
|
|
187
|
+
[ADR-074](docs/adr/ADR-074-metaharness-darwin-test-driven-repair.md).
|
|
188
|
+
|
|
108
189
|
---
|
|
109
190
|
|
|
110
191
|
## 📖 Table of Contents
|
|
@@ -128,30 +209,35 @@ Agentic-Flow v2 now includes **ALL** advanced vector/graph, GNN, and attention c
|
|
|
128
209
|
### 🎓 SONA: Self-Optimizing Neural Architecture
|
|
129
210
|
|
|
130
211
|
**Adaptive Learning** (<1ms Overhead)
|
|
212
|
+
|
|
131
213
|
- Sub-millisecond pattern learning and retrieval
|
|
132
214
|
- 300x faster than traditional approaches (150ms → 0.5ms)
|
|
133
215
|
- Real-time adaptation during task execution
|
|
134
216
|
- No performance degradation
|
|
135
217
|
|
|
136
218
|
**LoRA Fine-Tuning** (99% Parameter Reduction)
|
|
219
|
+
|
|
137
220
|
- Rank-2 Micro-LoRA: 2211 ops/sec
|
|
138
221
|
- Rank-16 Base-LoRA: +55% quality improvement
|
|
139
222
|
- 10-100x faster training than full fine-tuning
|
|
140
223
|
- Minimal memory footprint (<5MB for edge devices)
|
|
141
224
|
|
|
142
225
|
**Continual Learning** (EWC++)
|
|
226
|
+
|
|
143
227
|
- No catastrophic forgetting
|
|
144
228
|
- Learn new tasks while preserving old knowledge
|
|
145
229
|
- EWC lambda 2000-2500 for optimal memory preservation
|
|
146
230
|
- Cross-agent pattern sharing
|
|
147
231
|
|
|
148
232
|
**LLM Router** (60% Cost Savings)
|
|
233
|
+
|
|
149
234
|
- Intelligent model selection (Sonnet vs Haiku)
|
|
150
235
|
- Quality-aware routing (0.8-0.95 quality scores)
|
|
151
236
|
- Budget constraints and fallback handling
|
|
152
237
|
- $720/month → $288/month savings
|
|
153
238
|
|
|
154
239
|
**Quality Improvements by Domain**:
|
|
240
|
+
|
|
155
241
|
- Code tasks: +5.0%
|
|
156
242
|
- Creative writing: +4.3%
|
|
157
243
|
- Reasoning: +3.6%
|
|
@@ -159,6 +245,7 @@ Agentic-Flow v2 now includes **ALL** advanced vector/graph, GNN, and attention c
|
|
|
159
245
|
- Math: +1.2%
|
|
160
246
|
|
|
161
247
|
**5 Configuration Profiles**:
|
|
248
|
+
|
|
162
249
|
- **Real-Time**: 2200 ops/sec, <0.5ms latency
|
|
163
250
|
- **Batch**: Balance throughput & adaptation
|
|
164
251
|
- **Research**: +55% quality (maximum)
|
|
@@ -168,32 +255,38 @@ Agentic-Flow v2 now includes **ALL** advanced vector/graph, GNN, and attention c
|
|
|
168
255
|
### 🧠 Advanced Attention Mechanisms
|
|
169
256
|
|
|
170
257
|
**Flash Attention** (Production-Ready)
|
|
258
|
+
|
|
171
259
|
- 2.49x speedup in JavaScript runtime
|
|
172
260
|
- 7.47x speedup with NAPI runtime
|
|
173
261
|
- 50-75% memory reduction
|
|
174
262
|
- <0.1ms latency for all operations
|
|
175
263
|
|
|
176
264
|
**Multi-Head Attention** (Standard Transformer)
|
|
265
|
+
|
|
177
266
|
- 8-head configuration
|
|
178
267
|
- Compatible with existing systems
|
|
179
268
|
- <0.1ms latency
|
|
180
269
|
|
|
181
270
|
**Linear Attention** (Scalable)
|
|
271
|
+
|
|
182
272
|
- O(n) complexity
|
|
183
273
|
- Perfect for long sequences (>2048 tokens)
|
|
184
274
|
- <0.1ms latency
|
|
185
275
|
|
|
186
276
|
**Hyperbolic Attention** (Hierarchical)
|
|
277
|
+
|
|
187
278
|
- Models hierarchical structures
|
|
188
279
|
- Queen-worker swarm coordination
|
|
189
280
|
- <0.1ms latency
|
|
190
281
|
|
|
191
282
|
**MoE Attention** (Expert Routing)
|
|
283
|
+
|
|
192
284
|
- Sparse expert activation
|
|
193
285
|
- Multi-agent routing
|
|
194
286
|
- <0.1ms latency
|
|
195
287
|
|
|
196
288
|
**GraphRoPE** (Topology-Aware)
|
|
289
|
+
|
|
197
290
|
- Graph structure awareness
|
|
198
291
|
- Swarm coordination
|
|
199
292
|
- <0.1ms latency
|
|
@@ -208,12 +301,14 @@ Agentic-Flow v2 now includes **ALL** advanced vector/graph, GNN, and attention c
|
|
|
208
301
|
### 🤖 66 Self-Learning Specialized Agents
|
|
209
302
|
|
|
210
303
|
**All agents now feature v2.0.0-alpha self-learning capabilities**:
|
|
304
|
+
|
|
211
305
|
- 🧠 **ReasoningBank Integration**: Learn from past successes and failures
|
|
212
306
|
- 🎯 **GNN-Enhanced Context**: +12.4% better accuracy in finding relevant information
|
|
213
307
|
- ⚡ **Flash Attention**: 2.49x-7.47x faster processing
|
|
214
308
|
- 🤝 **Attention Coordination**: Smarter multi-agent consensus
|
|
215
309
|
|
|
216
310
|
**Core Development** (Self-Learning Enabled)
|
|
311
|
+
|
|
217
312
|
- `coder` - Learns code patterns, implements faster with GNN context
|
|
218
313
|
- `reviewer` - Pattern-based issue detection, attention consensus reviews
|
|
219
314
|
- `tester` - Learns from test failures, generates comprehensive tests
|
|
@@ -221,6 +316,7 @@ Agentic-Flow v2 now includes **ALL** advanced vector/graph, GNN, and attention c
|
|
|
221
316
|
- `researcher` - GNN-enhanced pattern recognition, attention synthesis
|
|
222
317
|
|
|
223
318
|
**Swarm Coordination** (Advanced Attention Mechanisms)
|
|
319
|
+
|
|
224
320
|
- `hierarchical-coordinator` - Hyperbolic attention for queen-worker models
|
|
225
321
|
- `mesh-coordinator` - Multi-head attention for peer consensus
|
|
226
322
|
- `adaptive-coordinator` - Dynamic mechanism selection (flash/multi-head/linear/hyperbolic/moe)
|
|
@@ -228,14 +324,17 @@ Agentic-Flow v2 now includes **ALL** advanced vector/graph, GNN, and attention c
|
|
|
228
324
|
- `swarm-memory-manager` - Cross-agent learning patterns
|
|
229
325
|
|
|
230
326
|
**Consensus & Distributed**
|
|
327
|
+
|
|
231
328
|
- `byzantine-coordinator`, `raft-manager`, `gossip-coordinator`
|
|
232
329
|
- `crdt-synchronizer`, `quorum-manager`, `security-manager`
|
|
233
330
|
|
|
234
331
|
**Performance & Optimization**
|
|
332
|
+
|
|
235
333
|
- `perf-analyzer`, `performance-benchmarker`, `task-orchestrator`
|
|
236
334
|
- `memory-coordinator`, `smart-agent`
|
|
237
335
|
|
|
238
336
|
**GitHub & Repository** (Intelligent Code Analysis)
|
|
337
|
+
|
|
239
338
|
- `pr-manager` - Smart merge strategies, attention-based conflict resolution
|
|
240
339
|
- `code-review-swarm` - Pattern-based issue detection, GNN code search
|
|
241
340
|
- `issue-tracker` - Smart classification, attention priority ranking
|
|
@@ -243,6 +342,7 @@ Agentic-Flow v2 now includes **ALL** advanced vector/graph, GNN, and attention c
|
|
|
243
342
|
- `workflow-automation` - Pattern-based workflow generation
|
|
244
343
|
|
|
245
344
|
**SPARC Methodology** (Continuous Improvement)
|
|
345
|
+
|
|
246
346
|
- `specification` - Learn from past specs, GNN requirement analysis
|
|
247
347
|
- `pseudocode` - Algorithm pattern library, MoE optimization
|
|
248
348
|
- `architecture` - Flash attention for large docs, pattern-based design
|
|
@@ -297,24 +397,28 @@ Agentic-Flow v2 now includes **ALL** advanced vector/graph, GNN, and attention c
|
|
|
297
397
|
### For Developers
|
|
298
398
|
|
|
299
399
|
✅ **Faster Development**
|
|
400
|
+
|
|
300
401
|
- Pre-built agents for common tasks
|
|
301
402
|
- Auto-spawning based on file types
|
|
302
403
|
- Smart code completion and editing
|
|
303
404
|
- 352x faster local code edits with Agent Booster
|
|
304
405
|
|
|
305
406
|
✅ **Better Performance**
|
|
407
|
+
|
|
306
408
|
- 2.49x-7.47x speedup with Flash Attention
|
|
307
409
|
- 150x-12,500x faster vector search
|
|
308
410
|
- 50% memory reduction for long sequences
|
|
309
411
|
- <0.1ms latency for all attention operations
|
|
310
412
|
|
|
311
413
|
✅ **Easier Integration**
|
|
414
|
+
|
|
312
415
|
- Type-safe TypeScript APIs
|
|
313
416
|
- Comprehensive documentation (2,500+ lines)
|
|
314
417
|
- Quick start guides and examples
|
|
315
418
|
- 100% backward compatible
|
|
316
419
|
|
|
317
420
|
✅ **Production-Ready**
|
|
421
|
+
|
|
318
422
|
- Battle-tested in real-world scenarios
|
|
319
423
|
- Enterprise-grade error handling
|
|
320
424
|
- Performance metrics tracking
|
|
@@ -323,24 +427,28 @@ Agentic-Flow v2 now includes **ALL** advanced vector/graph, GNN, and attention c
|
|
|
323
427
|
### For Businesses
|
|
324
428
|
|
|
325
429
|
💰 **Cost Savings**
|
|
430
|
+
|
|
326
431
|
- 32.3% token reduction with smart coordination
|
|
327
432
|
- Faster task completion (2.8-4.4x speedup)
|
|
328
433
|
- Reduced infrastructure costs
|
|
329
434
|
- Open-source, no vendor lock-in
|
|
330
435
|
|
|
331
436
|
📈 **Scalability**
|
|
437
|
+
|
|
332
438
|
- Horizontal scaling with swarm coordination
|
|
333
439
|
- Distributed consensus protocols
|
|
334
440
|
- Dynamic topology optimization
|
|
335
441
|
- Auto-scaling based on load
|
|
336
442
|
|
|
337
443
|
🔒 **Security**
|
|
444
|
+
|
|
338
445
|
- Quantum-resistant cryptography
|
|
339
446
|
- Byzantine fault tolerance
|
|
340
447
|
- Ed25519 signature verification
|
|
341
448
|
- Secure QUIC transport
|
|
342
449
|
|
|
343
450
|
🎯 **Competitive Advantage**
|
|
451
|
+
|
|
344
452
|
- State-of-the-art attention mechanisms
|
|
345
453
|
- +12.4% better recall with GNN
|
|
346
454
|
- Attention-based multi-agent consensus
|
|
@@ -349,6 +457,7 @@ Agentic-Flow v2 now includes **ALL** advanced vector/graph, GNN, and attention c
|
|
|
349
457
|
### For Researchers
|
|
350
458
|
|
|
351
459
|
🔬 **Cutting-Edge Features**
|
|
460
|
+
|
|
352
461
|
- Flash Attention implementation
|
|
353
462
|
- GNN query refinement
|
|
354
463
|
- Hyperbolic attention for hierarchies
|
|
@@ -356,12 +465,14 @@ Agentic-Flow v2 now includes **ALL** advanced vector/graph, GNN, and attention c
|
|
|
356
465
|
- GraphRoPE position embeddings
|
|
357
466
|
|
|
358
467
|
📊 **Comprehensive Benchmarks**
|
|
468
|
+
|
|
359
469
|
- Grade A performance validation
|
|
360
470
|
- Detailed performance analysis
|
|
361
471
|
- Open benchmark suite
|
|
362
472
|
- Reproducible results
|
|
363
473
|
|
|
364
474
|
🧪 **Extensible Architecture**
|
|
475
|
+
|
|
365
476
|
- Modular design
|
|
366
477
|
- Custom agent creation
|
|
367
478
|
- Plugin system
|
|
@@ -406,6 +517,7 @@ console.log(`Best solution: ${response.consensus}`);
|
|
|
406
517
|
```
|
|
407
518
|
|
|
408
519
|
**Benefits**:
|
|
520
|
+
|
|
409
521
|
- 2.49x faster response times
|
|
410
522
|
- +12.4% better solution accuracy
|
|
411
523
|
- Handles 50% more concurrent requests
|
|
@@ -414,27 +526,32 @@ console.log(`Best solution: ${response.consensus}`);
|
|
|
414
526
|
#### 2. **Automated Code Review & CI/CD**
|
|
415
527
|
|
|
416
528
|
```typescript
|
|
417
|
-
import { Task } from
|
|
529
|
+
import { Task } from "agentic-flow";
|
|
418
530
|
|
|
419
531
|
// Spawn parallel code review agents
|
|
420
532
|
await Promise.all([
|
|
421
|
-
Task(
|
|
422
|
-
Task(
|
|
423
|
-
|
|
424
|
-
|
|
533
|
+
Task("Security Auditor", "Review for vulnerabilities", "reviewer"),
|
|
534
|
+
Task(
|
|
535
|
+
"Performance Analyzer",
|
|
536
|
+
"Check optimization opportunities",
|
|
537
|
+
"perf-analyzer",
|
|
538
|
+
),
|
|
539
|
+
Task("Style Checker", "Verify code standards", "code-analyzer"),
|
|
540
|
+
Task("Test Engineer", "Validate test coverage", "tester"),
|
|
425
541
|
]);
|
|
426
542
|
|
|
427
543
|
// Automatic PR creation and management
|
|
428
|
-
import { mcp__claude_flow__github_pr_manage } from
|
|
544
|
+
import { mcp__claude_flow__github_pr_manage } from "agentic-flow/mcp";
|
|
429
545
|
|
|
430
546
|
await mcp__claude_flow__github_pr_manage({
|
|
431
|
-
repo:
|
|
432
|
-
action:
|
|
547
|
+
repo: "company/product",
|
|
548
|
+
action: "review",
|
|
433
549
|
pr_number: 123,
|
|
434
550
|
});
|
|
435
551
|
```
|
|
436
552
|
|
|
437
553
|
**Benefits**:
|
|
554
|
+
|
|
438
555
|
- 84.8% SWE-Bench solve rate
|
|
439
556
|
- 2.8-4.4x faster code reviews
|
|
440
557
|
- Parallel agent execution
|
|
@@ -464,6 +581,7 @@ const specializedRecs = await coordinator.routeToExperts(
|
|
|
464
581
|
```
|
|
465
582
|
|
|
466
583
|
**Benefits**:
|
|
584
|
+
|
|
467
585
|
- Better recommendations with hierarchical attention
|
|
468
586
|
- Specialized agents for different product categories
|
|
469
587
|
- 50% memory reduction for large catalogs
|
|
@@ -478,7 +596,7 @@ const specializedRecs = await coordinator.routeToExperts(
|
|
|
478
596
|
const paperAnalysis = await wrapper.linearAttention(
|
|
479
597
|
queryEmbedding,
|
|
480
598
|
paperSectionEmbeddings,
|
|
481
|
-
paperSectionEmbeddings
|
|
599
|
+
paperSectionEmbeddings,
|
|
482
600
|
);
|
|
483
601
|
|
|
484
602
|
// GNN-enhanced citation network search
|
|
@@ -496,6 +614,7 @@ console.log(`Recall improved by ${relatedPapers.improvementPercent}%`);
|
|
|
496
614
|
```
|
|
497
615
|
|
|
498
616
|
**Benefits**:
|
|
617
|
+
|
|
499
618
|
- O(n) complexity for long documents
|
|
500
619
|
- +12.4% better citation discovery
|
|
501
620
|
- Graph-aware literature search
|
|
@@ -534,6 +653,7 @@ console.log(`Top contributors: ${consensus.topAgents.map(a => a.agentId)}`);
|
|
|
534
653
|
```
|
|
535
654
|
|
|
536
655
|
**Benefits**:
|
|
656
|
+
|
|
537
657
|
- Models hierarchical research structures
|
|
538
658
|
- Queens (PIs) have higher influence
|
|
539
659
|
- Better consensus than simple voting
|
|
@@ -544,14 +664,14 @@ console.log(`Top contributors: ${consensus.topAgents.map(a => a.agentId)}`);
|
|
|
544
664
|
```typescript
|
|
545
665
|
// Use attention-based multi-agent analysis
|
|
546
666
|
const dataAnalysisAgents = [
|
|
547
|
-
{ agentId:
|
|
548
|
-
{ agentId:
|
|
549
|
-
{ agentId:
|
|
667
|
+
{ agentId: "statistician", output: "p < 0.05", embedding: statEmbed },
|
|
668
|
+
{ agentId: "ml-expert", output: "95% accuracy", embedding: mlEmbed },
|
|
669
|
+
{ agentId: "domain-expert", output: "Novel finding", embedding: domainEmbed },
|
|
550
670
|
];
|
|
551
671
|
|
|
552
672
|
const analysis = await coordinator.coordinateAgents(
|
|
553
673
|
dataAnalysisAgents,
|
|
554
|
-
|
|
674
|
+
"flash", // 2.49x faster
|
|
555
675
|
);
|
|
556
676
|
|
|
557
677
|
console.log(`Consensus analysis: ${analysis.consensus}`);
|
|
@@ -559,6 +679,7 @@ console.log(`Confidence scores: ${analysis.attentionWeights}`);
|
|
|
559
679
|
```
|
|
560
680
|
|
|
561
681
|
**Benefits**:
|
|
682
|
+
|
|
562
683
|
- Multi-perspective data analysis
|
|
563
684
|
- Attention-weighted consensus
|
|
564
685
|
- 2.49x faster coordination
|
|
@@ -585,6 +706,7 @@ console.log(`Pipeline result: ${docPipeline.consensus}`);
|
|
|
585
706
|
```
|
|
586
707
|
|
|
587
708
|
**Benefits**:
|
|
709
|
+
|
|
588
710
|
- Topology-aware coordination (ring, mesh, hierarchical, star)
|
|
589
711
|
- GraphRoPE position embeddings
|
|
590
712
|
- <0.1ms coordination latency
|
|
@@ -594,17 +716,14 @@ console.log(`Pipeline result: ${docPipeline.consensus}`);
|
|
|
594
716
|
|
|
595
717
|
```typescript
|
|
596
718
|
// Fast, accurate enterprise search
|
|
597
|
-
const searchResults = await wrapper.gnnEnhancedSearch(
|
|
598
|
-
|
|
599
|
-
{
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
},
|
|
606
|
-
}
|
|
607
|
-
);
|
|
719
|
+
const searchResults = await wrapper.gnnEnhancedSearch(searchQuery, {
|
|
720
|
+
k: 50,
|
|
721
|
+
graphContext: {
|
|
722
|
+
nodes: documentEmbeddings,
|
|
723
|
+
edges: documentRelations,
|
|
724
|
+
edgeWeights: relevanceScores,
|
|
725
|
+
},
|
|
726
|
+
});
|
|
608
727
|
|
|
609
728
|
console.log(`Found ${searchResults.results.length} documents`);
|
|
610
729
|
console.log(`Baseline recall: ${searchResults.originalRecall}`);
|
|
@@ -613,6 +732,7 @@ console.log(`Improvement: +${searchResults.improvementPercent}%`);
|
|
|
613
732
|
```
|
|
614
733
|
|
|
615
734
|
**Benefits**:
|
|
735
|
+
|
|
616
736
|
- 150x-12,500x faster than brute force
|
|
617
737
|
- +12.4% better recall with GNN
|
|
618
738
|
- Graph-aware document relations
|
|
@@ -621,25 +741,24 @@ console.log(`Improvement: +${searchResults.improvementPercent}%`);
|
|
|
621
741
|
#### 3. **Intelligent Workflow Automation**
|
|
622
742
|
|
|
623
743
|
```typescript
|
|
624
|
-
import { mcp__claude_flow__workflow_create } from
|
|
744
|
+
import { mcp__claude_flow__workflow_create } from "agentic-flow/mcp";
|
|
625
745
|
|
|
626
746
|
// Create automated workflow
|
|
627
747
|
await mcp__claude_flow__workflow_create({
|
|
628
|
-
name:
|
|
748
|
+
name: "invoice-processing",
|
|
629
749
|
steps: [
|
|
630
|
-
{ agent:
|
|
631
|
-
{ agent:
|
|
632
|
-
{ agent:
|
|
633
|
-
{ agent:
|
|
634
|
-
{ agent:
|
|
635
|
-
],
|
|
636
|
-
triggers: [
|
|
637
|
-
{ event: 'email-received', pattern: 'invoice.*\\.pdf' },
|
|
750
|
+
{ agent: "ocr", task: "Extract text from PDF" },
|
|
751
|
+
{ agent: "nlp", task: "Parse invoice fields" },
|
|
752
|
+
{ agent: "validator", task: "Validate amounts" },
|
|
753
|
+
{ agent: "accountant", task: "Record in ledger" },
|
|
754
|
+
{ agent: "notifier", task: "Send confirmation email" },
|
|
638
755
|
],
|
|
756
|
+
triggers: [{ event: "email-received", pattern: "invoice.*\\.pdf" }],
|
|
639
757
|
});
|
|
640
758
|
```
|
|
641
759
|
|
|
642
760
|
**Benefits**:
|
|
761
|
+
|
|
643
762
|
- Event-driven automation
|
|
644
763
|
- Multi-agent task orchestration
|
|
645
764
|
- Error handling and recovery
|
|
@@ -651,66 +770,66 @@ await mcp__claude_flow__workflow_create({
|
|
|
651
770
|
|
|
652
771
|
### Flash Attention Performance (Grade A)
|
|
653
772
|
|
|
654
|
-
| Metric
|
|
655
|
-
|
|
656
|
-
| **Speedup (JS Runtime)**
|
|
657
|
-
| **Speedup (NAPI Runtime)** | 4.0x+
|
|
658
|
-
| **Memory Reduction**
|
|
659
|
-
| **Latency (P50)**
|
|
773
|
+
| Metric | Target | Achieved | Status |
|
|
774
|
+
| -------------------------- | --------- | ---------- | --------- |
|
|
775
|
+
| **Speedup (JS Runtime)** | 1.5x-4.0x | **2.49x** | ✅ PASS |
|
|
776
|
+
| **Speedup (NAPI Runtime)** | 4.0x+ | **7.47x** | ✅ EXCEED |
|
|
777
|
+
| **Memory Reduction** | 50%-75% | **~50%** | ✅ PASS |
|
|
778
|
+
| **Latency (P50)** | <50ms | **<0.1ms** | ✅ EXCEED |
|
|
660
779
|
|
|
661
780
|
**Overall Grade: A (100% Pass Rate)**
|
|
662
781
|
|
|
663
782
|
### All Attention Mechanisms
|
|
664
783
|
|
|
665
|
-
| Mechanism
|
|
666
|
-
|
|
667
|
-
| **Flash**
|
|
668
|
-
| **Multi-Head** | 0.07ms
|
|
669
|
-
| **Linear**
|
|
670
|
-
| **Hyperbolic** | 0.06ms
|
|
671
|
-
| **MoE**
|
|
672
|
-
| **GraphRoPE**
|
|
784
|
+
| Mechanism | Avg Latency | Min | Max | Target | Status |
|
|
785
|
+
| -------------- | ----------- | ------ | ------ | ------ | --------- |
|
|
786
|
+
| **Flash** | 0.00ms | 0.00ms | 0.00ms | <50ms | ✅ EXCEED |
|
|
787
|
+
| **Multi-Head** | 0.07ms | 0.07ms | 0.08ms | <100ms | ✅ EXCEED |
|
|
788
|
+
| **Linear** | 0.03ms | 0.03ms | 0.04ms | <100ms | ✅ EXCEED |
|
|
789
|
+
| **Hyperbolic** | 0.06ms | 0.06ms | 0.06ms | <100ms | ✅ EXCEED |
|
|
790
|
+
| **MoE** | 0.04ms | 0.04ms | 0.04ms | <150ms | ✅ EXCEED |
|
|
791
|
+
| **GraphRoPE** | 0.05ms | 0.04ms | 0.05ms | <100ms | ✅ EXCEED |
|
|
673
792
|
|
|
674
793
|
### Flash vs Multi-Head Speedup by Candidate Count
|
|
675
794
|
|
|
676
|
-
| Candidates
|
|
677
|
-
|
|
678
|
-
| 10
|
|
679
|
-
| 50
|
|
680
|
-
| 100
|
|
681
|
-
| 200
|
|
682
|
-
| **Average** | -
|
|
795
|
+
| Candidates | Flash Time | Multi-Head Time | Speedup | Status |
|
|
796
|
+
| ----------- | ---------- | --------------- | --------- | ------ |
|
|
797
|
+
| 10 | 0.03ms | 0.08ms | **2.77x** | ✅ |
|
|
798
|
+
| 50 | 0.07ms | 0.08ms | **1.13x** | ⚠️ |
|
|
799
|
+
| 100 | 0.03ms | 0.08ms | **2.98x** | ✅ |
|
|
800
|
+
| 200 | 0.03ms | 0.09ms | **3.06x** | ✅ |
|
|
801
|
+
| **Average** | - | - | **2.49x** | ✅ |
|
|
683
802
|
|
|
684
803
|
### Vector Search Performance
|
|
685
804
|
|
|
686
|
-
| Operation
|
|
687
|
-
|
|
688
|
-
| **1M vectors**
|
|
689
|
-
| **10M vectors** | 10000ms
|
|
805
|
+
| Operation | Without HNSW | With HNSW | Speedup | Status |
|
|
806
|
+
| --------------- | ------------ | --------- | ----------- | ------ |
|
|
807
|
+
| **1M vectors** | 1000ms | 6.7ms | **150x** | ✅ |
|
|
808
|
+
| **10M vectors** | 10000ms | 0.8ms | **12,500x** | ✅ |
|
|
690
809
|
|
|
691
810
|
### GNN Query Refinement
|
|
692
811
|
|
|
693
|
-
| Metric
|
|
694
|
-
|
|
695
|
-
| **Recall@10**
|
|
696
|
-
| **Precision@10** | 0.82
|
|
812
|
+
| Metric | Baseline | With GNN | Improvement | Status |
|
|
813
|
+
| ---------------- | -------- | -------- | ----------- | --------- |
|
|
814
|
+
| **Recall@10** | 0.65 | 0.73 | **+12.4%** | 🎯 Target |
|
|
815
|
+
| **Precision@10** | 0.82 | 0.87 | **+6.1%** | ✅ |
|
|
697
816
|
|
|
698
817
|
### Multi-Agent Coordination Performance
|
|
699
818
|
|
|
700
|
-
| Topology
|
|
701
|
-
|
|
702
|
-
| **Mesh**
|
|
703
|
-
| **Hierarchical** | 10
|
|
704
|
-
| **Ring**
|
|
705
|
-
| **Star**
|
|
819
|
+
| Topology | Agents | Latency | Throughput | Status |
|
|
820
|
+
| ---------------- | ------ | ------- | ---------- | ------ |
|
|
821
|
+
| **Mesh** | 10 | 2.1ms | 476 ops/s | ✅ |
|
|
822
|
+
| **Hierarchical** | 10 | 1.8ms | 556 ops/s | ✅ |
|
|
823
|
+
| **Ring** | 10 | 1.5ms | 667 ops/s | ✅ |
|
|
824
|
+
| **Star** | 10 | 1.2ms | 833 ops/s | ✅ |
|
|
706
825
|
|
|
707
826
|
### Memory Efficiency
|
|
708
827
|
|
|
709
828
|
| Sequence Length | Standard | Flash Attention | Reduction | Status |
|
|
710
|
-
|
|
711
|
-
| 512 tokens
|
|
712
|
-
| 1024 tokens
|
|
713
|
-
| 2048 tokens
|
|
829
|
+
| --------------- | -------- | --------------- | --------- | ------ |
|
|
830
|
+
| 512 tokens | 4.0 MB | 2.0 MB | **50%** | ✅ |
|
|
831
|
+
| 1024 tokens | 16.0 MB | 4.0 MB | **75%** | ✅ |
|
|
832
|
+
| 2048 tokens | 64.0 MB | 8.0 MB | **87.5%** | ✅ |
|
|
714
833
|
|
|
715
834
|
### Overall Performance Grade
|
|
716
835
|
|
|
@@ -734,13 +853,13 @@ Every agent in Agentic-Flow v2.0.0-alpha features **autonomous self-learning** p
|
|
|
734
853
|
```typescript
|
|
735
854
|
// Agents automatically search for similar past solutions
|
|
736
855
|
const similarTasks = await reasoningBank.searchPatterns({
|
|
737
|
-
task:
|
|
738
|
-
k: 5,
|
|
739
|
-
minReward: 0.8
|
|
856
|
+
task: "Implement user authentication",
|
|
857
|
+
k: 5, // Top 5 similar tasks
|
|
858
|
+
minReward: 0.8, // Only successful patterns (>80% success)
|
|
740
859
|
});
|
|
741
860
|
|
|
742
861
|
// Apply lessons from past successes
|
|
743
|
-
similarTasks.forEach(pattern => {
|
|
862
|
+
similarTasks.forEach((pattern) => {
|
|
744
863
|
console.log(`Past solution: ${pattern.task}`);
|
|
745
864
|
console.log(`Success rate: ${pattern.reward}`);
|
|
746
865
|
console.log(`Key learnings: ${pattern.critique}`);
|
|
@@ -748,8 +867,8 @@ similarTasks.forEach(pattern => {
|
|
|
748
867
|
|
|
749
868
|
// Avoid past mistakes
|
|
750
869
|
const failures = await reasoningBank.searchPatterns({
|
|
751
|
-
task:
|
|
752
|
-
onlyFailures: true // Learn from failures
|
|
870
|
+
task: "Implement user authentication",
|
|
871
|
+
onlyFailures: true, // Learn from failures
|
|
753
872
|
});
|
|
754
873
|
```
|
|
755
874
|
|
|
@@ -757,16 +876,15 @@ const failures = await reasoningBank.searchPatterns({
|
|
|
757
876
|
|
|
758
877
|
```typescript
|
|
759
878
|
// Use GNN for +12.4% better context accuracy
|
|
760
|
-
const relevantContext = await agentDB.gnnEnhancedSearch(
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
gnnLayers: 3
|
|
766
|
-
}
|
|
767
|
-
);
|
|
879
|
+
const relevantContext = await agentDB.gnnEnhancedSearch(taskEmbedding, {
|
|
880
|
+
k: 10,
|
|
881
|
+
graphContext: buildCodeGraph(), // Related code as graph
|
|
882
|
+
gnnLayers: 3,
|
|
883
|
+
});
|
|
768
884
|
|
|
769
|
-
console.log(
|
|
885
|
+
console.log(
|
|
886
|
+
`Context accuracy improved by ${relevantContext.improvementPercent}%`,
|
|
887
|
+
);
|
|
770
888
|
|
|
771
889
|
// Process large contexts 2.49x-7.47x faster
|
|
772
890
|
const result = await agentDB.flashAttention(Q, K, V);
|
|
@@ -779,14 +897,14 @@ console.log(`Processed in ${result.executionTimeMs}ms`);
|
|
|
779
897
|
// Agents automatically store every task execution
|
|
780
898
|
await reasoningBank.storePattern({
|
|
781
899
|
sessionId: `coder-${agentId}-${Date.now()}`,
|
|
782
|
-
task:
|
|
783
|
-
input:
|
|
900
|
+
task: "Implement user authentication",
|
|
901
|
+
input: "Requirements: OAuth2, JWT tokens, rate limiting",
|
|
784
902
|
output: generatedCode,
|
|
785
|
-
reward: 0.95,
|
|
903
|
+
reward: 0.95, // Success score (0-1)
|
|
786
904
|
success: true,
|
|
787
|
-
critique:
|
|
905
|
+
critique: "Good test coverage, could improve error messages",
|
|
788
906
|
tokensUsed: 15000,
|
|
789
|
-
latencyMs: 2300
|
|
907
|
+
latencyMs: 2300,
|
|
790
908
|
});
|
|
791
909
|
```
|
|
792
910
|
|
|
@@ -794,12 +912,12 @@ await reasoningBank.storePattern({
|
|
|
794
912
|
|
|
795
913
|
Agents continuously improve through iterative learning:
|
|
796
914
|
|
|
797
|
-
| Iterations | Success Rate | Accuracy | Speed
|
|
798
|
-
|
|
799
|
-
| **1-5**
|
|
800
|
-
| **6-10**
|
|
801
|
-
| **11-20**
|
|
802
|
-
| **21-50**
|
|
915
|
+
| Iterations | Success Rate | Accuracy | Speed | Tokens |
|
|
916
|
+
| ---------- | ------------ | -------- | -------- | ------ |
|
|
917
|
+
| **1-5** | 70% | Baseline | Baseline | 100% |
|
|
918
|
+
| **6-10** | 82% (+12%) | +8.5% | +15% | -18% |
|
|
919
|
+
| **11-20** | 91% (+21%) | +15.2% | +32% | -29% |
|
|
920
|
+
| **21-50** | 98% (+28%) | +21.8% | +48% | -35% |
|
|
803
921
|
|
|
804
922
|
### Agent-Specific Learning Examples
|
|
805
923
|
|
|
@@ -808,22 +926,22 @@ Agents continuously improve through iterative learning:
|
|
|
808
926
|
```typescript
|
|
809
927
|
// Before: Search for similar implementations
|
|
810
928
|
const codePatterns = await reasoningBank.searchPatterns({
|
|
811
|
-
task:
|
|
812
|
-
k: 5
|
|
929
|
+
task: "Implement REST API endpoint",
|
|
930
|
+
k: 5,
|
|
813
931
|
});
|
|
814
932
|
|
|
815
933
|
// During: Use GNN to find related code
|
|
816
|
-
const similarCode = await agentDB.gnnEnhancedSearch(
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
);
|
|
934
|
+
const similarCode = await agentDB.gnnEnhancedSearch(taskEmbedding, {
|
|
935
|
+
k: 10,
|
|
936
|
+
graphContext: buildCodeDependencyGraph(),
|
|
937
|
+
});
|
|
820
938
|
|
|
821
939
|
// After: Store successful pattern
|
|
822
940
|
await reasoningBank.storePattern({
|
|
823
|
-
task:
|
|
941
|
+
task: "Implement REST API endpoint",
|
|
824
942
|
output: generatedCode,
|
|
825
943
|
reward: calculateCodeQuality(generatedCode),
|
|
826
|
-
success: allTestsPassed
|
|
944
|
+
success: allTestsPassed,
|
|
827
945
|
});
|
|
828
946
|
```
|
|
829
947
|
|
|
@@ -831,15 +949,15 @@ await reasoningBank.storePattern({
|
|
|
831
949
|
|
|
832
950
|
```typescript
|
|
833
951
|
// Enhanced research with GNN (+12.4% better)
|
|
834
|
-
const relevantDocs = await agentDB.gnnEnhancedSearch(
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
);
|
|
952
|
+
const relevantDocs = await agentDB.gnnEnhancedSearch(researchQuery, {
|
|
953
|
+
k: 20,
|
|
954
|
+
graphContext: buildKnowledgeGraph(),
|
|
955
|
+
});
|
|
838
956
|
|
|
839
957
|
// Multi-source synthesis with attention
|
|
840
958
|
const synthesis = await coordinator.coordinateAgents(
|
|
841
959
|
researchFindings,
|
|
842
|
-
|
|
960
|
+
"multi-head", // Multi-perspective analysis
|
|
843
961
|
);
|
|
844
962
|
```
|
|
845
963
|
|
|
@@ -848,15 +966,15 @@ const synthesis = await coordinator.coordinateAgents(
|
|
|
848
966
|
```typescript
|
|
849
967
|
// Learn from past test failures
|
|
850
968
|
const failedTests = await reasoningBank.searchPatterns({
|
|
851
|
-
task:
|
|
852
|
-
onlyFailures: true
|
|
969
|
+
task: "Test authentication",
|
|
970
|
+
onlyFailures: true,
|
|
853
971
|
});
|
|
854
972
|
|
|
855
973
|
// Generate comprehensive tests with Flash Attention
|
|
856
974
|
const testCases = await agentDB.flashAttention(
|
|
857
975
|
featureEmbedding,
|
|
858
976
|
edgeCaseEmbeddings,
|
|
859
|
-
edgeCaseEmbeddings
|
|
977
|
+
edgeCaseEmbeddings,
|
|
860
978
|
);
|
|
861
979
|
```
|
|
862
980
|
|
|
@@ -868,11 +986,14 @@ Agents learn to work together more effectively:
|
|
|
868
986
|
// Attention-based consensus (better than voting)
|
|
869
987
|
const coordinator = new AttentionCoordinator(attentionService);
|
|
870
988
|
|
|
871
|
-
const teamDecision = await coordinator.coordinateAgents(
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
989
|
+
const teamDecision = await coordinator.coordinateAgents(
|
|
990
|
+
[
|
|
991
|
+
{ agentId: "coder", output: "Approach A", embedding: embed1 },
|
|
992
|
+
{ agentId: "reviewer", output: "Approach B", embedding: embed2 },
|
|
993
|
+
{ agentId: "architect", output: "Approach C", embedding: embed3 },
|
|
994
|
+
],
|
|
995
|
+
"flash",
|
|
996
|
+
);
|
|
876
997
|
|
|
877
998
|
console.log(`Team consensus: ${teamDecision.consensus}`);
|
|
878
999
|
console.log(`Confidence: ${teamDecision.attentionWeights.max()}`);
|
|
@@ -885,15 +1006,15 @@ All agents share learning patterns via ReasoningBank:
|
|
|
885
1006
|
```typescript
|
|
886
1007
|
// Agent 1: Coder stores successful pattern
|
|
887
1008
|
await reasoningBank.storePattern({
|
|
888
|
-
task:
|
|
1009
|
+
task: "Implement caching layer",
|
|
889
1010
|
output: redisImplementation,
|
|
890
|
-
reward: 0.92
|
|
1011
|
+
reward: 0.92,
|
|
891
1012
|
});
|
|
892
1013
|
|
|
893
1014
|
// Agent 2: Different coder retrieves the pattern
|
|
894
1015
|
const cachedSolutions = await reasoningBank.searchPatterns({
|
|
895
|
-
task:
|
|
896
|
-
k: 3
|
|
1016
|
+
task: "Implement caching layer",
|
|
1017
|
+
k: 3,
|
|
897
1018
|
});
|
|
898
1019
|
// Learns from Agent 1's successful approach
|
|
899
1020
|
```
|
|
@@ -905,8 +1026,8 @@ Track learning progress:
|
|
|
905
1026
|
```typescript
|
|
906
1027
|
// Get performance stats for a task type
|
|
907
1028
|
const stats = await reasoningBank.getPatternStats({
|
|
908
|
-
task:
|
|
909
|
-
k: 20
|
|
1029
|
+
task: "implement-rest-api",
|
|
1030
|
+
k: 20,
|
|
910
1031
|
});
|
|
911
1032
|
|
|
912
1033
|
console.log(`Success rate: ${stats.successRate}%`);
|
|
@@ -1010,22 +1131,23 @@ Agentic-Flow v2 includes a powerful **self-learning hooks system** powered by Ru
|
|
|
1010
1131
|
|
|
1011
1132
|
### Hooks Overview
|
|
1012
1133
|
|
|
1013
|
-
| Hook
|
|
1014
|
-
|
|
1015
|
-
| `pre-edit`
|
|
1016
|
-
| `post-edit`
|
|
1017
|
-
| `pre-command`
|
|
1018
|
-
| `post-command` | Record command outcomes
|
|
1019
|
-
| `route`
|
|
1020
|
-
| `explain`
|
|
1021
|
-
| `pretrain`
|
|
1022
|
-
| `build-agents` | Generate agent configs
|
|
1023
|
-
| `metrics`
|
|
1024
|
-
| `transfer`
|
|
1134
|
+
| Hook | Purpose | When Triggered |
|
|
1135
|
+
| -------------- | ---------------------------------- | -------------------- |
|
|
1136
|
+
| `pre-edit` | Get context and agent suggestions | Before file edits |
|
|
1137
|
+
| `post-edit` | Record edit outcomes for learning | After file edits |
|
|
1138
|
+
| `pre-command` | Assess command risk | Before Bash commands |
|
|
1139
|
+
| `post-command` | Record command outcomes | After Bash commands |
|
|
1140
|
+
| `route` | Route task to optimal agent | On task assignment |
|
|
1141
|
+
| `explain` | Explain routing decision | On demand |
|
|
1142
|
+
| `pretrain` | Bootstrap from repository | During setup |
|
|
1143
|
+
| `build-agents` | Generate agent configs | After pretrain |
|
|
1144
|
+
| `metrics` | View learning dashboard | On demand |
|
|
1145
|
+
| `transfer` | Transfer patterns between projects | On demand |
|
|
1025
1146
|
|
|
1026
1147
|
### Core Hook Commands
|
|
1027
1148
|
|
|
1028
1149
|
#### Pre-Edit Hook
|
|
1150
|
+
|
|
1029
1151
|
Get context and agent suggestions before editing a file:
|
|
1030
1152
|
|
|
1031
1153
|
```bash
|
|
@@ -1047,6 +1169,7 @@ npx agentic-flow@alpha hooks pre-edit src/api/users.ts --task "Add validation"
|
|
|
1047
1169
|
```
|
|
1048
1170
|
|
|
1049
1171
|
#### Post-Edit Hook
|
|
1172
|
+
|
|
1050
1173
|
Record edit outcome for learning:
|
|
1051
1174
|
|
|
1052
1175
|
```bash
|
|
@@ -1068,6 +1191,7 @@ npx agentic-flow@alpha hooks post-edit src/api/users.ts --fail --error "Type err
|
|
|
1068
1191
|
```
|
|
1069
1192
|
|
|
1070
1193
|
#### Pre-Command Hook
|
|
1194
|
+
|
|
1071
1195
|
Assess command risk before execution:
|
|
1072
1196
|
|
|
1073
1197
|
```bash
|
|
@@ -1086,6 +1210,7 @@ npx agentic-flow@alpha hooks pre-command "rm -rf node_modules"
|
|
|
1086
1210
|
```
|
|
1087
1211
|
|
|
1088
1212
|
#### Route Hook
|
|
1213
|
+
|
|
1089
1214
|
Route task to optimal agent using learned patterns:
|
|
1090
1215
|
|
|
1091
1216
|
```bash
|
|
@@ -1112,6 +1237,7 @@ npx agentic-flow@alpha hooks route "Fix authentication bug in login flow"
|
|
|
1112
1237
|
```
|
|
1113
1238
|
|
|
1114
1239
|
#### Explain Hook
|
|
1240
|
+
|
|
1115
1241
|
Explain routing decision with full transparency:
|
|
1116
1242
|
|
|
1117
1243
|
```bash
|
|
@@ -1139,6 +1265,7 @@ npx agentic-flow@alpha hooks explain "Implement caching layer"
|
|
|
1139
1265
|
### Learning & Training Commands
|
|
1140
1266
|
|
|
1141
1267
|
#### Pretrain Hook
|
|
1268
|
+
|
|
1142
1269
|
Analyze repository to bootstrap intelligence:
|
|
1143
1270
|
|
|
1144
1271
|
```bash
|
|
@@ -1164,6 +1291,7 @@ npx agentic-flow@alpha hooks pretrain --depth 100
|
|
|
1164
1291
|
```
|
|
1165
1292
|
|
|
1166
1293
|
#### Build-Agents Hook
|
|
1294
|
+
|
|
1167
1295
|
Generate optimized agent configurations from pretrain data:
|
|
1168
1296
|
|
|
1169
1297
|
```bash
|
|
@@ -1191,6 +1319,7 @@ npx agentic-flow@alpha hooks build-agents --focus security
|
|
|
1191
1319
|
```
|
|
1192
1320
|
|
|
1193
1321
|
#### Metrics Hook
|
|
1322
|
+
|
|
1194
1323
|
View learning metrics and performance dashboard:
|
|
1195
1324
|
|
|
1196
1325
|
```bash
|
|
@@ -1220,6 +1349,7 @@ npx agentic-flow@alpha hooks metrics --timeframe 7d --detailed
|
|
|
1220
1349
|
```
|
|
1221
1350
|
|
|
1222
1351
|
#### Transfer Hook
|
|
1352
|
+
|
|
1223
1353
|
Transfer learned patterns from another project:
|
|
1224
1354
|
|
|
1225
1355
|
```bash
|
|
@@ -1246,6 +1376,7 @@ npx agentic-flow@alpha hooks transfer ../other-project --mode merge
|
|
|
1246
1376
|
The `intelligence` (alias: `intel`) subcommand provides access to the full RuVector stack:
|
|
1247
1377
|
|
|
1248
1378
|
#### Intelligence Route
|
|
1379
|
+
|
|
1249
1380
|
Route task using SONA + MoE + HNSW (150x faster than brute force):
|
|
1250
1381
|
|
|
1251
1382
|
```bash
|
|
@@ -1269,6 +1400,7 @@ npx agentic-flow@alpha hooks intel route "Optimize database queries" --top-k 3
|
|
|
1269
1400
|
```
|
|
1270
1401
|
|
|
1271
1402
|
#### Trajectory Tracking
|
|
1403
|
+
|
|
1272
1404
|
Track reinforcement learning trajectories for agent improvement:
|
|
1273
1405
|
|
|
1274
1406
|
```bash
|
|
@@ -1286,6 +1418,7 @@ npx agentic-flow@alpha hooks intel trajectory-end 42 --success --quality 0.95
|
|
|
1286
1418
|
```
|
|
1287
1419
|
|
|
1288
1420
|
#### Pattern Storage & Search
|
|
1421
|
+
|
|
1289
1422
|
Store and search patterns using HNSW-indexed ReasoningBank:
|
|
1290
1423
|
|
|
1291
1424
|
```bash
|
|
@@ -1308,6 +1441,7 @@ npx agentic-flow@alpha hooks intel pattern-search "hydration mismatch"
|
|
|
1308
1441
|
```
|
|
1309
1442
|
|
|
1310
1443
|
#### Intelligence Stats
|
|
1444
|
+
|
|
1311
1445
|
Get RuVector intelligence layer statistics:
|
|
1312
1446
|
|
|
1313
1447
|
```bash
|
|
@@ -1349,30 +1483,65 @@ The `init` command automatically configures hooks in `.claude/settings.json`:
|
|
|
1349
1483
|
"PreToolUse": [
|
|
1350
1484
|
{
|
|
1351
1485
|
"matcher": "Edit|Write|MultiEdit",
|
|
1352
|
-
"hooks": [
|
|
1486
|
+
"hooks": [
|
|
1487
|
+
{
|
|
1488
|
+
"type": "command",
|
|
1489
|
+
"command": "npx agentic-flow@alpha hooks pre-edit \"$TOOL_INPUT_file_path\""
|
|
1490
|
+
}
|
|
1491
|
+
]
|
|
1353
1492
|
},
|
|
1354
1493
|
{
|
|
1355
1494
|
"matcher": "Bash",
|
|
1356
|
-
"hooks": [
|
|
1495
|
+
"hooks": [
|
|
1496
|
+
{
|
|
1497
|
+
"type": "command",
|
|
1498
|
+
"command": "npx agentic-flow@alpha hooks pre-command \"$TOOL_INPUT_command\""
|
|
1499
|
+
}
|
|
1500
|
+
]
|
|
1357
1501
|
}
|
|
1358
1502
|
],
|
|
1359
1503
|
"PostToolUse": [
|
|
1360
1504
|
{
|
|
1361
1505
|
"matcher": "Edit|Write|MultiEdit",
|
|
1362
|
-
"hooks": [
|
|
1506
|
+
"hooks": [
|
|
1507
|
+
{
|
|
1508
|
+
"type": "command",
|
|
1509
|
+
"command": "npx agentic-flow@alpha hooks post-edit \"$TOOL_INPUT_file_path\" --success"
|
|
1510
|
+
}
|
|
1511
|
+
]
|
|
1363
1512
|
}
|
|
1364
1513
|
],
|
|
1365
1514
|
"PostToolUseFailure": [
|
|
1366
1515
|
{
|
|
1367
1516
|
"matcher": "Edit|Write|MultiEdit",
|
|
1368
|
-
"hooks": [
|
|
1517
|
+
"hooks": [
|
|
1518
|
+
{
|
|
1519
|
+
"type": "command",
|
|
1520
|
+
"command": "npx agentic-flow@alpha hooks post-edit \"$TOOL_INPUT_file_path\" --fail --error \"$ERROR_MESSAGE\""
|
|
1521
|
+
}
|
|
1522
|
+
]
|
|
1369
1523
|
}
|
|
1370
1524
|
],
|
|
1371
1525
|
"SessionStart": [
|
|
1372
|
-
{
|
|
1526
|
+
{
|
|
1527
|
+
"hooks": [
|
|
1528
|
+
{
|
|
1529
|
+
"type": "command",
|
|
1530
|
+
"command": "npx agentic-flow@alpha hooks intelligence stats --json"
|
|
1531
|
+
}
|
|
1532
|
+
]
|
|
1533
|
+
}
|
|
1373
1534
|
],
|
|
1374
1535
|
"UserPromptSubmit": [
|
|
1375
|
-
{
|
|
1536
|
+
{
|
|
1537
|
+
"hooks": [
|
|
1538
|
+
{
|
|
1539
|
+
"type": "command",
|
|
1540
|
+
"timeout": 3000,
|
|
1541
|
+
"command": "npx agentic-flow@alpha hooks route \"$USER_PROMPT\" --json"
|
|
1542
|
+
}
|
|
1543
|
+
]
|
|
1544
|
+
}
|
|
1376
1545
|
]
|
|
1377
1546
|
}
|
|
1378
1547
|
}
|
|
@@ -1419,18 +1588,19 @@ Agentic-Flow v2 includes a powerful **background workers system** that runs non-
|
|
|
1419
1588
|
|
|
1420
1589
|
Workers are automatically dispatched when trigger keywords are detected in prompts:
|
|
1421
1590
|
|
|
1422
|
-
| Trigger
|
|
1423
|
-
|
|
1424
|
-
| `ultralearn` | Deep codebase learning and pattern extraction
|
|
1425
|
-
| `optimize`
|
|
1426
|
-
| `audit`
|
|
1427
|
-
| `document`
|
|
1428
|
-
| `refactor`
|
|
1429
|
-
| `test`
|
|
1591
|
+
| Trigger | Description | Priority |
|
|
1592
|
+
| ------------ | ------------------------------------------------- | -------- |
|
|
1593
|
+
| `ultralearn` | Deep codebase learning and pattern extraction | high |
|
|
1594
|
+
| `optimize` | Performance analysis and optimization suggestions | medium |
|
|
1595
|
+
| `audit` | Security and code quality auditing | high |
|
|
1596
|
+
| `document` | Documentation generation and analysis | low |
|
|
1597
|
+
| `refactor` | Code refactoring analysis | medium |
|
|
1598
|
+
| `test` | Test coverage and quality analysis | medium |
|
|
1430
1599
|
|
|
1431
1600
|
### Worker Commands
|
|
1432
1601
|
|
|
1433
1602
|
#### Dispatch Workers
|
|
1603
|
+
|
|
1434
1604
|
Detect triggers in prompt and dispatch background workers:
|
|
1435
1605
|
|
|
1436
1606
|
```bash
|
|
@@ -1446,6 +1616,7 @@ npx agentic-flow@alpha workers dispatch "ultralearn how authentication works"
|
|
|
1446
1616
|
```
|
|
1447
1617
|
|
|
1448
1618
|
#### Monitor Status
|
|
1619
|
+
|
|
1449
1620
|
Get worker status and progress:
|
|
1450
1621
|
|
|
1451
1622
|
```bash
|
|
@@ -1471,6 +1642,7 @@ npx agentic-flow@alpha workers status
|
|
|
1471
1642
|
```
|
|
1472
1643
|
|
|
1473
1644
|
#### View Results
|
|
1645
|
+
|
|
1474
1646
|
View worker analysis results:
|
|
1475
1647
|
|
|
1476
1648
|
```bash
|
|
@@ -1494,6 +1666,7 @@ npx agentic-flow@alpha workers results
|
|
|
1494
1666
|
```
|
|
1495
1667
|
|
|
1496
1668
|
#### List Triggers
|
|
1669
|
+
|
|
1497
1670
|
List all available trigger keywords:
|
|
1498
1671
|
|
|
1499
1672
|
```bash
|
|
@@ -1511,6 +1684,7 @@ npx agentic-flow@alpha workers triggers
|
|
|
1511
1684
|
```
|
|
1512
1685
|
|
|
1513
1686
|
#### Worker Statistics
|
|
1687
|
+
|
|
1514
1688
|
Get worker statistics:
|
|
1515
1689
|
|
|
1516
1690
|
```bash
|
|
@@ -1543,12 +1717,14 @@ npx agentic-flow@alpha workers stats --timeframe 7d
|
|
|
1543
1717
|
Create and manage custom workers with specific analysis phases:
|
|
1544
1718
|
|
|
1545
1719
|
#### List Presets
|
|
1720
|
+
|
|
1546
1721
|
```bash
|
|
1547
1722
|
npx agentic-flow@alpha workers presets
|
|
1548
1723
|
# Shows available worker presets: quick-scan, deep-analysis, security-audit, etc.
|
|
1549
1724
|
```
|
|
1550
1725
|
|
|
1551
1726
|
#### Create Custom Worker
|
|
1727
|
+
|
|
1552
1728
|
```bash
|
|
1553
1729
|
npx agentic-flow@alpha workers create <name> [options]
|
|
1554
1730
|
|
|
@@ -1562,6 +1738,7 @@ npx agentic-flow@alpha workers create security-check --preset security-audit --t
|
|
|
1562
1738
|
```
|
|
1563
1739
|
|
|
1564
1740
|
#### Run Custom Worker
|
|
1741
|
+
|
|
1565
1742
|
```bash
|
|
1566
1743
|
npx agentic-flow@alpha workers run <nameOrTrigger> [options]
|
|
1567
1744
|
|
|
@@ -1656,6 +1833,7 @@ npx agentic-flow@alpha workers integration
|
|
|
1656
1833
|
```
|
|
1657
1834
|
|
|
1658
1835
|
#### Agent Recommendations
|
|
1836
|
+
|
|
1659
1837
|
Get recommended agents for a worker trigger:
|
|
1660
1838
|
|
|
1661
1839
|
```bash
|
|
@@ -1686,20 +1864,24 @@ Workers are automatically configured in `.claude/settings.json` via hooks:
|
|
|
1686
1864
|
"hooks": {
|
|
1687
1865
|
"UserPromptSubmit": [
|
|
1688
1866
|
{
|
|
1689
|
-
"hooks": [
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1867
|
+
"hooks": [
|
|
1868
|
+
{
|
|
1869
|
+
"type": "command",
|
|
1870
|
+
"timeout": 5000,
|
|
1871
|
+
"background": true,
|
|
1872
|
+
"command": "npx agentic-flow@alpha workers dispatch-prompt \"$USER_PROMPT\" --session \"$SESSION_ID\" --json"
|
|
1873
|
+
}
|
|
1874
|
+
]
|
|
1695
1875
|
}
|
|
1696
1876
|
],
|
|
1697
1877
|
"SessionEnd": [
|
|
1698
1878
|
{
|
|
1699
|
-
"hooks": [
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1879
|
+
"hooks": [
|
|
1880
|
+
{
|
|
1881
|
+
"type": "command",
|
|
1882
|
+
"command": "npx agentic-flow@alpha workers cleanup --age 24"
|
|
1883
|
+
}
|
|
1884
|
+
]
|
|
1703
1885
|
}
|
|
1704
1886
|
]
|
|
1705
1887
|
}
|
|
@@ -1779,20 +1961,20 @@ node -e "console.log(require('@ruvector/attention').runtime)"
|
|
|
1779
1961
|
```typescript
|
|
1780
1962
|
class EnhancedAgentDBWrapper {
|
|
1781
1963
|
// Attention mechanisms
|
|
1782
|
-
async flashAttention(Q, K, V): Promise<AttentionResult
|
|
1783
|
-
async multiHeadAttention(Q, K, V): Promise<AttentionResult
|
|
1784
|
-
async linearAttention(Q, K, V): Promise<AttentionResult
|
|
1785
|
-
async hyperbolicAttention(Q, K, V, curvature): Promise<AttentionResult
|
|
1786
|
-
async moeAttention(Q, K, V, numExperts): Promise<AttentionResult
|
|
1787
|
-
async graphRoPEAttention(Q, K, V, graph): Promise<AttentionResult
|
|
1964
|
+
async flashAttention(Q, K, V): Promise<AttentionResult>;
|
|
1965
|
+
async multiHeadAttention(Q, K, V): Promise<AttentionResult>;
|
|
1966
|
+
async linearAttention(Q, K, V): Promise<AttentionResult>;
|
|
1967
|
+
async hyperbolicAttention(Q, K, V, curvature): Promise<AttentionResult>;
|
|
1968
|
+
async moeAttention(Q, K, V, numExperts): Promise<AttentionResult>;
|
|
1969
|
+
async graphRoPEAttention(Q, K, V, graph): Promise<AttentionResult>;
|
|
1788
1970
|
|
|
1789
1971
|
// GNN query refinement
|
|
1790
|
-
async gnnEnhancedSearch(query, options): Promise<GNNRefinementResult
|
|
1972
|
+
async gnnEnhancedSearch(query, options): Promise<GNNRefinementResult>;
|
|
1791
1973
|
|
|
1792
1974
|
// Vector operations
|
|
1793
|
-
async vectorSearch(query, options): Promise<VectorSearchResult[]
|
|
1794
|
-
async insertVector(vector, metadata): Promise<void
|
|
1795
|
-
async deleteVector(id): Promise<void
|
|
1975
|
+
async vectorSearch(query, options): Promise<VectorSearchResult[]>;
|
|
1976
|
+
async insertVector(vector, metadata): Promise<void>;
|
|
1977
|
+
async deleteVector(id): Promise<void>;
|
|
1796
1978
|
}
|
|
1797
1979
|
```
|
|
1798
1980
|
|
|
@@ -1801,16 +1983,24 @@ class EnhancedAgentDBWrapper {
|
|
|
1801
1983
|
```typescript
|
|
1802
1984
|
class AttentionCoordinator {
|
|
1803
1985
|
// Agent coordination
|
|
1804
|
-
async coordinateAgents(outputs, mechanism): Promise<CoordinationResult
|
|
1986
|
+
async coordinateAgents(outputs, mechanism): Promise<CoordinationResult>;
|
|
1805
1987
|
|
|
1806
1988
|
// Expert routing
|
|
1807
|
-
async routeToExperts(task, agents, topK): Promise<ExpertRoutingResult
|
|
1989
|
+
async routeToExperts(task, agents, topK): Promise<ExpertRoutingResult>;
|
|
1808
1990
|
|
|
1809
1991
|
// Topology-aware coordination
|
|
1810
|
-
async topologyAwareCoordination(
|
|
1992
|
+
async topologyAwareCoordination(
|
|
1993
|
+
outputs,
|
|
1994
|
+
topology,
|
|
1995
|
+
graph?,
|
|
1996
|
+
): Promise<CoordinationResult>;
|
|
1811
1997
|
|
|
1812
1998
|
// Hierarchical coordination
|
|
1813
|
-
async hierarchicalCoordination(
|
|
1999
|
+
async hierarchicalCoordination(
|
|
2000
|
+
queens,
|
|
2001
|
+
workers,
|
|
2002
|
+
curvature,
|
|
2003
|
+
): Promise<CoordinationResult>;
|
|
1814
2004
|
}
|
|
1815
2005
|
```
|
|
1816
2006
|
|