Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Master advanced AgentDB features including QUIC synchronization, multi-database management, custom distance metrics, hybrid search, and distributed systems integration. Use when building distributed AI systems, multi-agent coordination, or advanced vector search applications.
.claude/skills/ruvnet-agentdb-advanced-features/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-13 | ✗→✓ | ▲ Improved | 100% | 0% |
| case-01 | ✗→✓ | ▲ Improved | 129% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 121% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 163% | 0% |
| case-04 | ✗→✓ | ▲ Improved | 404% | 0% |
Covers advanced AgentDB capabilities for distributed systems, multi-database coordination, custom distance metrics, hybrid search (vector + metadata), QUIC synchronization, and production deployment patterns. Enables building sophisticated AI systems with sub-millisecond cross-node communication and advanced search capabilities.
Performance: <1ms QUIC sync, hybrid search with filters, custom distance metrics.
QUIC (Quick UDP Internet Connections) enables sub-millisecond latency synchronization between AgentDB instances across network boundaries with automatic retry, multiplexing, and encryption.
Benefits:
typescriptimport { createAgentDBAdapter } from 'agentic-flow$reasoningbank'; // Initialize with QUIC synchronization const adapter = await createAgentDBAdapter({ dbPath: '.agentdb$distributed.db', enableQUICSync: true, syncPort: 4433, syncPeers: [ '192.168.1.10:4433', '192.168.1.11:4433', '192.168.1.12:4433', ], }); // Patterns automatically sync across all peers await adapter.insertPattern({ // ... pattern data }); // Available on all peers within ~1ms
typescriptconst adapter = await createAgentDBAdapter({ enableQUICSync: true, syncPort: 4433, // QUIC server port syncPeers: ['host1:4433'], // Peer addresses syncInterval: 1000, // Sync interval (ms) syncBatchSize: 100, // Patterns per batch maxRetries: 3, // Retry failed syncs compression: true, // Enable compression });
bash# Node 1 (192.168.1.10) AGENTDB_QUIC_SYNC=true \ AGENTDB_QUIC_PORT=4433 \ AGENTDB_QUIC_PEERS=192.168.1.11:4433,192.168.1.12:4433 \ node server.js # Node 2 (192.168.1.11) AGENTDB_QUIC_SYNC=true \ AGENTDB_QUIC_PORT=4433 \ AGENTDB_QUIC_PEERS=192.168.1.10:4433,192.168.1.12:4433 \ node server.js # Node 3 (192.168.1.12) AGENTDB_QUIC_SYNC=true \ AGENTDB_QUIC_PORT=4433 \ AGENTDB_QUIC_PEERS=192.168.1.10:4433,192.168.1.11:4433 \ node server.js
Best for normalized vectors, semantic similarity:
bash# CLI npx agentdb@latest query .$vectors.db "[0.1,0.2,...]" -m cosine # API const result = await adapter.retrieveWithReasoning(queryEmbedding, { metric: 'cosine', k: 10, });
Use Cases:
Formula: cos(θ) = (A · B) / (||A|| × ||B||) Range: -1, 1] (1 = identical, -1 = opposite)
Best for spatial data, geometric similarity:
bash# CLI npx agentdb@latest query .$vectors.db "[0.1,0.2,...]" -m euclidean # API const result = await adapter.retrieveWithReasoning(queryEmbedding, { metric: 'euclidean', k: 10, });
Use Cases:
Formula: d = √(Σ(ai - bi)²) Range: 0, ∞] (0 = identical, ∞ = very different)
Best for pre-normalized vectors, fast computation:
bash# CLI npx agentdb@latest query .$vectors.db "[0.1,0.2,...]" -m dot # API const result = await adapter.retrieveWithReasoning(queryEmbedding, { metric: 'dot', k: 10, });
Use Cases:
Formula: dot = Σ(ai × bi) Range: -∞, ∞] (higher = more similar)
typescript// Implement custom distance function function customDistance(vec1: number[], vec2: number[]): number { // Weighted Euclidean distance const weights = [1.0, 2.0, 1.5, ...]; let sum = 0; for (let i = 0; i < vec1.length; i++) { sum += weights[i] * Math.pow(vec1[i] - vec2[i], 2); } return Math.sqrt(sum); } // Use in search (requires custom implementation)
Combine vector similarity with metadata filtering:
typescript// Store documents with metadata await adapter.insertPattern({ id: '', type: 'document', domain: 'research-papers', pattern_data: JSON.stringify({ embedding: documentEmbedding, text: documentText, metadata: { author: 'Jane Smith', year: 2025, category: 'machine-learning', citations: 150, } }), confidence: 1.0, usage_count: 0, success_count: 0, created_at: Date.now(), last_used: Date.now(), }); // Hybrid search: vector similarity + metadata filters const result = await adapter.retrieveWithReasoning(queryEmbedding, { domain: 'research-papers', k: 20, filters: { year: { $gte: 2023 }, // Published 2023 or later category: 'machine-learning', // ML papers only citations: { $gte: 50 }, // Highly cited }, });
typescript// Complex metadata queries const result = await adapter.retrieveWithReasoning(queryEmbedding, { domain: 'products', k: 50, filters: { price: { $gte: 10, $lte: 100 }, // Price range category: { $in: ['electronics', 'gadgets'] }, // Multiple categories rating: { $gte: 4.0 }, // High rated inStock: true, // Available tags: { $contains: 'wireless' }, // Has tag }, });
Combine vector and metadata scores:
typescriptconst result = await adapter.retrieveWithReasoning(queryEmbedding, { domain: 'content', k: 20, hybridWeights: { vectorSimilarity: 0.7, // 70% weight on semantic similarity metadataScore: 0.3, // 30% weight on metadata match }, filters: { category: 'technology', recency: { $gte: Date.now() - 30 * 24 * 3600000 }, // Last 30 days }, });
typescript// Separate databases for different domains const knowledgeDB = await createAgentDBAdapter({ dbPath: '.agentdb$knowledge.db', }); const conversationDB = await createAgentDBAdapter({ dbPath: '.agentdb$conversations.db', }); const codeDB = await createAgentDBAdapter({ dbPath: '.agentdb$code.db', }); // Use appropriate database for each task await knowledgeDB.insertPattern({ /* knowledge */ }); await conversationDB.insertPattern({ /* conversation */ }); await codeDB.insertPattern({ /* code */ });
typescript// Shard by domain for horizontal scaling const shards = { 'domain-a': await createAgentDBAdapter({ dbPath: '.agentdb$shard-a.db' }), 'domain-b': await createAgentDBAdapter({ dbPath: '.agentdb$shard-b.db' }), 'domain-c': await createAgentDBAdapter({ dbPath: '.agentdb$shard-c.db' }), }; // Route queries to appropriate shard function getDBForDomain(domain: string) { const shardKey = domain.split('-')[0]; // Extract shard key return shards[shardKey] || shards['domain-a']; } // Insert to correct shard const db = getDBForDomain('domain-a-task'); await db.insertPattern({ /* ... */ });
Retrieve diverse results to avoid redundancy:
typescript// Without MMR: Similar results may be redundant const standardResults = await adapter.retrieveWithReasoning(queryEmbedding, { k: 10, useMMR: false, }); // With MMR: Diverse, non-redundant results const diverseResults = await adapter.retrieveWithReasoning(queryEmbedding, { k: 10, useMMR: true, mmrLambda: 0.5, // Balance relevance (0) vs diversity (1) });
MMR Parameters:
mmrLambda = 0: Maximum relevance (may be redundant)mmrLambda = 0.5: Balanced (default)mmrLambda = 1: Maximum diversity (may be less relevant)Use Cases:
Generate rich context from multiple memories:
typescriptconst result = await adapter.retrieveWithReasoning(queryEmbedding, { domain: 'problem-solving', k: 10, synthesizeContext: true, // Enable context synthesis }); // ContextSynthesizer creates coherent narrative console.log('Synthesized Context:', result.context); // "Based on 10 similar problem-solving attempts, the most effective // approach involves: 1) analyzing root cause, 2) brainstorming solutions, // 3) evaluating trade-offs, 4) implementing incrementally. Success rate: 85%" console.log('Patterns:', result.patterns); // Extracted common patterns across memories
typescript// Singleton pattern for shared adapter class AgentDBPool { private static instance: AgentDBAdapter; static async getInstance() { if (!this.instance) { this.instance = await createAgentDBAdapter({ dbPath: '.agentdb$production.db', quantizationType: 'scalar', cacheSize: 2000, }); } return this.instance; } } // Use in application const db = await AgentDBPool.getInstance(); const results = await db.retrieveWithReasoning(queryEmbedding, { k: 10 });
typescriptasync function safeRetrieve(queryEmbedding: number[], options: any) { try { const result = await adapter.retrieveWithReasoning(queryEmbedding, options); return result; } catch (error) { if (error.code === 'DIMENSION_MISMATCH') { console.error('Query embedding dimension mismatch'); // Handle dimension error } else if (error.code === 'DATABASE_LOCKED') { // Retry with exponential backoff await new Promise(resolve => setTimeout(resolve, 100)); return safeRetrieve(queryEmbedding, options); } throw error; } }
typescript// Performance monitoring const startTime = Date.now(); const result = await adapter.retrieveWithReasoning(queryEmbedding, { k: 10 }); const latency = Date.now() - startTime; if (latency > 100) { console.warn('Slow query detected:', latency, 'ms'); } // Log statistics const stats = await adapter.getStats(); console.log('Database Stats:', { totalPatterns: stats.totalPatterns, dbSize: stats.dbSize, cacheHitRate: stats.cacheHitRate, avgSearchLatency: stats.avgSearchLatency, });
bash# Export with compression npx agentdb@latest export .$vectors.db .$backup.json.gz --compress # Import from backup npx agentdb@latest import .$backup.json.gz --decompress # Merge databases npx agentdb@latest merge .$db1.sqlite .$db2.sqlite .$merged.sqlite
bash# Vacuum database (reclaim space) sqlite3 .agentdb$vectors.db "VACUUM;" # Analyze for query optimization sqlite3 .agentdb$vectors.db "ANALYZE;" # Rebuild indices npx agentdb@latest reindex .$vectors.db
bash# AgentDB configuration AGENTDB_PATH=.agentdb$reasoningbank.db AGENTDB_ENABLED=true # Performance tuning AGENTDB_QUANTIZATION=binary # binary|scalar|product|none AGENTDB_CACHE_SIZE=2000 AGENTDB_HNSW_M=16 AGENTDB_HNSW_EF=100 # Learning plugins AGENTDB_LEARNING=true # Reasoning agents AGENTDB_REASONING=true # QUIC synchronization AGENTDB_QUIC_SYNC=true AGENTDB_QUIC_PORT=4433 AGENTDB_QUIC_PEERS=host1:4433,host2:4433
bash# Check firewall allows UDP port 4433 # NOTE: Requires administrator privileges - for reference only sudo ufw allow 4433/udp # Verify peers are reachable ping host1 # Check QUIC logs DEBUG=agentdb:quic node server.js
typescript// Relax filters const result = await adapter.retrieveWithReasoning(queryEmbedding, { k: 100, // Increase k filters: { // Remove or relax filters }, });
typescript// Disable automatic optimization const result = await adapter.retrieveWithReasoning(queryEmbedding, { optimizeMemory: false, // Disable auto-consolidation k: 10, });
Category: Advanced / Distributed Systems Difficulty: Advanced Estimated Time: 45-60 minutes
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-13 | fail→pass | 15,034 | 10,730 | -29% | 1 | 1 | 0% | 3,013 | 6,017 | +100% | 0 | 0 | — |
case-14 | pass→pass | 6,302 | 1,829 | -71% | 1 | 1 | 0% | 1,228 | 4,219 | +244% | 0 | 0 | — |
case-01 | fail→pass | 12,625 | 10,833 | -14% | 1 | 1 | 0% | 2,776 | 6,359 | +129% | 0 | 0 | — |
case-02 | fail→pass | 11,901 | 10,084 | -15% | 1 | 1 | 0% | 2,793 | 6,179 | +121% | 0 | 0 | — |
case-03 | fail→pass | 10,783 | 7,282 | -32% | 1 | 1 | 0% | 2,050 | 5,384 | +163% | 0 | 0 | — |
case-04 | fail→pass | 5,348 | 3,435 | -36% | 1 | 1 | 0% | 882 | 4,446 | +404% | 0 | 0 | — |
case-05 | pass→pass | 7,058 | 3,208 | -55% | 1 | 1 | 0% | 1,224 | 4,406 | +260% | 0 | 0 | — |
case-06 | pass→pass | 6,381 | 2,635 | -59% | 1 | 1 | 0% | 1,157 | 4,249 | +267% | 0 | 0 | — |
case-07 | fail→pass | 12,640 | 12,051 | -5% | 1 | 1 | 0% | 2,558 | 6,279 | +145% | 0 | 0 | — |
case-08 | pass→pass | 11,044 | 7,180 | -35% | 1 | 1 | 0% | 2,160 | 5,339 | +147% | 0 | 0 | — |
case-09 | fail→pass | 20,139 | 15,550 | -23% | 1 | 1 | 0% | 3,726 | 7,105 | +91% | 0 | 0 | — |
case-10 | fail→pass | 11,412 | 8,106 | -29% | 1 | 1 | 0% | 2,072 | 5,292 | +155% | 0 | 0 | — |
case-11 | fail→pass | 13,279 | 2,043 | -85% | 1 | 1 | 0% | 2,353 | 4,188 | +78% | 0 | 0 | — |
case-12 | fail→pass | 12,892 | 11,105 | -14% | 1 | 1 | 0% | 2,382 | 6,145 | +158% | 0 | 0 | — |
case-15 | fail→pass | 13,684 | 2,373 | -83% | 1 | 1 | 0% | 2,767 | 4,244 | +53% | 0 | 0 | — |
case-16 | fail→pass | 8,518 | 2,452 | -71% | 1 | 1 | 0% | 1,502 | 4,176 | +178% | 0 | 0 | — |
case-17 | fail→pass | 8,522 | 1,679 | -80% | 1 | 1 | 0% | 1,469 | 4,086 | +178% | 0 | 0 | — |
case-18 | fail→pass | 10,967 | 2,207 | -80% | 1 | 1 | 0% | 1,798 | 4,255 | +137% | 0 | 0 | — |
case-19 | fail→pass | 13,107 | 2,334 | -82% | 1 | 1 | 0% | 2,151 | 4,198 | +95% | 0 | 0 | — |
case-20 | pass→pass | 9,346 | 7,458 | -20% | 1 | 1 | 0% | 1,791 | 5,390 | +201% | 0 | 0 | — |
case-21 | pass→pass | 9,820 | 6,505 | -34% | 1 | 1 | 0% | 1,800 | 5,047 | +180% | 0 | 0 | — |
case-22 | pass→pass | 7,149 | 6,988 | -2% | 1 | 1 | 0% | 1,404 | 5,001 | +256% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +68 percentage points is the difference between those two pass rates over the 22 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.