Enhanced /learn Command - Implementation Summary
Learns user preferences from interactions and applies them automatically to future code generation.
/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:
graph TD
A[User Interaction] --> B[Pattern Extractor]
B --> C[Correction Detection]
B --> D[Context Analysis]
B --> E[Preference Extraction]
C --> F[Pattern Validation]
D --> F
E --> F
F --> G[PATTERNS.md Update]
F --> H[Memory System]
F --> I[Other Commands]
G --> J[Apply in Future]
H --> J
I --> J
Action Steps:
Detection Phase
Analysis Phase (with /think)
Documentation Phase
Application Phase
Feedback Loop
Action Steps: To fully activate the enhanced /learn system:
/learn implementation with enhanced versionThe system is designed to be immediately useful while continuously improving through actual usage.
The enhanced /learn command transforms from a simple rule-capture tool into an intelligent pattern recognition system that builds adaptive knowledge from user interactions.
.claude/commands/learn-enhanced.md - Enhanced command documentationPATTERNS.md - Living document of learned patternsCONTEXT_AWARENESS.md - Context detection and adaptation guide.claude/scripts/pattern_extractor.py - Pattern extraction logic.claude/scripts/update_patterns.py - Document update automation.claude/scripts/learn_integration.py - System integration| Category | What It Captures | Example |
|---|---|---|
| Style | Code formatting preferences | "Use f-strings not .format()" |
| Review | What user checks for | "Always validate auth" |
| Workflow | Situational behaviors | "Rush mode = minimal refactoring" |
| Communication | How user wants responses | "Be concise when rushing" |
| Error Recovery | What fixes work | "This error means X" |
The system detects and adapts to:
# Patterns become memory entities
{
"name": "F-String Preference",
"entityType": "Pattern",
"observations": [
"User prefers f-strings",
"Seen 5 times",
"Applies to Python code",
"Auto-apply enabled"
]
}
User: "No, change 'usr' to 'user' - I prefer descriptive names"
System: [AUTO-LEARN] Captured naming preference pattern
User: "This needs to ship today"
System: [AUTO-LEARN] Detected rush mode context
# Before learn:
def calc(usr, val):
return "Result: {}".format(val)
# After learn (auto-applied patterns):
def calculate(user, value):
return f"Result: {value}"