agentdb-optimization
하는 일
이 스킬은 벡터 데이터베이스인 AgentDB를 더 빠르고 작게 만드는 방법을 보여 줍니다. 데이터가 늘면서 검색이 느려지거나 메모리 사용량이 너무 높아지는 개발자를 위한 스킬입니다.
사용하는 경우
- ✓데이터가 늘면서 벡터 검색이 느려질 때.
- ✓벡터 데이터베이스가 쓰는 메모리를 줄이고 싶을 때.
- ✓많은 벡터를 한 번에 더 효율적으로 넣어야 하는 경우.
스킬 링크
https://github.com/ruvnet/ruflo/blob/main/.claude/skills/agentdb-optimization/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“제 벡터 데이터베이스 검색이 느리고 메모리를 너무 많이 씁니다. 어떻게 빠르게 만들 수 있을까요?”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
이 스킬은 저장 공간을 줄이는 이진 양자화, 검색을 빠르게 하는 HNSW 인덱싱, 캐싱, 일괄 삽입 같은 옵션을 설명하며, 각각의 코드 예시를 제공합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
AgentDB Performance Optimization
What This Skill Does
Provides comprehensive performance optimization techniques for AgentDB vector databases. Achieve 150x-12,500x performance improvements through quantization, HNSW indexing, caching strategies, and batch operations. Reduce memory usage by 4-32x while maintaining accuracy.
Performance: <100µs vector search, <1ms pattern retrieval, 2ms batch insert for 100 vectors.
Prerequisites
- Node.js 18+
- AgentDB v1.0.7+ (via agentic-flow)
- Existing AgentDB database or application
Quick Start
Run Performance Benchmarks
# Comprehensive performance benchmarking
npx agentdb@latest benchmark
# Results show:
# ✅ Pattern Search: 150x faster (100µs vs 15ms)
# ✅ Batch Insert: 500x faster (2ms vs 1s for 100 vectors)
# ✅ Large-scale Query: 12,500x faster (8ms vs 100s at 1M vectors)
# ✅ Memory Efficiency: 4-32x reduction with quantization
Enable Optimizations
import { createAgentDBAdapter } from 'agentic-flow/reasoningbank';
// Optimized configuration
const adapter = await createAgentDBAdapter({
dbPath: '.agentdb/optimized.db',
quantizationType: 'binary', // 32x memory reduction
cacheSize: 1000, // In-memory cache
enableLearning: true,
enableReasoning: true,
});
Quantization Strategies
1. Binary Quantization (32x Reduction)
Best For: Large-scale deployments (1M+ vectors), memory-constrained environments Trade-off: ~2-5% accuracy loss, 32x memory reduction, 10x faster
const adapter = await createAgentDBAdapter({
quantizationType: 'binary',
// 768-dim float32 (3072 bytes) → 96 bytes binary
// 1M vectors: 3GB → 96MB
});
Use Cases:
- Mobile/edge deployment
- Large-scale vector storage (millions of vectors)
- Real-time search with memory constraints
Performance:
- Memory: 32x smaller
- Search Speed: 10x faster (bit operations)
- Accuracy: 95-98% of original
2. Scalar Quantization (4x Reduction)
Best For: Balanced performance/accuracy, moderate datasets Trade-off: ~1-2% accuracy loss, 4x memory reduction, 3x faster
const adapter = await createAgentDBAdapter({
quantizationType: 'scalar',
// 768-dim float32 (3072 bytes) → 768 bytes (uint8)
// 1M vectors: 3GB → 768MB
});
Use Cases:
- Production applications requiring high accuracy
- Medium-scale deployments (10K-1M vectors)
- General-purpose optimization
Performance:
- Memory: 4x smaller
- Search Speed: 3x faster
- Accuracy: 98-99% of original
3. Product Quantization (8-16x Reduction)
Best For: High-dimensional vectors, balanced compression Trade-off: ~3-7% accuracy loss, 8-16x memory reduction, 5x faster
const adapter = await createAgentDBAdapter({
quantizationType: 'product',
// 768-dim float32 (3072 bytes) → 48-96 bytes
// 1M vectors: 3GB → 192MB
});
Use Cases:
- High-dimensional embeddings (>512 dims)
- Image/video embeddings
- Large-scale similarity search
Performance:
- Memory: 8-16x smaller
- Search Speed: 5x faster
- Accuracy: 93-97% of original
4. No Quantization (Full Precision)
Best For: Maximum accuracy, small datasets Trade-off: No accuracy loss, full memory usage
const adapter = await createAgentDBAdapter({
quantizationType: 'none',
// Full float32 precision
});
HNSW Indexing
Hierarchical Navigable Small World - O(log n) search complexity
Automatic HNSW
AgentDB automatically builds HNSW indices:
const adapter = await createAgentDBAdapter({
dbPath: '.agentdb/vectors.db',
// HNSW automatically enabled
});
// Search with HNSW (100µs vs 15ms linear scan)
const results = await adapter.retrieveWithReasoning(queryEmbedding, {
k: 10,
});
HNSW Parameters
// Advanced HNSW configuration
const adapter = await createAgentDBAdapter({
dbPath: '.agentdb/vectors.db',
hnswM: 16, // Connections per layer (default: 16)
hnswEfConstruction: 200, // Build quality (default: 200)
hnswEfSearch: 100, // Search quality (default: 100)
});
Parameter Tuning:
- M (connections): Higher = better recall, more memory
- Small datasets (<10K): M = 8
- Medium datasets (10K-100K): M = 16
- Large datasets (>100K): M = 32
- efConstruction: Higher = better index quality, slower build
- Fast build: 100
- Balanced: 200 (default)
- High quality: 400
- efSearch: Higher = b
자주 묻는 질문
양자화란 무엇인가요?
벡터를 더 작은 형태로 저장해서 메모리를 아끼는 방법입니다.
설정을 벤치마크할 수 있나요?
네. 성능을 측정하는 벤치마크 명령이 언급되어 있습니다.
변경해도 결과가 정확하게 유지되나요?
이 방법들은 메모리를 줄이면서도 정확도를 유지하는 것을 목표로 한다고 이 스킬은 말합니다.
상세 정보
작성자의 원본 설명
Optimize AgentDB performance with quantization (4-32x memory reduction), HNSW indexing (150x faster search), caching, and batch operations. Use when optimizing memory usage, improving search speed, or scaling to millions of vectors.
repo: ruvnet/ruflo
인기도
- GitHub 스타
- 81k
- 순위
- #1713
- 라이선스
- MIT
- 업데이트
- 2026. 11. 2.
댓글
- …
이 저장소의 다른 스킬
agent-adaptive-coordinator
81k작업량이 바뀔 때 에이전트 무리를 나누고 재배치해, 작업에 맞는 배치를 고르도록 에이전트를 돕습니다.
agent-agent
81k큰 목표를 순서가 있는 행동 계획으로 나누고, 조건이 바뀌면 다시 계획하도록 에이전트를 가르칩니다.
agent-agentic-payments
81kAI 쇼핑을 위한 지출 위임장을 관리합니다. 지출 상한, 시간 창, 판매자 규칙, 서명된 승인을 포함합니다.
agent-analyze-code-quality
81k에이전트가 파일을 바꾸지 않고, 코드 품질 문제와 코드 냄새, 기술 부채, 리팩터링 아이디어를 찾아 검토하도록 돕습니다.
비슷한 스킬
discrawl
394k에이전트가 저장된 로컬 Discord 메시지 보관본을 검색하고 요약하며, 최신 상태를 확인하고 다이렉트 메시지를 읽도록 돕습니다.
clickhouse-io
280k에이전트가 ClickHouse 데이터베이스의 쿼리와 스키마를 최적화하도록 돕습니다. 고성능 분석 작업의 모범 사례를 적용합니다. 분석 쿼리가 느릴 때 씁니다.
scientific-db-pubmed-database
280k생의학 분야의 과학 논문을 에이전트가 검색하도록 돕습니다. 특정 의학 정보가 필요한 연구에 유용합니다.