/learn Command
Captures and persists learnings with Memory MCP integration for knowledge graph storage.
/plugin marketplace add jleechanorg/claude-commands/plugin install claude-commands@claude-commands-marketplaceWhen this command is invoked, YOU (Claude) must execute these steps immediately: This is NOT documentation - these are COMMANDS to execute right now. Use TodoWrite to track progress through multi-phase workflows.
Action Steps:
Purpose: The unified learning command that captures and documents learnings with Memory MCP integration for persistent knowledge storage
Usage: /learn [optional: specific learning or context]
Note: This is the single, unified /learn command. All learning functionality is consolidated here with Memory MCP integration as the default.
Enhanced Behavior:
/think mode for deep pattern recognition and learning extraction/memory search for automatic query optimization and improved learning pattern discovery/memory command's automatic compound query transformation/memory learn for structured learning entity creation with relationship discoveryExamples:
/learn - Analyze recent mistakes/corrections/learn always use source venv/bin/activate - Add specific learning/learn playwright is installed, stop saying it isn't - Correct misconceptionAuto-Learning Categories:
Enhanced Workflow:
memory/check_backup_version.shAuto-Trigger Scenarios:
/integrate command/learn invocationLearning Categories:
Updates & Integration:
Enhanced Memory MCP Entity Schema:
High-Quality Entity Types:
technical_learning - Specific technical solutions with code/errorsimplementation_pattern - Successful code patterns with reusable detailsdebug_session - Complete debugging journeys with root causesfix_implementation - Documented fixes with validation stepsworkflow_insight - Process improvements with measurable outcomesarchitecture_decision - Design choices with rationale and trade-offsuser_preference_pattern - User interaction patterns with optimizationEnhanced Observations Format:
Quality Requirements:
Enhanced Relations: fixes, implemented_in, tested_by, caused_by, prevents, optimizes, supersedes, requires
Enhanced Memory MCP Implementation Steps:
Enhanced Search & Context:
/memory search "technical terms" - Use universal composition for optimized searchQuality-Enhanced Entity Creation:
{system}_{issue}_{timestamp} formatStructured Observation Capture:
{
"name": "{canonical_identifier}",
"entityType": "{technical_learning|implementation_pattern|debug_session}",
"observations": [
"Context: {specific situation with timestamp}",
"Technical Detail: {exact error/solution/code with file:line}",
"Solution Applied: {specific steps taken}",
"Verification: {test results, metrics, confirmation}",
"References: {PR URLs, commits, files}",
"Reusable Pattern: {how to apply elsewhere}"
]
}
Enhanced Relation Building:
{fix} fixes {problem}{solution} implemented_in {file}{pattern} preferred_by {user}{new_pattern} supersedes {old_pattern}Quality Validation:
Integration Function Calls:
# Check backup script version consistency
memory/check_backup_version.sh || echo "Warning: Backup script version mismatch"
# Search for existing similar learnings (with error handling)
try:
/memory search "[key terms from learning]"
except Exception as e:
log_error("Memory MCP search failed: " + str(e))
fallback_to_local_only_mode()
# Create enhanced entity with high-quality patterns (with error handling)
try:
mcp__memory-server__create_entities([{
"name": "{system}_{issue_type}_{timestamp}", # Canonical naming
"entityType": "{technical_learning|implementation_pattern|debug_session|workflow_insight}", # Select appropriate type
"observations": [
"Context: {specific situation with timestamp and circumstances}",
"Technical Detail: {exact error message or code with file:line}",
"Root Cause: {identified cause with evidence}",
"Solution Applied: {specific implementation steps taken}",
"Code Changes: {file paths and line numbers modified}",
"Verification: {test results, performance metrics, confirmation}",
"References: {PR URLs, commit hashes, related documentation}",
"Reusable Pattern: {how this solution applies to other contexts}",
"Classification: [🚨|⚠️|✅|❌] {reason for classification}"
]
}])
except Exception as e:
log_error("Memory MCP entity creation failed: " + str(e))
notify_user("Learning saved locally only - Memory MCP unavailable")
# Build relations to related concepts (with error handling)
try:
mcp__memory-server__create_relations([{
"from": "[learning-name]",
"to": "[related-concept]",
"relationType": "[relates_to|caused_by|prevents|applies_to]"
}])
except Exception as e:
log_error("Memory MCP relation creation failed: " + str(e))
# Relations are optional - continue without them
Error Handling Strategy: