v2/docs/integrations/reasoningbank/REASONINGBANK-ANALYSIS-COMPLETE.md
Successfully analyzed ReasoningBank tools and created comprehensive documentation for building custom reasoning agents with claude-flow and agentic-flow integration.
~60KB)Location: /workspaces/claude-code-flow/docs/REASONINGBANK-AGENT-CREATION-GUIDE.md
Contents:
Key Sections:
score = α·similarity + β·recency + γ·reliability + δ·diversity~55KB)Location: /workspaces/claude-code-flow/docs/AGENTIC-FLOW-INTEGRATION-GUIDE.md
Contents:
Key Sections:
Location: .claude/agents/reasoning/example-reasoning-agent-template.md
Contents:
npx agentic-flow reasoningbank demo
Results Observed:
-- 7 core tables identified:
patterns -- Core memory storage (reasoning_memory)
pattern_embeddings -- Vector embeddings (BLOB)
pattern_links -- Memory relationships
task_trajectories -- Execution history
matts_runs -- MATTS algorithm runs
consolidation_runs -- Optimization history
metrics_log -- Performance tracking
RETRIEVE β JUDGE β DISTILL β CONSOLIDATE
β β β β
Get past Evaluate Extract Optimize
memories success patterns memory
score = α·similarity + β·recency + γ·reliability + δ·diversity
// Default weights:
Ξ± = 0.7 // Semantic similarity (cosine)
Ξ² = 0.2 // Recency (exponential decay)
Ξ³ = 0.1 // Reliability (confidence score)
Ξ΄ = 0.3 // Diversity (MMR selection)
// File: src/cli/simple-commands/agent.js (1250 lines)
// Key integration functions discovered:
- executeAgentTask() // Lines 81-130
- buildAgenticFlowCommand() // Lines 132-236
- listAgenticFlowAgents() // Lines 238-260
- createAgent() // Lines 262-311
- getAgentInfo() // Lines 313-338
- memoryCommand() // Lines 362-401
- initializeMemory() // Lines 403-431
- getMemoryStatus() // Lines 433-448
- consolidateMemory() // Lines 450-466
- listMemories() // Lines 468-494
- runMemoryDemo() // Lines 496-512
- configAgenticFlow() // Lines 572-601
- mcpAgenticFlow() // Lines 751-777
Multi-Provider Support:
ReasoningBank Memory Options (Lines 168-194):
--enable-memory # Enable learning
--memory-db <path> # Database location
--memory-k <n> # Top-k retrieval
--memory-domain <domain> # Domain filtering
--no-memory-learning # Read-only mode
--memory-min-confidence <n> # Confidence threshold
--memory-task-id <id> # Custom task ID
Model Optimization (Lines 196-208):
--optimize # Auto-select optimal model
--priority <priority> # quality|cost|speed|privacy|balanced
--max-cost <dollars> # Budget cap
Execution Options (Lines 210-234):
--retry # Auto-retry errors
--agents-dir <path> # Custom agents directory
--timeout <ms> # Execution timeout
--anthropic-key <key> # Override API key
--openrouter-key <key> # Override API key
--gemini-key <key> # Override API key
initialize()
.swarm/memory.dbretrieveMemories(query, options)
[{ id, title, description, content, score, components }]judgeTrajectory(trajectory, query)
{ label: 'Success'|'Failure', confidence: 0-1, reasons: [] }distillMemories(trajectory, verdict, query, options)
[memoryId1, memoryId2, ...]consolidate()
{ itemsProcessed, duplicatesFound, itemsPruned, durationMs }runTask(options)
{ verdict, usedMemories, newMemories, consolidated }Expected Improvements (from ReasoningBank paper):
Demo Results (observed):
# Core settings
REASONINGBANK_ENABLED=true
CLAUDE_FLOW_DB_PATH=.swarm/memory.db
ANTHROPIC_API_KEY=sk-ant-...
# Retrieval settings
REASONINGBANK_K=3
REASONINGBANK_MIN_CONFIDENCE=0.5
REASONINGBANK_RECENCY_HALFLIFE=7
# Scoring weights
REASONINGBANK_ALPHA=0.7
REASONINGBANK_BETA=0.2
REASONINGBANK_GAMMA=0.1
REASONINGBANK_DELTA=0.3
{
"database": { "path": ".swarm/memory.db" },
"embeddings": { "provider": "claude" },
"retrieve": { "k": 3, "alpha": 0.7, ... },
"judge": { "model": "claude-3-sonnet", ... },
"distill": { "model": "claude-3-sonnet", ... },
"consolidate": { "interval_hours": 24 }
}
claude-flow agent run β npx agentic-flowclaude-flow agent memory β npx agentic-flow reasoningbankclaude-flow agent config β npx agentic-flow configclaude-flow agent mcp β npx agentic-flow mcpclaude-flow agent create β npx agentic-flow agent createclaude-flow agent info β npx agentic-flow agent info/workspaces/claude-code-flow/docs/REASONINGBANK-AGENT-CREATION-GUIDE.md (60KB)/workspaces/claude-code-flow/docs/AGENTIC-FLOW-INTEGRATION-GUIDE.md (55KB)/workspaces/claude-code-flow/.claude/agents/reasoning/example-reasoning-agent-template.md (10KB)/workspaces/claude-code-flow/docs/REASONINGBANK-ANALYSIS-COMPLETE.md (this file)/workspaces/claude-code-flow/src/cli/simple-commands/agent.js (1250 lines)/workspaces/claude-code-flow/node_modules/agentic-flow/dist/reasoningbank/index.js/workspaces/claude-code-flow/node_modules/agentic-flow/dist/reasoningbank/core/retrieve.js/workspaces/claude-code-flow/node_modules/agentic-flow/dist/reasoningbank/core/judge.js/workspaces/claude-code-flow/node_modules/agentic-flow/dist/reasoningbank/core/distill.js/workspaces/claude-code-flow/.claude/agents/reasoning/README.md/workspaces/claude-code-flow/.claude/agents/reasoning/goal-planner.md/tmp/reasoningbank-analysis/.swarm/memory.db (created)npx agentic-flow reasoningbank demo (successful)# 1. Initialize ReasoningBank
claude-flow agent memory init
# 2. Run your first reasoning-enabled agent
claude-flow agent run coder "Build REST API" --enable-memory
# 3. Check what was learned
claude-flow agent memory status
# 1. Copy the template
cp .claude/agents/reasoning/example-reasoning-agent-template.md \
.claude/agents/custom/my-reasoning-agent.md
# 2. Customize the template
# Edit: name, description, domains, capabilities
# 3. Use your agent
claude-flow agent run my-reasoning-agent "Task description" \
--enable-memory \
--memory-domain custom/my-domain
# Day 1: First task (cold start)
claude-flow agent run coder "Build feature A" --enable-memory
# Day 2: Related task (benefits from Day 1)
claude-flow agent run coder "Build feature B" --enable-memory --memory-k 5
# Day 3: Another related task (benefits from Days 1-2)
claude-flow agent run coder "Build feature C" --enable-memory --memory-k 10
# Result: Each iteration faster and more consistent
claude-flow agent memory initclaude-flow agent memory demodocs/AGENTIC-FLOW-INTEGRATION-GUIDE.mddocs/AGENTIC-FLOW-INTEGRATION-GUIDE.mdclaude-flow agent --help.claude/agents/reasoning/README.mddocs/REASONINGBANK-AGENT-CREATION-GUIDE.md.claude/agents/reasoning/example-reasoning-agent-template.mdnode_modules/agentic-flow/dist/reasoningbank/index.jsnode_modules/agentic-flow/dist/reasoningbank/docs/REASONINGBANK-AGENT-CREATION-GUIDE.md#database-schemadocs/REASONINGBANK-AGENT-CREATION-GUIDE.mddocs/AGENTIC-FLOW-INTEGRATION-GUIDE.md.claude/agents/reasoning/example-reasoning-agent-template.md.claude/agents/reasoning/README.mdsrc/cli/simple-commands/init/index.js (lines 1698-1742)src/cli/simple-commands/agent.js (1250 lines)Summary: Successfully analyzed ReasoningBank tools and created comprehensive documentation for building custom reasoning agents. Delivered:
Users can now:
Version: 1.0.0 Date: 2025-10-12 Status: Complete and production-ready
"Agents that learn from experience get better over time" - ReasoningBank Philosophy