ReasoningBank with AgentDB
What it does
This skill shows how to build an agent that learns from its experiences, using ReasoningBank on top of AgentDB storage. It is for developers building self-improving AI systems.
When to use it
- ✓When you want an agent to remember which approaches worked and reuse them.
- ✓When you need an agent to judge its own outcomes and learn from them.
- ✓When you are moving an older ReasoningBank setup to AgentDB.
Skill link
https://github.com/ruvnet/RuView/blob/main/.claude/skills/reasoningbank-agentdb/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“Make my AI assistant remember which replies customers liked, and use those approaches next time.”
5 new skills a week. 1 minute to read.
How it works
The agent records each task as a trajectory, judges whether it succeeded, and distills the lessons into memory. Future decisions can then search those stored patterns for what worked.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
ReasoningBank with AgentDB
What This Skill Does
Provides ReasoningBank adaptive learning patterns using AgentDB's high-performance backend (150x-12,500x faster). Enables agents to learn from experiences, judge outcomes, distill memories, and improve decision-making over time with 100% backward compatibility.
Performance: 150x faster pattern retrieval, 500x faster batch operations, <1ms memory access.
Prerequisites
- Node.js 18+
- AgentDB v1.0.7+ (via agentic-flow)
- Understanding of reinforcement learning concepts (optional)
Quick Start with CLI
Initialize ReasoningBank Database
# Initialize AgentDB for ReasoningBank
npx agentdb@latest init ./.agentdb/reasoningbank.db --dimension 1536
# Start MCP server for Claude Code integration
npx agentdb@latest mcp
claude mcp add agentdb npx agentdb@latest mcp
Migrate from Legacy ReasoningBank
# Automatic migration with validation
npx agentdb@latest migrate --source .swarm/memory.db
# Verify migration
npx agentdb@latest stats ./.agentdb/reasoningbank.db
Quick Start with API
import { createAgentDBAdapter, computeEmbedding } from 'agentic-flow/reasoningbank';
// Initialize ReasoningBank with AgentDB
const rb = await createAgentDBAdapter({
dbPath: '.agentdb/reasoningbank.db',
enableLearning: true, // Enable learning plugins
enableReasoning: true, // Enable reasoning agents
cacheSize: 1000, // 1000 pattern cache
});
// Store successful experience
const query = "How to optimize database queries?";
const embedding = await computeEmbedding(query);
await rb.insertPattern({
id: '',
type: 'experience',
domain: 'database-optimization',
pattern_data: JSON.stringify({
embedding,
pattern: {
query,
approach: 'indexing + query optimization',
outcome: 'success',
metrics: { latency_reduction: 0.85 }
}
}),
confidence: 0.95,
usage_count: 1,
success_count: 1,
created_at: Date.now(),
last_used: Date.now(),
});
// Retrieve similar experiences with reasoning
const result = await rb.retrieveWithReasoning(embedding, {
domain: 'database-optimization',
k: 5,
useMMR: true, // Diverse results
synthesizeContext: true, // Rich context synthesis
});
console.log('Memories:', result.memories);
console.log('Context:', result.context);
console.log('Patterns:', result.patterns);
Core ReasoningBank Concepts
1. Trajectory Tracking
Track agent execution paths and outcomes:
// Record trajectory (sequence of actions)
const trajectory = {
task: 'optimize-api-endpoint',
steps: [
{ action: 'analyze-bottleneck', result: 'found N+1 query' },
{ action: 'add-eager-loading', result: 'reduced queries' },
{ action: 'add-caching', result: 'improved latency' }
],
outcome: 'success',
metrics: { latency_before: 2500, latency_after: 150 }
};
const embedding = await computeEmbedding(JSON.stringify(trajectory));
await rb.insertPattern({
id: '',
type: 'trajectory',
domain: 'api-optimization',
pattern_data: JSON.stringify({ embedding, pattern: trajectory }),
confidence: 0.9,
usage_count: 1,
success_count: 1,
created_at: Date.now(),
last_used: Date.now(),
});
2. Verdict Judgment
Judge whether a trajectory was successful:
// Retrieve similar past trajectories
const similar = await rb.retrieveWithReasoning(queryEmbedding, {
domain: 'api-optimization',
k: 10,
});
// Judge based on similarity to successful patterns
const verdict = similar.memories.filter(m =>
m.pattern.outcome === 'success' &&
m.similarity > 0.8
).length > 5 ? 'likely_success' : 'needs_review';
console.log('Verdict:', verdict);
console.log('Confidence:', similar.memories[0]?.similarity || 0);
3. Memory Distillation
Consolidate similar experiences into patterns:
// Get all experiences in domain
const experiences = await rb.retrieveWithReasoning(embedding, {
domain: 'api-optimization',
k: 100,
optimizeMemory: true, // Automatic consolidation
});
// Distill into high-level pattern
const distilledPattern = {
domain: 'api-optimization',
pattern: 'For N+1 queries: add eager loading, then cache',
success_rate: 0.92,
sample_size: experiences.memories.length,
confidence: 0.95
};
await rb.insertPattern({
id: '',
type: 'distilled-pattern',
domain: 'api-optimization',
pattern_data: JSON.stringify({
embedding: await computeEmbed
FAQ
Do I need reinforcement learning knowledge?
No. The skill lists reinforcement learning concepts as optional background.
How can I move old data?
The skill shows a migration command that imports data from a legacy memory file.
What do I need installed first?
Node.js 18 or newer and AgentDB version 1.0.7 or later.
Details
Original description by the author
Implement ReasoningBank adaptive learning with AgentDB's 150x faster vector database. Includes trajectory tracking, verdict judgment, memory distillation, and pattern recognition. Use when building self-learning agents, optimizing decision-making, or implementing experience replay systems.
repo: ruvnet/RuView
Popularity
- GitHub stars
- 102k
- Ranking position
- #836
- License
- MIT
- Updated
- 11/2/2026
Comments
- …
More skills from this repository
AgentDB Advanced Features
102kShows your agent advanced AgentDB features, such as syncing databases across machines and combining vector search with metadata filters.
AgentDB Learning Plugins
102kLets your agent build and train learning plugins for AgentDB, using reinforcement learning methods that improve from past experience.
AgentDB Memory Patterns
102kLets your agent remember conversations and context across sessions, using AgentDB as its persistent memory store.
AgentDB Performance Optimization
102kShows your agent how to speed up AgentDB searches and reduce memory use, with compression, a fast search index and caching.
Similar skills
add-model-provider
394kLets your agent connect a new AI model provider to OpenClaw using safe setup commands, keep API keys out of plain text, and run a live test.
acp-router
394kHelps your agent send a task to a coding assistant such as Claude Code or Cursor through OpenClaw, so the work runs in that tool.
browser-automation
394kTeaches your agent to control web pages step by step, including logins, tabs, and recovery when a page stops responding.