v2/docs/reasoningbank/models/problem-solving/README.md
Pre-trained Model for General Reasoning, Critical Thinking, and Problem-Solving
The Problem Solving model is a comprehensive ReasoningBank trained on 2,000 optimized reasoning patterns across 5 cognitive dimensions. It specializes in adaptive problem-solving strategies, drawing from diverse thinking patterns to tackle complex challenges.
This model implements a cognitive diversity approach with equal representation across 5 thinking patterns:
Focus: Logical deduction, systematic analysis, finding the single best solution
Subcategories:
Example Pattern: Production Database Slowdown
Problem: Database experiencing intermittent slowdowns every 15 minutes
Reasoning:
1. Identify symptom: Query latency spikes at regular intervals
2. Gather metrics: CPU, memory, disk I/O patterns
3. Analyze correlation: Disk I/O spikes align with latency
4. Investigate: Background checkpoint process identified
5. Trace configuration: checkpoint_timeout = 15 minutes
6. Validate hypothesis: Checkpoint causes write amplification
7. Root cause: Aggressive checkpoint frequency without tuning
Solution: Increase checkpoint_timeout, enable async checkpointing, WAL optimization
Outcome: Latency spikes eliminated, 40% performance improvement
Success Rate: 0.92
Focus: Brainstorming, exploring multiple alternatives, creative ideation
Subcategories:
Example Pattern: Customer Churn Reduction
Problem: Need innovative approaches to reduce customer churn
Reasoning:
- Idea 1: Predictive churn model with proactive outreach
- Idea 2: Gamification with loyalty points
- Idea 3: Personalized features based on usage
- Idea 4: Community building with user forums
- Idea 5: Flexible pricing with pause options
- Idea 6: Early access for loyal customers
- Idea 7: Integration marketplace for lock-in
- Idea 8: Educational content series
- Synthesis: Combine predictive ML + personalization + community
Solution: Multi-faceted retention strategy
Outcome: Churn -32%, lifetime value +45%
Success Rate: 0.85
Focus: Pattern breaking, reframing, unconventional approaches
Subcategories:
Example Pattern: Price Competition Challenge
Problem: Unable to compete on price with larger competitors
Reasoning:
- Challenge assumption: "Must compete on price"
- Reframe: Compete on value, not price
- Lateral shift: Target customers who value quality over cost
- Pattern break: Premium positioning instead of price matching
- Insight: Market segment willing to pay more for better service
- Creative leap: Position as boutique alternative
- Validation: 40% of market underserved by commoditization
Solution: Premium positioning - 30% higher prices, white-glove service
Outcome: Revenue +55%, profit margins tripled, retention 94%
Success Rate: 0.87
Focus: Holistic analysis, feedback loops, emergent behavior
Subcategories:
Example Pattern: Code Quality Declining Despite Hiring
Problem: Code quality declining despite hiring more engineers
Reasoning:
- System: Engineering team + codebase + processes
- Map relationships: More engineers → Less senior oversight per person
- Feedback loop: Less oversight → Lower quality → More bugs → More firefighting
- Time delays: Quality issues emerge 3 months after merge
- Reinforcing loop: Firefighting reduces code review time
- Leverage point: Code review process quality, not quantity
- Intervention: Mandatory pair programming + automated gates
Solution: Pair programming, automated quality checks, architect oversight
Outcome: Code quality +45%, bug density -62%, sustainable despite growth
Success Rate: 0.90
Focus: Assumption validation, bias detection, evidence evaluation
Subcategories:
Example Pattern: Feature Request Assumption
Problem: Team believes users want more features, but retention declining
Reasoning:
1. Identify assumption: "More features will improve retention"
2. Question evidence: What data supports this?
3. Challenge logic: Do users actually ask for more features?
4. Examine alternatives: Could feature bloat be causing issues?
5. Gather contradicting data: User interviews show overwhelm
6. Test assumption: Ship nothing new for 1 month
7. Invalidate: Retention actually improved without new features
8. New insight: Users need better core experience
Solution: Freeze features, improve core workflows, reduce complexity
Outcome: Retention +31%, feature usage depth +45%, NPS +18
Success Rate: 0.88
npx claude-flow@alpha memory query "How to approach a complex system outage with intermittent failures?" \
--namespace problem-solving \
--reasoningbank \
--k 5
Expected Results: Convergent thinking patterns showing systematic debugging approaches, hypothesis testing, and feedback loop analysis.
npx claude-flow@alpha memory query "Explore multiple approaches to solve database scaling bottleneck" \
--namespace problem-solving \
--reasoningbank \
--k 5
Expected Results: Divergent thinking patterns exploring caching, sharding, read replicas, query optimization, and architectural alternatives.
npx claude-flow@alpha memory query "Traditional deployment process too slow, need breakthrough solution" \
--namespace problem-solving \
--reasoningbank \
--k 5
Expected Results: Lateral thinking patterns challenging deployment assumptions, suggesting continuous deployment, feature flags, and pattern-breaking approaches.
npx claude-flow@alpha memory query "Why does increasing marketing spend reduce lead quality?" \
--namespace problem-solving \
--reasoningbank \
--k 5
Expected Results: Systems thinking patterns revealing balancing loops, time delays, and leverage points in the marketing-sales system.
npx claude-flow@alpha memory query "Validate assumption that users want more features" \
--namespace problem-solving \
--reasoningbank \
--k 5
Expected Results: Critical thinking patterns for assumption testing, evidence gathering, and bias detection.
This model is designed for seamless integration with agentic-flow agents:
// Agent uses multiple cognitive patterns for complex problem
const problem = "Production system experiencing cascading failures";
// 1. Critical Thinking: Validate assumptions
const assumptions = await reasoningBank.query(
"Validate assumptions about cascading failure causes",
{ cognitive_type: "critical" }
);
// 2. Convergent Thinking: Root cause analysis
const rootCause = await reasoningBank.query(
"Systematic debugging for cascading failures",
{ cognitive_type: "convergent" }
);
// 3. Systems Thinking: Understand feedback loops
const systemDynamics = await reasoningBank.query(
"Feedback loops causing cascading failures",
{ cognitive_type: "systems" }
);
// 4. Divergent Thinking: Generate solutions
const solutions = await reasoningBank.query(
"Alternative solutions for system resilience",
{ cognitive_type: "divergent" }
);
// 5. Lateral Thinking: Breakthrough approach
const breakthrough = await reasoningBank.query(
"Unconventional approaches to system reliability",
{ cognitive_type: "lateral" }
);
// Synthesize insights from all cognitive patterns
const strategy = synthesizeMultiPatternSolution([
assumptions,
rootCause,
systemDynamics,
solutions,
breakthrough
]);
// coder agent with problem-solving reasoning
{
"agent": "coder",
"reasoningbank": {
"model": "problem-solving",
"enabled": true,
"retrieval_k": 5,
"cognitive_diversity": true, // Use patterns from multiple cognitive types
"trajectory_following": true // Follow multi-step reasoning paths
}
}
// researcher agent with critical thinking focus
{
"agent": "researcher",
"reasoningbank": {
"model": "problem-solving",
"enabled": true,
"retrieval_k": 3,
"filter": { "cognitive_type": "critical" }, // Focus on critical thinking
"trajectory_following": false
}
}
# Query
npx claude-flow@alpha memory query \
"API returning inconsistent data for same request" \
--namespace problem-solving \
--reasoningbank
# Expected: Convergent patterns (root cause analysis, logical deduction)
# - Check for distributed cache coherency issues
# - Investigate load balancer state
# - Analyze cache invalidation synchronization
# Query
npx claude-flow@alpha memory query \
"Customer success team expansion not improving retention" \
--namespace problem-solving \
--reasoningbank
# Expected: Systems patterns (feedback loops, leverage points)
# - Identify vicious cycle: more CS → more feature requests → product overwhelmed
# - Find leverage: product usability, not support quantity
# - System intervention: cross-functional retention task force
# Query
npx claude-flow@alpha memory query \
"Office space shortage without relocating" \
--namespace problem-solving \
--reasoningbank
# Expected: Divergent patterns (alternatives, creative solutions)
# - Hot-desking with reservation system
# - Hybrid remote work policy
# - Repurpose underutilized spaces
# - Partner with coworking for overflow
# Query
npx claude-flow@alpha memory query \
"How to handle growing costs with growing scale" \
--namespace problem-solving \
--reasoningbank
# Expected: Multiple patterns from different domains
# - Infrastructure: auto-scaling, rightsizing, spot instances
# - Process: continuous optimization vs reactive
# - Business: cost allocation, FinOps practices
Based on cognitive diversity research and ReasoningBank architecture:
-- Core patterns with cognitive metadata
CREATE TABLE patterns (
id INTEGER PRIMARY KEY,
memory_id TEXT UNIQUE,
content TEXT, -- Problem statement
reasoning_steps TEXT, -- JSON array of reasoning steps
outcome TEXT, -- Solution and results
success_rate REAL, -- Historical effectiveness
cognitive_type TEXT, -- convergent/divergent/lateral/systems/critical
domain TEXT, -- business/technical/creative/analytical
tags TEXT, -- Comma-separated searchable tags
created_at INTEGER,
updated_at INTEGER
);
-- 384-dimensional embeddings for semantic search
CREATE TABLE pattern_embeddings (
id INTEGER PRIMARY KEY,
pattern_id INTEGER,
embedding BLOB, -- 384-d float32 vector
embedding_model TEXT,
FOREIGN KEY (pattern_id) REFERENCES patterns(id)
);
-- Pattern relationships (3,500 links)
CREATE TABLE pattern_links (
id INTEGER PRIMARY KEY,
source_id INTEGER,
target_id INTEGER,
link_type TEXT, -- alternative/enhances/requires
strength REAL, -- 0.0-1.0
FOREIGN KEY (source_id) REFERENCES patterns(id),
FOREIGN KEY (target_id) REFERENCES patterns(id)
);
-- Multi-step reasoning paths (500 trajectories)
CREATE TABLE task_trajectories (
id INTEGER PRIMARY KEY,
memory_id TEXT,
step_sequence TEXT, -- JSON array of pattern IDs
total_steps INTEGER, -- 3-7 steps typically
success_rate REAL,
created_at INTEGER
);
# Only convergent (systematic) patterns
npx claude-flow@alpha memory query "debug production issue" \
--reasoningbank \
--filter "cognitive_type:convergent"
# Only divergent (creative) patterns
npx claude-flow@alpha memory query "improve user engagement" \
--reasoningbank \
--filter "cognitive_type:divergent"
# Technical domain
npx claude-flow@alpha memory query "scale microservices" \
--reasoningbank \
--filter "domain:technical"
# Business domain
npx claude-flow@alpha memory query "reduce customer churn" \
--reasoningbank \
--filter "domain:business"
# High-confidence patterns only (>0.85 success rate)
npx claude-flow@alpha memory query "deploy safely" \
--reasoningbank \
--filter "success_rate:>0.85"
# Find alternative approaches
npx claude-flow@alpha memory query "solve scaling problem" \
--reasoningbank \
--links "alternative" \
--k 10
# Find prerequisite patterns
npx claude-flow@alpha memory query "implement microservices" \
--reasoningbank \
--links "requires" \
--k 5
# Follow proven reasoning paths
npx claude-flow@alpha memory query "complex system debugging" \
--reasoningbank \
--trajectory \
--steps 5
import Database from 'better-sqlite3';
const db = new Database('memory.db');
// Insert new pattern
db.prepare(`
INSERT INTO patterns (memory_id, content, reasoning_steps, outcome,
success_rate, cognitive_type, domain, tags)
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
`).run(
'custom/pattern-1',
'Your problem description',
JSON.stringify(['step 1', 'step 2', 'step 3']),
'Your outcome',
0.85,
'convergent',
'technical',
'debugging,performance,optimization'
);
// Generate and insert embedding
const embedding = await generateEmbedding('Your problem description');
db.prepare(`
INSERT INTO pattern_embeddings (pattern_id, embedding)
VALUES (last_insert_rowid(), ?)
`).run(embedding);
// Link related patterns
db.prepare(`
INSERT INTO pattern_links (source_id, target_id, link_type, strength)
VALUES (?, ?, ?, ?)
`).run(sourcePatternId, targetPatternId, 'enhances', 0.9);
// Create multi-step reasoning path
db.prepare(`
INSERT INTO task_trajectories (memory_id, step_sequence, total_steps, success_rate)
VALUES (?, ?, ?, ?)
`).run(
'custom/trajectory-1',
JSON.stringify([patternId1, patternId2, patternId3, patternId4]),
4,
0.88
);
Run validation suite:
node /workspaces/claude-code-flow/docs/reasoningbank/models/validation-suite.js \
/workspaces/claude-code-flow/docs/reasoningbank/models/problem-solving \
problem-solving
Quality Criteria (All Met ✅):
// .claude/config.json
{
"agents": {
"coder": {
"reasoningbank": {
"enabled": true,
"models": ["problem-solving"],
"cognitive_diversity": true,
"auto_switch": true // Automatically switch cognitive patterns
}
}
}
}
// Use with claude-flow MCP server
{
"action": "query",
"query": "How to debug intermittent production issues?",
"options": {
"reasoningbank": true,
"model": "problem-solving",
"cognitive_type": "convergent",
"k": 5
}
}
This model is based on research in:
Part of the claude-flow ReasoningBank system. Pre-trained model available for use with claude-flow and agentic-flow agents.
/docs/reasoningbank/models/problem-solving/train-problem.js/docs/reasoningbank/models/validation-suite.jsModel Version: 1.0.0 Training Date: 2025-10-15 Training Agent: Problem Solving Training Agent Quality Status: ✅ All criteria met