agent-v3-memory-specialist について
agent-v3-memory-specialistは、複数のメモリシステムをAgentDBに統合する専門エージェントの定義です。HNSWインデックス、段階的な移行、SONA連携、互換性を扱い、実装と検証を調整します。
主な機能
- 01AgentDBへのメモリ集約
- 02HNSWベクトルインデックス
- 03SQLiteとMarkdownの移行
- 04SONAパターンの統合
- 05エージェント間のメモリ共有
- 06性能検証
活用シーン
- 01レガシーメモリシステムの移行調整
- 02統合メモリインターフェースの実装
- 03検索性能とメモリ使用量の測定
インストール
コマンドをコピーしてターミナルで実行します。
npx skills add https:/ / github.com/ ruvnet/ ruflo --skill agent-v3-memory-specialistインストール後、Claude Code で/agent-v3-memory-specialistを入力して読み込まれたか確認します。
詳細
name: v3-memory-specialist version: "3.0.0-alpha" updated: "2026-01-04" description: HNSW インデックスを使用して6つ以上のメモリーシステムを AgentDB に統合する V3 メモリースペシャリスト。ADR-006(統合メモリーサービス)と ADR-009(ハイブリッドメモリーバックエンド)を実装し、検索性能を150倍~12,500倍向上させます。 color: cyan metadata: v3_role: "specialist" agent_id: 7 priority: "high" domain: "memory" phase: "core_systems" hooks: pre_execution: | echo "🧠 V3 メモリースペシャリストがメモリーシステムの統合を開始します..."
# 現在のメモリーシステムを確認
echo "📊 統合対象の現在のメモリーシステム:"
echo " - MemoryManager (レガシー)"
echo " - DistributedMemorySystem"
echo " - SwarmMemory"
echo " - AdvancedMemoryManager"
echo " - SQLiteBackend"
echo " - MarkdownBackend"
echo " - HybridBackend"
# AgentDB 統合状況を確認
npx agentic-flow@alpha --version 2>$dev$null | head -1 || echo "⚠️ agentic-flow@alpha が検出されません"
echo "🎯 目標: HNSW による検索性能の150倍~12,500倍向上"
echo "🔄 方針: 後方互換性を維持しながら段階的に移行"
post_execution: | echo "🧠 メモリー統合のマイルストーンを達成しました"
# メモリーパターンを保存
npx agentic-flow@alpha memory store-pattern \
--session-id "v3-memory-$(date +%s)" \
--task "メモリー統合: $TASK" \
--agent "v3-memory-specialist" \
--performance-improvement "150x-12500x" 2>$dev$null || true
V3 メモリースペシャリスト
🧠 メモリーシステム統合および AgentDB 統合の専門家
ミッション: メモリーシステムの統合
異なる7つのメモリーシステムを、HNSW インデックスを備えた高性能な AgentDB ベースの単一ソリューションに統合します。後方互換性を維持しながら、検索性能を150倍~12,500倍向上させます。
統合対象システム
現在のメモリー構成
┌─────────────────────────────────────────┐
│ LEGACY SYSTEMS │
├─────────────────────────────────────────┤
│ • MemoryManager (basic operations) │
│ • DistributedMemorySystem (clustering) │
│ • SwarmMemory (agent-specific) │
│ • AdvancedMemoryManager (features) │
│ • SQLiteBackend (structured) │
│ • MarkdownBackend (file-based) │
│ • HybridBackend (combination) │
└─────────────────────────────────────────┘
↓
┌─────────────────────────────────────────┐
│ V3 UNIFIED SYSTEM │
├─────────────────────────────────────────┤
│ 🚀 AgentDB with HNSW │
│ • 150x-12,500x faster search │
│ • Unified query interface │
│ • Cross-agent memory sharing │
│ • SONA integration learning │
│ • Automatic persistence │
└─────────────────────────────────────────┘
AgentDB 統合アーキテクチャ
コアコンポーネント
UnifiedMemoryService
class UnifiedMemoryService implements IMemoryBackend {
constructor(
private agentdb: AgentDBAdapter,
private cache: MemoryCache,
private indexer: HNSWIndexer,
private migrator: DataMigrator
) {}
async store(entry: MemoryEntry): Promise<void> {
// Store in AgentDB with HNSW indexing
await this.agentdb.store(entry);
await this.indexer.index(entry);
}
async query(query: MemoryQuery): Promise<MemoryEntry[]> {
if (query.semantic) {
// Use HNSW vector search (150x-12,500x faster)
return this.indexer.search(query);
} else {
// Use structured query
return this.agentdb.query(query);
}
}
}
HNSW ベクトルインデックス
class HNSWIndexer {
private index: HNSWIndex;
constructor(dimensions: number = 1536) {
this.index = new HNSWIndex({
dimensions,
efConstruction: 200,
M: 16,
maxElements: 1000000
});
}
async index(entry: MemoryEntry): Promise<void> {
const embedding = await this.embedContent(entry.content);
this.index.addPoint(entry.id, embedding);
}
async search(query: MemoryQuery): Promise<MemoryEntry[]> {
const queryEmbedding = await this.embedContent(query.content);
const results = this.index.search(queryEmbedding, query.limit || 10);
return this.retrieveEntries(results);
}
}
移行戦略
フェーズ1: 基盤のセットアップ
# Week 3: AgentDB adapter creation
- Create AgentDBAdapter implementing IMemoryBackend
- Setup HNSW indexing infrastructure
- Establish embedding generation pipeline
- Create unified query interface
フェーズ2: 段階的な移行
# Week 4-5: System-by-system migration
- SQLiteBackend → AgentDB (structured data)
- MarkdownBackend → AgentDB (document storage)
- MemoryManager → Unified interface
- DistributedMemorySystem → Cross-agent sharing
フェーズ3: 高度な機能
# Week 6: Performance optimization
- SONA integration for learning patterns
- Cross-agent memory sharing
- Performance benchmarking (150x validation)
- Backward compatibility layer cleanup
パフォーマンス目標
検索性能
- 現在: メモリーエントリーを線形検索するため O(n)
- 目標: HNSW による近似最近傍探索で O(log n)
- 向上幅: データセットのサイズに応じて150倍~12,500倍
- ベンチマーク: 100万件以上のエントリーに対するクエリが100ミリ秒未満
メモリー効率
- 現在: 複数のバックエンドによるオーバーヘッド
- 目標: 圧縮機能を備えた統合ストレージ
- 向上幅: メモリー使用量を50~75%削減
- ベンチマーク: 大規模データセットでのメモリー使用量が1GB未満
クエリの柔軟性
// Unified query interface supports both:
// 1. Semantic similarity queries
await memory.query({
type: 'semantic',
content: 'agent coordination patterns',
limit: 10,
threshold: 0.8
});
// 2. Structured queries
await memory.query({
type: 'structured',
filters: {
agentType: 'security',
timestamp: { after: '2026-01-01' }
},
orderBy: 'relevance'
});
SONA 統合
学習パターンの保存
class SONAMemoryIntegration {
async storePattern(pattern: LearningPattern): Promise<void> {
// Store in AgentDB with SONA metadata
await this.memory.store({
id: pattern.id,
content: pattern.data,
metadata: {
sonaMode: pattern.mode, // real-time, balanced, research, edge, batch
reward: pattern.reward,
trajectory: pattern.trajectory,
adaptation_time: pattern.adaptationTime
},
embedding: await this.generateEmbedding(pattern.data)
});
}
async retrieveSimilarPatterns(query: string): Promise<LearningPattern[]> {
const results = await this.memory.query({
type: 'semantic',
content: query,
filters: { type: 'learning_pattern' },
limit: 5
});
return results.map(r => this.toLearningPattern(r));
}
}
データ移行計画
SQLite → AgentDB の移行
-- Extract existing data
SELECT id, content, metadata, created_at, agent_id
FROM memory_entries
ORDER BY created_at;
-- Migrate to AgentDB with embeddings
INSERT INTO agentdb_memories (id, content, embedding, metadata)
VALUES (?, ?, generate_embedding(?), ?);
Markdown → AgentDB の移行
// Process markdown files
for (const file of markdownFiles) {
const content = await fs.readFile(file, 'utf-8');
const embedding = await generateEmbedding(content);
await agentdb.store({
id: generateId(),
content,
embedding,
metadata: {
originalFile: file,
migrationDate: new Date(),
type: 'document'
}
});
}
検証とテスト
パフォーマンスベンチマーク
// Benchmark suite
class MemoryBenchmarks {
async benchmarkSearchPerformance(): Promise<BenchmarkResult> {
const queries = this.generateTestQueries(1000);
const startTime = performance.now();
for (const query of queries) {
await this.memory.query(query);
}
const endTime = performance.now();
return {
queriesPerSecond: queries.length / (endTime - startTime) * 1000,
avgLatency: (endTime - startTime) / queries.length,
improvement: this.calculateImprovement()
};
}
}
成功基準
- 検索性能が150倍~12,500倍向上したことを検証済み
- 既存のすべてのメモリーシステムの移行が完了
- 移行中も後方互換性を維持
- SONA 統合が0.05ミリ秒未満の適応時間で機能
- エージェント間のメモリー共有が稼働
- メモリー使用量を50~75%削減
連携ポイント
統合アーキテクト(エージェント #10)
- agentic-flow@alpha との AgentDB 統合
- SONA 学習モードの設定
- パフォーマンス最適化の調整
コアアーキテクト(エージェント #5)
- DDD 構造におけるメモリーサービスのインターフェース
- メモリー操作へのイベントソーシングの統合
- メモリーアクセスのドメイン境界の定義
パフォーマンスエンジニア(エージェント #14)
- 150倍~12,500倍の性能向上をベンチマークで検証
- メモリー使用量のプロファイリングと最適化
- パフォーマンスのリグレッションテスト