AgentDB Memory Patterns
できること
このスキルは、セッション間で続くメモリをAIエージェントに持たせる方法を示します。AgentDBのストレージを使います。チャットアシスタントやその他の状態を持つエージェントを作る人向けです。
使う場面
- ✓チャットボットに、以前の会話で利用者が言ったことを覚えさせたいとき。
- ✓複数のセッションにまたがって文脈を保つエージェントが必要なとき。
- ✓過去のやり取りからパターンを学ぶべきアシスタントを作っているとき。
スキルのリンク
https://github.com/ruvnet/RuView/blob/main/.claude/skills/agentdb-memory-patterns/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“私のアシスタントにメモリを設定して、次にお客様がチャットしたとき、それぞれのお客様の好みを覚えているようにしてください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
スキルはAgentDBデータベースを起動し、セッションの詳細、長期的なメモ、学習したパターンを保存します。エージェントは、新しい会話の文脈が必要になったときに、それらを検索します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
AgentDB Memory Patterns
What This Skill Does
Provides memory management patterns for AI agents using AgentDB's persistent storage and ReasoningBank integration. Enables agents to remember conversations, learn from interactions, and maintain context across sessions.
Performance: 150x-12,500x faster than traditional solutions with 100% backward compatibility.
Prerequisites
- Node.js 18+
- AgentDB v1.0.7+ (via agentic-flow or standalone)
- Understanding of agent architectures
Quick Start with CLI
Initialize AgentDB
# Initialize vector database
npx agentdb@latest init ./agents.db
# Or with custom dimensions
npx agentdb@latest init ./agents.db --dimension 768
# Use preset configurations
npx agentdb@latest init ./agents.db --preset large
# In-memory database for testing
npx agentdb@latest init ./memory.db --in-memory
Start MCP Server for Claude Code
# Start MCP server (integrates with Claude Code)
npx agentdb@latest mcp
# Add to Claude Code (one-time setup)
claude mcp add agentdb npx agentdb@latest mcp
Create Learning Plugin
# Interactive plugin wizard
npx agentdb@latest create-plugin
# Use template directly
npx agentdb@latest create-plugin -t decision-transformer -n my-agent
# Available templates:
# - decision-transformer (sequence modeling RL)
# - q-learning (value-based learning)
# - sarsa (on-policy TD learning)
# - actor-critic (policy gradient)
# - curiosity-driven (exploration-based)
Quick Start with API
import { createAgentDBAdapter } from 'agentic-flow/reasoningbank';
// Initialize with default configuration
const adapter = await createAgentDBAdapter({
dbPath: '.agentdb/reasoningbank.db',
enableLearning: true, // Enable learning plugins
enableReasoning: true, // Enable reasoning agents
quantizationType: 'scalar', // binary | scalar | product | none
cacheSize: 1000, // In-memory cache
});
// Store interaction memory
const patternId = await adapter.insertPattern({
id: '',
type: 'pattern',
domain: 'conversation',
pattern_data: JSON.stringify({
embedding: await computeEmbedding('What is the capital of France?'),
pattern: {
user: 'What is the capital of France?',
assistant: 'The capital of France is Paris.',
timestamp: Date.now()
}
}),
confidence: 0.95,
usage_count: 1,
success_count: 1,
created_at: Date.now(),
last_used: Date.now(),
});
// Retrieve context with reasoning
const context = await adapter.retrieveWithReasoning(queryEmbedding, {
domain: 'conversation',
k: 10,
useMMR: true, // Maximal Marginal Relevance
synthesizeContext: true, // Generate rich context
});
Memory Patterns
1. Session Memory
class SessionMemory {
async storeMessage(role: string, content: string) {
return await db.storeMemory({
sessionId: this.sessionId,
role,
content,
timestamp: Date.now()
});
}
async getSessionHistory(limit = 20) {
return await db.query({
filters: { sessionId: this.sessionId },
orderBy: 'timestamp',
limit
});
}
}
2. Long-Term Memory
// Store important facts
await db.storeFact({
category: 'user_preference',
key: 'language',
value: 'English',
confidence: 1.0,
source: 'explicit'
});
// Retrieve facts
const prefs = await db.getFacts({
category: 'user_preference'
});
3. Pattern Learning
// Learn from successful interactions
await db.storePattern({
trigger: 'user_asks_time',
response: 'provide_formatted_time',
success: true,
context: { timezone: 'UTC' }
});
// Apply learned patterns
const pattern = await db.matchPattern(currentContext);
Advanced Patterns
Hierarchical Memory
// Organize memory in hierarchy
await memory.organize({
immediate: recentMessages, // Last 10 messages
shortTerm: sessionContext, // Current session
longTerm: importantFacts, // Persistent facts
semantic: embeddedKnowledge // Vector search
});
Memory Consolidation
// Periodically consolidate memories
await memory.consolidate({
strategy: 'importance', // Keep important memories
maxSize: 10000, // Size limit
minScore: 0.5 // Relevance threshold
});
CLI Operations
Query Database
# Query with vector embedding
npx agentdb@latest query ./agents.db "[0.1,0.2,0.3,...]"
# Top-k
よくある質問
メモリはどこに保存されますか?
AgentDBのデータベースファイルに保存されます。テスト用のインメモリの選択肢もあります。
Claude Codeに接続できますか?
はい。AgentDB MCPサーバーを起動して、Claude Codeに追加する方法が示されています。
始める前に必要なものは?
Node.js 18以降と、AgentDBのバージョン1.0.7以降です。
詳細
作者による元の説明
Implement persistent memory patterns for AI agents using AgentDB. Includes session memory, long-term storage, pattern learning, and context management. Use when building stateful agents, chat systems, or intelligent assistants.
repo: ruvnet/RuView
人気
- GitHubのスター
- 102k
- ランキング
- #825
- ライセンス
- MIT
- 更新日
- 2026/11/2
コメント
- …
このリポジトリの他のスキル
AgentDB Advanced Features
102kエージェントが、複数のマシンにまたがるデータベースの同期や、ベクトル検索とメタデータによる絞り込みの組み合わせなど、AgentDBの高度な機能を示します。
AgentDB Learning Plugins
102kエージェントが、過去の経験から改善する強化学習の手法を使って、AgentDB向けの学習プラグインを作成・学習できるよう支援します。
AgentDB Performance Optimization
102kエージェントが、圧縮、高速な検索インデックス、キャッシュを使って、AgentDBの検索を高速化し、メモリ使用量を減らす方法を示します。
AgentDB Vector Search
102kエージェントが、正確な単語ではなく意味で文書を検索できるよう支援します。質問応答やナレッジベースに適しています。
似ているスキル
add-model-provider
394k安全なセットアップコマンドで新しいAIモデルプロバイダーをOpenClawに接続し、APIキーを平文で残さず、ライブテストを行うようエージェントを支援します。
acp-router
394kClaude CodeやCursorなどのコーディングアシスタントに、OpenClaw経由でタスクを渡し、その作業がそのツール内で行われるようエージェントを支援します。
browser-automation
394kログイン、タブ、応答しなくなったページからの復旧を含め、Webページを段階的に操作するようエージェントに教えます。