ReasoningBank with AgentDB
Implement ReasoningBank adaptive learning with AgentDB's 150x faster vector database. Includes trajectory tracking, verdict judgment, memory distillation, and pattern recognition
Install / Use
npx skills add spencermarx/open-code-review --skill reasoningbank-agentdbInstalls into whichever agent you are using.
SKILL.md
Installable skill definition
Quality Score
Category
Data & AnalyticsSupported Platforms
Our assessment of ReasoningBank with AgentDB
ReasoningBank with AgentDB scores 85/100 on our quality scale, 452nd of 599 Data & Analytics skills we index.
Its SKILL.md is 11 KB long, well organised into 41 sections with 18 code examples: a thorough specification that gives an agent plenty to work with.
It has 368 GitHub stars, a meaningful sign that others use it.
Maintenance, license and trust
- The repository was last updated about 4 months ago. That is recent enough to be usable, but agent tooling moves fast, so check the instructions against your agent's current version.
- Our last check on 2026-11-04 found the source still online.
- It is released under the Apache-2.0 license, a permissive license that allows use, modification and commercial use with attribution.
- Its trust signals score 98/100, with no cautions. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.
Safety scan
No issues foundOur scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review of the same text found nothing harmful.
AI review by kimi-k2.7-code on 2026-10-07. Automated pattern scan on 2026-10-07. It catches known dangerous patterns, not every risk — read a skill before letting an agent act on it.
ReasoningBank with AgentDB compared with similar skills
All 4 of these similar skills score higher than ReasoningBank with AgentDB; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| ReasoningBank with AgentDB (this skill)by spencermarx | 85 | 368 | 4mo ago | SKILL.md |
| algorithmic-artby anthropics | 100 | 177.9k | 58d ago | SKILL.md |
| pptxby anthropics | 100 | 177.9k | 58d ago | SKILL.md |
| prospectingby coreyhaines31 | 100 | 60.1k | 8d ago | SKILL.md |
| ad-creativeby coreyhaines31 | 100 | 60.1k | 8d ago | SKILL.md |
Frequently asked questions
- How do I install ReasoningBank with AgentDB?
- Run
npx skills add spencermarx/open-code-review --skill "ReasoningBank with AgentDB". The install tabs above show the steps for each supported agent. - Which AI agents does ReasoningBank with AgentDB work with?
- It is written for Universal, as a SKILL.md file. Other agents that read the same format can often use it too.
- Is ReasoningBank with AgentDB safe to use?
- Our scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review of the same text found nothing harmful. It is Apache-2.0-licensed and scores 98/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is ReasoningBank with AgentDB still maintained?
- The repository was last updated about 4 months ago. That is recent enough to be usable, but agent tooling moves fast, so check the instructions against your agent's current version.
Skill content
View source on GitHubname: "ReasoningBank with AgentDB" description: "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."
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 computeEmbedding(JSON.stringify(distilledPattern)),
pattern: distilledPattern
}),
confidence: 0.95,
usage_count: 0,
success_count: 0,
created_at: Date.now(),
last_used: Date.now(),
});
Integration with Reasoning Agents
AgentDB provides 4 reasoning modules that enhance ReasoningBank:
1. PatternMatcher
Find similar successful patterns:
const result = await rb.retrieveWithReasoning(queryEmbedding, {
domain: 'problem-solving',
k: 10,
useMMR: true, // Maximal Marginal Relevance for diversity
});
// PatternMatcher returns diverse, relevant memories
result.memories.forEach(mem => {
console.log(`Pattern: ${mem.pattern.approach}`);
console.log(`Similarity: ${mem.similarity}`);
console.log(`Success Rate: ${mem.success_count / mem.usage_count}`);
});
2. ContextSynthesizer
Generate rich context from multiple memories:
const result = await rb.retrieveWithReasoning(queryEmbedding, {
domain: 'code-optimization',
synthesizeContext: true, // Enable context synthesis
k: 5,
});
// ContextSynthesizer creates coherent narrative
console.log('Synthesized Context:', result.context);
// "Based on 5 similar optimizations, the most effective approach
// involves profiling, identifying bottlenecks, and applying targeted
// improvements. Success rate: 87%"
3. MemoryOptimizer
Automatically consolidate and prune:
const result = await rb.retrieveWithReasoning(queryEmbedding, {
domain: 'testing',
optimizeMemory: true, // Enable automatic optimization
});
// MemoryOptimizer consolidates similar patterns and prunes low-quality
console.log('Optimizations:', result.optimizations);
// { consolidated: 15, pruned: 3, improved_quality: 0.12 }
4. ExperienceCurator
Filter by quality and relevance:
const result = await rb.retrieveWithReasoning(queryEmbedding, {
domain: 'debugging',
k: 20,
minConfidence: 0.8, // Only high-confidence experiences
});
// ExperienceCurator returns only quality experiences
result.memories.forEach(mem => {
console.log(`Confidence: ${mem.confidence}`);
console.log(`Success Rate: ${mem.success_count / mem.usage_count}`);
});
Legacy API Compatibility
AgentDB maintains 100% backward compatibility with legacy ReasoningBank:
import {
retrieveMemories,
judgeTrajectory,
distillMemories
} from 'agentic-flow/reasoningbank';
// Legacy API works unchanged (uses AgentDB backend automatically)
const memories = await retrieveMemories(query, {
domain: 'code-generation',
agent: 'coder'
});
const verdict = await judgeTrajectory(trajectory, query);
const newMemories = await distillMemories(
trajectory,
verdict,
query,
{ domain: 'code-generation' }
);
Performance Characteristics
- Pattern Search: 150x faster (100µs vs 15ms)
- Memory Retrieval: <1ms (with cache)
- Batch Insert: 500x faster (2ms vs 1s for 100 patterns)
- Trajectory Judgment: <5ms (including retrieval + analysis)
- Memory Distillation: <50ms (consolidate 100 patterns)
Advanced Patterns
Hierarchical Memory
Organize memories by abstraction level:
// Low-level: Specific implementation
await rb.insertPattern({
type: 'concrete',
domain: 'debugging/null-pointer',
pattern_data: JSON.stringify({
embedding,
pattern: { bug: 'NPE in UserService.getUser()', fix: 'Add null check' }
}),
confidence: 0.9,
// ...
});
// Mid-level: Pattern across similar cases
await rb.insertPattern({
type: 'pattern',
domain: 'debugging',
pattern_data: JSON.stringify({
embedding,
pattern: { category: 'null-pointer', approach: 'defensive-checks' }
}),
confidence: 0.85,
// ...
});
// High-level: General principle
await rb.insertPattern({
type: 'principle',
domain: 'software-engineering',
pattern_data: JSON.stringify({
embedding,
pattern: { principle: 'fail-fast with clear errors' }
}),
confidence: 0.95,
// ...
});
Multi-Domain Learning
Transfer learning across domains:
// Learn from backend optimization
const backendExperience = await rb.retrieveWithReasoning(embedding, {
domain: 'backend-optimization',
k: 10,
});
// Apply to frontend optimization
const transferredKnowledge = backendExperience.memories.map(mem => ({
...mem,
domain: 'frontend-optimization',
adapted: true,
}));
CLI Operations
Database Management
# Export trajectories and patterns
npx agentdb@latest export ./.agentdb/reasoningbank.db ./backup.json
# Import experiences
npx agentdb@latest import ./experiences.json
# Get statistics
npx agentdb@latest stats ./.agentdb/reasoningbank.db
# Shows: total patterns, domains, confidence distribution
Migration
# Migrate from legacy ReasoningBank
npx agentdb@latest migrate --source .swarm/memory.db --target .agentdb/reasoningbank.db
# Validate migration
npx agentdb@latest stats .agentdb/reasoningbank.db
Troubleshooting
Issue: Migration fails
# Check source database exists
ls -la .swarm/memory.db
# Run with verbose logging
DEBUG=agentdb:* npx agentdb@latest migrate --source .swarm/memory.db
Issue: Low confidence scores
// Enable context synthesis for better quality
const result = await rb.retrieveWithReasoning(embedding, {
synthesizeContext: true,
useMMR: true,
k: 10,
});
Issue: Memory growing too large
// Enable automatic optimization
const result = await rb.retrieveWithReasoning(embedding, {
optimizeMemory: true, // Consolidates similar patterns
});
// Or manually optimize
await rb.optimize();
Learn More
- AgentDB Integration: node_modules/agentic-flow/docs/AGENTDB_INTEGRATION.md
- GitHub: https://github.com/ruvnet/agentic-flow/tree/main/packages/agentdb
- MCP Integration:
npx agentdb@latest mcp - Website: https://agentdb.ruv.io
Category: Machine Learning / Reinforcement Learning Difficulty: Intermediate Estimated Time: 20-30 minutes
Related Skills
algorithmic-art
177.9kCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems.
pptx
177.9kUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an em…
prospecting
60.1kWhen the user wants to find and qualify prospects for outbound, or asks who to target first, which signal to prioritize, or where to spot buyers with the problem: buying signals, enrichment, verification, account research.
ad-creative
60.1kWhen the user wants to write or judge ad creative, or asks which ad, hook, or angle to run or kill: headlines, primary text, and variations for Google, Meta, LinkedIn, and TikTok, fresh angles when creative fatigues. Test hypotheses name the metric, comparison, and expected direction.
Languages
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.
