
Agentdb Memory Patterns
Apply AgentDB-backed session, long-term, and pattern-learning memory patterns for stateful chat agents and assistants.
Overview
AgentDB Memory Patterns is an agent skill most often used in Build (also Operate iterate, Grow lifecycle) that implements persistent session, long-term, and pattern-learning memory for stateful agents using AgentDB.
Install
npx skills add https://github.com/ruvnet/ruflo --skill agentdb-memory-patternsWhat is this skill?
- CLI init with custom dimensions, large preset, or in-memory DB for tests
- `npx agentdb mcp` plus one-time `claude mcp add` for Claude Code
- create-plugin wizard and templates for learning-oriented plugins
- Session memory, long-term storage, pattern learning, and context management patterns
- ReasoningBank integration noted with 150x–12,500x faster vs traditional solutions in docs
- Documentation cites 150x–12,500x performance vs traditional solutions
- Supports init presets including large and configurable embedding dimensions
Adoption & trust: 627 installs on skills.sh; 58.5k GitHub stars; 1/3 security scanners passed (skills.sh audits).
What problem does it solve?
Your assistant forgets prior sessions and tool outcomes because memory is only the current context window.
Who is it for?
Indie developers adding production-grade persistent memory to Node-based agents before investing in custom vector infrastructure.
Skip if: Static skills with no state, or builders who only need a one-off markdown session export without retrieval.
When should I use this skill?
Use when building stateful agents, chat systems, or intelligent assistants that need AgentDB persistent memory.
What do I get? / Deliverables
You deploy AgentDB with documented memory tiers, MCP access, and optional plugins so agents recall conversations and learned patterns across runs.
- Initialized AgentDB database file
- Optional MCP server configuration for Claude
- Plugin scaffold from create-plugin flow
Recommended Skills
Journey fit
Spans multiple journey phases - primary shelf plus alternate fits below.
Persistent agent memory is adopted during Build; the same store supports cross-session product behavior in Grow and Operate. agent-tooling catalogs memory, MCP, and plugin scaffolding skills separate from generic backend CRUD.
Where it fits
Initialize `.agents.db` and attach MCP so Claude Code recalls prior repo-specific instructions.
Model long-term user facts separately from ephemeral session buffers in a support bot API.
Store engagement patterns to tailor onboarding messages for returning subscribers.
Swap in-memory DB for on-disk store when moving from local dev to a persisted staging environment.
How it compares
Baseline AgentDB memory cookbook—pair with ReasoningBank skill when you need trajectory judging and distillation, not just storage.
Common Questions / FAQ
Who is agentdb memory patterns for?
Builders of stateful agents, chat systems, and intelligent assistants who want CLI-first AgentDB setup and Claude MCP integration.
When should I use agentdb memory patterns?
In Build when designing memory architecture; in Operate when tuning retention and context windows; in Grow when personalizing returning users from stored interaction patterns.
Is agentdb memory patterns safe to install?
It executes npx agentdb, writes local databases, and can run an MCP server—scope filesystem and network accordingly. Review the Security Audits panel on this Prism page.
Workflow Chain
Then invoke: reasoningbank with agentdb
SKILL.md
READMESKILL.md - Agentdb Memory Patterns
# 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 ```bash # 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 ```bash # 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 ```bash # 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 ```typescript 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 ```typescript 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 ```typescript // 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 ```typescript // 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 = aw